repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
google/sentencepiece
python/sentencepiece_python_module_example.ipynb
apache-2.0
!pip install sentencepiece !wget https://raw.githubusercontent.com/google/sentencepiece/master/data/botchan.txt """ Explanation: <a href="https://colab.research.google.com/github/google/sentencepiece/blob/master/python/sentencepiece_python_module_example.ipynb" target="_parent"><img src="https://colab.research.google....
UWSEDS/LectureNotes
week_4/Exceptions.ipynb
bsd-2-clause
def divide(numerator, denominator): result = numerator/denominator print("result = %f" % result) divide(1.0, 0) def divide1(numerator, denominator): try: GARBAGE result = numerator/denominator print("result = %f" % result) except (ZeroDivisionError, NameError) as err: i...
opencobra/cobrapy
documentation_builder/faq.ipynb
gpl-2.0
from cobra.io import load_model model = load_model("iYS1720") for metabolite in model.metabolites: metabolite.id = f"test_{metabolite.id}" try: model.metabolites.get_by_id(model.metabolites[0].id) except KeyError as e: print(repr(e)) """ Explanation: FAQ This document will address frequently asked questi...
wuhuikai/GP-GAN
GP_GAN.ipynb
mit
!gdown https://drive.google.com/uc?id=0Bybnpq8dvwudXzZFLU1iOXVOZ3c !gdown https://drive.google.com/uc?id=0Bybnpq8dvwudRzRLUm1xYmt6R1E !gdown https://drive.google.com/uc?id=0Bybnpq8dvwudOEFELWkzcGJJVjA """ Explanation: Download the pretrained models End of explanation """ %cd .. !pip install -r requirements/test/req...
chongxi/xike_hls_module
spkDect/How spkDect Works.ipynb
mit
din = np.fromfile('spkDect_test_spk.bin', dtype='float32') data = np.zeros((40,8)) k = 0 for t in range(40): for ch in range(8): data[t,ch] = din[k] k+=1 fig,ax = subplots(1,2,figsize=(15,5)) ax[0].plot(data[:,:4], '-o'); ax[1].plot(data[:,4:], '-o'); """ Explanation: Load test file End of expla...
SebastianBocquet/pygtc
demo.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' # For mac users with Retina display from matplotlib import pyplot as plt import numpy as np import pygtc """ Explanation: Example 1: Making a GTC/triangle plot with pygtc This example is built from a jupyter notebook hosted on the pyGTC GitHub repositor...
piskvorky/gensim
docs/notebooks/topic_coherence_model_selection.ipynb
lgpl-2.1
from __future__ import print_function import os import re import logging from collections import OrderedDict from gensim.corpora import TextCorpus, MmCorpus from gensim import utils, models logging.basicConfig(level=logging.ERROR) # disable warning logging """ Explanation: Performing Model Selection Using Topic Co...
quoniammm/happy-machine-learning
Udacity-ML/finding_donors-master/finding_donors.ipynb
mit
# 为这个项目导入需要的库 import numpy as np import pandas as pd from time import time from IPython.display import display # 允许为DataFrame使用display() # 导入附加的可视化代码visuals.py import visuals as vs # 为notebook提供更加漂亮的可视化 %matplotlib inline # 导入人口普查数据 data = pd.read_csv("census.csv") # 成功 - 显示第一条记录 display(data.head(n=1)) """ Explan...
h-mayorquin/time_series_basic
presentations/2016-01-23(Scaling Analysis of Wall Street).ipynb
bsd-3-clause
import numpy as np import h5py from sklearn import svm, cross_validation """ Explanation: Scaling analysis of Nexa on Wall Street Here I will present a scaling analysis of Nexa wall street with regards to the number of clusters in the sensors space and the number of clusters in the data space. Load the libraries End ...
ES-DOC/esdoc-jupyterhub
notebooks/noaa-gfdl/cmip6/models/sandbox-3/atmoschem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'sandbox-3', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: NOAA-GFDL Source ID: SANDBOX-3 Topic: Atmoschem Sub-Topics: Transport, ...
GoogleCloudPlatform/asl-ml-immersion
notebooks/introduction_to_tensorflow/labs/load_diff_filedata.ipynb
apache-2.0
import functools import numpy as np import tensorflow as tf print("TensorFlow version: ", tf.version.VERSION) TRAIN_DATA_URL = "https://storage.googleapis.com/tf-datasets/titanic/train.csv" TEST_DATA_URL = "https://storage.googleapis.com/tf-datasets/titanic/eval.csv" train_file_path = tf.keras.utils.get_file("train...
magenta/magenta-demos
jupyter-notebooks/Sketch_RNN_TF_To_JS_Tutorial.ipynb
apache-2.0
# import the required libraries import numpy as np import time import random import codecs import collections import os import math import json import tensorflow as tf from six.moves import xrange # libraries required for visualisation: from IPython.display import SVG, display import svgwrite # conda install -c omnia...
tensorflow/workshops
extras/amld/notebooks/solutions/1_data.ipynb
apache-2.0
data_path = '/content/gdrive/My Drive/amld_data' # Alternatively, you can also store the data in a local directory. This method # will also work when running the notebook in Jupyter instead of Colab. # data_path = './amld_data if data_path.startswith('/content/gdrive/'): from google.colab import drive assert data_...
google/learned_optimization
docs/notebooks/Part2_CustomTasks.ipynb
apache-2.0
!pip install git+https://github.com/google/learned_optimization.git import numpy as np import jax.numpy as jnp import jax from matplotlib import pylab as plt from learned_optimization.outer_trainers import full_es from learned_optimization.outer_trainers import truncated_pes from learned_optimization.outer_trainers i...
TheOregonian/articles
health/vaccination/Oregon Herd Immunity Analysis 2016.ipynb
mit
import math import numpy as np import pandas as pd """ Explanation: &ldquo;Low vaccination rates put some Oregon schools at high risk for measles&rdquo; Lynne Terry and Melissa Lewis, <em>The Oregonian</em>, Feb. 11, 2018 End of explanation """ school_types_df = pd.read_csv('data/schools_types.csv', dtype={'ID': s...
gfeiden/Notebook
Projects/upper_sco_age/apsidal_motion_age.ipynb
mit
def c2(masses, radii, e, a, rotation=None): f = (1.0 - e**2)**-2 g = (8.0 + 12.0*e**2 + e**4)*f**(5.0/2.0) / 8.0 if rotation == None: omega_ratio_sq = 0.0 elif rotation == 'synchronized': omega_ratio_sq = (1.0 + e)/(1.0 - e)**3 else: omega_ratio_sq = 0.0 c2_0 = (ome...
quoniammm/mine-tensorflow-examples
dpAI/Python+Basics+With+Numpy+v3.ipynb
mit
### START CODE HERE ### (≈ 1 line of code) test = None ### END CODE HERE ### print ("test: " + test) """ Explanation: Python Basics with Numpy (optional assignment) Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will help familiarize y...
CalPolyPat/phys202-2015-work
assignments/assignment05/InteractEx02.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np import math from IPython.html.widgets import interact, interactive, fixed from IPython.display import display """ Explanation: Interact Exercise 2 Imports End of explanation """ def plot_sine1(a,b): f = plt.figure() ax = plt.subplot...
WNoxchi/Kaukasos
FAI_old/statefarm-sample-codealong.ipynb
mit
import theano import os, sys sys.path.insert(1, os.path.join(os.getcwd(), 'utils')) %matplotlib inline from __future__ import print_function, division # path = "data/sample/" path = "data/statefarm/sample/" import utils; reload(utils) from utils import * from IPython.display import FileLink # batch_size = 64 batch_s...
robertoalotufo/ia898
src/comb.ipynb
mit
import numpy as np def comb(shape, delta, offset): shape = np.array(shape) assert shape.size <= 3 g = np.zeros(shape) if shape.size == 1: g[offset::delta] = 1 elif shape.size == 2: g[offset[0]::delta[0], offset[1]::delta[1]] = 1 elif shape.size == 3: g[offset[0]::delta[...
rishuatgithub/MLPy
hugging-face/1. Introduction-hugging-face (Pipeline).ipynb
apache-2.0
from transformers import pipeline classifier = pipeline('sentiment-analysis') classifier("I've been waiting for a HuggingFace course my whole life.") ## passing multiple sentences classifier([ "I've been waiting for a HuggingFace course my whole life.", "I hate this so much!" ]) """ Explanation: What is N...
saashimi/code_guild
interactive-coding-challenges/arrays_strings/compress/compress_challenge.ipynb
mit
def compress_string(string): # TODO: Implement me pass """ Explanation: <small><i>This notebook was prepared by Donne Martin. Source and license info is on GitHub.</i></small> Challenge Notebook Problem: Compress a string such that 'AAABCCDDDD' becomes 'A3B1C2D4'. Only compress the string if it saves space. ...
Akshay-lodha/MTP
notebooks/LungCancerDetection.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import os import glob import SimpleITK as sitk from PIL import Image from scipy.misc import imread %matplotlib inline from IPython.display import clear_output pd.options.mode.chained_assignment = None """ Explanation: I...
mfouesneau/pyphot
examples/Sun_Vega.ipynb
mit
%matplotlib inline import pylab as plt import numpy as np import sys sys.path.append('../') import pyphot """ Explanation: pyphot - A tool for computing photometry from spectra Some examples are provided in this notebook Full documentation available at http://mfouesneau.github.io/docs/pyphot/ End of explanation """ ...
tleonhardt/CodingPlayground
dataquest/JupyterNotebook/Basics.ipynb
mit
import pandas as pd white_house = pd.read_csv("../data/2015_white_house.csv") print(white_house.shape) print(white_house.iloc[-1]) white_house %matplotlib notebook import matplotlib.pyplot as plt plt.hist(white_house["Salary"]) plt.show() """ Explanation: White House Employee Data The 2015_white_house.csv* file co...
openai/openai-python
examples/finetuning/finetuning-classification.ipynb
mit
from sklearn.datasets import fetch_20newsgroups import pandas as pd import openai categories = ['rec.sport.baseball', 'rec.sport.hockey'] sports_dataset = fetch_20newsgroups(subset='train', shuffle=True, random_state=42, categories=categories) """ Explanation: Fine tuning classification example We will fine-tune an a...
JannesKlaas/MLiFC
Week 2/Ch. 9 - Feature engineering & data preparation.ipynb
mit
# As always, first some libraries # Numpy handles matrices import numpy as np # Pandas handles data import pandas as pd # Matplotlib is a plotting library import matplotlib.pyplot as plt # Set matplotlib to render imediately %matplotlib inline # Seaborn is a plotting library built on top of matplotlib that can handle ...
michrawson/nyu_ml_lectures
notebooks/04.1 Cross Validation.ipynb
cc0-1.0
from sklearn.datasets import load_iris from sklearn.neighbors import KNeighborsClassifier iris = load_iris() X, y = iris.data, iris.target classifier = KNeighborsClassifier() """ Explanation: Cross-Validation and scoring methods To evaluate how well our supervised models generalize, so far we split our data into a t...
wikistat/Intro-Python
Cal5-PythonSklearnApprent.ipynb
mit
# Importations import matplotlib.pyplot as plt from sklearn import datasets %matplotlib inline # les données digits = datasets.load_digits() # Contenu et mode d'obtention print(digits) images_and_labels = list(zip(digits.images, digits.target)) for index, (image, label) in enumerate(images_and_labels[:8]): ...
mathLab/RBniCS
tutorials/07_nonlinear_elliptic/tutorial_nonlinear_elliptic_exact.ipynb
lgpl-3.0
from dolfin import * from rbnics import * """ Explanation: Tutorial 07 - Non linear Elliptic problem Keywords: exact parametrized functions, POD-Galerkin 1. Introduction In this tutorial, we consider a non linear elliptic problem in a two-dimensional spatial domain $\Omega=(0,1)^2$. We impose a homogeneous Dirichlet c...
ES-DOC/esdoc-jupyterhub
notebooks/cnrm-cerfacs/cmip6/models/cnrm-esm2-1/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cnrm-cerfacs', 'cnrm-esm2-1', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: CNRM-CERFACS Source ID: CNRM-ESM2-1 Topic: Aerosol Sub-Topics: Transpo...
robertoalotufo/ia898
dev/2017-01-14-RAL-Aprendendo a usar o nbconvert geração de HTML e Python.ipynb
mit
!ls !jupyter nbconvert 2016-12-20-RMS-JupShow.ipynb """ Explanation: nbconvert - Convertendo o notebook para HTML e arquivos Python O nbconvert permite a conversão de notebooks em outros formatos, permitindo: - apresentação do notebook em PDF - publicação de texto com LaTeX, permitindo a geração de artigos criados po...
nikbearbrown/Deep_Learning
NEU/Singh_Palod_DL/Generative Adversarial Networks/GANS for Text.ipynb
mit
import tensorflow as tf import numpy as np import os from collections import Counter from nltk.tokenize import TweetTokenizer import codecs from random import randint tf.__version__ with codecs.open(os.path.join('../data', 'sent.csv'), 'r', encoding='utf-8') as f: corpus_line_by_line = f.read().lower().split("\n"...
sdpython/cpyquickhelper
_doc/notebooks/cbenchmark_sum_type.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() %matplotlib inline """ Explanation: Measures a vector sum with different accumulator type This notebook compares how fast is the sum if the accumulator used to store the sum is of a different type than the summed elements. End of explanation """ try: ...
domino14/macondo
notebooks/superleaves/make_pseudo_superleaves.ipynb
gpl-3.0
t0 = time.time() maximum_superleave_length = 6 leaves = {i:sorted(list(set(list(combinations(tilebag,i))))) for i in range(1,maximum_superleave_length+1)} for i in range(1,maximum_superleave_length+1): leaves[i] = [''.join(leave) for leave in leaves[i]] t1 = time.time() print('Calculated superleav...
mbuchove/notebook-wurk-b
stats/astro283_hw6.ipynb
mit
import numpy as np from scipy import optimize, special from matplotlib import pyplot as plt from astropy.io import fits %matplotlib inline """ Explanation: <h1> Homework Set 6</h1> Matt Buchovecky Astro 283 / Fitz End of explanation """ # open the data file and load data into a list of points infile = open("./samp...
deisi/SFG2D
docs/Tutorial_Pump_Probe.ipynb
mit
# Import and load some packages # makes python a little like matlab. %pylab import sfg2d # This imports the sfg2d package """ Explanation: You can run a cell by hitting Shift + Enter on the keyboard A more extensive tutorial can be found here Skip to: "Getting Started With Jupyter Notebooks" if you are hazy. End ...
feststelltaste/software-analytics
notebooks/Defect Analysis using pandas.ipynb
gpl-3.0
URL = "https://youtrack.jetbrains.com/api/issues?" \ "$top=1000&"\ "fields=created,resolved&"\ "query=Type:%20Bug%20Project%3A%20%7BCode%20With%20Me%7D" URL """ Explanation: Introduction Defect Analysis is a classic analysis technique to get insights into how buggy your system might be. One variant of Defect Analysis...
andreyf/machine-learning-examples
sklearn/sklearn.random_forest.ipynb
gpl-3.0
%pylab inline from sklearn import ensemble, cross_validation, learning_curve, metrics import numpy as np import pandas as pd """ Explanation: Sklearn sklearn.ensemble.RandomForestClassifier документация: http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html End of explanatio...
sympy/scipy-2017-codegen-tutorial
notebooks/60-chemical-kinetics-reaction-diffusion.ipynb
bsd-3-clause
reactions = [ ('k', {'A': 1}, {'B': 1, 'A': -1}), ] names, params = 'A B'.split(), ['k'] """ Explanation: In this notebook we will add diffusion in addition to reactions. We will first study the simplest possible chemical reaction set: $$ A \overset{k}{\rightarrow} B $$ we will consider a flat geometry where we as...
AllenDowney/ModSim
python/soln/chap13.ipynb
gpl-2.0
# install Pint if necessary try: import pint except ImportError: !pip install pint # download modsim.py if necessary from os.path import exists filename = 'modsim.py' if not exists(filename): from urllib.request import urlretrieve url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/' ...
dariox2/CADL
session-1/lecture-1.ipynb
apache-2.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') """ Explanation: Session 1: Introduction to Tensorflow <p class='lead'> Creative Applications of Deep Learning with Tensorflow<br /> Parag K. Mital<br /> Kadenze, Inc.<br /> </p> <a name="learning-goals"></a> Learning Goals ...
GoogleCloudPlatform/dfcx-scrapi
examples/intent_analysis/compare_intent_tp_data.ipynb
apache-2.0
# If you haven't already, make sure you install the `dfcx-scrapi` library !pip install dfcx-scrapi """ Explanation: Introduction In this notebook, we will show you how to evaluate the levenshtein ration between the training phrases of two intents. Prerequisites Ensure you have a GCP Service Account key with the Dial...
rashikaranpuria/Machine-Learning-Specialization
Machine Learning Foundations: A Case Study Approach/Assignment_one/Predicting house prices.ipynb
mit
import graphlab """ Explanation: Fire up graphlab create End of explanation """ sales = graphlab.SFrame('home_data.gl/home_data.gl') sales """ Explanation: Load some house sales data Dataset is from house sales in King County, the region where the city of Seattle, WA is located. End of explanation """ graphlab....
CartoDB/cartoframes
docs/examples/data_visualization/grid_layout/layout_viewport.ipynb
bsd-3-clause
from cartoframes.auth import set_default_credentials set_default_credentials('cartoframes') """ Explanation: Layout viewport Use the Layout class to create a variety of map views for comparison. For more information, run help(Layout). The first example sets a common viewport for all maps while the second sets two dif...
kmyokoyama/mathings
taylor.ipynb
apache-2.0
def taylor(f, x, var, max_terms=6, x0=0): def taylor_terms(): for k in range(max_terms): term = (sp.diff(f, var, k).subs(var, x0).evalf()/np.math.factorial(k)) * (x - x0)**k yield term serie = 0 for term in taylor_terms(): serie += term return se...
mne-tools/mne-tools.github.io
stable/_downloads/0ae9af7fe8e152942071a6b23acc0958/40_sensor_locations.ipynb
bsd-3-clause
import os import numpy as np import matplotlib.pyplot as plt # the following import is required for matplotlib < 3.2: from mpl_toolkits.mplot3d import Axes3D # noqa import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', ...
watsonyanghx/CS231n
assignment3/ImageGradients.ipynb
mit
# As usual, a bit of setup import time, os, json import numpy as np import skimage.io import matplotlib.pyplot as plt from cs231n.classifiers.pretrained_cnn import PretrainedCNN from cs231n.data_utils import load_tiny_imagenet from cs231n.image_utils import blur_image, deprocess_image %matplotlib inline plt.rcParams...
SSQ/Coursera-UW-Machine-Learning-Classification
Programming Assignment 1/Predicting sentiment from product reviews with pandas.ipynb
mit
products = pd.read_csv('amazon_baby.csv') """ Explanation: Load Amazon dataset 1. Load the dataset consisting of baby product reviews on Amazon.com. Store the data in a data frame products. End of explanation """ products = products.fillna({'review':''}) # fill in N/A's in the review column def remove_punctuation(...
UWSEDS/LectureNotes
Spring2018/Debugging-and-Exceptions/Exceptions.ipynb
bsd-2-clause
def divide1(numerator, denominator): try: result = numerator/denominator print("result = %f" % result) except: print("You can't divide by 0!!") divide1(1.0, 2) divide1(1.0, 0) divide1("x", 2) """ Explanation: Exceptions An exception is an event, which occurs during the execution of a progr...
donaghhorgan/COMP9033
labs/10 - Association rule mining.ipynb
gpl-3.0
import itertools import pandas as pd import pyspark from pyspark.ml.fpm import FPGrowth from pyspark.sql.functions import split """ Explanation: Lab 10: Association rule mining Introduction In this lab, we're going to look at association rule mining for grocery data. At the end of the lab, you should be able to: Fin...
McDermott-Group/Simulation
Projects/chargeNoiseMaskDesignCorr.ipynb
gpl-2.0
ri = (40,50,60,70,80,90,100,108) ro = (40.7,52.9,69,90.5,123,182,305,500) #Cq = (46.3,47.0, 46.9,47.0,47.0,47.0,46.9,46.9) Cq = (46.3,49.5, 46.9,49.5,47.0,51.7,46.9,54) Cg = (1.5, 1.44, 1.47, 1.45, 1.46, 1.49, 1.42, 1.48) Cgnd = (39.0, 30.9, 32.8, 35.6, 41.9, 54.1, 74.0, 108) r_xy = (np.nan, 110, np.nan, 175, np.nan, 2...
Kaggle/learntools
notebooks/geospatial/raw/tut1.ipynb
apache-2.0
import geopandas as gpd """ Explanation: Introduction In this micro-course, you'll learn about different methods to wrangle and visualize geospatial data, or data with a geographic location. <center> <img src="https://i.imgur.com/v6ZUGgI.png"><br/> </center> Along the way, you'll offer solutions to several real-world ...
statsmodels/statsmodels.github.io
v0.12.0/examples/notebooks/generated/stationarity_detrending_adf_kpss.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm """ Explanation: Stationarity and detrending (ADF/KPSS) Stationarity means that the statistical properties of a time series i.e. mean, variance and covariance do not change over time. Many statistical...
jrrembert/cybernetic-organism
dato/deeplearning/Deep Features for Image Retrieval.ipynb
gpl-2.0
import graphlab """ Explanation: Building an image retrieval system with deep features Fire up GraphLab Create End of explanation """ image_train = graphlab.SFrame('image_train_data/') image_test = graphlab.SFrame('image_test_data/') """ Explanation: Load the CIFAR-10 dataset We will use a popular benchmark dataset...
ES-DOC/esdoc-jupyterhub
notebooks/ncar/cmip6/models/sandbox-3/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncar', 'sandbox-3', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: NCAR Source ID: SANDBOX-3 Topic: Atmos Sub-Topics: Dynamical Core, Radiation, Turbul...
pombredanne/gensim
docs/notebooks/dtm_example.ipynb
lgpl-2.1
import logging import os from gensim import corpora, utils from gensim.models.wrappers.dtmmodel import DtmModel import numpy as np """ Explanation: DTM Example In this example we will present a sample usage of the DTM wrapper. Prior to using this you need to compile the DTM code yourself or use one of the binaries. Th...
sdpython/ensae_teaching_cs
_doc/notebooks/expose/ml_table_mortalite.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 2A.i - Table de mortalité dans plusieurs containers Pas de calcul d'espérence de vie, seulement différentes façons de lire les données d'une table de mortalité. End of explanation """ ...
ozorich/phys202-2015-work
assignments/assignment04/TheoryAndPracticeEx01.ipynb
mit
from IPython.display import Image """ Explanation: Theory and Practice of Visualization Exercise 1 Imports End of explanation """ # Add your filename and uncomment the following line: Image(filename='drugs_and_poverty_Chicago.0.png') """ Explanation: Graphical excellence and integrity Find a data-focused visualizat...
uranc/locmea
tutorials/.ipynb_checkpoints/Untitled-Copy1-checkpoint.ipynb
gpl-3.0
# Data path/filename t_ind = 38 data_path = '../data/' file_name = data_path + 'data_sim_low.hdf5' data_options = {'flag_cell': True, 'flag_electode': False} data = data_in(file_name, **data_options) """ Explanation: We start by adding some data from an hdf file. You will also need the python package h5py. The data o...
mattilyra/suckerpunch
examples/Introduction.ipynb
lgpl-3.0
document = 'Lorem Ipsum dolor sit amet' # shingle and discard the last 5 as these are just the last n<5 characters from the document shingles = [document[i:i+5] for i in range(len(document))][:-5] shingles other_document = 'Lorem Ipsum dolor sit amet is how dummy text starts' # shingle and discard the last 5 as these ...
ilayn/harold
notebooks/harold_introduction.ipynb
mit
import numpy as np from harold import * import matplotlib.pyplot as plt """ Explanation: A Brief Introduction to harold harold is a control systems toolbox that provides essential control engineering tools. In this notebook, we cover the basics of working with models and standard operations using them. Let us first im...
sraejones/Phys202-project
project/NeuralNetworks.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt from IPython.html.widgets import interact from sklearn.datasets import load_digits digits = load_digits() print(digits.data.shape) def show_digit(i): plt.matshow(digits.images[i]); interact(show_digit, i=(0,100)); """ Explanation: Neural Networks This project w...
solomonvimal/UCLA-Hydro
LakeArea_Altimetry/Altimetry_MODIS_SurfaceArea_lake610.ipynb
gpl-3.0
% matplotlib inline import pandas as pd import glob import matplotlib.pyplot as plt import matplotlib as mpl import numpy import numpy as np mpl.rcParams['ytick.labelsize'] = 14 mpl.rcParams['xtick.labelsize'] = 14 mpl.rcParams['font.size'] = 14 GRLM = "/home2/svimal/Github/Nina/data/lake_610/610_GRLM10.txt"; print GR...
xgcm/xrft
doc/DFT-iDFT_example.ipynb
mit
import numpy as np import numpy.testing as npt import xarray as xr import xrft import numpy.fft as npft import scipy.signal as signal import dask.array as dsar import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Example of discrete and inverse discrete Fourier transform End of explanation """ k0 = 1/...
cbare/Etudes
notebooks/random_forest_regression_example.ipynb
apache-2.0
import numpy as np import pandas as pd from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import r2_score import matplotlib.pyplot as plt """ Explanation: Random forest regression example As an experiment, we'll look at a dataset uniquely well suited to modeling with random forest regression. En...
ProfessorKazarinoff/staticsite
content/code/sympy/sympy-solving-2-equations-for-2-unknowns-and-statics-problem.ipynb
gpl-3.0
import numpy as np from sympy import symbols, Eq, solve """ Explanation: SymPy (http://www.sympy.org) is a Python library for symbolic math. In symbolic math, symbols represent mathematical expressions. In a numerical calculation, the value of pi is stored as an estimate of pi, a floating point number close to 3.14....
dtamayo/MachineLearning
Day5/Transit/Findout_Blended_stars.ipynb
gpl-3.0
import matplotlib from matplotlib import pyplot as plt import numpy as np import scipy as sp %matplotlib inline """ Explanation: Find out Blended stars Today our job is to find out blending stars and distinguish them with the true signals. When two stars are close to each other in the CCD, part of their lights may fal...
loisaidasam/gensim
docs/notebooks/sklearn_wrapper.ipynb
lgpl-2.1
from gensim.sklearn_integration.sklearn_wrapper_gensim_ldamodel import SklearnWrapperLdaModel """ Explanation: Using wrappers for Scikit learn API This tutorial is about using gensim models as a part of your scikit learn workflow with the help of wrappers found at gensim.sklearn_integration The wrapper available (as o...
rasbt/algorithms_in_ipython_notebooks
ipython_nbs/data-structures/hashtable-1.ipynb
gpl-3.0
class HashTable(): def __init__(self, size=17): pass def insert(self, key, value): """Insert a new key-value pair or overwrites an existing one.""" pass def __setitem__(self, key, value): return self.insert(key, value) def get(self, key): """Retrie...
MPBA/pyphysio
tutorials/2-algorithms.ipynb
gpl-3.0
# import packages from __future__ import division import numpy as np import matplotlib.pyplot as plt %matplotlib inline # import data from included examples from pyphysio.tests import TestData from pyphysio import EvenlySignal ecg_data = TestData.ecg() eda_data = TestData.eda() # create two signals fsamp = 2048 tst...
mit-eicu/eicu-code
notebooks/careplan.ipynb
mit
# Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import psycopg2 import getpass import pdvega # for configuring connection from configobj import ConfigObj import os %matplotlib inline # Create a database connection using settings from config file config='../db/config.ini' #...
bmcfee/pescador
examples/Pescador demo.ipynb
isc
import pescador import numpy as np np.set_printoptions(precision=4) import sklearn import sklearn.datasets import sklearn.linear_model import sklearn.metrics import sklearn.model_selection def batch_sampler(X, Y, batch_size=20, scale = 1e-1): '''A gaussian noise generator for data Parameters --------...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_whitened.ipynb
bsd-3-clause
import mne from mne.datasets import sample """ Explanation: Plotting whitened data This tutorial demonstrates how to plot whitened evoked data. Data are whitened for many processes, including dipole fitting, source localization and some decoding algorithms. Viewing whitened data thus gives a different perspective on t...
statsmodels/statsmodels.github.io
v0.12.2/examples/notebooks/generated/statespace_varmax.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt dta = sm.datasets.webuse('lutkepohl2', 'https://www.stata-press.com/data/r12/') dta.index = dta.qtr dta.index.freq = dta.index.inferred_freq endog = dta.loc['1960-04-01':'1978-10-01', ['dln_inv', 'dl...
peterwittek/ipython-notebooks
Simulating_POVMs.ipynb
gpl-3.0
from __future__ import print_function, division from fractions import Fraction import numpy as np import numpy.linalg import random import time from povm_tools import basis, check_ranks, complex_cross_product, dag, decomposePovmToProjective, \ enumerate_vertices, find_best_shrinking_factor, get_random_qutrit, \ ...
publicityreform/findbyimage
notebooks/word2vec/word2vec.ipynb
gpl-3.0
import sklearn import matplotlib.pyplot as plt import scipy import numpy as np from keras.models import Sequential from keras.layers.embeddings import Embedding from keras.layers import Flatten, Activation, Merge from keras.preprocessing.text import Tokenizer, base_filter from keras.preprocessing.sequence import skipgr...
brettavedisian/phys202-2015-work
assignments/assignment04/MatplotlibEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 2 Imports End of explanation """ !head -n 30 open_exoplanet_catalogue.txt """ Explanation: Exoplanet properties Over the past few decades, astronomers have discovered thousands of extrasolar planets. The follo...
snowicecat/umich-eecs445-f16
handsOn_lecture00_python_tutorial/lecture00_python_tutorial.ipynb
mit
print ('Hello Python!') """ Explanation: EECS 445: Python Tutorial Presented by: Zhao Fu September 12, 2016 References: 1. https://docs.python.org/3/tutorial/ 2. https://docs.python.org/3/library/ 3. http://cs231n.github.io/python-numpy-tutorial/ 4. https://github.com/donnemartin/data-science-ipython-notebooks Why Pyt...
robotcator/gensim
gensim Quick Start.ipynb
lgpl-2.1
raw_corpus = ["Human machine interface for lab abc computer applications", "A survey of user opinion of computer system response time", "The EPS user interface management system", "System and human system engineering testing of EPS", "Relation of user pe...
machinelearningnanodegree/stanford-cs231
solutions/kvn219/assignment1/knn.ipynb
mit
# Run some setup code for this notebook. import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt import numpy.linalg as la import seaborn as sns import itertools import pandas as pd sns.set_style('whitegrid') # create a palette generator palette = itertools.cycle(s...
ericmjl/protein-systematic-characterization
experiments/20160805-mutagenesis/primer design.ipynb
mit
%load_ext autoreload %autoreload 2 from Bio import SeqIO def report(seqrecord): print(seqrecord) print('Length: {0} n.t.'.format(len(seqrecord.seq))) """ Explanation: Mutagenesis primer design The goal here is to design primers for mutagenesis on PB2. The specific PB2 sequence that we are going to use is A/V...
JorisBolsens/PYNQ
Pynq-Z1/notebooks/examples/tracebuffer_i2c.ipynb
bsd-3-clause
from pprint import pprint from time import sleep from pynq import PL from pynq import Overlay from pynq.drivers import Trace_Buffer from pynq.iop import Pmod_TMP2 from pynq.iop import PMODA from pynq.iop import PMODB from pynq.iop import ARDUINO ol = Overlay("base.bit") ol.download() """ Explanation: Trace Buffer - T...
IS-ENES-Data/submission_forms
test/forms/test/test_ki_12345.ipynb
apache-2.0
# please edit the (red) information below: Name, email and project the data belongs to from dkrz_forms import form_handler my_project = "DKRZ_CDP" my_first_name = "...." # example: sf.first_name = "Harold" my_last_name = "...." # example: sf.last_name = "Mitty" my_email = "...." # example: sf.email = "Mr.Mitt...
ogaway/Econometrics
Dummy.ipynb
gpl-3.0
%matplotlib inline # -*- coding:utf-8 -*- from __future__ import print_function import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt import warnings warnings.filterwarnings('ignore') # データ読み込み data = pd.read_csv('example/k0901.csv') data # 説明変数設定 X = data[['X', 'D']] X ...
vzg100/Post-Translational-Modification-Prediction
.ipynb_checkpoints/Phosphorylation Sequence Tests -XGB -dbptm+ELM-VectorAvr.-phos_stripped-checkpoint.ipynb
mit
from pred import Predictor from pred import sequence_vector from pred import chemical_vector """ Explanation: Template for test End of explanation """ par = ["pass", "ADASYN", "SMOTEENN", "random_under_sample", "ncl", "near_miss"] for i in par: print("y", i) y = Predictor() y.load_data(file="Data/Trainin...
rjurney/Agile_Data_Code_2
ch06/Exploring_Data_with_Reports.ipynb
mit
import pyspark.sql.functions as F import pyspark.sql.types as T from pyspark.sql import SparkSession # Initialize PySpark with MongoDB and Elastic support spark = ( SparkSession.builder.appName("Exploring Data with Reports") # Load support for MongoDB and Elasticsearch .config("spark.jars.packages", "org....
numeristical/introspective
examples/SplineCalib_Tutorial.ipynb
mit
# "pip install ml_insights" in terminal if needed import pandas as pd import numpy as np import matplotlib.pyplot as plt import ml_insights as mli %matplotlib inline from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import log_loss, brier_sco...
neurodata/ndmg
tutorials/Overview.ipynb
apache-2.0
import os import os.path as op import glob import shutil import warnings import subprocess from pathlib import Path from ndmg.scripts import ndmg_dwi_pipeline from ndmg.scripts.ndmg_bids import get_atlas from ndmg.utils import cloud_utils """ Explanation: Ndmg Tutorial: Running Inside Python This tutorial provides a ...
kit-cel/wt
mloc/ch1_Preliminaries/KKT_waterfilling.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from ipywidgets import interactive import ipywidgets as widgets %matplotlib inline """ Explanation: Water-filling Visualized This code is provided as supplementary material of the lecture Machine Learning and Optimization in Communications (...
srcole/qwm
misc/paper_data/Extract time series from a published figure.ipynb
mit
# Load image and libraries %matplotlib inline from matplotlib import cm import matplotlib.pyplot as plt import numpy as np from scipy import misc input_image = misc.imread('figure_processed.png') # Convert input image from RGBA to binary input_image = input_image - 255 input_image = np.mean(input_image,2) binary_image...
seansweeney/NEARC-2017
Updating AGOL item metadata.ipynb
unlicense
from arcgis.gis import GIS from getpass import getpass from IPython.display import display """ Explanation: Import the GIS module and other needed Python modules The IPython.display module has some helper functions that the Python API takes advantage of for displaying objects like item details and maps in the notebook...
jinzishuai/learn2deeplearn
google_dl_udacity/lesson4/4_convolutions.ipynb
gpl-3.0
# These are all the modules we'll be using later. Make sure you can import them # before proceeding further. from __future__ import print_function import numpy as np import tensorflow as tf from six.moves import cPickle as pickle from six.moves import range pickle_file = '../notMNIST.pickle' with open(pickle_file, 'r...
ES-DOC/esdoc-jupyterhub
notebooks/nasa-giss/cmip6/models/giss-e2-1h/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nasa-giss', 'giss-e2-1h', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: NASA-GISS Source ID: GISS-E2-1H Sub-Topics: Radiative Forcings. Propert...
AlphaGit/deep-learning
batch-norm/Batch_Normalization_Exercises.ipynb
mit
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False) """ Explanation: Batch Normalization – Practice Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a con...
joelagnel/lisa
ipynb/examples/trace_analysis/TraceAnalysis_IdleStates.ipynb
apache-2.0
import logging from conf import LisaLogging LisaLogging.setup() %matplotlib inline import os # Support to access the remote target from env import TestEnv # Support to access cpuidle information from the target from devlib import * # Support to configure and run RTApp based workloads from wlgen import RTA, Ramp #...
jriehl/numba
examples/notebooks/numba.ipynb
bsd-2-clause
%pylab inline import numpy as np from numba import jit """ Explanation: This example uses trunk version of numba at Github. End of explanation """ def sum(arr): M, N = arr.shape sum = 0.0 for i in range(M): for j in range(N): sum += arr[i,j] return sum fastsum = jit('f8(f8[:,:])'...
ivastar/clear
notebooks/forward_modeling/Foward_model.ipynb
mit
from grizli import model import fsps import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec from scipy.interpolate import interp1d from astropy.table import Table from astropy import wcs from astropy.io import fits from glob import glob import os ## Seaborn is used to make plots lo...
dwhswenson/openpathsampling
docs/wip/sequential_ensembles.ipynb
mit
xval = paths.FunctionCV(name="x", f=lambda snap : snap.coordinates[0][0]) state = paths.CVDefinedVolume(xval, lambda_min=float("-inf"), lambda_max=0.0) # building example trajectories delta = 0.1 x_out = 0.9; x_in = -1.1 traj1 = trajectory_1D([x_in, x_out, x_in]) x_in += delta; x_out += delta traj2 = trajectory_1D([x_...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/n01_day7_model_choosing_close_feat_all_syms_equal.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 %matplotlib inline %pylab inline pylab.rcParams['figure.figsize'] = (20.0, 10...