repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
leon-adams/datascience | notebooks/linear-classifier-regularization.ipynb | mpl-2.0 | # Run some setup code for this notebook.
from __future__ import division
import sys
import os
sys.path.append('..')
import graphlab
import numpy as np
"""
Explanation: Logistic Regression with L2 regularization
The goal of this second notebook is to implement your own logistic regression classifier with L2 regularizat... |
ES-DOC/esdoc-jupyterhub | notebooks/cccr-iitm/cmip6/models/sandbox-2/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-2', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, En... |
RaRe-Technologies/gensim | docs/notebooks/doc2vec-wikipedia.ipynb | lgpl-2.1 | import logging
import multiprocessing
from pprint import pprint
import smart_open
from gensim.corpora.wikicorpus import WikiCorpus, tokenize
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
"""
Explanation: Training ... |
aryarohit07/machine-learning-with-python | logistic_regression/logistic_regression_gradient_descent.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('ex2data1.txt', header=None)
df.columns = ["score1", "score2", "res"]
pos = df[(df.res == 1)]
neg = df[(df.res == 0)]
plt.scatter(pos['score1'], pos['score2'], label='admitted')
plt.scatter(neg['score1'], neg['score2'], label='not... |
NathanYee/ThinkBayes2 | code/report02.ipynb | gpl-2.0 | import numpy as np
import thinkbayes2
from thinkbayes2 import Pmf, Cdf, Suite, Beta, MakeMixture
import thinkplot
% matplotlib inline
"""
Explanation: Report02 - Nathan Yee
This notebook contains report02 for computational baysian statistics fall 2016
MIT License: https://opensource.org/licenses/MIT
End of explanati... |
ES-DOC/esdoc-jupyterhub | notebooks/nasa-giss/cmip6/models/sandbox-2/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nasa-giss', 'sandbox-2', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: NASA-GISS
Source ID: SANDBOX-2
Topic: Landice
Sub-Topics: Glaciers, Ice.
P... |
rishuatgithub/MLPy | nlp/UPDATED_NLP_COURSE/02-Parts-of-Speech-Tagging/02-NER-Named-Entity-Recognition.ipynb | apache-2.0 | # Perform standard imports
import spacy
nlp = spacy.load('en_core_web_sm')
# Write a function to display basic entity info:
def show_ents(doc):
if doc.ents:
for ent in doc.ents:
print(ent.text+' - '+ent.label_+' - '+str(spacy.explain(ent.label_)))
else:
print('No named entities foun... |
dodonator/pythonfooLite | Level_02/Level_2.ipynb | gpl-3.0 | eingabe = input("Bitte etwas eingeben: ")
zahl = int(eingabe)
print(zahl)
"""
Explanation: Level 2
Einstieg
In diesem Level werden wir lernen, wie die Ausführung von bestimmten Code an Bedingungen knüpfen. Dafür werden wir erst den Typ des boolean und im Anschluss unsere ersten Kontrollstrukturen, die if-Bedingung und... |
aadimator/data_analyst_nanodegree | P0: Analyze Chopstick Length/Data_Analyst_ND_Project0.ipynb | mit | import pandas as pd
# pandas is a software library for data manipulation and analysis
# We commonly use shorter nicknames for certain packages. Pandas is often abbreviated to pd.
# hit shift + enter to run this cell or block of code
path = r'chopstick-effectiveness.csv'
# Change the path to the location where the cho... |
google/applied-machine-learning-intensive | content/04_classification/06_images_and_video/01-open_cv.ipynb | apache-2.0 | # 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 the L... |
subutai/htmresearch | projects/kdimgrid/jupyter notebooks/Capacity Figures - Figure 5.ipynb | agpl-3.0 | """
Load the ND data,
which we want to analyze
"""
path = "../data/ND_data_filtered"
W = gather_data(path, "width")
W = W[0,:,:,:]
log_mean = np.mean(np.log(W), axis=2)
log_std = np.std(np.log(W), axis=2)
"""
Load the 1D data,
for predictions
"""
path = "../data/1D_data_for_predicti... |
jamesfolberth/NGC_STEM_camp_AWS | notebooks/machineLearning_notebooks/01_Naive_Bayes/MontyHall_NaiveBayes.ipynb | bsd-3-clause | # To begin, define the prior as the probability of the car being behind door i (i=1,2,3), call this "pi".
# Note that pi is uniformly distributed.
p1 = ?
p2 = ?
p3 = ?
# Next, to define the class conditional, we need three pieces of information. Supposing Monty reveals door 3,
# we must find:
# probability that Mo... |
AaronRanAn/Pyton-for-Data-Analytics | CH5-Getting Started With Pandas/CH5 - Getting Started With Pandas.ipynb | apache-2.0 | from pandas import Series, DataFrame
import pandas as pd
"""
Explanation: CH5 Getting Started With Pandas
End of explanation
"""
obj = Series([4,7,-5,3])
obj
obj.values
obj.index
obj2 = Series([4,6,8,9], index = ['a','d','t','y'])
obj2
obj2.index
obj2['y']
obj2['y']=3
obj2['y']
obj2[obj2 >= 6] # note that n... |
guruucsd/EigenfaceDemo | python/Perceptron Demo.ipynb | mit | from sklearn.datasets import make_blobs
X = y = None # Global variables
@interact
def plot_blobs(n_samples=(10, 500),
center1_x=1.5,
center1_y=1.5,
center2_x=-1.5,
center2_y=-1.5):
centers=array([[center1_x, center1_y],[center2_x, center2_y]])
global ... |
pligor/predicting-future-product-prices | 04_time_series_prediction/17_price_history_seq2seq-overfitting.ipynb | agpl-3.0 | from __future__ import division
import tensorflow as tf
from os import path, remove
import numpy as np
import pandas as pd
import csv
from sklearn.model_selection import StratifiedShuffleSplit
from time import time
from matplotlib import pyplot as plt
import seaborn as sns
from mylibs.jupyter_notebook_helper import sho... |
isendel/machine-learning | ml-classification/week-2/Untitled.ipynb | apache-2.0 | len(products[products['contains_perfect']==1])
def get_numpy_data(dataframe, features, label):
dataframe['constant'] = 1
features = ['constant'] + features
features_frame = dataframe[features]
features_matrix = features_frame.as_matrix()
label_sarray = dataframe[label]
label_array = label_sarra... |
mtasende/Machine-Learning-Nanodegree-Capstone | notebooks/dev/n17_training_a_volume_estimator.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... |
omoju/udacityUd120Lessons | Deep Dive into Enron Dataset.ipynb | gpl-3.0 | %pylab inline
import sys
from time import time
sys.path.append("../tools/")
sys.path.append("../naive bayes/")
sys.path.append("../datasets_questions/")
sys.path.append("../final_project/")
import explore_enron_data as eD
from feature_format import featureFormat, targetFeatureSplit
"""
Explanation: Lesson 5 - Deep ... |
statsmodels/statsmodels | examples/notebooks/discrete_choice_example.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import statsmodels.api as sm
from scipy import stats
from statsmodels.formula.api import logit
print(sm.datasets.fair.SOURCE)
print(sm.datasets.fair.NOTE)
dta = sm.datasets.fair.load_pandas().data
dta["affair"] = (dta["affair... |
dvirsamuel/MachineLearningCourses | Visual Recognision - Stanford/assignment2/FullyConnectedNets.ipynb | gpl-3.0 | # As usual, a bit of setup
import time
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from cs231n.classifiers.fc_net import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array
from cs231n... |
dsnair/Ames_Housing_Data | feature_engineering/feature_engineering.ipynb | gpl-3.0 | # drop ID
data.drop(["Id"], axis = 1, inplace=True)
data.head()
"""
Explanation: Explore variables one at a time
End of explanation
"""
data["MSSubClass"].isnull().sum()
sns.countplot(x="MSSubClass", data=data, palette=sns.color_palette("Blues", 1));
"""
Explanation: MSSubClass
End of explanation
"""
MSSubClass... |
dataDogma/Computer-Science | Databases-Content/Intro_to_DB/.ipynb_checkpoints/Stanford - Introduction_to_database - Getting the database ready-checkpoint.ipynb | gpl-3.0 | # importing the sqlalechemy ORM( object realtional mapper )
import sqlalchemy
"""
Explanation: Using SQL in Jupyter via DB ORMs
ORM( Object Relation Mappers) for various databases used in this notebook:
Sqlite
MySQL
Oracle
PostgreSQL
Sqlite
Table of Contents
Version Check
Connecting to Sqlite DB engin... |
jonathf/chaospy | docs/user_guide/advanced_topics/polynomial_chaos_kriging.ipynb | mit | import numpy
import chaospy
distribution = chaospy.Uniform(0, 15)
samples = distribution.sample(10, rule="sobol")
evaluations = samples*numpy.sin(samples)
evaluations.round(4)
"""
Explanation: Polynomial chaos Kriging
We start by defining a problem. Here we borrow the formulation from uqlab.
End of explanation
"""
... |
azhurb/deep-learning | intro-to-tflearn/TFLearn_Digit_Recognition.ipynb | mit | # Import Numpy, TensorFlow, TFLearn, and MNIST data
import numpy as np
import tensorflow as tf
import tflearn
import tflearn.datasets.mnist as mnist
"""
Explanation: Handwritten Number Recognition with TFLearn and MNIST
In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9.
This... |
cmorgan/toyplot | docs/convenience-api.ipynb | bsd-3-clause | import numpy
y = numpy.linspace(0, 1, 20) ** 2
import toyplot
canvas = toyplot.Canvas(width=300)
axes = canvas.axes()
axes.plot(y);
"""
Explanation: .. _convenience-api:
Convenience API
With Toyplot, a figure always consists of three parts:
A :py:class:canvas <toyplot.canvas.Canvas>
One or more sets of :py:mod... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/sandbox-2/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'sandbox-2', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: NERC
Source ID: SANDBOX-2
Topic: Ocean
Sub-Topics: Timestepping Framework, Advection... |
edwardd1/phys202-2015-work | assignments/assignment05/InteractEx04.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 4
Imports
End of explanation
"""
def random_line(m, b, sigma, size=10):
"""Create a line y = m*x + b + N(0,si... |
McSinyx/hsg | usth/ICT2.9/practical/dsp.ipynb | gpl-3.0 | input_1kHz_15kHz = [
+0.0000000000, +0.5924659585, -0.0947343455, +0.1913417162, +1.0000000000,
+0.4174197128, +0.3535533906, +1.2552931065, +0.8660254038, +0.4619397663,
+1.3194792169, +1.1827865776, +0.5000000000, +1.1827865776, +1.3194792169,
+0.4619397663, +0.8660254038, +1.2552931065, +0.3535533906... |
amcdawes/QMlabs | Lab 4 - Measurements Solutions.ipynb | mit | import matplotlib.pyplot as plt
from numpy import sqrt,pi,cos,sin,arange,random,exp
from qutip import *
H = Qobj([[1],[0]])
V = Qobj([[0],[1]])
P45 = Qobj([[1/sqrt(2)],[1/sqrt(2)]])
M45 = Qobj([[1/sqrt(2)],[-1/sqrt(2)]])
R = Qobj([[1/sqrt(2)],[-1j/sqrt(2)]])
L = Qobj([[1/sqrt(2)],[1j/sqrt(2)]])
def sim_transform(o_ba... |
Kaggle/learntools | notebooks/ml_intermediate/raw/ex3.ipynb | apache-2.0 | # Set up code checking
import os
if not os.path.exists("../input/train.csv"):
os.symlink("../input/home-data-for-ml-course/train.csv", "../input/train.csv")
os.symlink("../input/home-data-for-ml-course/test.csv", "../input/test.csv")
from learntools.core import binder
binder.bind(globals())
from learntools.m... |
mne-tools/mne-tools.github.io | 0.22/_downloads/7b0095430c62d9ef92be2dd3af2614f6/plot_30_annotate_raw.ipynb | bsd-3-clause | import os
from datetime import timedelta
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False)
raw.crop(tmax=60)... |
zerothi/ts-tbt-sisl-tutorial | S_02/run.ipynb | gpl-3.0 | graphene = sisl.geom.graphene(1.44)
graphene.write('STRUCT.fdf')
graphene.write('STRUCT.xyz')
"""
Explanation: Analyzing output from Siesta makes analysis much easier since many things are intrinsically enabled through sisl, i.e. orbital numbering etc. may easily be handled with sisl.
In this example we will use Siest... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session07/Day3/Building-A-Supervised-Machine-Learning-Model.ipynb | mit | import numpy as np
from sklearn.preprocessing import Imputer
from sklearn.preprocessing import MinMaxScaler, StandardScaler
%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
"""
Explanation: Building a Supervised Machine Learning Model
The objective of this hands-on activity ... |
adamwlev/adamwlev.github.io | notebooks/2016CongresTweets.ipynb | mit | import pandas as pd
import numpy as np
import json
import codecs
import warnings
import matplotlib.pyplot as plt
%matplotlib inline
race_metadata = pd.read_csv('~/election-twitter/elections-twitter/data/race-metadata.csv')
race_metadata_2016 = pd.read_csv('~/election-twitter/elections-twitter/data/race-metadata-2016.c... |
dalonlobo/GL-Mini-Projects | TweetAnalysis/Tweepy streamer.ipynb | mit | import logging # python logging module
# basic format for logging
logFormat = "%(asctime)s - [%(levelname)s] (%(funcName)s:%(lineno)d) %(message)s"
# logs will be stored in tweepy.log
logging.basicConfig(filename='tweepy.log', level=logging.INFO,
format=logFormat, datefmt="%Y-%m-%d %H:%M:%S")
""... |
zerothi/ts-tbt-sisl-tutorial | TS_05/run.ipynb | gpl-3.0 | graphene = sisl.geom.graphene(1.44)
elec = graphene.tile(2, axis=0)
elec.write('ELEC_GRAPHENE.fdf')
elec.write('ELEC_GRAPHENE.xyz')
C1d = sisl.Geometry([[0,0,0]], graphene.atom[0], [10, 10, 1.4])
elec_chain = C1d.tile(4, axis=2)
elec_chain.write('ELEC_CHAIN.fdf')
elec_chain.write('ELEC_CHAIN.xyz')
chain = elec_chain.t... |
bpgc-cte/python2017 | Week 4/Lecture_8_Classes_and_Objects .ipynb | mit | LIMIT = 800000
class BITSian(object):
def __init__(self, name, id_no, parent_income):
self.name = name
self.id_no = id_no
self.parent_income = parent_income
def get_mcn(self, limit, falsify_tax_document=False):
if falsify_tax_document:
return True
el... |
sbu-python-summer/python-tutorial | day-5/scipy-basics.ipynb | bsd-3-clause | from scipy import integrate
help(integrate)
"""
Explanation: SciPy
SciPy is a collection of numerical algorithms with python interfaces. In many cases, these interfaces are wrappers around standard numerical libraries that have been developed in the community and are used with other languages. Usually detailed refer... |
mne-tools/mne-tools.github.io | 0.23/_downloads/9552276573be20bde95d1b4bc52b4768/20_event_arrays.ipynb | bsd-3-clause | import os
import numpy as np
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False)
raw.crop(tmax=60).load_data()... |
dato-code/tutorials | notebooks/customer-churn-prediction.ipynb | apache-2.0 | # Let's import Graphlab Create and a few other libraries
import graphlab as gl
import graphlab.aggregate
import datetime
import time
"""
Explanation: Customer Churn Prediction
In this webinar, we will loads data from the UCI Online Retail data (http://archive.ics.uci.edu/ml/datasets/Online+Retail) and predicts which c... |
statkraft/shyft-doc | notebooks/api/single_cell.ipynb | lgpl-3.0 | # Pure python modules and jupyter notebook functionality
# first you should import the third-party python modules which you'll use later on
# the first line enables that figures are shown inline, directly in the notebook
%pylab inline
import os
import sys
import numpy as np
from matplotlib import pyplot as plt
"""
Exp... |
starbro/BeastMode | IMDB_reviews.ipynb | apache-2.0 | %matplotlib inline
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import pandas as pd
import time
pd.set_option('display.width', 500)
pd.set_option('display.max_columns', 100)
pd.set_option('display.notebook_repr_html', True)
import seaborn as s... |
jakevdp/PracticalLombScargle | figures/Kepler.ipynb | bsd-3-clause | # !curl -O https://archive.stsci.edu/pub/kepler/lightcurves/0071/007198959/kplr007198959-2009259160929_llc.fits
from astropy.io import fits
hdulist = fits.open('kplr007198959-2009259160929_llc.fits')
hdulist.info()
hdulist[1].header
from astropy.table import Table
data = Table(hdulist[1].data)
data
df = data.to_pan... |
the-deep-learners/TensorFlow-LiveLessons | notebooks/live_training/tensor-fied_intro_to_tensorflow_LT.ipynb | mit | import numpy as np
np.random.seed(42)
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import tensorflow as tf
tf.set_random_seed(42)
xs = [0., 1., 2., 3., 4., 5., 6., 7.]
ys = [-.82, -.94, -.12, .26, .39, .64, 1.02, 1.]
fig, ax = plt.subplots()
_ = ax.scatter(xs, ys)
m = tf.Variable(-0.5)
b ... |
mne-tools/mne-tools.github.io | 0.22/_downloads/bb8e52a46ac1372ec146fb9c9983f326/plot_15_handling_bad_channels.ipynb | bsd-3-clause | import os
from copy import deepcopy
import numpy as np
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False)
""... |
phoebe-project/phoebe2-docs | 2.1/tutorials/t0s.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.1,<2.2"
"""
Explanation: Various t0s
Setup
Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""
%matplotlib inline
import p... |
amueller/pydata-amsterdam-2016 | Grid Searches for Hyper Parameters.ipynb | cc0-1.0 | from sklearn.grid_search import GridSearchCV
from sklearn.svm import SVC
from sklearn.datasets import load_digits
from sklearn.cross_validation import train_test_split
digits = load_digits()
X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target)
"""
Explanation: Grid Searches
Grid-Search with... |
kiwiPhrases/EITChousing | EITC Housing Aid Cost Estimation.ipynb | mit | ##Load modules and set data path:
import pandas as pd
import numpy as np
import numpy.ma as ma
import re
data_path = "C:/Users/SpiffyApple/Documents/USC/RaphaelBostic"
#################################################################
################### load tax data ###############################
#upload tax data
tx... |
open-forcefield-group/openforcefield | examples/forcefield_modification/ManipulateParameters.ipynb | mit | from openff.toolkit.topology import Molecule, Topology
from openff.toolkit.typing.engines.smirnoff.forcefield import ForceField
from openff.toolkit.utils import get_data_file_path
from simtk import openmm, unit
import numpy as np
"""
Explanation: Loading and modifying a SMIRNOFF-format force field
This notebook illust... |
hanezu/cs231n-assignment | assignment2/Dropout.ipynb | mit | # As usual, a bit of setup
import time
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.fc_net import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array
from cs231n.solver import Solver
%matplotlib inline
... |
mdiaz236/DeepLearningFoundations | sentiment-rnn/Sentiment_RNN_Solution.ipynb | mit | import numpy as np
import tensorflow as tf
with open('../sentiment-network/reviews.txt', 'r') as f:
reviews = f.read()
with open('../sentiment-network/labels.txt', 'r') as f:
labels = f.read()
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural... |
sampathweb/movie-sentiment-analysis | 01-load-vectorize-count.ipynb | mit | from __future__ import print_function # Python 2/3 compatibility
import numpy as np
import pandas as pd
from collections import Counter
from IPython.display import Image
"""
Explanation: Objective
Load Data, vectorize reviews to numbers
Build a basic model based on counting
Evaluate the Model
Make a first Kaggle Su... |
ucsd-ccbb/jupyter-genomics | notebooks/awsCluster/NGSPipelineUsingCFNClusterOnAWS.ipynb | mit | import os
import sys
sys.path.append(os.getcwd().replace("notebooks/awsCluster", "src/awsCluster"))
from util import DesignFileLoader
## S3 input and output address.
s3_input_files_address = "s3://path/to/s3_input_files_address"
s3_output_files_address = "s3://path/to/s3_output_files_address"
## CFNCluster name
your... |
appleby/fastai-courses | deeplearning1/nbs/lesson6-ma.ipynb | apache-2.0 | path = get_file('nietzsche.txt', origin="https://s3.amazonaws.com/text-datasets/nietzsche.txt")
text = open(path).read()
print('corpus length:', len(text))
chars = sorted(list(set(text)))
vocab_size = len(chars)+1
print('total chars:', vocab_size)
"""
Explanation: Setup
We're going to download the collected works of ... |
gdsfactory/gdsfactory | docs/notebooks/02_movement.ipynb | mit | import gdsfactory as gf
# Start with a blank Component
c = gf.Component("demo_movement")
# Create some more shape Devices
T = gf.components.text("hello", size=10, layer=(1, 0))
E = gf.components.ellipse(radii=(10, 5), layer=(2, 0))
R = gf.components.rectangle(size=(10, 3), layer=(3, 0))
# Add the shapes to D as refe... |
vishaalprasad/AnimeRecommendation | notebooks/models/linear_model.ipynb | mit | import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
matplotlib.style.use('seaborn')
from animerec.data import get_data
users, anime = get_data()
from sklearn.model_selection import train_test_split
train, test = train_test_split(users, test_size = 0.1) #let's split up the dataset into a train and tes... |
ES-DOC/esdoc-jupyterhub | notebooks/mri/cmip6/models/sandbox-2/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mri', 'sandbox-2', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: MRI
Source ID: SANDBOX-2
Topic: Landice
Sub-Topics: Glaciers, Ice.
Properties: 3... |
arnaldog12/Manual-Pratico-Deep-Learning | Adaline.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from random import random
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import MinMaxScaler
from sklearn.datasets.samples_generator import make_blobs
%matplotlib inline
"""
Explanation: No notebook anterior, nós apre... |
jpn--/larch | book/example/legacy/302_itin_nl.ipynb | gpl-3.0 | import pandas as pd
import larch
larch.__version__
"""
Explanation: 302: Itinerary Choice using Simple Nested Logit
End of explanation
"""
from larch.data_warehouse import example_file
itin = pd.read_csv(example_file("arc"), index_col=['id_case','id_alt'])
d = larch.DataFrames(itin, ch='choice', crack=True, autoscal... |
rdempsey/web-scraping-data-mining-course | week8/1_data_analysis/1 - Statistical Analysis.ipynb | mit | # Import the Python libraries we need
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
# Define a variable for the accidents data file
accidents_data_file = '/Users/robert.dempsey/Dropbox/Private/Art of Skill Hacking/Books/' \
'Python Bu... |
okartal/popgen-systemsX | exercises.ipynb | cc0-1.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Population Genetics
Önder Kartal, University of Zurich
This is a collection of elementary exercises that introduces you to the most fundamental concepts of population genetics. We use Python to explore these topics and solve proble... |
quoniammm/mine-tensorflow-examples | fastAI/deeplearning1/nbs/lesson5.ipynb | mit | from keras.datasets import imdb
idx = imdb.get_word_index()
"""
Explanation: Setup data
We're going to look at the IMDB dataset, which contains movie reviews from IMDB, along with their sentiment. Keras comes with some helpers for this dataset.
End of explanation
"""
idx_arr = sorted(idx, key=idx.get)
idx_arr[:10]
... |
GoogleCloudPlatform/tf-estimator-tutorials | 08_Text_Analysis/06 - Part_1 - Text Classification - Hacker News - Data Preprocessing with TFT.ipynb | apache-2.0 | import os
class Params:
pass
# Set to run on GCP
Params.GCP_PROJECT_ID = 'ksalama-gcp-playground'
Params.REGION = 'europe-west1'
Params.BUCKET = 'ksalama-gcs-cloudml'
Params.PLATFORM = 'local' # local | GCP
Params.DATA_DIR = 'data/news' if Params.PLATFORM == 'local' else 'gs://{}/data/news'.format(Params.BUCKE... |
tensorflow/docs-l10n | site/en-snapshot/lite/examples/style_transfer/overview.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... |
gsorianob/fiuba-python | .ipynb_checkpoints/Clase 02 - Tipos de datos computestos y ciclos-checkpoint.ipynb | apache-2.0 | lista_de_numeros = [1, 6, 3, 9, 5, 2]
print lista_de_numeros
print type(lista_de_numeros)
"""
Explanation: 20/10
Tipos de datos compuestos. Estructuras de control repetitivas.
Índices y slices
Diccionarios como acumuladores/contadores
Listas
End of explanation
"""
print 'El %s esta en %s?: %s' % (5, lista_de_numer... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/reinforcement_learning/labs/contextual_bandits_with_tf_agents.ipynb | apache-2.0 | pip freeze | grep tf_agents || pip install -q tf_agents==0.11.0
"""
Explanation: Contextual Bandits with TF-agents
Learning Objectives
Learn to load a dataset in BigQuery and connect to it using TensorFlow IO
Learn how to transform a classification dataset into a contextual bandit problem
Learn how to stream a BigQue... |
birdsarah/bokeh-miscellany | old/tooltips cut off.ipynb | gpl-2.0 | Image(url="https://raw.githubusercontent.com/birdsarah/bokeh-miscellany/master/cut-off-tooltip.png", width=400, height=400)
"""
Explanation: In an jupyter notebook if your bokeh tooltips extend beyond the extent of your plot, the css from the jupyter notebook can interfere with the display leaving something like this ... |
igotcharts/charts_and_more_charts | notebooks/Lots of Sequels.ipynb | mit | from imdbpie import Imdb
imdb = Imdb()
imdb = Imdb(anonymize=True)
def title_search(title):
return pd.DataFrame(imdb.search_for_title(title),index=[x for x in range(len(pd.DataFrame(imdb.search_for_title(title))))])
titles_to_search=['Fast and Furious','Police Academy',
'Nightmare on Elm Street... |
AdityaSoni19031997/Machine-Learning | Coursera_DL/Building+your+Deep+Neural+Network+-+Step+by+Step+v5.ipynb | mit | import numpy as np
import h5py
import matplotlib.pyplot as plt
from testCases_v3 import *
from dnn_utils_v2 import sigmoid, sigmoid_backward, relu, relu_backward
%matplotlib inline
plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['imag... |
steinam/teacher | jup_notebooks/data-science-ipython-notebooks-master/matplotlib/04.07-Customizing-Colorbars.ipynb | mit | import matplotlib.pyplot as plt
plt.style.use('classic')
%matplotlib inline
import numpy as np
"""
Explanation: <!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png">
This notebook contains an excerpt from the Python Data Science Handbook by Jake VanderPlas; the cont... |
tensorflow/docs-l10n | site/ja/addons/tutorials/time_stopping.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... |
dvirsamuel/MachineLearningCourses | EllipsesProject/MyEllipsesNotebook.ipynb | gpl-3.0 | import numpy as np
from numpy import genfromtxt
from PIL import Image
import pandas as pd
from collections import Counter
import keras
from keras.layers.normalization import BatchNormalization
from keras.models import Model
from keras.layers import Input, Dense, Dropout, Activation, Flatten, Concatenate, Add
from keras... |
DillonNovak/Programming-for-Chemical-Engineering-Applications | Python%2BTutorial-Template.ipynb | gpl-3.0 | #A variable stores a piece of data and gives it a name
#syntax of the form:
#variable_name = variable_value
#What are some types of variables you will need to use?
answer = 42
print(answer)
is_it_tuesday = True
is_it_wednesday = False
print(is_it_tuesday)
pi_approx = 3.1415
print(pi_approx)
my_name = "Dillon"
print... |
Jackporter415/phys202-2015-work | assignments/assignment10/ODEsEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
"""
Explanation: Ordinary Differential Equations Exercise 1
Imports
End of explanation
"""
def solve_euler(derivs, y0, x):
"""Solve a 1d ... |
AaronCWong/phys202-2015-work | assignments/assignment08/InterpolationEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.interpolate import interp1d
"""
Explanation: Interpolation Exercise 1
End of explanation
"""
with np.load('trajectory.npz') as data:
t = data['t']
x = data['x']
y = data['y']
assert isinstance(x, np.n... |
fggp/ctcsound | cookbook/01-the-ctcsound-module.ipynb | lgpl-2.1 | import ctcsound
"""
Explanation: The ctcsound Module
The Csound API is a set of C functions and C++ classes that expose to hosts programs the functionalities of Csound.
ctcsound is a python module wrapping the access to the Csound API using two Python classes: Csound and CsoundPerformanceThread. ctcsound uses the ctyp... |
bspalding/research_public | presentations/LECTURE_Stanford_Quantopian_Tutorial_and_Markowitz_Optimization.ipynb | apache-2.0 | 2 + 2
# This is a comment, it won't be evaluated
x = 1
x = x + 1
x
"""
Explanation: An Introductory Tutorial to IPython Notebooks
By Delaney Granizo-Mackenzie & Justin Lent
Adapted from a notebook by Dr. Thomas Wiecki
Notebook released under the Creative Commons Attribution 4.0 License.
IPython notebooks are a power... |
suvarchal/JyIDV | examples/CreateFunctionFormulas.ipynb | mit | def moistStaticEnergy(T,Q,GZ):
""" Calculates Moist Static Energy with Temperature, Specific Humidity and Geopotential Height. """
from ucar.visad.quantities import SpecificHeatCapacityOfDryAirAtConstantPressure,LatentHeatOfEvaporation
cp=SpecificHeatCapacityOfDryAirAtConstantPressure.newReal()
L=Latent... |
mattwaite/RockPaperScissorsWithPython | RockPaperScissors.ipynb | mit | import random
choices = ["Rock", "Paper", "Scissors"]
def choice():
selection = random.choice(choices)
return selection
def winner(player1, player2):
if player1 == "Rock" and player2 == "Rock":
result = "Tie"
elif player1 == "Rock" and player2 == "Paper":
result = "Player 2 wins"
... |
marwin-ko/projects | gyant-technical_challenge/zika_classification_model.ipynb | mit | # Algorithms
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
# Metrics
from sklearn.metrics import confusion_matrix, roc_curve, auc, accuracy_score
from sklearn.metrics import classification_... |
tom-heimbrodt/oeplatform | api/tutorials/OEP_API_tutorial_part1.ipynb | agpl-3.0 | __copyright__ = "Reiner Lemoine Institut, Zentrum für nachhaltige Energiesysteme Flensburg"
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
__url__ = "https://github.com/openego/data_processing/blob/master/LICENSE"
__author__ = "wolfbunke, Ludee"
"""
Explanation: <img src="http://193.... |
jubins/ML-TwitterBotDetection | FinalProjectAndCode/IPython NoteBooks/.ipynb_checkpoints/BotDetection-checkpoint.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams['patch.force_edgecolor'] = True
import seaborn as sns
import warnings
warnings.filterwarnings("ignore")
%matplotlib inline
filepath = 'https://raw.githubusercontent.com/jubins/ML-TwitterBotDetection/master/Fina... |
zzsza/Datascience_School | 03. 파이썬 프로그래밍/06. 파이썬 객체지향 프로그래밍 기초 2.ipynb | mit | class Character(object):
def __init__(self):
self.life = 1000
def attacked(self):
self.life -= 10
print(u"공격받음! 생명력 =", self.life)
"""
Explanation: 파이썬 객체지향 프로그래밍 기초 2
이번에는 컴퓨터 게임의 캐릭터를 만드는 예제를 통해 상속(Inheritance)의 개념을 공부한다.
게임 캐릭터와 객체
컴퓨터 게임에 사용되는 플레이어의 캐릭터는 객체 지향 프로그램을 통해... |
MartyWeissman/Python-for-number-theory | P3wNT Notebook 7.ipynb | gpl-3.0 | def GCD(a,b):
while b: # Recall that != means "not equal to".
a, b = b, a % b
return abs(a)
def totient(m):
tot = 0 # The running total.
j = 0
while j < m: # We go up to m, because the totient of 1 is 1 by convention.
j = j + 1 # Last step of while loop: j = m-1, and then j = j... |
sdpython/ensae_teaching_cs | _doc/notebooks/exams/td_note_2020_2.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 1A.e - Enoncé 22 octobre 2019 (2)
Correction du second énoncé de l'examen du 22 octobre 2019. L'énoncé propose une façon de disposer des tables carrées dans une salle carrée.
End of explanation
"""
def distance_table(x1, y1, x2, y2):
... |
emjotde/UMZ | Wyklady/08/Konkursy2.ipynb | cc0-1.0 | def runningMeanFast(x, N):
return np.convolve(x, np.ones((N,))/N, mode='valid')
def powerme(x1,x2,n):
X = []
for m in range(n+1):
for i in range(m+1):
X.append(np.multiply(np.power(x1,i),np.power(x2,(m-i))))
return np.hstack(X)
def safeSigmoid(x, eps=0):
y = 1.0/(1.0 + np.exp(-... |
phoebe-project/phoebe2-docs | development/examples/single_spots.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Single Star with Spots
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # units
import numpy as np... |
RoebideBruijn/datascience-intensive-course | exercises/data_wrangling_json/sliderule_dsi_json_exercise.ipynb | mit | import pandas as pd
import numpy as np
"""
Explanation: JSON examples and exercise
get familiar with packages for dealing with JSON
study examples with JSON strings and files
work on exercise to be completed and submitted
reference: http://pandas.pydata.org/pandas-docs/stable/io.html#io-json-reader
data source:... |
kbennion/foundations-hw | 09/09 - Functions.ipynb | mit | len
"""
Explanation: Class 9: Functions
A painful analogy
What do you do when you wake up in the morning?
I don't know about you, but I get ready.
"Obviously," you say, a little too snidely for my liking. You're particular, very detail-oriented, and need more information out of me.
Fine, then. Since you're going to be... |
dnc1994/MachineLearning-UW | ml-clustering-and-retrieval/1_nearest-neighbors-lsh-implementation.ipynb | mit | import numpy as np
import graphlab
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import norm
from sklearn.metrics.pairwise import pairwise_distances
import time
from copy import copy
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Locality Sensitive Hashing
Locality Sensitive Hashing... |
mari-linhares/tensorflow-workshop | code_samples/RNN/colorbot/colorbot_solutions.ipynb | apache-2.0 | # small important detail, to train properly with the experiment you need to
# repeat the dataset the number of epochs desired
train_input_fn = get_input_fn(TRAIN_INPUT, BATCH_SIZE, num_epochs=40)
# create experiment
def generate_experiment_fn(run_config, hparams):
estimator = tf.estimator.Estimator(model_fn=model_... |
ES-DOC/esdoc-jupyterhub | notebooks/ncc/cmip6/models/noresm2-hh/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-hh', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: NCC
Source ID: NORESM2-HH
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radi... |
aleph314/K2 | Foundations/Data Collection and Analysis/SQL Exercises.ipynb | gpl-3.0 | import sqlite3
sqlite_db = './myDB.db'
"""
Explanation: SQL Introduction
Using the Titanic dataset, perform the following exercises.
1 - Import the data into SQLite, removing the index column.
.mode csv
.import Titanic.csv titanic
SQL
CREATE TABLE temp AS SELECT Name, PClass, Age, Sex, Survived, SexCode FROM titanic;... |
empirical-org/WikipediaSentences | notebooks/Participle Phrase Fragment Detection 2.ipynb | agpl-3.0 | import pandas as pd
import numpy as np
import tensorflow as tf
import tflearn
from tflearn.data_utils import to_categorical
import spacy
nlp = spacy.load('en_core_web_lg')
import re
from nltk.util import ngrams, trigrams
import csv
"""
Explanation: TFLearn [Participle Phrase] Fragment Detection 2 -- includes past part... |
undercertainty/ou_nlp | 14_recurrent_neural_networks.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
def reset_graph(seed=42):
tf.reset_default_graph()
tf.set_random_seed(seed)
np.random.seed(seed)
# To... |
robblack007/clase-cinematica-robot | Practicas/practica5/Problemas.ipynb | mit | def ci_pendulo_doble(x, y):
# tome en cuenta que las longitudes de los eslabones son 2 y 2
l1, l2 = 2, 2
from numpy import arccos, arctan2, sqrt
# YOUR CODE HERE
raise NotImplementedError()
return q1, q2
from numpy.testing import assert_allclose
assert_allclose(ci_pendulo_doble(4, 0), (0,0))
as... |
msmexplorer/msmexplorer | notebooks/Fs-Peptide-Example.ipynb | mit | %matplotlib inline
from msmbuilder.example_datasets import FsPeptide
from msmbuilder.featurizer import DihedralFeaturizer
from msmbuilder.decomposition import tICA
from msmbuilder.preprocessing import RobustScaler
from msmbuilder.cluster import MiniBatchKMeans
from msmbuilder.msm import MarkovStateModel
import numpy ... |
linamnt/studyGroup | lessons/python/python-for-kids/Python-lesson.ipynb | apache-2.0 | # First, let the player choose Rock, Paper or Scissors by typing the letter ‘r’, ‘p’ or ‘s’
# first create a prompt and explain
input('what is your name?')
# for python to do anything with the result we need to save it in a variable which we can name anything but this is informative
player = input('rock (r), pap... |
shugert/DeepLearning | Pixel Regression - Step by Step.ipynb | mit | import matplotlib.image as mpimg
import matplotlib.pylab as plt
import numpy as np
%matplotlib inline
im = mpimg.imread("data/monalisa.jpg")
plt.imshow(im)
plt.show()
im.shape
"""
Explanation: Author: <a href="http://www.shugert.com.mx">Samuel Noriega</a> | See full post at <a href="https://3blades.io/blog">3blades<... |
amccaugh/phidl | docs/tutorials/layers.ipynb | mit | import phidl.geometry as pg
from phidl import Device, Layer, LayerSet
from phidl import quickplot as qp
D = Device()
# Specify layer with a single integer 0-255 (gds datatype will be set to 0)
layer1 = 1
# Specify layer as 1, equivalent to layer = 2, datatype = 6
layer2 = (2,6)
# Specify layer as 2, equivalent to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.