repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
cyang019/blight_fight | src/Building_List_and_Label.ipynb | mit | data_events = pd.read_csv('../data/events.csv')
data_events.head(10)
data_events.shape
# To get rid of duplicates with same coordinates and possibly different address names
building_pool = data_events.drop_duplicates(subset=['lon','lat'])
building_pool.shape
# 1. sort data according to longitude
# init new_data... |
quantopian/research_public | notebooks/lectures/Instability_of_Estimates/notebook.ipynb | apache-2.0 | # We'll be doing some examples, so let's import the libraries we'll need
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
"""
Explanation: Instability of Parameter Estimates
By Evgenia "Jenny" Nitishinskaya and Delaney Granizo-Mackenzie. Algorithms by David Edwards.
Part of the Quantopian Lecture... |
dtamayo/MachineLearning | Day4/Transit/MachineLearningWorkShop-TESSSimulatedData.ipynb | gpl-3.0 | import sklearn
from sklearn.linear_model import LogisticRegression
from sklearn.cross_validation import train_test_split
from sklearn.utils import shuffle
from sklearn import metrics
from sklearn.metrics import roc_curve
from sklearn.metrics import classification_report
from sklearn.decomposition import PCA
from sklear... |
probml/pyprobml | notebooks/book1/14/lenet_jax.ipynb | mit | import jax
import jax.numpy as jnp # JAX NumPy
import matplotlib.pyplot as plt
import math
from IPython import display
try:
from flax import linen as nn # The Linen API
except ModuleNotFoundError:
%pip install -qq flax
from flax import linen as nn # The Linen API
from flax.training import train_state #... |
knowledgeanyhow/notebooks | hacks/instaquery.ipynb | mit | %matplotlib inline
from IPython.display import display, Image
from IPython.html.widgets import interact_manual
def instaquery(df, renderer=lambda df, by: display(df)):
'''
Creates an interactive query widget with an optional custom renderer.
df: DataFrame to query
renderer: Render function of the... |
mastertrojan/Udacity | gan_mnist/Intro_to_GANs_Exercises.ipynb | mit | %matplotlib inline
import pickle as pkl
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data')
"""
Explanation: Generative Adversarial Network
In this notebook, we'll be building a generativ... |
mastertrojan/Udacity | 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... |
rishuatgithub/MLPy | nlp/UPDATED_NLP_COURSE/05-Topic-Modeling/01-Non-Negative-Matrix-Factorization.ipynb | apache-2.0 | import pandas as pd
npr = pd.read_csv('npr.csv')
npr.head()
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
Non-Negative Matric Factorization
Let's repeat thet opic modeling task from the previous lecture, but this time, we will use NMF instead of LDA.
Data
We will ... |
jseabold/statsmodels | examples/notebooks/ets.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
%matplotlib inline
from statsmodels.tsa.exponential_smoothing.ets import ETSModel
plt.rcParams['figure.figsize'] = (12, 8)
"""
Explanation: ETS models
The ETS models are a family of time series models with an underlying state space model consistin... |
tjhunter/karps | python/notebooks/Demo 1-details.ipynb | apache-2.0 | # The main function
import karps as ks
# The standard library
import karps.functions as f
# Some tools to display the computation process:
from karps.display import show_phase
"""
Explanation: Example 1 - writing UDAFs the simple way
This small example shows how simple it could be to write a UDAF in Spark with moderat... |
saketkc/notebooks | python/coursera-BayesianML/05_Vae_assignment.ipynb | bsd-2-clause | %tensorflow_version 1.x
"""
Explanation: <a href="https://colab.research.google.com/github/saketkc/notebooks/blob/master/coursera-BayesianML/05_Vae_assignment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
First things first
Click File -> Save a ... |
seg/2016-ml-contest | geoLEARN/Submission_3_RF_FE.ipynb | apache-2.0 | ###### Importing all used packages
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import make_axes_locatable
import seaborn as sns
from... |
mjones01/NEON-Data-Skills | code/Python/remote-sensing/lidar/classify_raster_with_threshold_py.ipynb | agpl-3.0 | import numpy as np
import gdal
import matplotlib.pyplot as plt
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
"""
Explanation: Classify a Raster Using Threshold Values in Python
In this tutorial, we will learn how to:
1. Read NEON LiDAR Raster Geotifs (eg. CHM, Slope Aspect) into Python numpy arr... |
d00d/quantNotebooks | Notebooks/quantopian_research_public/notebooks/lectures/Instability_of_Estimates/notebook.ipynb | unlicense | # We'll be doing some examples, so let's import the libraries we'll need
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
"""
Explanation: Instability of Parameter Estimates
By Evgenia "Jenny" Nitishinskaya and Delaney Granizo-Mackenzie. Algorithms by David Edwards.
Part of the Quantopian Lecture... |
lexieheinle/jour407homework | ChartHomework/ChartsHomework.ipynb | mit | import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
sns.set(style="ticks", context='talk', font_scale=1.1)
%matplotlib inline
"""
Explanation: Seaborn provides a easy framework to edit matplotlib charts.
Pandas pulls in the data. sns.set allows a one set default for the program.
End of explanat... |
tolaoniyangi/dmc | notebooks/week-5/02-using your own images.ipynb | apache-2.0 | %matplotlib inline
from matplotlib.pyplot import imshow
import matplotlib.pyplot as plt
import numpy as np
from scipy import misc
import os
import random
import pickle
"""
Explanation: Lab 5.2 - Using your own images
In the next part of the lab we will download another set of images from the web and format them for ... |
bharath31/carnd-p2 | Traffic_Sign_Classifier.ipynb | mit | # Load pickled data
import pickle
# TODO: Fill this in based on where you saved the training and testing data
training_file = 'train.p'
validation_file= 'valid.p'
testing_file = 'test.p'
with open(training_file, mode='rb') as f:
train = pickle.load(f)
with open(validation_file, mode='rb') as f:
valid = pickl... |
SteveDiamond/cvxpy | examples/notebooks/dgp/dgp_fundamentals.ipynb | gpl-3.0 | import cvxpy as cp
"""
Explanation: DGP fundamentals
This notebook will introduce you to the fundamentals of disciplined geometric programming (DGP), which lets you formulate and solve log-log convex programs (LLCPs) in CVXPY.
LLCPs are problems that become convex after the variables, objective functions, and constrai... |
lionell/university-labs | eco_systems/vlad2.ipynb | mit | X = np.array([
[1320, 1170],
[1060, 965]
])
y = np.array([
[1075],
[1185]
])
s = np.array([0.45, 0.2])
"""
Explanation: 14.1
Задані виміри економіки країни
End of explanation
"""
x = (np.sum(X, axis=1).reshape(-1, 1) + y)
print(x)
A = X / x.T
print(A)
M = np.eye(A.shape[0]) - A.T
p = np.linalg.s... |
ewulczyn/ewulczyn.github.io | ipython/ab_testing_and_independence/ab_testing_and_independence.ipynb | mit | class Beta():
def __init__(self, a, b):
self.a = a
self.b = b
def draw(self):
return beta_dist.rvs(self.a, self.b)
"""
Explanation: AB Testing and the Importance of Independent Observations
Statistical tests commonly used for AB testing, like the two-sample z-test, rely on the ... |
DistrictDataLabs/ceb-training | 05 - Visual Diagnostics with Yellowbrick.ipynb | mit | import os
import pandas as pd
names = [
'class',
'cap-shape',
'cap-surface',
'cap-color'
]
mushrooms = os.path.join('data','agaricus-lepiota.txt')
dataset = pd.read_csv(mushrooms)
dataset.columns = names
dataset.head()
features = ['cap-shape', 'cap-surface', 'cap-color']
target = ['class']
X = d... |
bbfamily/abu | abupy_lecture/14-量化相关性分析应用(ABU量化使用文档).ipynb | gpl-3.0 | # 基础库导入
from __future__ import print_function
from __future__ import division
import warnings
warnings.filterwarnings('ignore')
warnings.simplefilter('ignore')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import os
import sys
# 使用insert 0即只使用github,避免交叉使用了pip安装的abupy,导致的... |
Daniel-M/IntroPythonBiologos | ejemplos/BioinformaticaPython.ipynb | gpl-3.0 | secuencia_A="gatcctccatatacaacggtatctccacctcaggtttagatctcaacaacggaaccattg".upper()
secuencia_B="caggtttagatctcaacaacggaaccattggatcctccatatacaacggtatctccacct".upper() # secuencia_A partida en mitades
secuencia_C="ccgacatgagacagttaggtatcgtcgagagttacaagctaaaacgagcagtagtcagct".upper()
secuencia_D="tttactctcacatcctgtagtg... |
opencobra/cobrapy | documentation_builder/phenotype_phase_plane.ipynb | gpl-2.0 | from cobra.io import load_model
from cobra.flux_analysis import production_envelope
model = load_model("textbook")
"""
Explanation: Production envelopes
Production envelopes (aka phenotype phase planes) will show distinct phases of optimal growth with different use of two different substrates. For more information, s... |
JoseGuzman/myIPythonNotebooks | Optimization/Maximum_likelihood_estimation.ipynb | gpl-2.0 | %pylab inline
from scipy.stats import norm
from lmfit import minimize, Parameters
"""
Explanation: <H2>Parameter estimation by maximum likelihood method<H2>
End of explanation
"""
# create some data
mymean = 28.74
mysigma = 8.33 # standard deviation!
rv_norm = norm(loc = mymean, scale = mysigma)
data = rv_norm.rvs(... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/bigquery/solutions/a_sample_explore_clean.ipynb | apache-2.0 | from google.cloud import bigquery
PROJECT = !gcloud config get-value project
PROJECT = PROJECT[0]
%env PROJECT=$PROJECT
"""
Explanation: Sample, Explore, and Clean Taxifare Dataset
Learning Objectives
- Practice querying BigQuery
- Sample from large dataset in a reproducible way
- Practice exploring data using Panda... |
lknelson/DH-Institute-2017 | 04-Discriminating-Words/DTM_and_Discriminating_Words.ipynb | bsd-2-clause | import pandas
#create a dataframe called "df"
df = pandas.read_csv("BDHSI2016_music_reviews.csv", sep = '\t')
##I'm going to do a pre-processing step to remove digits in the text, for analytical purposes.
##If you don't understand this code right now it's ok. But challenge yourself to make sense of it!
df['body'] = d... |
amitkaps/applied-machine-learning | Module-03a-Intuition-Trees.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('fivethirtyeight')
plt.rcParams['figure.figsize'] = (9,6)
df = pd.read_csv("data/creditRisk.csv")
df.head()
"""
Explanation: Intuition - Decision Trees
Decision Trees are a non-parametric supervised learning metho... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/kubeflow_pipelines/pipelines/solutions/kfp_pipeline_vertex_prebuilt.ipynb | apache-2.0 | from datetime import datetime
from google.cloud import aiplatform
REGION = "us-central1"
PROJECT_ID = !(gcloud config get-value project)
PROJECT_ID = PROJECT_ID[0]
# Set `PATH` to include the directory containing KFP CLI
PATH = %env PATH
%env PATH=/home/jupyter/.local/bin:{PATH}
"""
Explanation: Continuous Training... |
cmshobe/landlab | notebooks/teaching/geomorphology_exercises/drainage_density_notebooks/drainage_density_class_notebook.ipynb | mit | # below is to make plots show up in the notebook
%matplotlib inline
# Code Block 1
import numpy as np
from matplotlib import pyplot as plt
from landlab import HexModelGrid, RasterModelGrid, imshow_grid
from landlab.components import (
DepressionFinderAndRouter,
FlowAccumulator,
LinearDiffuser,
Stream... |
italoPontes/Machine-learning | Tarefas/Predicao-de-CRA-com-Regressao/Task 03.ipynb | lgpl-3.0 | #enconding=utf8
import copy
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
from scipy import stats
from scipy.stats import skew
from scipy.stats.stats import pearsonr
%config InlineBackend.figure_format = 'retina' #set 'png' here when working on noteboo... |
ALEXKIRNAS/DataScience | Coursera/Machine-learning-data-analysis/Course 2/Week_05/task_nn.ipynb | mit | # Выполним инициализацию основных используемых модулей
%matplotlib inline
import random
import matplotlib.pyplot as plt
from sklearn.preprocessing import normalize
import numpy as np
"""
Explanation: Нейронные сети: зависимость ошибки и обучающей способности от числа нейронов
В этом задании вы будете настраивать двус... |
BBN-Q/Auspex | doc/examples/Example-Datafiles.ipynb | apache-2.0 | import QGL.config
from QGL import *
# a minimal example of a qubit control chain
cl = ChannelLibrary(":memory:")
q2 = cl.new_qubit("q2")
# specify the particulars for a rack of APS2s
ip_addresses = [f"192.168.1.{i}" for i in [23, 24, 25, 28]]
aps2 = cl.new_APS2_rack("Maxwell", ip_addresses, tdm_ip="192.168.1.11")
aps... |
gronnbeck/udacity-deep-learning | first-neural-network/Your_first_neural_network.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
srnas/barnaba | manuscript_figures/04_figure.ipynb | gpl-3.0 | import pickle
import numpy as np
# calculate eRMSD from native
fname = "ermsd.p"
print "# reading pickle %s" % fname,
ermsd = pickle.load(open(fname, "r"))
print " - ", ermsd.shape
# calculate RMSD from native
fname = "rmsd.p"
print "# reading pickle %s" % fname,
rmsd = pickle.load(open(fname, "r"))
print " - ", rmsd... |
probml/pyprobml | notebooks/book1/15/rnn_jax.ipynb | mit | import jax.numpy as jnp
import matplotlib.pyplot as plt
import math
from IPython import display
import jax
try:
import flax.linen as nn
except ModuleNotFoundError:
%pip install -qq flax
import flax.linen as nn
from flax import jax_utils
try:
import optax
except ModuleNotFoundError:
%pip install -... |
jpilgram/phys202-2015-work | assignments/assignment08/InterpolationEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
sns.set_style('white')
from scipy.interpolate import griddata
"""
Explanation: Interpolation Exercise 2
End of explanation
"""
# YOUR CODE HERE
#raise NotImplementedError()
#I worked with James Amarel
x=np.empty((1,))
x[0]=0... |
QuantStack/quantstack-talks | 2019-06-26-GeoPython/notebooks/2.ipyleaflet.ipynb | bsd-3-clause | from ipyleaflet import Map, basemaps, basemap_to_tiles
import ipyleaflet
center = (52.204793, 360.121558)
m = Map(
layers=(basemap_to_tiles(basemaps.NASAGIBS.ModisTerraTrueColorCR, "2018-11-12"), ),
center=center,
zoom=4
)
m
m.zoom
m.zoom = 5
from ipywidgets import IntSlider, link
zoom_slider = IntS... |
juditacs/snippets | misc/mutability.ipynb | lgpl-3.0 | l = [[]] * 3
l[0] is l[1], l[0] is l[2]
l[0].append("abc")
l
l = [1] * 3
print(l)
l[0] is l[1], l[0] is l[2]
"""
Explanation: operator* multiplies the same reference
End of explanation
"""
l[1] = 2
print(l)
l[0] is l[1], l[0] is l[2], l[1] is l[2]
"""
Explanation: Changing l[1] actually references a different obj... |
usantamaria/iwi131 | ipynb/25b-C3_2014_S2/Certamen3_2014_S2_CC.ipynb | cc0-1.0 | a = open('f1.dat')
b = open('f2.dat', 'w')
c, j = 'ekil', -1
for x in a:
p = list()
for i in range(len(x)):
if i %3 != 2:
x.replace('e','x')
b.write(x[i])
else:
ch = x.replace(x[i], c[j-(i/3)])
p.append(ch[i])
j = j - ((i+1)/3)
prin... |
gaufung/Data_Analytics_Learning_Note | Scikit_Learning/Tutorial/Unsupervised_learning.ipynb | mit | from sklearn import cluster, datasets
iris = datasets.load_iris()
X_iris = iris.data
y_iris = iris.target
k_means = cluster.KMeans(n_clusters=3)
k_means.fit(X_iris, y_iris)
print(k_means.labels_[::10])
print(y_iris[::10])
"""
Explanation: Unsupervised learning
1 k-means clustering
There is absolutely no guarantee of... |
arii/arii.github.io | rj/code/Robot Juggling.ipynb | mit | from tutorial import *
play_full_solution()
"""
Explanation: Robot Juggling Demo
In this final section we will program the robot to juggle the ball to bounce with a desired periodic motion.
End of explanation
"""
import tutorial; reload(tutorial); from tutorial import * ;
initial_pose = (16, 20, 0)
restitution = ... |
Hash--/documents | notebooks/Fusion_Basics/Dispersion Relation.ipynb | mit | def plasma_frequency(n, q, m):
'''
Returns the plasma angular frequency for a given species.
'''
omega_p = sqrt(n*q**2/(m*epsilon_0))
return omega_p
def cyclotron_frequency(q, m, B0):
'''
Returns the cyclotron angular frequency for a given species.
'''
omega_c = np.abs(q)*B0/m
r... |
doudon/pymks_overview | notebooks/cahn_hilliard.ipynb | mit | %matplotlib inline
%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Cahn-Hilliard Example
This example demonstrates how to use PyMKS to solve the Cahn-Hilliard equation. The first section provides some background information about the Cahn-Hilliard equation as wel... |
leferrad/learninspy | examples/notebooks/mnist_learninspy_ae.ipynb | isc | from learninspy.core.model import NetworkParameters, NeuralNetwork
from learninspy.core.autoencoder import AutoEncoder, StackedAutoencoder
from learninspy.core.optimization import OptimizerParameters
from learninspy.core.stops import criterion
from learninspy.utils.data import StandardScaler, LocalLabeledDataSet, split... |
peastman/deepchem | examples/tutorials/Advanced_model_training_using_hyperopt.ipynb | mit | !pip install deepchem
!pip install hyperopt
"""
Explanation: Advanced model training using hyperopt
In the Advanced Model Training tutorial we have already taken a look into hyperparameter optimasation using GridHyperparamOpt in the deepchem pacakge. In this tutorial, we will take a look into another hyperparameter tu... |
MarsCapone/project-euler | python/project-euler.ipynb | mit | def is_prime(n):
if n == 1: return False
if n < 4: return True
if n % 2 == 0: return False
if n < 9: return True # excluded 4, 6, 8 already
if n % 3 == 0: return False
i = 5
while i < n**(0.5) + 1:
if n % i == 0:
return False
if n % (i + 2) == 0:
retu... |
fluffy-hamster/A-Beginners-Guide-to-Python | A Beginners Guide to Python/Final Project (Minesweeper)/_07. My Solution (explanation).ipynb | mit | ## Assume that this code exists in a file named example.py
def main():
print(1 + 1)
if __name__ == "__main__":
main()
"""
Explanation: So my the code for my solution can be found in:
../misc/minesweeper.py
In this lecture I shall be going through some bits of code and explaining parts of it. I encourage you... |
drericstrong/Blog | 20170713_TransformerPrognosticsPart3Prognostics.ipynb | agpl-3.0 | import numpy as np
import seaborn as sns
from scipy import stats
import matplotlib.pyplot as plt
%matplotlib inline
# Please adjust the random seed for new results
np.random.seed(11)
# See Part 2 for code comments
def core_hot_spot(ambient_temp, overload_ratio, t0=35, tc=30, N=1,
N0=0.5, Nc=0.8, L=1)... |
analysiscenter/dataset | examples/tutorials/research/05_update_domain_in_research.ipynb | apache-2.0 | import sys
import os
import shutil
import numpy as np
import matplotlib
%matplotlib inline
os.environ["CUDA_VISIBLE_DEVICES"] = "6"
sys.path.append('../../..')
from batchflow import Pipeline, B, C, V, D, L
from batchflow.opensets import CIFAR10
from batchflow.models.torch import VGG7, VGG16, ResNet18
from batchflow... |
reworkhow/CS212 | poker.ipynb | mit | def ss(nums):
total=0
for i in range(len(nums)):
total=total+nums[i]**2
return total
"""
Explanation: warmup:
sequential style:
End of explanation
"""
def ss(nums):
return sum(x**2 for x in nums)
"""
Explanation: functional style (P):
End of explanation
"""
print max([3,4,5,0]),max([3,4,-5... |
xdnian/pyml | assignments/solutions/ex04_sample_solution.ipynb | mit | import pandas as pd
wine_data_remote = 'https://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data'
wine_data_local = '../datasets/wine/wine.data'
df_wine = pd.read_csv(wine_data_remote,
header=None)
df_wine.columns = ['Class label', 'Alcohol', 'Malic acid', 'Ash',
... |
batfish/pybatfish | jupyter_notebooks/Introduction to Forwarding Analysis.ipynb | apache-2.0 | # Import packages
%run startup.py
bf = Session(host="localhost")
"""
Explanation: Introduction to Forwarding Analysis using Batfish
Analyzing how the network forwards packets is one of the most common tasks for network engineers. Typically, it is performed by running traceroute between multiple sources and destination... |
gee-community/gee_tools | notebooks/batch/exportByFeat.ipynb | mit | import ee
ee.Initialize()
from geetools import batch
"""
Explanation: exportByFeat(img, fc, prop, folder, name, scale, dataType, **kwargs):
Export an image clipped by features (Polygons). You can use the same arguments as the original function ee.batch.export.image.toDrive
Parameters
img: image to clip
fc: feature co... |
serenejiang/MrOS_VitaminD | notebooks/3.1 Shannon alpha diversity analysis (Linear Regression).ipynb | gpl-3.0 | import pandas as pd
import numpy as np
import statsmodels.formula.api as smf
from statsmodels.compat import lzip
import statsmodels.stats.api as sms
import statsmodels.api as sm
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
"""
Explanation: output: 'mapping_PDalpha.txt'(mapping file with PD... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/08_image_keras/labs/mnist_linear.ipynb | apache-2.0 | import numpy as np
import shutil
import os
import tensorflow as tf
print(tf.__version__)
"""
Explanation: MNIST Image Classification with TensorFlow
This notebook demonstrates how to implement a simple linear image models on MNIST using Estimator.
<hr/>
This <a href="mnist_models.ipynb">companion notebook</a> extends ... |
gschivley/Index-variability | Notebooks/archive/Detrending justification.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import os
import glob
import numpy as np
from statsmodels.tsa.tsatools import detrend
def make_gen_index(data_folder, time='Monthly'):
"""
Read and combine the state-level generation and index files
inputs:
... |
jmcarpenter2/swifter | examples/swifter_speed_comparison.ipynb | mit | import numpy as np
import pandas as pd
import dask.dataframe as dd
import swifter
import perfplot
import matplotlib.pyplot as plt
import psutil
ncores = psutil.cpu_count()
npartitions = ncores*2
"""
Explanation: Imports and data
The libraries used in this notebook are available by calling pipenv install --dev in the ... |
alantian/polyglot | notebooks/Transliteration.ipynb | gpl-3.0 | from polyglot.transliteration import Transliterator
"""
Explanation: Transliteration
Transliteration is the conversion of a text from one script to another.
For instance, a Latin transliteration of the Greek phrase "Ελληνική Δημοκρατία", usually translated as 'Hellenic Republic', is "Ellēnikḗ Dēmokratía".
End of expla... |
probml/pyprobml | deprecated/poisson_lds_example.ipynb | mit |
!pip install git+git://github.com/lindermanlab/ssm-jax-refactor.git
import ssm
"""
Explanation: <a href="https://colab.research.google.com/github/probml/probml-notebooks/blob/main/notebooks/poisson_lds_example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In C... |
tensorflow/probability | tensorflow_probability/examples/jupyter_notebooks/Multiple_changepoint_detection_and_Bayesian_model_selection.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# 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, sof... |
juhaj/topics-python-in-research | .ipynb_checkpoints/ode_pde-checkpoint.ipynb | gpl-3.0 | dx = 0.3
x = np.arange(0, 10, dx) # returns [0, dx, 2dx, 3dx, 4dx, 5dx, ...]
print(x)
f1 = np.sin(x)
f2 = x**2/100
f3 = np.log(1+x)-1
fs = [f1, f2, f3]
for i in range(3): plt.plot(x, fs[i])
df1 = np.cos(x)
df2 = x/50
df3 = 1/(1+x)
dfs = [df1, df2, df3]
"""
Explanation: Numerical differential equations
In the simples... |
googleinterns/bizview-semi-supervised-learning | Supervised_learning/resnet_main.ipynb | apache-2.0 | from keras.utils import np_utils
import numpy as np
from resnet_lib import create_dataset, create_model, test_callback, tune_model, visualize_model
"""
Explanation: Resnet Supervised Learning
This file trains a supervised learning model (Resnet50) using transfer learning to train on an unknown dataset. And the results... |
alexhuth/n4cs-fa2017 | homeworks/homework_1.ipynb | gpl-3.0 | # Dependencies
%config InlineBackend.figure_format = 'retina'
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Homework 1
In this homework you are going to implement and test linear model fitting functions, and data quality checking functions. You will need to install (at least) ... |
cliburn/sta-663-2017 | notebook/12B_C++_Python_pybind11.ipynb | mit | ! pip3 install pybind11
! pip3 install cppimport
"""
Explanation: Using pybind11
The package pybind11 is provides an elegant way to wrap C++ code for Python, including automatic conversions for numpy arrays and the C++ Eigen linear algebra library. Used with the cppimport package, this provides a very nice work flow f... |
kecnry/autofig | docs/gallery/color_size_zorder.ipynb | gpl-3.0 | import autofig
import numpy as np
import matplotlib.pyplot as plt
#autofig.inline()
n = 75
x = np.linspace(0, 4*np.pi, n)
y1 = np.sin(x)
y2 = -np.sin(x)
z1 = np.cos(x)
z2 = -2*np.cos(x)
yerr = np.random.rand(n)*0.3
zerr = np.random.rand(n)
"""
Explanation: Gallery: Color and Size-Scaling with Z-Order
End of expla... |
TheProgrammingDuck/Europa-Challenge | Experimental/SVMDocs.ipynb | mit | import pandas as pd
df = pd.io.parsers.read_csv(
'Data/NewBalanced.csv',
)
print(df.shape)
print('\n')
print(df.head(5))
print('\n')
print(df.tail(1))
"""
Explanation: Considering our data
Our initial goal was to apply a ML approach to accurately predict the likelihood of a wildfire occuring. The data we used w... |
mne-tools/mne-tools.github.io | 0.24/_downloads/d8a6d02146c5c075611a652218e020ad/30_reading_fnirs_data.ipynb | bsd-3-clause | import os.path as op
import numpy as np
import pandas as pd
import mne
"""
Explanation: Importing data from fNIRS devices
fNIRS devices consist of two kinds of optodes: light sources (AKA "emitters" or
"transmitters") and light detectors (AKA "receivers"). Channels are defined as
source-detector pairs, and channel loc... |
LimeeZ/phys292-2015-work | assignments/assignment03/NumpyEx02.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: Numpy Exercise 2
Imports
End of explanation
"""
def np_fact(n):
"""Compute n! = n*(n-1)*...*1 using Numpy."""
LOL = np.arange(1, n+1, 1)
Factorial = np.cumprod(LOL)
if n == 0:
ret... |
phanrahan/magmathon | notebooks/signal-generator/solutions/Triangle.ipynb | mit | import magma as m
m.set_mantle_target('ice40')
import mantle
def DefineTriangle(n):
T = m.Bits(n)
class _Triangle(m.Circuit):
name = f'Triangle{n}'
IO = ['I', m.In(T), 'O', m.Out(T)]
@classmethod
def definition(io):
invert = mantle.Invert(n)
mux = ... |
pinga-lab/magnetic-ellipsoid | code/lambda_triaxial_ellipsoids.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: $\lambda$ variable for triaxial ellipsoids
End of explanation
"""
a = 200.
b = 180.
c = 150.
x = 210.
y = 230.
z = 300.
"""
Explanation: Here, we follow the reasoning presented by Webster (1904) for analyzing the ellipsoidal coo... |
yoon-gu/stoc | jupyter/HJB Equation Generator.ipynb | mit | t, x, u= symbols('t x u')
Vt, Vx = symbols('V_t V_x')
f = x + 0.5 * u**2
b = x + u
"""
Explanation: Optimal Control Problem
Minimize $$\int_0^Tf(t,x,u)~dt$$ subject to
$$
\begin{cases}
x'(t) = b(t,x,u)\
x(0) = x_0
\end{cases}
$$
End of explanation
"""
hjbeq = r'\frac{\partial V}{\partial t} + \min_u \left[' + latex(... |
mne-tools/mne-tools.github.io | 0.20/_downloads/a1ab4842a5aa341564b4fa0a6bf60065/plot_dipole_orientations.ipynb | bsd-3-clause | import mne
import numpy as np
from mne.datasets import sample
from mne.minimum_norm import make_inverse_operator, apply_inverse
data_path = sample.data_path()
evokeds = mne.read_evokeds(data_path + '/MEG/sample/sample_audvis-ave.fif')
left_auditory = evokeds[0].apply_baseline()
fwd = mne.read_forward_solution(
dat... |
tensorflow/docs | site/en/guide/estimator.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... |
waynegm/OpendTect-5-plugins | python_bindings/Examples/wmodpy_survey.ipynb | gpl-3.0 | import sys
import platform
data_root = None
alt_root = None
if platform.system() == 'Linux':
sys.path.insert(0, "/opt/seismic/OpendTect_6/6.6.0/bin/lux64/Release")
# sys.path.insert(0,'/home/wayne/Work/WMSeismicSolutions/dGB/Development/Build/bin/od6.6/bin/lux64/Debug')
data_root = '/mnt/Data/seismic/ODData'... |
smattis/BET-1 | examples/linearMap/linearMapUniformSampling.ipynb | gpl-3.0 | import numpy as np
import bet.calculateP.simpleFunP as simpleFunP
import bet.calculateP.calculateP as calculateP
import bet.sample as samp
import bet.sampling.basicSampling as bsam
from myModel import my_model
"""
Explanation: Linear Map: Uniform Sampling
Copyright (C) 2014-2019 The BET Development Team
This example s... |
ellisztamas/faps | docs/tutorials/02_genotype_data.ipynb | mit | import numpy as np
import faps as fp
print("Created using FAPS version {}.".format(fp.__version__))
"""
Explanation: Genotype data in FAPS
End of explanation
"""
allele_freqs = np.random.uniform(0.3,0.5,10)
mypop = fp.make_parents(5, allele_freqs, family_name='my_population')
"""
Explanation: Tom Ellis, March 2017
... |
anandha2017/udacity | nd101 Deep Learning Nanodegree Foundation/DockerImages/19_Autoencoders/notebooks/autoencoder/Convolutional_Autoencoder_Solution.ipynb | mit | %matplotlib inline
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', validation_size=0)
img = mnist.train.images[2]
plt.imshow(img.reshape((28, 28)), cmap='Greys_r')
"""
Explanation: C... |
bitrepository/jupyter-release-tests | Quickstart Test.ipynb | apache-2.0 | !docker run \
--detach \
--rm \
--env 'ACTIVEMQ_MIN_MEMORY=512' \
--env 'ACTIVEMQ_MAX_MEMORY=2048' \
--publish 61616:61616 \
--name activemq \
webcenter/activemq:5.12.0 \
/opt/activemq/bin/activemq console
"""
Explanation: Introduction
The Bitrepository quickstart is a package for quic... |
jakevdp/sklearn_tutorial | notebooks/02.1-Machine-Learning-Intro.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('seaborn')
# Import the example plot from the figures directory
from fig_code import plot_sgd_separator
plot_sgd_separator()
"""
Explanation: <small><i>This notebook was put together by Jake Vanderplas. Source and license info is on GitHub.</i></small>... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/chi2_fitting.ipynb | bsd-3-clause | import numpy as np
import pandas as pd
import statsmodels.api as sm
"""
Explanation: Least squares fitting of models to data
This is a quick introduction to statsmodels for physical scientists (e.g. physicists, astronomers) or engineers.
Why is this needed?
Because most of statsmodels was written by statisticians and ... |
newsapps/public-notebooks | Shooting victims by block.ipynb | mit | import os
import requests
def get_table_url(table_name, base_url=os.environ['NEWSROOMDB_URL']):
return '{}table/json/{}'.format(os.environ['NEWSROOMDB_URL'], table_name)
def get_table_data(table_name):
url = get_table_url(table_name)
try:
r = requests.get(url)
return r.json()
exce... |
arsenovic/clifford | docs/tutorials/cga/visualization-tools.ipynb | bsd-3-clause | from clifford.g2c import *
point = up(2*e1+e2)
line = up(3*e1 + 2*e2) ^ up(3*e1 - 2*e2) ^ einf
circle = up(e1) ^ up(-e1 + 2*e2) ^ up(-e1 - 2*e2)
"""
Explanation: This notebook is part of the clifford documentation: https://clifford.readthedocs.io/.
Visualization tools
In this example we will look at some external too... |
lantonov/Rockstar | bayesopt.ipynb | gpl-3.0 | import timeit
import subprocess
import random
import numpy as np
import scipy as sp
import math
import re
import chess
from bayes_opt import BayesianOptimization
from operator import itemgetter
from chess import uci
from chess import Board
from chess import Move
from chess import syzygy
from numpy import sqrt
from scip... |
AllenDowney/ThinkStats2 | solutions/chap13soln.ipynb | gpl-3.0 | from os.path import basename, exists
def download(url):
filename = basename(url)
if not exists(filename):
from urllib.request import urlretrieve
local, _ = urlretrieve(url, filename)
print("Downloaded " + local)
download("https://github.com/AllenDowney/ThinkStats2/raw/master/code/th... |
datactive/bigbang | bigbang/datasets/domains/Create Domain-Category Data.ipynb | mit | domain_categories = {
"generic" : [
"gmail.com",
"hotmail.com",
"gmx.de",
"gmx.net",
"gmx.at",
"earthlink.net",
"comcast.net",
"yahoo.com",
"email.com"
],
"personal" : [
"mnot.net",
"henriknordstrom.net",
"adamba... |
timkpaine/lantern | experimental/widgets/3_Output Widget.ipynb | apache-2.0 | import ipywidgets as widgets
"""
Explanation: Index - Back - Next
Output widgets: leveraging Jupyter's display system
End of explanation
"""
out = widgets.Output(layout={'border': '1px solid black'})
out
"""
Explanation: The Output widget can capture and display stdout, stderr and rich output generated by IPython. ... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/text_classification/labs/rnn_encoder_decoder.ipynb | apache-2.0 | pip freeze | grep nltk || pip install nltk
import os
import pickle
import sys
import nltk
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import tensorflow as tf
from tensorflow.keras.layers import (
Dense,
Embedding,
GRU,
Input,
)
from tensorflow.keras.mode... |
antoniomezzacapo/qiskit-tutorial | qiskit/terra/QuantumCircuits.ipynb | apache-2.0 | import numpy as np
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import Aer, execute
from qiskit.quantum_info import Pauli, state_fidelity, basis_state, process_fidelity
"""
Explanation: <img src="../../images/qiskit-heading.gif" alt="Note: In order for images to show up in this ju... |
whitead/numerical_stats | unit_14/hw_2016/homework_key.ipynb | gpl-3.0 | #NOTE - you can make these folders in your OS if you want instead.
import os
os.mkdir('che116-package')
os.mkdir('che116-package/che116')
%%writefile che116-package/setup.py
from setuptools import setup
setup(name = 'che116', #the name for install purposes
author = 'Andrew White', #for your own info
des... |
GoogleCloudPlatform/covid-19-open-data | examples/category_estimation.ipynb | apache-2.0 | # Since reported numbers are approximate, they are rounded for the sake of simplicity
severe_ratio = .15
critical_ratio = .05
mild_ratio = 1 - severe_ratio - critical_ratio
"""
Explanation: Estimating Current Cases by Category
This notebook explores a methodology to estimate current mild, severe and critical patients.... |
darcamo/pyphysim | apps/ia/IA Results 2x2(1).ipynb | gpl-2.0 | %pylab inline
"""
Explanation: Simulation Results for varying number of maximum iterations
This notebook shows BER and Sum Capacity results for different IA
algorithms when the maximum number of allowed iterations is limited. Note
that the algorithm might run less iterations than the allowed maximum if
the precoders ... |
raschuetz/foundations-homework | Data_and_Databases_homework/homework_2_schuetz_graded.ipynb | mit | import pg8000
conn = pg8000.connect(database="homework2")
"""
Explanation: Grade: 6 / 6 -- great job!
Homework 2: Working with SQL (Data and Databases 2016)
This homework assignment takes the form of an IPython Notebook. There are a number of exercises below, with notebook cells that need to be completed in order to m... |
kazunori279/TensorFlow-Intro | 2. Classify Manhattan with TensorFlow.ipynb | apache-2.0 | import tensorflow as tf
tf.__version__
"""
Explanation: 2. Classify Manhattan with TensorFlow
In this codelab, we will use TensorFlow to train a neural network to predict whether a location is in Manhattan or not, by looking at its longitude and latitude.
<br/>
<br/>
<br/>
Labs and Solutions
In this codelab there are... |
Planet-Nine/cs207project | Paper/SGD algorithm paper.ipynb | mit | from numpy import loadtxt
train = loadtxt('data_stdev2_train.csv')
X = train[:,0:2]
Y = train[:,2:3]
import pylab as pl
%matplotlib inline
pl.figure(0,figsize=(8, 6))
pl.ylabel('X1')
pl.xlabel('X0')
pl.scatter(X[:, 0], X[:, 1], c=(1.-Y), s=50, cmap = pl.cm.cool)
"""
Explanation: Stochastic Gradient Descent and its Opt... |
ReactiveX/RxPY | notebooks/reactivex.io/Part IV - Grouping, Buffering, Delaying, misc.ipynb | mit | reset_start_time(O.delay)
d = subs(marble_stream('a-b-c|').delay(150).merge(marble_stream('1-2-3|')))
"""
Explanation: A Decision Tree of Observable Operators
Part 4: Grouping, Buffering, Delaying, misc
source: http://reactivex.io/documentation/operators.html#tree.
(transcribed to RxPY 1.5.7, Py2.7 / 2016-12, Gunther... |
julienchastang/unidata-python-workshop | notebooks/MetPy_Advanced/QG Analysis.ipynb | mit | from datetime import datetime
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import numpy as np
from scipy.ndimage import gaussian_filter
from siphon.catalog import TDSCatalog
from siphon.ncss import NCSS
import matplotlib.pyplot as plt
import metpy.calc as mpcalc
import metpy.constants as mpconstants
f... |
MIT-LCP/mimic-code | mimic-iv-cxr/txt/validation/compare_negbio_and_chexpert.ipynb | mit | chexpert_categories = ["No Finding", "Enlarged Cardiomediastinum", "Cardiomegaly",
"Lung Lesion", "Lung Opacity", "Edema", "Consolidation",
"Pneumonia", "Atelectasis", "Pneumothorax", "Pleural Effusion",
"Pleural Other", "Fracture", "Support Devices"]
#... |
spacy-io/thinc | examples/05_visualizing_models.ipynb | mit | !pip install "thinc>=8.0.0a0" pydot graphviz svgwrite
"""
Explanation: Visualizing Thinc models (with shape inference)
This is a simple notebook showing how you can easily visualize your Thinc models and their inputs and outputs using Graphviz and pydot. If you're installing pydot via the notebook, make sure to restar... |
mitdbg/modeldb | client/workflows/examples/text_classification_rnn.ipynb | mit | # Python 3.6
!pip install verta
!pip install matplotlib==3.1.1
!pip install tensorflow==2.0.0-beta1
!pip install tensorflow-hub==0.5.0
!pip install tensorflow-datasets==1.0.2
"""
Explanation: Text Classification
This text classification example:
* trains a recurrent neural network on the IMDB large movie review datase... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.