repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
kevinjliang/Duke-Tsinghua-MLSS-2017
04A_MLP_Optimizer_Sandbox_Assignment.ipynb
apache-2.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # Import data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) # Helper functions for creating weight variables def weight_variable(shape): """wei...
openearth/notebooks
netcdf_fortran.ipynb
gpl-3.0
%%file test.f90 program example use netcdf integer, parameter :: n_time = 366 integer, parameter :: n_lon = 720 integer, parameter :: n_lat = 360 real(kind=4), dimension(n_lon, n_lat, n_time) :: outflow character(len=*), parameter :: unit = 'm3 s-1' ! this is an example dataset from Dai Yamazaki chara...
johntanz/ROP
.ipynb_checkpoints/Masimo160127-checkpoint.ipynb
gpl-2.0
#the usual beginning import pandas as pd import numpy as np from pandas import Series, DataFrame from datetime import datetime, timedelta from pandas import concat #define any string with 'C' as NaN def readD(val): if 'C' in val: return np.nan return val """ Explanation: Masimo Analysis For Pulse Ox. ...
nntisapeh/intro_programming
notebooks/if_statements.ipynb
mit
# A list of desserts I like. desserts = ['ice cream', 'chocolate', 'apple crisp', 'cookies'] favorite_dessert = 'apple crisp' # Print the desserts out, but let everyone know my favorite dessert. for dessert in desserts: if dessert == favorite_dessert: # This dessert is my favorite, let's let everyone know!...
Purg/SMQTK
bin/memex/hackathon_2016_07/cp1/data_retreival/notebooks/CP1 Data Curation.ipynb
bsd-3-clause
import json import os from collections import defaultdict DATA_FILE = '' !md5sum $DATA_FILE """ Explanation: The goal of this notebook is to retrieve the relevant images from a set of ads with assigned clusters. Input The input is specified by DATA_FILE, which is a JSON lines file containing CDR ad documents that e...
smorton2/think-stats
code/chap07soln.ipynb
gpl-3.0
from __future__ import print_function, division %matplotlib inline import numpy as np import brfss import thinkstats2 import thinkplot """ Explanation: Examples and Exercises from Think Stats, 2nd Edition http://thinkstats2.com Copyright 2016 Allen B. Downey MIT License: https://opensource.org/licenses/MIT End of ...
probml/pyprobml
notebooks/book1/01/pandas_intro.ipynb
mit
# Standard Python libraries from __future__ import absolute_import, division, print_function, unicode_literals import os import time import numpy as np import glob import matplotlib.pyplot as plt import PIL import imageio from IPython.display import display, HTML import sklearn import seaborn as sns sns.set(style=...
kubeflow/kfserving-lts
docs/samples/pipelines/kfs-pipeline.ipynb
apache-2.0
!pip3 install kfp --upgrade import kfp.compiler as compiler import kfp.dsl as dsl import kfp from kfp import components # Create kfp client # Note: Add the KubeFlow Pipeline endpoint below if the client is not running on the same cluster. # Example: kfp.Client('http://192.168.1.27:31380/pipeline') client = kfp.Client...
Milad7m/motion
07_04.ipynb
mit
import numpy as np import pandas as pd from sklearn.svm import SVR from sklearn.linear_model import Lasso from sklearn.metrics import mean_squared_error from sklearn.preprocessing import StandardScaler from sklearn.cross_validation import train_test_split """ Explanation: Main imports End of explanation """ # input ...
keras-team/keras-io
examples/timeseries/ipynb/timeseries_weather_forecasting.ipynb
apache-2.0
import pandas as pd import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras """ Explanation: Timeseries forecasting for weather prediction Authors: Prabhanshu Attri, Yashika Sharma, Kristi Takach, Falak Shah<br> Date created: 2020/06/23<br> Last modified: 2020/07/20<br> Description: This n...
bmeaut/python_nlp_2017_fall
course_material/05_Decorators_Packaging/05_Decorators_packaging.ipynb
mit
def greeter(func): print("Hello") func() def say_something(): print("Let's learn some Python.") greeter(say_something) # greeter(12) """ Explanation: Introduction to Python and Natural Language Technologies Lecture 5 Decorators and packaging March 7, 2018 Let's create a greeter function takes an...
gully/PyKE
docs/source/tutorials/ipython_notebooks/psfphotometry/c9-prf-fitting.ipynb
mit
import pyke pyke.__version__ import oktopus oktopus.__version__ """ Explanation: Fitting PRFs in K2 TPFs from Campaign 9.1 In this simple tutorial we will show how to perform PRF photometry in a K2 target pixel file using PyKE and oktopus. This notebook was created with the following versions of PyKE and oktopus: E...
jqug/microscopy-object-detection
CNN training & evaluation - plasmodium (phone).ipynb
mit
29416./261345 N_samples_to_display = 10 pos_indices = np.where(train_y)[0] pos_indices = pos_indices[np.random.permutation(len(pos_indices))] for i in range(N_samples_to_display): plt.subplot(2,N_samples_to_display,i+1) example_pos = train_X[pos_indices[i],:,:,:] example_pos = np.swapaxes(example_pos,0,2) ...
junhwanjang/DataSchool
Lecture/05. 기초 선형 대수 1 - 행렬의 정의와 연산/6) 연립방정식과 역행렬.ipynb
mit
A = np.array([[1, 3, -2], [3, 5, 6], [2, 4, 3]]) A b = np.array([[5], [7], [8]]) b Ainv = np.linalg.inv(A) Ainv x = np.dot(Ainv, b) x np.dot(A, x) - b x, resid, rank, s = np.linalg.lstsq(A, b) x """ Explanation: 연립방정식과 역행렬 다음과 같이 $x_1, x_2, \cdots, x_n$ 이라는 $n$ 개의 미지수를 가지는 방정식을 연립 방정식(system of equations)이라고 한다. ...
hannorein/reboundx
ipython_examples/Radiation_Forces_Circumplanetary_Dust.ipynb
gpl-3.0
import rebound import reboundx import numpy as np sim = rebound.Simulation() sim.G = 6.674e-11 # SI units sim.dt = 1.e4 # Initial timestep in sec. sim.N_active = 2 # Make it so dust particles don't interact with one another gravitationally sim.add(m=1.99e30, hash="Sun") # add Sun with mass in kg sim.add(m=5.68e26, a=1....
gdhungana/desispec
doc/nb/Bootstrap_tests.ipynb
bsd-3-clause
# import """ Explanation: Tests for the Bootstrap code End of explanation """ def pix_sub(infil, outfil, rows=(80,310)): hdu = fits.open(infil) # Trim img = hdu[0].data sub_img = img[:,rows[0]:rows[1]] # New newhdu = fits.PrimaryHDU(sub_img) # Header for key in ['CAMERA','VSPECTER','R...
planetlabs/notebooks
jupyter-notebooks/temporal-analysis/crop-temporal.ipynb
apache-2.0
import datetime import json import os import shutil import subprocess import geojson import matplotlib.pyplot as plt import numpy as np import pandas as pd from planet import api from planet.api import filters, downloader import rasterio from shapely.geometry import shape """ Explanation: Crop Temporal Analysis Throu...
pysal/pysal
notebooks/explore/pointpats/window.ipynb
bsd-3-clause
import pysal.lib as ps import numpy as np from pysal.explore.pointpats import PointPattern f = ps.examples.get_path('vautm17n_points.shp') fo = ps.io.open(f) pp_va = PointPattern(np.asarray([pnt for pnt in fo])) fo.close() pp_va.summary() """ Explanation: Point Pattern Windows Author: Serge Rey &#115;&#106;&#115;&#11...
niallrobinson/jade-hack
Dask Intro.ipynb
gpl-3.0
!pip install castra graphviz # missing dependency for !apt-get install -y graphviz # logic graph viz # just so we do plots in the notebook %matplotlib inline import dask # for parallel computing from distributed import Executor, progress # for distributed parallel computing """ Explanation: Dask Dask is a Python lib...
pyemma/deeplearning
assignment2/ConvolutionalNetworks.ipynb
gpl-3.0
# As usual, a bit of setup import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.cnn import * from cs231n.data_utils import get_CIFAR10_data from cs231n.gradient_check import eval_numerical_gradient_array, eval_numerical_gradient from cs231n.layers import * from cs231n.fast_layers import * from cs...
landlab/landlab
notebooks/tutorials/overland_flow/how_to_d4_pitfill_a_dem.ipynb
mit
from landlab import imshow_grid from landlab.components import FlowAccumulator from landlab.io import read_esri_ascii """ Explanation: <a href="http://landlab.github.io"><img style="float: left" src="../../landlab_header.png"></a> How to do "D4" pit-filling on a digital elevation model (DEM) (Greg Tucker, July 2021) D...
martinggww/lucasenlights
MachineLearning/DataScience-Python3/MultivariateRegression.ipynb
cc0-1.0
import pandas as pd df = pd.read_excel('http://cdn.sundog-soft.com/Udemy/DataScience/cars.xls') df.head() """ Explanation: Multivariate Regression Let's grab a small little data set of Blue Book car values: End of explanation """ import statsmodels.api as sm df['Model_ord'] = pd.Categorical(df.Model).codes X = d...
metpy/MetPy
v0.11/_downloads/6535033cff935ab2c434cdad6eb5b4f7/Wind_SLP_Interpolation.ipynb
bsd-3-clause
import cartopy.crs as ccrs import cartopy.feature as cfeature from matplotlib.colors import BoundaryNorm import matplotlib.pyplot as plt import numpy as np import pandas as pd from metpy.calc import wind_components from metpy.cbook import get_test_data from metpy.interpolate import interpolate_to_grid, remove_nan_obse...
Bismarrck/deep-learning
tv-script-generation/dlnd_tv_script_generation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper data_dir = './data/simpsons/moes_tavern_lines.txt' text = helper.load_data(data_dir) # Ignore notice, since we don't use it for analysing the data text = text[81:] """ Explanation: TV Script Generation In this project, you'll generate your own Simpsons TV scrip...
DistrictDataLabs/yellowbrick
examples/rebeccabilbro/pipelines.ipynb
apache-2.0
%matplotlib inline import os import sys # Modify the path sys.path.append("/Users/rebeccabilbro/Desktop/waves/stuff/yellowbrick") import requests import numpy as np import pandas as pd import yellowbrick as yb import matplotlib.pyplot as plt """ Explanation: Chained Visualizations with Yellowbrick Pipelines In ...
zhaojijet/UdacityDeepLearningProject
examples/Skip-Grams-Solution.ipynb
apache-2.0
import time import numpy as np import tensorflow as tf import utils """ Explanation: Skip-gram word2vec In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p...
anhaidgroup/py_entitymatching
notebooks/guides/end_to_end_em_guides/Basic EM Workflow Restaurants - 1.ipynb
bsd-3-clause
import sys sys.path.append('/Users/pradap/Documents/Research/Python-Package/anhaid/py_entitymatching/') import py_entitymatching as em import pandas as pd import os # Display the versions print('python version: ' + sys.version ) print('pandas version: ' + pd.__version__ ) print('magellan version: ' + em.__version__ )...
mohsinhaider/pythonbootcampacm
Objects and Data Structures/Dictionaries.ipynb
mit
# Initializing a Dictionary my_dictionary = {"Mike":1, "John":5} """ Explanation: Dictionaries Python has 3 primary types of data: sequences, sets, and mappings. A dictionary is a mapping, or, in other words, a container for multiple mappings of key-value pairs. In specific, mappings are collections of objects organiz...
matheusportela/indeed-ml-codesprint
indeed.ipynb
mit
import numpy as np import sklearn """ Explanation: Indeed Machine Learning CodeSprint Load the important packages: End of explanation """ import csv def load_train_data(filename): X = [] y = [] with open(filename) as fd: reader = csv.reader(fd, delimiter='\t') # ignore header row ...
giacomov/3ML
docs/examples/joint_BAT_gbm_demo.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt from jupyterthemes import jtplot jtplot.style(context="talk", fscale=1, ticks=True, grid=False) plt.style.use("mike") from threeML import * from threeML.io.package_data import get_path_of_data_file import os import warnings warnings.simplefilter("ignore") """ Ex...
usantamaria/ipynb_para_docencia
10_libreria_pycuda/pycuda.ipynb
mit
""" IPython Notebook v4.0 para python 3.0 Librerías adicionales: numpy, scipy, matplotlib. (EDITAR EN FUNCION DEL NOTEBOOK!!!) Contenido bajo licencia CC-BY 4.0. Código bajo licencia MIT. (c) Sebastian Flores, Christopher Cooper, Alberto Rubio, Pablo Bunout. """ # Configuración para recargar módulos y librerías dinámi...
tensorflow/docs-l10n
site/ja/tutorials/structured_data/imbalanced_data.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...
Kkari/bsc_thesis
Diploma_munka_notebook_0.ipynb
apache-2.0
def accuracy(predictions, labels): return (100.0 * np.sum(np.argmax(predictions, 1) == np.argmax(labels, 1)) / predictions.shape[0]) # Reformat the dataset for the convolutional networks def reformat(dataset): dataset = dataset.reshape((-1, image_size, image_size, num_channels)).astype(np.float32) ...
ueapy/ueapy.github.io
content/notebooks/2017-03-24-climate-model-output.ipynb
mit
URL = 'https://raw.githubusercontent.com/ueapy/ueapy.github.io/src/content/data/run1_U_60N_10hPa.dat' """ Explanation: Today one of the group members asked for help with reading climate model output and preparing it for data analysis. This notebook shows a couple of ways of doing that with the help of numpy and iris P...
hvanwyk/quadmesh
experiments/multiscale_gmrf/optimal_upscaling_01.ipynb
mit
# Add src folder to path import os import sys sys.path.insert(0,'../../src/') """ Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Introduction" data-toc-modified-id="Introduction-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Introducti...
jcbozonier/research
notebooks/PuLP Shopping with a Data Scientist.ipynb
mit
model_a = p.LpProblem("Albon Shopping Problem", p.LpMinimize) """ Explanation: Shopping with a Data Scientist End of explanation """ lightning_1 = p.LpVariable('lightning_1', lowBound=0, cat='Integer') lightning_3 = p.LpVariable('lightning_3', lowBound=0, cat='Integer') lightning_6 = p.LpVariable('lightning_6', lowB...
luofan18/deep-learning
batch-norm/Batch_Normalization_Lesson.ipynb
mit
# Import necessary packages import tensorflow as tf import tqdm import numpy as np import matplotlib.pyplot as plt %matplotlib inline # Import MNIST data so we have something for our experiments from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) "...
irockafe/revo_healthcare
notebooks/Effects_of_retention_time_on_classification/retention_time_regions_and_classifiiability.ipynb
mit
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import matplotlib.colors as colors %matplotlib inline """ Explanation: <h2>Goal:</h2> Write functions to subdivide an m/z : rt space into rt bins. See how this affects classification performance End of explanation """ # Get the data ### Subdiv...
ZoranPandovski/al-go-rithms
image_processing/Augmentation/augmentor.ipynb
cc0-1.0
!pip install Augmentor -q %matplotlib inline """ Explanation: Image Augmentation using Augmentor Augmentor is an image augmentation library in Python for machine learning. It aims to be a standalone library that is platform and framework independent, which is more convenient, allows for finer grained control over aug...
ivannz/study_notes
year_15_16/machine_learning_course/ensemble_practicum/ensemble_methods_scikit.ipynb
mit
import numpy as np import pandas as pd %matplotlib inline import matplotlib.pyplot as plt from sklearn.utils import check_random_state """ Explanation: A half-baked tutorial on ensemble methods <center>by Ivan Nazarov<center/> This tutorial covers both introductiory level theory underpinning each ensemble method, as ...
skdaccess/skdaccess
skdaccess/examples/Demo_TESS_Data_Alerts.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt plt.rcParams['figure.dpi'] = 150 """ Explanation: The MIT License (MIT)<br> Copyright (c) 2018 Massachusetts Institute of Technology<br> Authors: Cody Rude<br> This software has been created in projects supported by the US National<br> Science Foundation and NASA (PI...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/gapic/automl/showcase_automl_tabular_binary_classification_batch.ipynb
apache-2.0
import os import sys # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install -U google-cloud-aiplatform $USER_FLAG """ Explanation: Vertex client library: AutoML tabular binary classification model for batch prediction <tab...
daviddesancho/PREFUR
examples/free_energy_model_local.ipynb
gpl-3.0
from prefur import thermo """ Explanation: Splitting stabilization energy We start by importing the thermo module from the prefur package. End of explanation """ fig, ax = plt.subplots(2,2, figsize=(7,5), sharex=True) ax = ax.flatten() FES = thermo.FES(40) FES.gen_enthalpy_global(DHloc=1.31, DHnonloc=5.5) FES.gen_f...
JamesRunnalls/HealthEconomics_Analysis
Health_Economics.ipynb
gpl-3.0
%matplotlib notebook import pandas as pd import matplotlib.pyplot as plt import numpy as np import difflib import re #import seaborn as sns """ Explanation: Health and Economic Analysis End of explanation """ key = pd.read_excel('key.xlsx',sheetname='UK', usecols=['NUTS3_13','LAU1_NAT_CODE_NEW']) key = key.drop_dup...
mathcoding/Programmazione2
Appunti vari.ipynb
mit
0.1+0.1+0.1-0.3 """ Explanation: Precisione dei numeri floats A seguito di un paio di domande fatte a lezione, vediamo la precisione dei numeri "reali" in Python. I float in python corrispondono ai double in C e quindi sono numeri in doppio precisione, e occupano in memoria 64 bits. Questo comporta un errore di preci...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/production_ml/labs/samples/core/dataflow/dataflow.ipynb
apache-2.0
project = 'Input your PROJECT ID' region = 'Input GCP region' # For example, 'us-central1' output = 'Input your GCS bucket name' # No ending slash """ Explanation: GCP Dataflow Component Sample A Kubeflow Pipeline component that prepares data by submitting an Apache Beam job (authored in Python) to Cloud Dataflow for...
sz-workshop-2017/virtual-machine
notebooks/6.2 - Loading a pre-trained model.ipynb
apache-2.0
import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from keras.layers import LSTM from keras.callbacks import ModelCheckpoint from keras.utils import np_utils import sys import re import pickle """ Explanation: 6.2 - Using a pre-trained model with Ker...
sriharshams/mlnd
boston_housing/boston_housing.ipynb
apache-2.0
# Import libraries necessary for this project import numpy as np import pandas as pd from sklearn.cross_validation import ShuffleSplit # Import supplementary visualizations code visuals.py import visuals as vs # Pretty display for notebooks %matplotlib inline # Load the Boston housing dataset data = pd.read_csv('hou...
chseifert/tutorials
visualizations/Anscombe-Data-Set.ipynb
apache-2.0
import matplotlib.pyplot as plt import numpy as np import pandas import statistics from statistics import variance from pylab import * from collections import OrderedDict """ Explanation: THE ANSCOMBE QUARTET Authors Ndèye Gagnessiry Ndiaye and Christin Seifert License This work is licensed under the Creative Common...
quantopian/research_public
notebooks/tutorials/4_futures_getting_started_lesson5/notebook.ipynb
apache-2.0
from quantopian.research.experimental import continuous_future, history cl_future = continuous_future('CL') xb_future = continuous_future('XB') cl_price = history( cl_future, fields='price', frequency='daily', start='2014-01-01', end='2015-01-01' ) xb_price = history( xb_future, fields='...
mihaic/brainiak
examples/funcalign/FastSRM_encoding_experiment.ipynb
apache-2.0
import wget from time import time from glob import glob from os.path import join import nibabel from nilearn.image import new_img_like from nilearn.input_data import NiftiMasker, MultiNiftiMasker import numpy as np from joblib import Parallel, delayed from nilearn.plotting import plot_stat_map import matplotlib.pyplot ...
landlab/landlab
notebooks/tutorials/flow_direction_and_accumulation/the_Flow_Director_Accumulator_PriorityFlood.ipynb
mit
# import plotting tools from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import matplotlib as mpl # import numpy import numpy as np # import necessary landlab components from landlab import RasterModelGrid...
emjotde/UMZ
Wyklady/05/Wieloklasyfikacja.ipynb
cc0-1.0
import pandas data = pandas.read_csv("iris.csv", header=None, names=["lod.dl.", "lod.sz.", "pl.dl.", "pl.sz.", "Gatunek"]) data[:8] """ Explanation: Wieloklasyfikacja Regresja logistyczna i liniowa Przypomnienie: <br/>Zgadnienie klasyfikacji wieloklasowej $$\textrm{Zbiór klas: } \qquad C = { c_1, c_2, \cdots, c_k } ...
KJE2001/seminars
04_operators_and_commutators.ipynb
mit
from sympy import * # Define symbols x, y, z = symbols('x y z') # We want results to be printed to screen init_printing(use_unicode=True) # Calculate the derivative with respect to x diff(exp(x**2), x) """ Explanation: <figure> <IMG SRC="gfx/Logo_norsk_pos.png" WIDTH=100 ALIGN="right"> </figure> Operators and commu...
snowicecat/umich-eecs445-f16
handsOn_lecture11_info-theory-decision-trees/handsOn11.ipynb
mit
from sklearn.tree import DecisionTreeClassifier from sklearn.linear_model import LogisticRegression, Perceptron import numpy as np import matplotlib.pyplot as plt from mlxtend.evaluate import plot_decision_regions %matplotlib inline %config InlineBackend.figure_format = 'retina' """ Explanation: EECS 445: Machine Le...
bjodah/PubChemPy
examples/CAS registry numbers.ipynb
mit
import re import pubchempy as pcp """ Explanation: Retrieving CAS registry numbers End of explanation """ import logging logging.getLogger('pubchempy').setLevel(logging.DEBUG) """ Explanation: Enable debug logging to make it easier to see what is going on: End of explanation """ def get_substructure_cas(smiles):...
brainsqueeze/Open_Ag_examples
open_ag_tutorials.ipynb
mit
from sklearn.datasets import fetch_20newsgroups import numpy as np """ Explanation: Scikit-learn API examples End of explanation """ newsgroups_train = fetch_20newsgroups(subset='train') newsgroups_test = fetch_20newsgroups(subset='test') print newsgroups_train.keys(), '\n' print newsgroups_train['data'][:2], '\n'...
peterdalle/mij
3 News robot/Earthquake news robot.ipynb
gpl-3.0
# Import datetime to use dates. from datetime import * # The data comes in a dictionary (key-value pairs). Note that it looks just like JSON! data = { "Richter": 7.5, "Latitud": 12, "Longitud": 12, "City": "Gothenburg", "Country": "Sweden", "Datetime": "2017-02-01 22:15:...
GoogleCloudPlatform/vertex-ai-samples
notebooks/official/migration/UJ2,12 Vertex SDK Custom Image Classification with pre-built training container.ipynb
apache-2.0
import os # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG """ Explanation: Vertex AI: Vertex AI Migration: Custom Image Classification w/pre-built training container <tab...
napsternxg/DataMiningPython
Lecture Notebooks/Redoing Weka stuff.ipynb
gpl-3.0
%matplotlib inline import numpy as np from scipy.io import arff import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import patsy import statsmodels.api as sm from sklearn import tree, linear_model, metrics, dummy, naive_bayes, neighbors from IPython.display import Image import pydotplus sns.s...
nudomarinero/mltier1
Match_LOFAR_combined_final.ipynb
gpl-3.0
import numpy as np from astropy.table import Table, join from astropy import units as u from astropy.coordinates import SkyCoord, search_around_sky from IPython.display import clear_output import pickle import os from mltier1 import (get_center, Field, MultiMLEstimator, parallel_process, get_sigma_all, describe) %loa...
astroumd/GradMap
notebooks/Lectures2019/Lecture1/GradMap_L1_Student.ipynb
gpl-3.0
## You can use Python as a calculator: 5*7 #This is a comment and does not affect your code. #You can have as many as you want. #Comments help explain your code to others and yourself #No worries. 5+7 5-7 5/7 """ Explanation: Introduction to "Doing Science" in Python for REAL Beginners Python is one of many lang...
mclaughlin6464/pearce
notebooks/Make MCMC Cfgs for Aemulus.ipynb
mit
import yaml import copy from os import path import numpy as np orig_cfg_fname = '/u/ki/swmclau2/Git/pearce/bin/mcmc/nh_gg_sham_hsab_mcmc_config.yaml' with open(orig_cfg_fname, 'r') as yamlfile: orig_cfg = yaml.load(yamlfile) bsub_template="""#BSUB -q long #BSUB -W 72:00 #BSUB -J {jobname} #BSUB -oo /u/ki/swmclau...
alephcero/adsProject
3. Model Evaluation and Selection.ipynb
gpl-3.0
import pandas as pd import numpy as np import os import sys import simpledbf %pylab inline import matplotlib.pyplot as plt import statsmodels.api as sm from sklearn.model_selection import train_test_split from sklearn import linear_model """ Explanation: New York University Applied Data Science 2016 Final Project Mea...
GoogleCloudPlatform/training-data-analyst
self-paced-labs/ai-platform-qwikstart/ai_platform_qwik_start.ipynb
apache-2.0
import os """ Explanation: AI Platform: Qwik Start This lab gives you an introductory, end-to-end experience of training and prediction on AI Platform. The lab will use a census dataset to: Create a TensorFlow 2.x training application and validate it locally. Run your training job on a single worker instance in the c...
cliburn/sta-663-2017
notebook/06_Graphics.ipynb
mit
import warnings warnings.filterwarnings("ignore") """ Explanation: Graphics in Python The foundational package for most graphics in Python is matplotlib, and the seaborn package builds on this to provide more statistical graphing options. We will focus on these two packages, but there are many others if these don't me...
bassio/omicexperiment
omicexperiment/docs/01_experiment_basics.ipynb
bsd-3-clause
%load_ext autoreload %autoreload 2 from omicexperiment.experiment.microbiome import MicrobiomeExperiment mapping = "example_map.tsv" biom = "example_fungal.biom" tax = "blast_tax_assignments.txt" #the MicrobiomeExperiment constructor currently needs three parameters exp = MicrobiomeExperiment(biom, mapping,tax) #the...
cmry/cmry.github.io
sources/serialize_sk2.ipynb
mit
import serialize_sk as sr def deserialize(class_init, attr): for k, v in attr.items(): setattr(class_init, k, sr.json_to_data(v)) return class_init """ Explanation: Scikit-learn Pipeline Persistence and JSON Serialization Part II By Chris Emmery, 14-04-2016, 5 minute read This is a follow-up to this...
csc-training/python-introduction
notebooks/answers/4 - Functions and exceptions.ipynb
mit
def celsius_to_kelvin(c): return c + 273.15 celsius_to_kelvin(0) """ Explanation: Functions and exceptions Functions Write a function that converts from Celsius to Kelvin. To convert from Centigrade to Kelvin you add 273.15 to the value. Try your solution for a few values. End of explanation """ def fahrenheit_...
ageron/ml-notebooks
extra_capsnets-cn.ipynb
apache-2.0
from IPython.display import IFrame IFrame(src="https://www.youtube.com/embed/pPN8d0E3900", width=560, height=315, frameborder=0, allowfullscreen=True) """ Explanation: 胶囊网络(CapsNets) 基于论文:Dynamic Routing Between Capsules,作者:Sara Sabour, Nicholas Frosst and Geoffrey E. Hinton (NIPS 2017)。 部分启发来自于Huadong Liao的实现CapsNet-...
blua/deep-learning
weight-initialization/.ipynb_checkpoints/weight_initialization-checkpoint.ipynb
mit
%matplotlib inline import tensorflow as tf import helper from tensorflow.examples.tutorials.mnist import input_data print('Getting MNIST Dataset...') mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) print('Data Extracted.') """ Explanation: Weight Initialization In this lesson, you'll learn how to fin...
ppham27/MLaPP-solutions
chap07/7.ipynb
mit
%matplotlib inline import numpy as np from scipy import stats import matplotlib.pyplot as plt import pandas as pd from linreg import * np.random.seed(2016) def make_data(N): X = np.linspace(0, 20, N) Y = stats.norm.rvs(size=N, loc=-1.5*X + X*X/9, scale=2) return X, Y X, Y = make_data(21) print(np.column...
jseabold/statsmodels
examples/notebooks/pca_fertility_factors.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import statsmodels.api as sm from statsmodels.multivariate.pca import PCA plt.rc("figure", figsize=(16,8)) plt.rc("font", size=14) """ Explanation: statsmodels Principal Component Analysis Key ideas: Principal component analysis, world bank data, fertility In this n...
derrowap/MA490-MachineLearning-FinalProject
project.ipynb
mit
data_inorder = pd.read_csv('Data\\adder_inorder_data.csv') data_inorder = data_inorder[['Steps', 'MSE']] data_inorder = data_inorder.sort_values(['Steps']) data_inorder.head(9) data_rnd_0 = pd.read_csv('Data\\adder_random_0_data.csv') data_rnd_0 = data_rnd_0[['Steps', 'MSE']] data_rnd_0 = data_rnd_0.sort_values(['Step...
GoogleCloudPlatform/bigquery-notebooks
notebooks/community/analytics-componetized-patterns/retail/recommendation-system/bqml-scann/tfx01_interactive.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 !pip install -U -q tfx """ Explanation: Create an interactive TFX pipeline This notebook is the first of two notebooks that guide you through automating the Real-time Item-to-item Recommendation with BigQuery ML Matrix Factorization and ScaNN solution with a pipeline. Use this noteb...
davidthomas5412/PanglossNotebooks
MassLuminosityProject/DataAndMassPrior_2017_02_08.ipynb
mit
from IPython.display import Image Image(filename='pgm_mock_data.png') """ Explanation: Generate Mock Data End of explanation """ from scipy.stats import norm import numpy as np np.random.seed(1) alpha1 = norm(10.709, 0.022).rvs() alpha2 = norm(0.359, 0.009).rvs() alpha3 = 2.35e14 alpha4 = norm(1.10, 0.06).rvs() S ...
tjwei/HackNTU_Data_2017
Week03/00-Download-M06A.ipynb
mit
from urllib.request import urlopen, urlretrieve import tqdm """ Explanation: 下載 ETC M06A 資料 <a href="http://www.freeway.gov.tw/UserFiles/File/TIMCCC/TDCS%E4%BD%BF%E7%94%A8%E6%89%8B%E5%86%8A(tanfb)v3.0-1.pdf">國道高速公路電子收費交通資料蒐集支援系統(Traffic Data Collection System,TDCS)使用手冊</a> End of explanation """ # 歷史資料網址 data_baseur...
Echelle/AO_bonding_paper
notebooks/SiGaps_11_etalon_trans.ipynb
mit
%pylab inline import pandas as pd import seaborn as sns sns.set_context("paper", font_scale=2.0, rc={"lines.linewidth": 2.5}) sns.set(style="ticks") """ Explanation: This IPython Notebook is for showing the family of solutions to the Fabry-Perot etalon transmission. The filename of the figure is etalon_trans.pdf. Aut...
therealAJ/python-sandbox
data-science/learning/ud1/DataScience/NaiveBayes.ipynb
gpl-3.0
import os import io import numpy from pandas import DataFrame from sklearn.feature_extraction.text import CountVectorizer from sklearn.naive_bayes import MultinomialNB def readFiles(path): for root, dirnames, filenames in os.walk(path): for filename in filenames: path = os.path.join(root, filen...
bzamecnik/ml-playground
snippets/keras/keras_hello_world.ipynb
mit
%pylab inline from keras.layers.core import Dense, Activation from keras.models import Sequential from keras.utils import np_utils from sklearn.cross_validation import train_test_split from sklearn.datasets.samples_generator import make_blobs from sklearn.metrics import classification_report, confusion_matrix """ Ex...
DJCordhose/ai
notebooks/tensorflow/tf_low_level_advanced.ipynb
mit
# import and check version import tensorflow as tf # tf can be really verbose tf.logging.set_verbosity(tf.logging.ERROR) print(tf.__version__) # a small sanity check, does tf seem to work ok? hello = tf.constant('Hello TF!') sess = tf.Session() print(sess.run(hello)) sess.close() """ Explanation: <a href="https://co...
elastic/examples
Machine Learning/Data Frames/pivot_review_data_pandas.ipynb
apache-2.0
import bz2 import pandas as pd import numpy as np import matplotlib.pyplot as plt from pandas.plotting import scatter_matrix """ Explanation: Pivot review data in pandas This notebook shows how data can be pivoted by python pandas to reveal insights into the behaviour of reviewers. The use case and data is from Mark H...
GoogleCloudPlatform/nvidia-merlin-on-vertex-ai
03-model-inference-hugectr.ipynb
apache-2.0
import json import os import shutil import time from pathlib import Path from src.serving import export from google.cloud import aiplatform as vertex_ai """ Explanation: Serving models using NVIDIA Triton Inference Server and Vertex AI Prediction This notebook demonstrates how to serve NVIDIA Merlin HugeCTR deep lea...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/migration/UJ2,12 legacy Custom Training Prebuilt Container TF Keras.ipynb
apache-2.0
! pip3 install google-cloud-storage """ Explanation: Vertex SDK: Train & deploy a TensorFlow model with hosted runtimes (aka pre-built containers) Installation Install the Google cloud-storage library as well. End of explanation """ import os if not os.getenv("AUTORUN"): # Automatically restart kernel after ins...
brettavedisian/phys202-2015-work
assignments/assignment06/ProjectEuler17.ipynb
mit
def number_to_words(n): """Given a number n between 1-1000 inclusive return a list of words for the number.""" num_to_word={'1':'one','2':'two','3':'three','4':'four','5':'five','6':'six','7':'seven','8':'eight','9':'nine','10':'ten', '11':'eleven','12':'twelve','13':'thirteen','14':'fourteen',...
spencerchan/ctabus
notebooks/Toward Neighborhood-Level Analysis - Bus Service in Logan Square.ipynb
gpl-3.0
commareas = gpd.read_file("../data/raw/geofences/Boundaries - Community Areas (current).geojson") commareas.plot() commareas.head() """ Explanation: Introduction <a name="introduction"></a> With the large volume of CTA bus location data I have collected so far in 2019, I want to develop a process for analyzing the dat...
mcneela/Retina
demos/mcculloch-pitts/McCulloch-Pitts Neurons.ipynb
bsd-3-clause
class MPNeuron(object): def __init__(self, threshold, inputs): self.threshold = threshold self.inputs = inputs def activate(self): excitations = 0 for trigger in self.inputs: if trigger.excitatory: excitations += trigger.value else: ...
martinjrobins/hobo
examples/stats/custom-logpdf.ipynb
bsd-3-clause
import numpy as np import pints class Rosenbrock(pints.LogPDF): def __init__(self, a=1, b=100): self._a = a self._b = b def __call__(self, x): return - np.log((self._a - x[0])**2 + self._b * (x[1] - x[0]**2)**2) def n_parameters(self): return 2 """ Explanation: Writing a ...
ES-DOC/esdoc-jupyterhub
notebooks/mohc/cmip6/models/hadgem3-gc31-hh/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mohc', 'hadgem3-gc31-hh', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: MOHC Source ID: HADGEM3-GC31-HH Topic: Seaice Sub-Topics: Dynamics, Thermody...
Vvkmnn/books
AutomateTheBoringStuffWithPython/lesson44.ipynb
gpl-3.0
import PyPDF2 """ Explanation: Lesson 44: Reading and Editing PDFs PDF files are binary files, which are more complex than text files, since they contain formatting information, images, and other assets. PDF is great for printing, but not great for software, which work by typically parsing plain text. The PyPDF2 modu...
littlewine/USelections2016
LDA extract topics.ipynb
mit
from pymongo import MongoClient import json client = MongoClient() db = client.Twitter import pandas as pd import time import re from nltk.tokenize import RegexpTokenizer import HTMLParser # In Python 3.4+ import html import nltk from nltk.corpus import stopwords """ Explanation: In this notebook, we will train an ...
atlury/deep-opencl
DL0110EN/3.2.1.logistic_regression_with_mean_square_error_v2.ipynb
lgpl-3.0
# Import the libraries we need for this lab import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d import torch from torch.utils.data import Dataset, DataLoader import torch.nn as nn """ Explanation: <a href="http://cocl.us/pytorch_link_top"> <img src="https://cocl.us/Pytorch_top" wi...
kriete/cie5703_notebooks
week_7_spatial_students.ipynb
mit
from rpy2.robjects.packages import importr from rpy2.robjects import r import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: This is a python / R implementation for spatial analysis of radar rainfall fields. All courtesy for the R code implementation goes to Marc ...
Vettejeep/Data-Analysis-and-Data-Science-Projects
Principal Components Analysis on the UCI Image Segmentation Data Set.ipynb
gpl-3.0
%matplotlib inline import pandas as pd from sklearn.ensemble import RandomForestClassifier import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn import decomposition from sklearn import metrics """ Explanation: Principal Com...
zzsza/TIL
AutoGIS/02-Geometric-Objects-Spatial-Data-Model.ipynb
mit
from shapely.geometry import Point, LineString, Polygon # Create Point geometric object(s) with coordinates point1 = Point(2.2, 4.2) point2 = Point(7.2, -25.1) point3 = Point(9.26, -2.456) point3D = Point(9.26, -2.456, 0.57) # What is the type of the point? point_type = type(point1) print(point1) print(point3D) prin...
colour-science/colour-ipython
notebooks/colour.ipynb
bsd-3-clause
from IPython.core.display import Image Image(filename="resources/images/Colour_Logo_Medium_001.png") """ Explanation: Colour - Colour Science for Python End of explanation """ %matplotlib inline import colour from colour.plotting import * colour.filter_warnings(True, False) colour_plotting_defaults() visible_sp...
Santara/ML-MOOC-NPTEL
lecture4/ML-Anirban_Tutorial4.ipynb
gpl-3.0
iris = datasets.load_iris() X = iris.data[:,:2] y = iris.target X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42) """ Explanation: 1. Support Vector Classification 1.1 Load the Iris dataset End of explanation """ def evaluate_on_test_data(model=None): predictions = model...
ES-DOC/esdoc-jupyterhub
notebooks/mri/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', 'mri', 'sandbox-3', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: MRI Source ID: SANDBOX-3 Topic: Atmos Sub-Topics: Dynamical Core, Radiation, Turbulen...
nbelaid/nbelaid.github.io
dev/titanic/titanic.ipynb
mit
# Import numerical and data processing libraries import numpy as np import pandas as pd # Import helpers that make it easy to do cross-validation from sklearn.model_selection import KFold from sklearn.model_selection import cross_val_score # Import machine learning models from sklearn.linear_model import LinearRegres...
mne-tools/mne-tools.github.io
0.21/_downloads/7cf7296709bf473b6e7fed6bc98287be/plot_ems_filtering.ipynb
bsd-3-clause
# Author: Denis Engemann <denis.engemann@gmail.com> # Jean-Remi King <jeanremi.king@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne import io, EvokedArray from mne.datasets import sample from mne.decoding import EMS, compute_ems from sklearn.model_...