repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
celliern/triflow
examples/notebooks/advection_diffusion.ipynb
gpl-3.0
import numpy as np import pylab as pl import triflow as trf from scipy.signal import gaussian %matplotlib inline """ Explanation: The convection diffusion equation End of explanation """ model = trf.Model("k * dxxU - c * dxU", "U", ["k", "c"]) """ Explanation: The convection–diffusion equation is a combination of ...
adityaka/misc_scripts
python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/04_01/Begin/.ipynb_checkpoints/Create-checkpoint.ipynb
bsd-3-clause
import pandas as pd import numpy as np """ Explanation: Creating Data Frames documentation: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html DataFrame is a 2-dimensional labeled data structure with columns of potentially different types. You can think of it like a spreadsheet or SQL table, o...
phoebe-project/phoebe2-docs
2.3/examples/minimal_GPs.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" import matplotlib.pyplot as plt plt.rc('font', family='serif', size=14, serif='STIXGeneral') plt.rc('mathtext', fontset='stix') import phoebe import numpy as np logger = phoebe.logger('warning') # we'll set the random seed so that the noise model is reproducible np.random.seed(1...
ryneches/SuchTree
docs/slides1.ipynb
bsd-3-clause
%pylab inline import seaborn from SuchTree import SuchTree """ Explanation: SuchTree I didn't want to write this. I really didn't. End of explanation """ from ete2 import Tree, TreeStyle, NodeStyle, TextFace from numpy import linspace ts = TreeStyle() ts.mode = 'r' ts.show_leaf_name = True ts.branch_vertical_margi...
dendisuhubdy/tensorflow
tensorflow/contrib/eager/python/examples/notebooks/4_high_level.ipynb
apache-2.0
# In the tf.keras.layers package, layers are objects. To construct a layer, # simply construct the object. Most layers take as a first argument the number # of output dimensions / channels. layer = tf.keras.layers.Dense(100) # The number of input dimensionss is often unnecessary, as it can be inferred # the first time ...
eyurtsev/fcsparser
doc/fcsparser_example.ipynb
mit
%pylab inline import fcsparser path = fcsparser.test_sample_path # path to a test data file that is included with the package """ Explanation: Working with the fcs parser ATTENTION The parser returns the data exactly as recorded in the file. This means that no transformations or compensation have been applied to thi...
kubeflow/kfserving-lts
docs/samples/pipelines/kfs-pipeline-v1alpha2.ipynb
apache-2.0
!pip3 install kfp --upgrade import kfp.dsl as dsl import kfp from kfp import components import json # Create kfp client # Note: Add the KubeFlow Pipeline endpoint below if the client is not running on the same cluster. client = kfp.Client('kfserving_endpoint') EXPERIMENT_NAME = 'KFServing Experiments' experiment = cl...
Vvkmnn/books
AutomateTheBoringStuffWithPython/lesson49.ipynb
gpl-3.0
import pyautogui """ Explanation: Lesson 49: Controlling the Keyboard with Python Python can be used to control the keyboard and mouse, which allows us to automate any program that uses these as inputs. Graphical User Interface (GUI) Automation is particularly useful for repetative clicking or keyboard entry. The pro...
sainathadapa/fastai-courses
deeplearning1/nbs-custom-mine/lesson6_01.ipynb
apache-2.0
from theano.sandbox import cuda %matplotlib inline import utils; reload(utils) from utils import * from __future__ import division, print_function """ Explanation: Table of Contents <p><div class="lev2 toc-item"><a href="#Setup" data-toc-modified-id="Setup-01"><span class="toc-item-num">0.1&nbsp;&nbsp;</span>Setup</a...
motasay/twitter-sentiment
src/analysis.ipynb
gpl-3.0
np.random.seed(142) print 'Loading the word2vec model...' sys.stdout.flush() w2v = load_word2vec() print 'Building the word2vec sentence features...' sys.stdout.flush() vec_function = lambda sentence: get_word2vec_features(w2v, sentence) num_features = w2v.layer1_size w2v_X_train, w2v_Y_train, w2v_X_test , w2v_Y_tes...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/n08_simple_q_learner_1000_states.ipynb
mit
# Basic imports import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime as dt import scipy.optimize as spo import sys from time import time from sklearn.metrics import r2_score, median_absolute_error from multiprocessing import Pool %matplotlib inline %pylab inline pylab.rcPar...
JackDi/phys202-2015-work
assignments/assignment05/MatplotlibEx03.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 3 Imports End of explanation """ def well2d(x, y, nx, ny, L=1.0): """Compute the 2d quantum well wave function.""" # YOUR CODE HERE psi=(2.0/L)*np.sin(nx*np.pi*x/L)*np.sin(ny*np.pi*y/L) return p...
tensorflow/docs-l10n
site/ja/guide/keras/preprocessing_layers.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...
csampez/analisis-numerico-computo-cientifico
MNO/proyecto_final/MNO_2017/proyectos/equipos/equipo_6/avance_22_05_2017/code/Clase_SVD_Imagen.ipynb
apache-2.0
#SE IMPORTAN LIBRERIAS PARA GRAFICAR, PARA COMPUTO DE MATRICES Y PARA LEER IMAGENES %matplotlib inline import matplotlib.pyplot as plt import numpy as np from PIL import Image #SE LEE UNA IMAGEN, SE LEE Y SE GUARDA COMO BLANCO Y NEGRO img = Image.open('GTR.jpg') #img.rotate(45).show() #Para rotar la imagen cierto no....
tensorflow/docs-l10n
site/en-snapshot/guide/keras/custom_layers_and_models.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...
rahulkgup/deep-learning-foundation
transfer-learning/Transfer_Learning.ipynb
mit
from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm vgg_dir = 'tensorflow_vgg/' # Make sure vgg exists if not isdir(vgg_dir): raise Exception("VGG directory doesn't exist!") class DLProgress(tqdm): last_block = 0 def hook(self, block_num=1, block_size=1, total_s...
biolink/ontobio
notebooks/Intro_Local_Ontologies.ipynb
bsd-3-clause
from ontobio.ontol_factory import OntologyFactory ofactory = OntologyFactory() ont = ofactory.create("nucleus.json") ## interpreted as a json local handle """ Explanation: Load ontology First load an ontology Loading a local ontology Assume we have an ontology on disk in obographs-json format, e.g. nucleus.json. Firs...
cgivre/oreilly-sec-ds-fundamentals
Notebooks/Intro/One Dimensional Data Worksheet-Python.ipynb
apache-2.0
import pandas as pd import numpy as np """ Explanation: One Dimensional Data Worksheet This worksheet reviews the concepts discussed about 1 dimensional data. The goal for these exercises is getting you to think in terms of vectorized computing. This worksheet should take 20-30 minutes to complete. End of explanatio...
ageron/ml-notebooks
03_classification.ipynb
apache-2.0
# To support both python 2 and python 3 from __future__ import division, print_function, unicode_literals # Common imports import numpy as np import os # to make this notebook's output stable across runs np.random.seed(42) # To plot pretty figures %matplotlib inline import matplotlib as mpl import matplotlib.pyplot ...
karlstroetmann/Algorithms
Python/Chapter-06/Calculator.ipynb
gpl-2.0
def toInt(s): try: return int(s) except ValueError: return s toInt('123') toInt('**') """ Explanation: The Shunting Yard Algorithm (Operator Precedence Parsing) The function $\texttt{toInt}(s)$ tries to convert the string $s$ to an integer. If this works out, the integer is returned. Oth...
afeiguin/comp-phys
00_02_numbers_in_python.ipynb
mit
import sys sys.float_info """ Explanation: Manipulating numbers in Python Disclaimer: Much of this section has been transcribed from <a href="https://pymotw.com/2/math/">https://pymotw.com/2/math/</a> Every computer represents numbers using the <a href="https://en.wikipedia.org/wiki/IEEE_floating_point">IEEE floati...
VictorQuintana91/Thesis
notebooks/sample_scripts/test_working_with_strings.ipynb
mit
import nltk # nltk.download() text="Welcome readers. I hope you find it interesting. please fo reply." from nltk.tokenize import sent_tokenize sent_tokenize(text) """ Explanation: Tokenisation of Text into sentences Code from Mastering Natural Langiage Processing with Python. End of explanation """ tokenizer=nltk...
barjacks/foundations-homework
08/H2B_Applications/H-2B_Visa_Programme_2015.ipynb
mit
import pandas as pd import matplotlib.pyplot as plt %matplotlib inline df = pd.read_excel("H-2B_Disclosure_Data_FY15_Q4.xlsx") df.head() #df.info() """ Explanation: Exploring the H-2B Visa Programme H-2B visas are nonimmigrant visas, which allow foreign nationals to enter the U.S. temporarily and engage in nonagric...
msschwartz21/craniumPy
experiments/templates/TEMP-landmarks.ipynb
gpl-3.0
import deltascope as ds import deltascope.alignment as ut import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import normalize from scipy.optimize import minimize import os import tqdm import json import time """ Explanation: Introduction: Landmarks End of explanation "...
flutter/codelabs
tfrs-flutter/step5/backend/retrieval/retrieval.ipynb
bsd-3-clause
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...
kgullikson88/keras_notebooks
notebooks/MNIST_cnn.ipynb
mit
# Import some stuff from __future__ import print_function, absolute_import, division import numpy as np np.random.seed(1337) # for reproducibility from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Convolution2D, M...
EderSantana/agnez
examples/MNIST.ipynb
bsd-3-clause
%matplotlib inline ''' This code was modified from: https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py Train a simple convnet on the MNIST dataset. Run on GPU: THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python mnist_cnn.py Get to 99.25% test accuracy after 12 epochs (there is still a lot of...
AtmaMani/pyChakras
udemy_ml_bootcamp/Python-for-Data-Visualization/Matplotlib/Matplotlib Exercises - Solutions.ipynb
mit
import numpy as np x = np.arange(0,100) y = x*2 z = x**2 """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> Matplotlib Exercises - Solutions Welcome to the exercises for reviewing matplotlib! Take your time with these, Matplotlib can be tricky to understand at first. The...
apryor6/apryor6.github.io
visualizations/seaborn/notebooks/.ipynb_checkpoints/heatmap-checkpoint.ipynb
mit
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np plt.rcParams['figure.figsize'] = (20.0, 10.0) plt.rcParams['font.family'] = "serif" df = pd.pivot_table(data=sns.load_dataset("flights"), index='month', values='pass...
milancurcic/lunch-bytes
Spring_2019/LB26/Pandas_dataframe_tutorial.ipynb
cc0-1.0
import pandas as pd """ Explanation: Data Analysis with Pandas Dataframe Pandas is a popular library for manipulating vectors, tables, and time series. We will frequently use Pandas data structures instead of the built-in python data structures, as they provide much richer functionality. Also, Pandas is fast, which ma...
asengsta/DataScience
machine_learning_template.ipynb
gpl-3.0
# Import Libraries %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt from datetime import datetime import io import boto3 import sagemaker from sagemaker import KMeans from sagemaker import get_execution_role import sagemaker.amazon.common as smac from sagemaker.amazon.amazon_...
kit-cel/lecture-examples
mloc/ch4_Deep_Learning/pytorch/function_approximation_with_MLP.ipynb
gpl-2.0
import numpy as np import torch import torch.nn as nn import torch.optim as optim import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn.preprocessing import MinMaxScaler %matplotlib inline device = 'cuda' if torch.cuda.is_available() else 'cpu' print("We are using the following device fo...
google/grr
colab/examples/demo.ipynb
apache-2.0
%load_ext grr_colab.ipython_extension import grr_colab """ Explanation: GRR Colab End of explanation """ grr_colab.flags.FLAGS.set_default('grr_http_api_endpoint', 'http://localhost:8000/') grr_colab.flags.FLAGS.set_default('grr_admin_ui_url', 'http://localhost:8000/') grr_colab.flags.FLAGS.set_default('grr_auth_ap...
pydataberlin/conf2017slides
tutorial_notebooks/topic_modelling.ipynb
gpl-3.0
import matplotlib.pyplot as plt import gensim import numpy as np import spacy from gensim.models import CoherenceModel, LdaModel, LsiModel, HdpModel from gensim.models.wrappers import LdaMallet from gensim.corpora import Dictionary import pyLDAvis.gensim import os, re, operator, warnings warnings.filterwarnings('igno...
gojomo/gensim
docs/src/auto_examples/tutorials/run_word2vec.ipynb
lgpl-2.1
import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) """ Explanation: Word2Vec Model Introduces Gensim's Word2Vec model and demonstrates its use on the Lee Evaluation Corpus &lt;https://hekyll.services.adelaide.edu.au/dspace/bitstream/2440/28910/1/hdl_28910.pdf&gt;...
kmunve/APS
aps/similar_forecast/Find_previous_forecast_knn.ipynb
mit
import pandas as pd import numpy as np import json from sklearn import preprocessing import matplotlib import matplotlib.pyplot as plt %matplotlib inline import warnings warnings.simplefilter('ignore') """ Explanation: Find forecast for a similar conditions The nearest neighbor model should retrieve the region Id a...
JarnoRFB/qtpyvis
notebooks/pytorch/inference.ipynb
mit
# input batch size for training (default: 64) batch_size = 64 # input batch size for testing (default: 1000) test_batch_size = 1000 # number of epochs to train (default: 10) epochs = 10 # learning rate (default: 0.01) lr = 0.01 # SGD momentum (default: 0.5) momentum = 0.5 # disables CUDA training no_cuda = True #...
tuanvu216/udacity-course
intro_to_statistics/Lesson 2 - Programming Charts.ipynb
mit
%%writefile plotting.py from matplotlib import pyplot from numpy import arange import bisect def scatterplot(x,y): pyplot.plot(x,y,'b.') pyplot.xlim(min(x)-1,max(x)+1) pyplot.ylim(min(y)-1,max(y)+1) pyplot.show() def barplot(labels,data): pos=arange(len(data)) pyplot.xticks(pos+0.4,labels) ...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session10/Day1/MetropolisHastings.ipynb
mit
np.random.seed(212) m_true = # complete b_true = # complete x = np.random.uniform(low=0, high=100, size=40) y_true = # complete y_obs = y_true + np.random.normal(0,50,size=40) y_unc = np.ones_like(y_obs)*50 """ Explanation: Construction Zone: Building a Metropolis-Hastings Sampler From Scratch Version 0.1 By AA Mille...
pydataberlin/conf2017slides
Introductory statistical data analysis with pandas PyData Berlin 2017.ipynb
gpl-3.0
#import the packages we will use import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt #use simplest tool available import statsmodels.formula.api as smf import statsmodels.stats.multicomp as multi import statsmodels.api as sm import scipy.stats from sklearn.cross_validation impor...
Vooban/Decision-Trees-For-Knowledge-Discovery
Decision-Trees-For-Knowledge-Discovery-With-Scikit-Learn.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder, OneHotEncoder from sklearn import tree import pydot from io import StringIO import os """ Explanation: Discovering structure behind data Let's understand and model the hidden structure behind data wi...
DAInamite/programming-humanoid-robot-in-python
joint_control/learn_posture.ipynb
gpl-2.0
%pylab inline import pickle from os import listdir, path import numpy as np from sklearn import svm, metrics ROBOT_POSE_DATA_DIR = 'robot_pose_data' classes = listdir(ROBOT_POSE_DATA_DIR) print classes def load_pose_data(i): '''load pose data from file''' data = [] target = [] # YOUR CODE HERE ...
ctzhu/lifemodels
examples/Intro_example.ipynb
mit
df = pd.read_csv('mckay.txt', sep=' ') df['Time1'] = df.Time0 #Time-to-event data, Time0 is the left bound, Time1 is the right bound. s_df = lms.s_models.survt_df(df) df.head() """ Explanation: lifemodels What is it? lifemodels is a Python package for fitting lifespan data to a number of models using MLE. It also ...
fsbr/se3-path-planner
modularPlanner/.ipynb_checkpoints/Cusp Plots (Daily)-checkpoint.ipynb
mit
import tsyganenko as tsyg import pandas as pd import numpy as np import matplotlib.pyplot as plt from spacepy import coordinates as coord import spacepy.time as spt from spacepy.time import Ticktock import datetime as dt from mpl_toolkits.mplot3d import Axes3D import sys #adding the year data here so I don't have to c...
planet-os/notebooks
api-examples/hrrr_smoke_demo.ipynb
mit
%matplotlib notebook %matplotlib inline import numpy as np import dh_py_access.lib.datahub as datahub import xarray as xr import matplotlib.pyplot as plt import ipywidgets as widgets from mpl_toolkits.basemap import Basemap,shiftgrid import dh_py_access.package_api as package_api import matplotlib.colors as colors impo...
aasensio/SolarnetGranada
notebooks/Asymmetries.ipynb
mit
lambda0 = 6301.5080 JUp = 2.0 JLow = 2.0 gUp = 1.5 gLow = 1.833 lambdaStart = 6300.8 lambdaStep = 0.015 nLambda = 100 lineInfo = np.asarray([lambda0, JUp, JLow, gUp, gLow, lambdaStart, lambdaStep]) s = pymilne.milne(nLambda, lineInfo) stokes = np.zeros((4,nLambda)) BField = 100.0 BTheta = 20.0 BChi = 20.0 VMac = 2...
Ziqi-Li/bknqgis
pandas/doc/source/style.ipynb
gpl-2.0
import matplotlib.pyplot # We have this here to trigger matplotlib's font cache stuff. # This cell is hidden from the output import pandas as pd import numpy as np np.random.seed(24) df = pd.DataFrame({'A': np.linspace(1, 10, 10)}) df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))], ...
solowPy/undergraduate-teaching
intro-to-linear-regression.ipynb
mit
# grab the entire Penn World Tables data from the web... pwt = pypwt.load_pwt_data() #...this gives us a panel (i.e., two dimensional) data set pwt def labor_supply(data, year="1950-01-01"): """ Labor supply in a given year is the product of number of employed persons, 'emp', and the average number of ho...
DeepThoughtTeam/tensorflow
tensorflow/tools/docker/notebooks/1_hello_tensorflow.ipynb
apache-2.0
import tensorflow as tf with tf.Session(): input1 = tf.constant([1.0, 1.0, 1.0, 1.0]) input2 = tf.constant([2.0, 2.0, 2.0, 2.0]) output = tf.add(input1, input2) result = output.eval() print result """ Explanation: Hello, TensorFlow A beginner-level, getting started, basic introduction to TensorFlow TensorFl...
intel-analytics/BigDL
python/nano/notebooks/pytorch/cifar10/nano-inference-example.ipynb
apache-2.0
import os from time import time import torch from torch import nn import torch.nn.functional as F import torchvision from pl_bolts.datamodules import CIFAR10DataModule from pl_bolts.transforms.dataset_normalizations import cifar10_normalization from pytorch_lightning import LightningModule, seed_everything from torch....
hindersin/randomGraphs
randomGraphs.ipynb
mit
popSize = 4 # This is the number of nodes in the network update = 'BD' # Either 'BD' or 'DB' for Birth-death or death-Birth updating respectively direction = 'undirected' # Either 'directed' or 'undirected' graphs are used stepSize = 0.05 # Step size for the probability for each link in the network to be present indepe...
rsterbentz/phys202-2015-work
assignments/assignment05/InteractEx03.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.display import display """ Explanation: Interact Exercise 3 Imports End of explanation """ def soliton(x, t, c, a): """Return phi(x, t) for a soliton wave with co...
mne-tools/mne-tools.github.io
0.17/_downloads/0f794e75f963d5793938890d6f3d2513/plot_receptive_field_mtrf.ipynb
bsd-3-clause
# Authors: Chris Holdgraf <choldgraf@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # Nicolas Barascud <nicolas.barascud@ens.fr> # # License: BSD (3-clause) # sphinx_gallery_thumbnail_number = 3 import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat from os.path import jo...
benbovy/cosmogenic_dating
emcee_test_3params.ipynb
mit
import math import numpy as np import pandas as pd from scipy import stats from scipy import optimize import emcee import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline clr_plt = sns.color_palette() """ Explanation: Bayesian approach with emcee - Test case - 3 free parameters An example of applyin...
mcquay239/cg-lectures
convex_hull.ipynb
mit
%matplotlib import numpy as np import matplotlib.pyplot as plt from pyhull.convex_hull import ConvexHull X, Y = np.random.uniform(1, 9, size=(2, 30)) ch = ConvexHull(np.transpose([X, Y])) plt.plot(X, Y, "ro") for v in ch.vertices: plt.plot(X[v], Y[v], "g") plt.axis([0, 10, 0, 10]) plt.show() """ Explanati...
mjirik/imtools
examples/Trainer3d.ipynb
mit
def externfv(data3d, voxelsize_mm): # scale f0 = scipy.ndimage.filters.gaussian_filter(data3d, sigma=3).reshape(-1, 1) f1 = scipy.ndimage.filters.gaussian_filter(data3d, sigma=1).reshape(-1, 1) - f0 fv = np.concatenate([ f0, f1 ], 1) return fv """ Explanation: Training Define feature...
faheemziker/FZValidationTextField
covid.ipynb
mit
!pip install elasticsearch !pip install google-cloud-datastore """ Explanation: <a href="https://colab.research.google.com/github/faheemziker/FZValidationTextField/blob/master/covid.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Monthly Cases of C...
fonnesbeck/scientific-python-workshop
notebooks/Matplotlib.ipynb
cc0-1.0
%matplotlib inline import matplotlib.pyplot as plt """ Explanation: Scientific Plotting with Matplotlib We require plots, charts and other statistical graphics for the written communication of quantitative ideas. They allow us to more easily convey relationships and reveal deviations from patterns. Gelman and Unwin 20...
rajuniit/udacity
language-translation/dlnd_language_translation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: Language Translation In this project, you’re going...
petspats/pyhacores
under_construction/fsk_demodulator/doc.ipynb
apache-2.0
from pyha.components.fsk_modulator import FSKModulator samples_per_symbol = 64 # this is so high to make stuff plottable symbols = [1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0] data = [] for x in symbols: data.extend([x] * samples_per_symbol) plt.plot(data...
laurent-george/protolab_sound_recognition
notebooks/confusion matrix - final.ipynb
mit
files = glob.glob('/mnt/protolab_innov/data/sounds/dataset_demo/*/*.wav') files = glob.glob('/home/lgeorge/Downloads/dataset/*/*.wav') _class = [os.path.basename(f).split('-')[0] for f in files] df = pd.DataFrame(zip(_class, files), columns=['classname', 'filename']) mask_to_remove = df.filename.str.contains('BlowNos...
metpy/MetPy
v1.1/_downloads/9041777e133eed610f5b243c688e89f9/surface_declarative.ipynb
bsd-3-clause
from datetime import datetime, timedelta import cartopy.crs as ccrs import pandas as pd from metpy.cbook import get_test_data import metpy.plots as mpplots """ Explanation: Surface Analysis using Declarative Syntax The MetPy declarative syntax allows for a simplified interface to creating common meteorological analy...
Olsthoorn/TransientGroundwaterFlow
Syllabus_in_notebooks/Sec5_3_1_tide_damping_effect_frequency.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt """ Explanation: Section 5.3.1 Dependence of the inland effect of a wave frequency Relates to exercise 5 on page 47. @olsthoorn, 2012-12-30 The solution for the partial differential equation $$ kD \frac {\partial^2 s} {\partial x} = S \frac {\partial s} {\partial t} $...
BrandonSmithJ/tensorflow-double-DQN
Double-DQN/tensorflow-deepq/notebooks/karpathy_game.ipynb
mit
g.plot_reward(smoothing=100) """ Explanation: Average Reward over time End of explanation """ g.__class__ = KarpathyGame np.set_printoptions(formatter={'float': (lambda x: '%.2f' % (x,))}) x = g.observe() new_shape = (x[:-2].shape[0]//g.eye_observation_size, g.eye_observation_size) print(x[:-2].reshape(new_shape)) p...
serenejiang/q2-permutationFDR
demo/small example of using Q2-DSFDR.ipynb
bsd-3-clause
!qiime tools import \ --input-path ../data/deblur-feature-table.biom \ --type 'FeatureTable[Frequency]' \ --source-format BIOMV210Format \ --output-path ../data/dblr_haddad.qza """ Explanation: This notebook is show how to use Q2-DSFDR in command line interface convert feature table to qiime2 qza artifact End of expla...
kanishkamisra/something-like
recommender-system.ipynb
mit
import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.metrics.pairwise import linear_kernel """ Explanation: Simple Product Recommendations By leveraging text frequency metrics and vector similarity, products can be matched with one another. End of explanation ""...
maxis42/ML-DA-Coursera-Yandex-MIPT
5 Data analysis applications/Homework/4 project text analysis/Text analysis.ipynb
mit
from __future__ import division, print_function import numpy as np from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import MultinomialNB from sklearn.model_selection import cross_val_score from sklearn.pipeline im...
InsightSoftwareConsortium/SimpleITK-Notebooks
Python/55_VH_Resample.ipynb
apache-2.0
%matplotlib inline import matplotlib.pyplot as plt import SimpleITK as sitk # If the environment variable SIMPLE_ITK_MEMORY_CONSTRAINED_ENVIRONMENT is set, this will override the ReadImage # function so that it also resamples the image to a smaller size (testing environment is memory constrained). %run setup_for_test...
ecell/ecell4-notebooks
en/tutorials/tutorial03.ipynb
gpl-2.0
from ecell4_base.core import * """ Explanation: 3. How to Setup the Initial Condition Here, we explain the basics of World classes. In E-Cell4, six types of World classes are supported now: spatiocyte.SpatiocyteWorld, egfrd.EGFRDWorld, bd.BDWorld, meso.MesoscopicWorld, gillespie.GillespieWorld, and ode.ODEWorld. In th...
eds-uga/csci1360-fa16
assignments/A2/A2_Q5.ipynb
mit
def urn_to_dict(urn_list): urn_dict = {} ### BEGIN SOLUTION ### END SOLUTION return urn_dict u1 = ["green", "green", "blue", "green"] a1 = set({("green", 3), ("blue", 1)}) assert a1 == set(urn_to_dict(u1).items()) u2 = ["red", "blue", "blue", "green", "yellow", "black", "black", "green"...
ankdesh/Udacity-MachineLearning-Nanodegree
projects/boston_housing/boston_housing.ipynb
mit
# Import libraries necessary for this project import numpy as np import pandas as pd import visuals as vs # Supplementary code from sklearn.cross_validation import ShuffleSplit # Pretty display for notebooks %matplotlib inline # Load the Boston housing dataset data = pd.read_csv('housing.csv') prices = data['MEDV'] f...
ES-DOC/esdoc-jupyterhub
notebooks/test-institute-1/cmip6/models/sandbox-3/ocnbgchem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'test-institute-1', 'sandbox-3', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: TEST-INSTITUTE-1 Source ID: SANDBOX-3 Topic: Ocnbgchem Sub-Topic...
robblack007/clase-cinematica-robot
Practicas/practica3/Practica.ipynb
mit
# Se importan widgets de IPython para interactuar con la funcion from ipywidgets import interact, fixed # Si la linea anterior no funciona, se puede quitar el comentario a la siguiente linea #from IPython.html.widgets import interact, fixed # Se define la constante τ, la cual representa la cantidad de radianes # en un...
tperol/earthquake-clusters
Final.ipynb
mit
%matplotlib inline import numpy as np import scipy as sp import json import matplotlib as mpl import matplotlib.cm as cm import matplotlib.pyplot as plt import pandas as pd from pyquery import PyQuery as pq import requests pd.set_option('display.width', 500) pd.set_option('display.max_columns', 100) pd.set_option('disp...
linglaiyao1314/maths-with-python
09-exceptions-testing.ipynb
mit
from __future__ import division def divide(numerator, denominator): """ Divide two numbers. Parameters ---------- numerator: float numerator denominator: float denominator Returns ------- fraction: float numerator / denominator ""...
google/tf-quant-finance
tf_quant_finance/examples/jupyter_notebooks/Dates_in_TFF.ipynb
apache-2.0
#@title (1) Constructing Dates: sequence of `datetime.datetime` # Use Python's datetime library to construct a date as datetime.date(year, month, day). dates = [datetime.date(2015, 4, 15), datetime.date(2017, 12, 30)] # Then, convert this into a date tensor. date_tensor = tff.datetime.dates_from_datetimes(dates) date_t...
zomansud/coursera
ml-clustering-and-retrieval/week-3/2_kmeans-with-text-data_blank.ipynb
mit
import graphlab import matplotlib.pyplot as plt import numpy as np import sys import os from scipy.sparse import csr_matrix %matplotlib inline '''Check GraphLab Create version''' from distutils.version import StrictVersion assert (StrictVersion(graphlab.version) >= StrictVersion('1.8.5')), 'GraphLab Create must be ve...
mne-tools/mne-tools.github.io
dev/_downloads/2455121b46e43615a45b660a36d0ad93/30_epochs_metadata.ipynb
bsd-3-clause
import os import numpy as np import pandas as pd import mne kiloword_data_folder = mne.datasets.kiloword.data_path() kiloword_data_file = os.path.join(kiloword_data_folder, 'kword_metadata-epo.fif') epochs = mne.read_epochs(kiloword_data_file) """ Explanation: Working with Epoch meta...
csaladenes/blog
deold/3_deoldify.ipynb
mit
#@title Check GPU #@markdown Run this to connect to a Colab Instance, and see what GPU Google gave you. gpu = !nvidia-smi --query-gpu=gpu_name --format=csv print(gpu[1]) print("The Tesla T4 and P100 are fast and support hardware encoding. The K80 and P4 are slower.") print("Sometimes resetting the instance in the 'run...
HSE-LaMBDA/modern-technologies-for-ml-and-big-data
lecture3/06-howto-neural-nets.ipynb
mit
!cd toy_datasets; wget -O MiniBooNE_PID.txt -nc MiniBooNE_PID.txt https://archive.ics.uci.edu/ml/machine-learning-databases/00199/MiniBooNE_PID.txt import numpy, pandas from rep.utils import train_test_split from sklearn.metrics import roc_auc_score data = pandas.read_csv('toy_datasets/MiniBooNE_PID.txt', sep='\s*', ...
joostgp/kaggle_bosch
pre_path_per_sample.ipynb
apache-2.0
const.TRAIN_FILES const.TEST_FILES """ Explanation: Load lookup table & data End of explanation """ num_data = func.load_data_file(const.TRAIN_FILES[0], ftype='bin') cat_data = func.load_data_file(const.TRAIN_FILES[1], ftype='bin') num_data_te = func.load_data_file(const.TEST_FILES[0], ftype='bin') cat_data_te = fu...
mne-tools/mne-tools.github.io
stable/_downloads/d7890cef2b07af34d1364209c590db5f/roi_erpimage_by_rt.ipynb
bsd-3-clause
# Authors: Jona Sassenhagen <jona.sassenhagen@gmail.com> # # License: BSD-3-Clause import mne from mne.event import define_target_events from mne.channels import make_1020_channel_selections print(__doc__) """ Explanation: Plot single trial activity, grouped by ROI and sorted by RT This will produce what is sometime...
pmgbergen/porepy
tutorials/tracer_transport.ipynb
gpl-3.0
import numpy as np import scipy.sparse as sps import porepy as pp import data.flow_benchmark_2d_geiger_setup as setup """ Explanation: Assembly of system with multiple domains, variables and numerics This tutorial demonstrates how a transient problem may be solved in PorePy. We consider the advective-diffusive trace...
ShinjiKatoA16/UCSY-sw-eng
RaspberryPiProgramming.ipynb
mit
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) # use GPIO numbering, see output of gpio command #GPIO.setmode(GPIO.BOARD) # use Physical pin numbering GPIO.setup(18, GPIO.OUT) # PIN18 (Physical:Pin12) : Output GPIO.output(18, GPIO.HIGH) # Ping18 -> High (3.3V) """ Explanation: Raspberry Pi Programming GPIO digital ou...
ledrui/week4_Ridge_Regression
Overfitting_Demo_Ridge_Lasso.ipynb
mit
import graphlab import math import random import numpy from matplotlib import pyplot as plt %matplotlib inline """ Explanation: Overfitting demo Create a dataset based on a true sinusoidal relationship Let's look at a synthetic dataset consisting of 30 points drawn from the sinusoid $y = \sin(4x)$: End of explanation ...
NYUDataBootcamp/Projects
MBA_S17/170512_PeterMeijer_EconomyAndPolitics.ipynb
mit
import sys import pandas as pd import pandas_datareader.data as web import matplotlib.pyplot as plt import datetime as dt import seaborn as sns import numpy as np import datetime as dt from dateutil.relativedelta import relativedelta %matplotlib inline ...
yafeunteun/wikipedia-spam-classifier
notebooks/spam_detection_wikipedia.ipynb
mit
! sh bootstrap.sh from sklearn.cluster import KMeans import numpy as np import pandas as pd import matplotlib.pyplot as plt import random from sklearn.utils import shuffle from sklearn.metrics import f1_score from sklearn.cross_validation import KFold from sklearn.metrics import recall_score from sklearn.ensemble impo...
tensorflow/docs-l10n
site/ko/hub/tutorials/cord_19_embeddings.ipynb
apache-2.0
# Copyright 2019 The TensorFlow Hub Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
GoogleCloudPlatform/tf-estimator-tutorials
00_Miscellaneous/tfx/01_tf_estimator_deepdive.ipynb
apache-2.0
try: COLAB = True from google.colab import auth auth.authenticate_user() except: pass RANDOM_SEED = 19831006 import os import math import multiprocessing import pandas as pd from datetime import datetime import tensorflow as tf print "TensorFlow : {}".format(tf.__version__) tf.enable_eager_execution() pri...
Python4AstronomersAndParticlePhysicists/PythonWorkshop-ICE
notebooks/07_01_scipy.ipynb
mit
import scipy as sp import numpy as np # we will need to plot stuff later import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (10, 8) plt.rcParams['font.size'] = 16 plt.rcParams['lines.linewidth'] = 2 """ Explanation: SciPy Uses numpy as its core Numerical methods for: integration so...
bjackman/lisa
ipynb/examples/utils/gem5_example.ipynb
apache-2.0
from conf import LisaLogging LisaLogging.setup() # One initial cell for imports import json import logging import os from env import TestEnv # Suport for FTrace events parsing and visualization import trappy from trappy.ftrace import FTrace from trace import Trace # Support for plotting # Generate plots inline %mat...
femtotrader/pyfolio
pyfolio/examples/round_trip_example.ipynb
apache-2.0
%matplotlib inline import gzip import os import pandas as pd import pyfolio as pf transactions = pd.read_csv(gzip.open('../tests/test_data/test_txn.csv.gz'), index_col=0, parse_dates=0) positions = pd.read_csv(gzip.open('../tests/test_data/test_pos.csv.gz'), index_col=0, parse_d...
google/fhir
examples/gcp_datalab/notebooks/1_train_and_eval_ml_model_to_predict_los.ipynb
apache-2.0
import os GCP_PROJECT = 'dp-workspace' GCS_BUCKET = 'gs://cluster19-bkt' GCS_REGION = 'us-central1' os.putenv("REGION", GCS_REGION) LABELS_JOB = 'bundlesTolabels' SEQEX_JOB = 'gen_seqex' STAGING_LOCATION = GCS_BUCKET+'/staging' TEMP_LOCATION = GCS_BUCKET+'/temp' RUNNER = 'DirectRunner' TF_RECORD_BUNDLES = 'gs://cluster...
grokkaine/biopycourse
day2/stats_scipy.ipynb
cc0-1.0
%matplotlib inline import pandas as pd import numpy as np from scipy import stats df = pd.read_csv('data/gex.txt', sep = '\t', index_col = 0) print(df.head(4)) #df.iloc[:,1:].astype(float) #print df.dtypes #print type(df.GSM21712.values) pmatrix = np.zeros((6,6))# the P-value matrix i = -1 for ci in df.columns[1:]: ...
dstuebe/generators
presentation.ipynb
mit
def fib(): a, b = 0, 1 while True: yield b a, b = b, a+b function_result = fib() print function_result """ Explanation: Generators: x = yield 42 And other applications David Stuebe <a href="https://www.swipely.com/" target="_blank">www.swipely.com</a> Get the presentation On Github IO: <a href...
whiterd/Tutorial-Notebooks
2017-03-Presentation-Jupyter-Notebook.ipynb
mit
some_global_variable = 6 def my_function(arg): """This is a docstring.""" some_global_variable = 1 return some_global_variable print(my_function(5)) some_global_variable """ Explanation: <img src="resources/jupyter-main-logo.svg" alt="Jupyter" height="200" width="200"> <h1 align="center">Jupyte...
bhattacharjee/courses
CourseraDeepLearningSpecialization/2.HyperparameterTrainingRegularizationAndOptimization/Week1/Exercises/Regularization.ipynb
mit
# import packages import numpy as np import matplotlib.pyplot as plt from reg_utils import sigmoid, relu, plot_decision_boundary, initialize_parameters, load_2D_dataset, predict_dec from reg_utils import compute_cost, predict, forward_propagation, backward_propagation, update_parameters import sklearn import sklearn.da...
jstac/quantecon_nyu_2016
lecture11/overfitting_noises_dcs.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import seaborn as sn """ Explanation: Stochastic and Deterministic Noise as Catalysts for Overfitting Small exercise for showcasing the sources of overfitting. Example taken from the 4th Chapter of the book by Abu-Mostafa Yaser, Learning from data. ...
xdze2/thermique_appart
Ordre_de_grandeur.ipynb
mit
S = 25.8e-2 * 43.7e-2 # m3 m = 3.2 # kg # Masse surfacique : rhoS = m/S print( rhoS ) """ Explanation: Ordre de grandeur Albédo tuile http://www.ecohabitation.com/actualite/nouvelles/toits-blancs-alternative-diminuer-changements-climatiques#_ftn1 absorption 0.64 https://dumas.ccsd.cnrs.fr/dumas-00469805/document ...
tensorflow/recommenders
docs/examples/quickstart.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...