text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Find the Repos Available in your Database, and What Repository Groups They Are In ## Connect to your database ``` import psycopg2 import pandas as pd import sqlalchemy as salc import numpy as np import seaborn as sns import matplotlib.pyplot as plt import warnings import datetime import json warnings.filterwarning...
github_jupyter
<a href="https://colab.research.google.com/github/noahgift/distributed-computing-explorations/blob/main/Concurrency_Python.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Concurrency in Python * *[Watch Video Lesson 6.6: Use concurrency methods...
github_jupyter
# Facies detection model Seismic horizon is a change in rock properties across a boundary between two layers of rock, particularly seismic velocity and density. Such changes are visible in seismic images (even for an untrained eye), and could be automatically detected. This notebook demonstrates how to build convolut...
github_jupyter
``` from IPython.display import SVG from sklearn.datasets import load_digits from keras.utils.vis_utils import model_to_dot from keras.models import Sequential, Model from keras.layers import Input, Dense, concatenate, Activation ``` ### Load dataset - digits dataset in scikit-learn - url: http://scikit-learn.org/stab...
github_jupyter
## Excitability of Network Construct network such that stimuli recieved from the first state impacts processing of next state, the memory of the system. ``` import numpy as np import seaborn as sns import matplotlib.pyplot as plt import spikey np.random.seed(0) def quincience_time(w_matrix, neuron, **config): neu...
github_jupyter
# Tutorial - Model Prediction ``` #Import Section from sklearn.feature_selection import SelectKBest,f_regression from sklearn.linear_model import LinearRegression,BayesianRidge,ElasticNet,Lasso,SGDRegressor,Ridge from sklearn.kernel_ridge import KernelRidge from sklearn.preprocessing import LabelEncoder,Imputer,OneHot...
github_jupyter
``` %load_ext line_profiler %load_ext autoreload import numpy as np import tensorflow as tf import neural_tangents as nt from neural_tangents import stax from jax.config import config; config.update("jax_enable_x64", True) import jax.numpy as jnp from jax import random, jit from matplotlib import pyplot as plt %mat...
github_jupyter
## Train a model with linear data using XGBoost algorithm ### Model is trained with XGBoost installed in notebook instance ### In the later examples, we will train using SageMaker's XGBoost algorithm ``` # Install xgboost in notebook instance. #### Command to install xgboost !conda install -y -c conda-forge xgboost ...
github_jupyter
<div align="right"><i>Peter Norvig<br>March 2019</i></div> # Pairing Socks [Bram Cohen](https://en.wikipedia.org/wiki/Bram_Cohen) posed a problem that I'll restate thusly: > *You have N pairs of socks, all different, in the dryer. You pull random socks out one-by-one, placing each sock in one of C possible places o...
github_jupyter
# Bay Area Bike Share Analysis ## Introduction > **Tip**: Quoted sections like this will provide helpful instructions on how to navigate and use an iPython notebook. [Bay Area Bike Share](http://www.bayareabikeshare.com/) is a company that provides on-demand bike rentals for customers in San Francisco, Redwood City,...
github_jupyter
``` import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() import scipy as sc import numpy as np import matplotlib.ticker as mticker ``` <h2> Import data (Make sure to parse dates.Consider setting index colum...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') # from google.colab import drive # drive.mount('/content/drive') !pwd path = '/content/drive/MyDrive/Research/AAAI/cifar_new/k_001b/sixth_run1_' import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotli...
github_jupyter
# Test of widgets * lets see what we got here ``` # try the following: #!pip install ipywidgets==7.4.2 #!pip install bqplot # lets import our usual stuff import pandas as pd import bqplot import numpy as np import traitlets import ipywidgets %matplotlib inline data = np.random.random((10, 10)) # now add scales - col...
github_jupyter
# Knowledge Based Recommendation System of Recipe Ingredients ## Notebook 3: Recommend Similar Ingredients using Word2Vec and Cosine Similarity ### Project Breakdown 1 Exploratory Data Analysis and Preprocessing 2: Build Word Embeddings using Word2Vec, FastText 3: Recommend similar ingredients 4: Build...
github_jupyter
# Probabilistic Programming and Bayesian Methods for Hackers Chapter 2 <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter2_MorePyMC/Ch2_MorePyMC_T...
github_jupyter
``` from decodes.core import * from decodes.io.jupyter_out import JupyterOut import math out = JupyterOut.unit_square( ) ``` # Geometric Properties of Surfaces The use of nearest neighbor approximation allowed us to present the geometric properties that captured the shape of a curve, quantities were derived by enact...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np %matplotlib inline df_olist_leads = pd.read_csv("../Sri_CapstoneProject_Olist/olist_marketing_qualified_leads_dataset.csv") df_closed_leads = pd.read_csv("../Sri_CapstoneProject_Olist/olist_closed_deals_dataset.csv") df_p...
github_jupyter
# 基于注意力的神经机器翻译 此笔记本训练一个将立陶宛语翻译为英语的序列到序列(sequence to sequence,简写为 seq2seq)模型。此例子难度较高,需要对序列到序列模型的知识有一定了解。 训练完此笔记本中的模型后,你将能够输入一个立陶宛语句子,例如 *"Aš bandau."*,并返回其英语翻译 *"I try."* 对于一个简单的例子来说,翻译质量令人满意。但是更有趣的可能是生成的注意力图:它显示在翻译过程中,输入句子的哪些部分受到了模型的注意。 <img src="https://tensorflow.google.cn/images/spanish-english.png" alt="spanish...
github_jupyter
# EM-based method for OT-based registration (polynomial) ## Description ### General approach This version of OT registration formulates the problem of image registration as a latent variable model, and proposes an iterative, EM-based approach to inferring the spatial mapping between the two images from the data. Thi...
github_jupyter
# Table of Contents <p><div class="lev1 toc-item"><a href="#Realce-de-Contraste-Interativo-utilizando-Janela-e-Nível" data-toc-modified-id="Realce-de-Contraste-Interativo-utilizando-Janela-e-Nível-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Realce de Contraste Interativo utilizando Janela e Nível</a></div><div c...
github_jupyter
# Monte Carlo Methods ## Part 0: Explore BlackjackEnv ``` import sys import gym import numpy as np from collections import defaultdict from plot_utils import plot_blackjack_values, plot_policy env = gym.make('Blackjack-v0') print(env.observation_space) print(env.action_space) for i_episode in range(3): state = e...
github_jupyter
# Example: CanvasXpress violin Chart No. 5 This example page demonstrates how to, using the Python package, create a chart that matches the CanvasXpress online example located at: https://www.canvasxpress.org/examples/violin-5.html This example is generated using the reproducible JSON obtained from the above page an...
github_jupyter
# Simple Recurrent Language Model Predicting the next token. # Imports and Setup Common imports and standardized code for importing the relevant data, models, etc., in order to minimize copy-paste/typo errors. Set the relevant text field (`'abstract'` or `'title'`) and whether we are working with `'one-hot'` or `'...
github_jupyter
``` import tensorflow as tf import numpy as np ``` ## mnist dataset <br> http://yann.lecun.com/exdb/mnist/ ``` import pickle # load pickle dataset def load(data_path): with open(data_path,'rb') as f: mnist = pickle.load(f) return mnist["training_images"], mnist["training_labels"], mnist["test_images...
github_jupyter
``` # download InferSent sentence encoder and GloVe vectors !git clone https://github.com/facebookresearch/InferSent !cp -r ./InferSent/* . !mkdir -p dataset/GloVe !curl -Lo encoder/infersent1.pickle https://dl.fbaipublicfiles.com/senteval/infersent/infersent1.pkl !curl -Lo dataset/GloVe/glove.840B.300d.zip http://nlp....
github_jupyter
<a href="https://colab.research.google.com/github/csy99/dna-nn-theory/blob/master/supervised_viridae_adam256_save_embedding.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np import pandas as pd import matplotlib import matplotli...
github_jupyter
# <font face="times"><font size="6pt"><p style = 'text-align: center;'> BRYN MAWR COLLEGE <font size="6pt"><p style = 'text-align: center;'><b><font face="times">Computational Methods in the Physical Sciences</b><br/><br/> <p style = 'text-align: center;'><b><font face="times">Module 1: A Brief Introduction to Pytho...
github_jupyter
``` import pandas as pd import tsfresh import os import json import scapy import numpy as np import warnings from scapy.all import * warnings.filterwarnings("ignore") #ignore warnings caused by ################################################################# # ...
github_jupyter
# Exponential Here we analyse how accurate are the approximate functions for exponential ### Define a benchmark method ``` import os, sys sys.path.insert(1, os.path.join(sys.path[0], '..')) import torch as th import matplotlib.pyplot as plt import numpy as np def benchmark(real_func, approx_func, interval, n_points=...
github_jupyter
# Expectation-maximization algorithm In this assignment, we will derive and implement formulas for Gaussian Mixture Model — one of the most commonly used methods for performing soft clustering of the data. ### Installation We will need ```numpy```, ```scikit-learn```, ```matplotlib``` libraries for this assignment ...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader fro...
github_jupyter
# Задание 2.2 - Введение в PyTorch Для этого задания потребуется установить версию PyTorch 1.0 https://pytorch.org/get-started/locally/ В этом задании мы познакомимся с основными компонентами PyTorch и натренируем несколько небольших моделей.<br> GPU нам пока не понадобится. Основные ссылки: https://pytorch.org/t...
github_jupyter
# Qcodes example with Rohde Schwarz RTO 1000 series Oscilloscope ``` %matplotlib notebook import matplotlib.pyplot as plt import qcodes as qc from qcodes.instrument_drivers.rohde_schwarz.RTO1000 import RTO1000 rto = RTO1000('rto', 'TCPIP0::172.20.3.86::inst0::INSTR') # Before we do anything, let's make sure that the ...
github_jupyter
``` import numpy as np import pandas as pd import tensorflow as tf import matplotlib.pyplot as plt import seaborn as sns sns.set() df = pd.read_csv('../dataset/GOOG-year.csv') df.head() from collections import deque import random class Actor: def __init__(self, name, input_size, output_size, size_layer): w...
github_jupyter
# Publishing SQL Data as JSON Documents ## Publishing JSON Up to this point, we have focused on JSON functions that allow you to extract values, objects, and arrays from documents. There are many circumstances where you want to be able to take the existing data in a table and make it available to outside world as JSON...
github_jupyter
# pyLectureMultiModalAnalysis ## Feature extraction from video segment ### Functions: 2 #### video2frame(), frame2features() ### Author: Stelios Karozis ## RandomVector() ``` def RandomVector(trainmode=True,sz=100): import pickle import numpy as np from numpy import array import random if ...
github_jupyter
#Random Forest ## Importación de librerías y datos Por medio de nuestra libería ESIOS_contoller.py importamos nuestro último dataset de datos y lo parseamos para su uso. Sirve tanto como para Drive como jupiter. ``` import json, urllib, datetime, pickle, time import pandas as pd import numpy as np import seaborn as ...
github_jupyter
# GSuite Tools This notebook contains examples for using GSuite. ``` from pymagic.gsuite_tools import GDrive,GSheets,GMail import pandas as pd import os, sys # if sys.platform == "linux": # wd = "/home/collier/Downloads/" # else: # wd = "/Users/collier/Downloads/" # os.chdir(wd) ``` # Authentication T...
github_jupyter
# Frequently Asked Questions ## What is "Scientific Programming"? **Scientific programming targets to solve scientific problems with the help of computers**. It is sometimes used as synonym for [computational science](https://en.wikipedia.org/wiki/Computational_science), but in my opinion these are not entirely th...
github_jupyter
# Advanced Feature Engineering in BQML **Learning Objectives** 1. Evaluate the model 2. Extract temporal features, feature cross temporal features 3. Apply ML.FEATURE_CROSS to categorical features 4. Create a Euclidian feature column, feature cross coordinate features 5. Apply the BUCKETIZE function, TRANSFORM clause...
github_jupyter
<small><small><i> All of these python notebooks are available at [https://gitlab.erc.monash.edu.au/andrease/Python4Maths.git] </i></small></small> # Python ... - is an open source programming language - is an object-oriented programming language - is an interpreter-language - provides easy interfaces to other language...
github_jupyter
# Load data <https://www.kaggle.com/c/bike-sharing-demand> ``` import sage import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split # Load data df = sage.datasets.bike() feature_names = df.columns.tolist()[:-3] # Split data, with total count serving as regression target ...
github_jupyter
``` import pandas as pd from scipy import stats from scipy.stats import norm gee_userid = pd.read_csv('./gee_results/gee_user_id.csv') gee_userid = gee_userid[['name','estimate','naive_z']] # gee_userid['pnorm'] = 2*min(norm.cdf(gee_userid['naive_z']),1-norm.cdf(gee_userid['naive_z'])) gee_userid['p1'] = 2*norm.cdf(gee...
github_jupyter
# Lesson 3 Exercise 2: Focus on Primary Key <img src="images/cassandralogo.png" width="250" height="250"> ### Walk through the basics of creating a table with a good Primary Key in Apache Cassandra, inserting rows of data, and doing a simple SQL query to validate the information. #### We will use a python wrapper/ py...
github_jupyter
``` # 경찰서별 담당 행정구역 sgg_nm_transfer = { '마산동부경찰서' : '창원시마산회원구' , '마산중부경찰서' : '창원시마산합포구' , '서울강남경찰서' : '강남구' , '서울강동경찰서' : '강동구' , '서울강북경찰서' :'강북구' , '서울강서경찰서' : '강서구', '서울관악경찰서' : '관악구' , '서울광진경찰서' : '광진구', '서울구로경찰서' : '구로구' , '서울금천경찰서' : '금천구' , '서울남대문경찰서' : '중...
github_jupyter
``` import warnings warnings.filterwarnings("ignore") import os import json import jieba import torch import pickle import codecs import torch.nn as nn import torch.optim as optim import pandas as pd from ark_nlp.model.re.casrel_bert import CasRelBert from ark_nlp.model.re.casrel_bert import CasRelBertConfig from ark...
github_jupyter
<a href="https://qworld.net" target="_blank" align="left"><img src="../qworld/images/header.jpg" align="left"></a> $$ \newcommand{\set}[1]{\left\{#1\right\}} \newcommand{\abs}[1]{\left\lvert#1\right\rvert} \newcommand{\norm}[1]{\left\lVert#1\right\rVert} \newcommand{\inner}[2]{\left\langle#1,#2\right\rangle} \newcomma...
github_jupyter
``` import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import pandas as pd import glob import os import pickle from collections import OrderedDict from scipy import signal from tqdm import tqdm from pathlib import Path from sklearn.pipeline import Pipeline from torchsummary import s...
github_jupyter
# TextAttack with Custom Dataset and Word Embedding. This tutorial will show you how to use textattack with any dataset and word embedding you may want to use [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/QData/TextAttack/blob/master/docs/2noteboo...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns ``` ### Revenue per Weekday section - revenue per minute: * fruit 4€ * spices 3€ * dairy 5€ * drinks 6€ ``` df = pd.read_csv('data/data_clean.csv', index_col=0, sep= ',', header=0) # create revenue column def label_revenue (row): if row['locati...
github_jupyter
Neuromorphic engineering I ## Lab 9: Silicon Neuron Circuits Team member 1: Jan Hohenheim Team member 2: Maxim Gärtner Date: 25.11.21 ------------------------------------------------------------------------------------------------------------------- In this lab, we will test a circuit that generates action potent...
github_jupyter
``` import csv import os import enchant import numpy as np import matplotlib.pyplot as plt import seaborn as sns sys.path.append('..') sns.set() sns.set_style("ticks") output_file = os.path.join( '..', 'results', 'post-ocr-correction', 'char-to-char-encoder-decoder', 'english', 'output-english-...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') ``` # Snowflake time of flight Have you ever watched a snowflake fall and thought, "How long has that snowflake been falling?" Here, we want to determine the time of flight for a snowflake. We'll start simple and add some complex...
github_jupyter
``` from jupyter_cadquery.occ import Part, PartGroup, show from jupyter_cadquery import set_sidecar set_sidecar("OCC", init=True) ``` # OCC bottle (ported over to OCP) ``` import math from OCP.gp import gp_Pnt, gp_Vec, gp_Trsf, gp_Ax2, gp_Ax3, gp_Pnt2d, gp_Dir2d, gp_Ax2d, gp from OCP.GC import GC_MakeArcOfCircle, G...
github_jupyter
``` from geoscilabs.dcip.DC_Pseudosections import MidpointPseudoSectionWidget, DC2DPseudoWidget from IPython.display import display ``` # Building Pseudosections 2D profiles are often plotted as pseudo-sections by extending $45^{\circ}$ lines downwards from the A-B and M-N midpoints and plotting the corresponding $\...
github_jupyter
``` # default_exp tabular.core ``` # tabular.core > API details. ``` #hide #export import pandas as pd from fastai.data.external import * from fastcore.all import * from pathlib import PosixPath from fastcore.test import * from fastai.tabular.all import * import fastai from fastai.tabular.core import _maybe_expand f...
github_jupyter
``` import numpy as np import tensorflow as tf import collections def build_dataset(words, n_words): count = [['GO', 0], ['PAD', 1], ['EOS', 2], ['UNK', 3]] count.extend(collections.Counter(words).most_common(n_words - 1)) dictionary = dict() for word, _ in count: dictionary[word] = len(dictiona...
github_jupyter
## 7. Set Yourself Up for Success A Python `set` is an _unordered_ collection: the elements of a set do not have a position or order, so you cannot do indexing, slicing, or other sequence-like operations on sets as you would do on, for instance, lists. Sets in Python mimic mathematical sets: the elements do not repe...
github_jupyter
``` import os from time import time import numpy as np from sklearn.linear_model import RidgeClassifier import torch import torchvision.transforms as transforms from torch.utils.data import DataLoader from tlopu.model_utils import pick_model from tlopu.features import fast_conv_features, decoding, get_random_featur...
github_jupyter
# Exporting ImageNet Inception _WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.24.*, run `git checkout -b 0.24` or switch to the `0.24` branch on GitHub)_ In this notebook, we'll show how to export the [pre-trained Imagenet Ince...
github_jupyter
``` from keras.utils.data_utils import get_file import numpy as np import random import sys import io from sklearn import preprocessing import pandas as pd # Read the data data=pd.read_csv('pid_uri_id.csv') trackinfo=data[['trackid','track_uri']] trackinfo=trackinfo.drop_duplicates() import os text=list(data['trackid'...
github_jupyter
<a href="https://colab.research.google.com/github/Micle5858/mit-deep-learning/blob/master/Neural_Networks.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #Introduction to Neural Networks In this notebook you will learn how to create and use a neural...
github_jupyter
# k-means with text data In this assignment you will * Cluster Wikipedia documents using k-means * Explore the role of random initialization on the quality of the clustering * Explore how results differ after changing the number of clusters * Evaluate clustering, both quantitatively and qualitatively When properly ex...
github_jupyter
``` import numpy as np import networkx as nx import matplotlib.pyplot as plt from IPython.display import Image Image('graph.png') ``` We are going to use networkx package to construct the graph and find the shortest paths. Refer to the [NetworkX documentation](https://networkx.github.io/documentation/stable/). ``` #t...
github_jupyter
### Examples from Udacity course on web development Link to Website: [https://de.udacity.com/course/web-development--cs253](https://de.udacity.com/course/web-development--cs253) See lesson 5. #### 1. HTTP requests with urllib2 ``` import urllib2 page = urllib2.urlopen("http://www.example.com") # dir(page) will list...
github_jupyter
# Deep learning framework example: Movie Review Dataset This notebook demonstrates how to use the deeplearning API to train and test the model on the [Stanford movie review corpus](https://nlp.stanford.edu/sentiment/) corpus. This dataset contains hand written digits and their labels. See the [saved version](https:/...
github_jupyter
# Mask R-CNN - Train on Shapes Dataset This notebook shows how to train Mask R-CNN on your own dataset. To keep things simple we use a synthetic dataset of shapes (squares, triangles, and circles) which enables fast training. You'd still need a GPU, though, because the network backbone is a Resnet101, which would be ...
github_jupyter
# BLU05 - Learning Notebook - Part 2 of 3 - SARIMAX ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from random import gauss from random import seed from statsmodels.tsa.seasonal import seasonal_decompose import warnings warnings.simplefilter(action='ignore', category=FutureWarning) seed(...
github_jupyter
# Learning In this notebook we'll discuss what it means for a computer to learn. ## Function ![Euclid](https://upload.wikimedia.org/wikipedia/commons/3/30/Euklid-von-Alexandria_1.jpg) The term function is often not clearly defined and has many different uses. In programming, we usually write functions where we kno...
github_jupyter
# Building symbolic metamodels A symbolic metamodel takes as an input a machine learning model, and outputs a symbolic equation describing its response surface as illustrated in the Figure below. This notebook provides the steps needed for building a symbolic metamodel for an XGBoost model fitted to the "UCI absenteei...
github_jupyter
# Homework # 1: Audio Classification In this work you will master all the basic skills with audio applied to the problem of classification. You will: * 🔥 master `torchaudio` as a library for working with audio in conjunction with `torch` * 🔊 try out the different feature representations of the audio signal in pract...
github_jupyter
``` %matplotlib inline import os import cv2 import time import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from weapons.CTC_0a import ctc_recog_model os.environ["CUDA_VISIBLE_DEVICES"] = '0' def parse_filename(filename): """ vertices: se, sw, nw, ne lp_indices: indices in province...
github_jupyter
``` import pandas as pd import tensorflow as tf import numpy as np import matplotlib.pyplot as plt df = pd.read_csv("OnlineNewsPopularity.csv", skipinitialspace=True) df.info() import re REGEX = re.compile("http://mashable.com/([0-9]{4}/[0-9]{2}/[0-9]{2})/([-a-z0-9_]+)/") def parse_url(url): date, slug = REGEX.find...
github_jupyter
## Crypto Arbitrage In this program, you'll take on the role of an analyst at a high-tech investment firm. The vice president (VP) of your department is considering arbitrage opportunities in Bitcoin and other cryptocurrencies. As Bitcoin trades on markets across the globe, can you capitalize on simultaneous price dis...
github_jupyter
# The GDSCTools library Nore that in this notebook, we need the following code but this may not be required in a script or a standard Python shell if pylab is already loaded. ## Regression methods Currently (v0.15), we have 3 classes available that implements 3 regression methods namely: - GDSCElasticNet - GDSCRidg...
github_jupyter
# 全卷积网络 :label:`sec_fcn` 如 :numref:`sec_semantic_segmentation`中所介绍的那样,语义分割是对图像中的每个像素分类。 *全卷积网络*(fully convolutional network,FCN)采用卷积神经网络实现了从图像像素到像素类别的变换 :cite:`Long.Shelhamer.Darrell.2015`。 与我们之前在图像分类或目标检测部分介绍的卷积神经网络不同,全卷积网络将中间层特征图的高和宽变换回输入图像的尺寸:这是通过在 :numref:`sec_transposed_conv`中引入的*转置卷积*(transposed convolution)实现的。...
github_jupyter
# First you need to mount your Google Drive so that the contents are available for use here. To do this, run the cell below and follow the instructions (press enter after inserting the code) ``` from google.colab import drive drive.mount('/content/drive') ``` # Then change the current directory so it's pointing to th...
github_jupyter
# Listes Les listes en Python sont un ensemble ordonnés d'objets. Les objets peuvent être de type variés. Une liste peux contenir une liste. ## Une liste est une séquence * Une liste est délimité par des crochets `[]` * Les éléments sont séparé par une virgule `,` * Un élément peut être accédé par son indice `L[1]` *...
github_jupyter
# Basic Imports ``` import torch import torch.nn as nn import numpy as np import torch.nn.functional as F from tqdm import tqdm ``` # Load traning data ``` training_data = np.load('traning_data.npy',allow_pickle=True) ``` # Structure of network ``` class Net(nn.Module): def __init__(self): super().__i...
github_jupyter
# Intro to Jupyter notebooks and Python for data science Check out the keyboard shortcuts by going to help -> keyboard shortcuts. I frequently use `esc` to exit a cell, `a` to add a cell above, `b` to add a cell below, `enter` to edit a cell, `shift+enter` to run a cell, arrow keys to go up and down between cells, `c...
github_jupyter
``` # from google.colab import drive # drive.mount('/content/drive') import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader...
github_jupyter
# 3D Multi-organ Segmentation with UNETR (BTCV Challenge) # PyTorch Lightning Tutorial Prepared by: **Ali Hatamizadeh** and **Yucheng Tang**. This tutorial demonstrates how MONAI can be used in conjunction with PyTorch Lightning framework to construct a training workflow of UNETR on multi-organ segmentation task us...
github_jupyter
# 引入所需模块 ``` import re import json import requests import numpy as np import scipy.integrate as spi import matplotlib.pyplot as plt ``` ## 获取丁香园数据计算治愈率、死亡率 ``` url = 'https://3g.dxy.cn/newh5/view/pneumonia' response = requests.get(url) origin = json.loads(re.search( r'window.getStatisticsService = ({.*?})', res...
github_jupyter
# FloPy shapefile export demo The goal of this notebook is to demonstrate ways to export model information to shapefiles. This example will cover: * basic exporting of information for a model, individual package, or dataset * custom exporting of combined data from different packages * general exporting and importing of...
github_jupyter
``` import cv2 as cv import matplotlib.pylab as plt import xmltodict import glob import json import warnings warnings.filterwarnings('ignore') # Load image img = cv.imread('/home/idl/Downloads/openlogo/JPEGImages/1034987742.jpg') img = cv.cvtColor(img, cv.COLOR_BGR2RGB) plt.imshow(img); files = glob.glob('/home/idl/Do...
github_jupyter
<table width="100%"> <tr> <td style="background-color:#ffffff;"> <a href="http://qworld.lu.lv" target="_blank"><img src="..\images\qworld.jpg" width="35%" align="left"> </a></td> <td style="background-color:#ffffff;vertical-align:bottom;text-align:right;"> prepared by Abuzer Yak...
github_jupyter
# Building your Deep Neural Network: Step by Step Welcome to your week 4 assignment (part 1 of 2)! You have previously trained a 2-layer Neural Network (with a single hidden layer). This week, you will build a deep neural network, with as many layers as you want! - In this notebook, you will implement all the functio...
github_jupyter
<center> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/Logos/organization_logo/organization_logo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # Logistic Regression with Python Estimated time needed: **25** minutes ## Objectives After completing this la...
github_jupyter
# SNC Introduction The aim of this document is to introduce the concepts needed to describe a stochastic network and its dynamics, and to explain how such network can be controlled. Note that the discussion related to how to optimally control a stochastic network is out of the scope of this document. This topic is d...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Understanding-Expressions-in-Aerospike" data-toc-modified-id="Understanding-Expressions-in-Aerospike-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Understanding Expressions in Aerospike</a></span><ul cl...
github_jupyter
<a href="https://colab.research.google.com/github/yhatpub/yhatpub/blob/main/notebooks/fastai/lesson10_classification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Fastai Lesson 10 on YHat.pub This notebook picks up from [Fastai Fastbook 10 Text...
github_jupyter
``` #!/usr/bin/env python3 # -------------------------------------------------------------- # Author: Mahendra Data - mahendra.data@dbms.cs.kumamoto-u.ac.jp # License: BSD 3 clause # -------------------------------------------------------------- # Mount Google Drive from google.colab import drive drive.mount("/content/...
github_jupyter
# Chapter 8: Transformations This Jupyter notebook is the Python equivalent of the R code in section 8.8 R, pp. 373 - 375, [Introduction to Probability, 2nd Edition](https://www.crcpress.com/Introduction-to-Probability-Second-Edition/Blitzstein-Hwang/p/book/9781138369917), Blitzstein & Hwang. ---- ``` import matplo...
github_jupyter
``` %load_ext autoreload %autoreload 2 %matplotlib inline from numpy import * from IPython.html.widgets import * from IPython.display import display import matplotlib.pyplot as plt from IPython.core.display import clear_output ``` # Gini coefficient Gini coefficient is a measure of statistical dispersion. For the K...
github_jupyter
# Smoothing ## Install packages ``` import sys !{sys.executable} -m pip install -r requirements.txt import cvxpy as cvx import numpy as np import pandas as pd import time import os import quiz_helper import matplotlib.pyplot as plt %matplotlib inline plt.style.use('ggplot') plt.rcParams['figure.figsize'] = (14, 8) ``...
github_jupyter
<a href="https://colab.research.google.com/github/harshatejas/pytorch_custom_object_detection/blob/main/Training.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !git clone https://github.com/harshatejas/pytorch_custom_object_detection.git %cd /c...
github_jupyter
# Discretisers Examples on how to use variable discretisation transformers available in Feature-engine. For this demonstration, we use the Ames House Prices dataset produced by Professor Dean De Cock: Dean De Cock (2011) Ames, Iowa: Alternative to the Boston Housing Data as an End of Semester Regression Project, Jou...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, confusion_matrix dataset=pd.read_csv('BankNote_Authentication.csv') print(dataset.columns...
github_jupyter
``` #Define libraries import tensorflow as tf import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Conv1D, MaxPooling1D, BatchNormalization, Flatten from sklearn.model_selection import KFold from keras.utils import multi_gpu_model #from sklearn.cross_validation import StratifiedKFol...
github_jupyter
``` import numpy as np import pickle # not necessary import cv2 # Computer vision to convert image to array from os import listdir # Please make sure to google below subjects from keras.models import Sequential from keras.layers.normalization import BatchNormalization from keras.layers.convolutional import Conv2D from...
github_jupyter