repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
tensorflow/graphics | tensorflow_graphics/notebooks/intrinsics_optimization.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... |
yuhao0531/dmc | notebooks/week-5/01-CNN in keras for mnist.ipynb | apache-2.0 | import numpy as np
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D
from keras.utils import np_utils
from keras import backend as K
from ker... |
rsignell-usgs/notebook | NEXRAD/.ipynb_checkpoints/THREDDS_NEXRAD-Copy1-checkpoint.ipynb | mit | import matplotlib
import warnings
warnings.filterwarnings("ignore", category=matplotlib.cbook.MatplotlibDeprecationWarning)
%matplotlib inline
"""
Explanation: Using Python to Access NEXRAD Level 2 Data from Unidata THREDDS Server
This is a modified version of Ryan May's notebook here:
http://nbviewer.jupyter.org/gist... |
mne-tools/mne-tools.github.io | 0.14/_downloads/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.cross_... |
lionell/university-labs | num_methods/second/lab3.ipynb | mit | def thomas(a, b, c, d):
n = len(d)
A = np.empty_like(d)
B = np.empty_like(d)
A[0] = -c[0]/b[0]
B[0] = d[0]/b[0]
for i in range(1, n):
A[i] = -c[i] / (b[i] + a[i]*A[i - 1])
B[i] = (d[i] - a[i]*B[i - 1])/(b[i] + a[i]*A[i - 1])
y = np.empty_like(d)
y[n - 1] = B[n - 1]
fo... |
DawesLab/LabNotebooks | Mitchell-Schaeffer Replicated.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
# h steady-state value
def h_inf(Vm=0.0):
return 1 # TODO??
# Input stimulus
def Id(t):
if 5.0 < t < 15.0:
return 0.1
elif 400.0 < t < 410.0:
return 0.1
return 0.0
# Compute derivatives
def compu... |
Jackporter415/phys202-2015-work | assignments/assignment04/TheoryAndPracticeEx01.ipynb | mit | from IPython.display import Image
"""
Explanation: Theory and Practice of Visualization Exercise 1
Imports
End of explanation
"""
# Add your filename and uncomment the following line:
Image(filename='Graph1.png')
"""
Explanation: Graphical excellence and integrity
Find a data-focused visualization on one of the fol... |
RyanAlberts/Springbaord-Capstone-Project | Statistics_Exercises/Mini_Project_Clustering.ipynb | mit | %matplotlib inline
import pandas as pd
import sklearn
import matplotlib.pyplot as plt
import seaborn as sns
# Setup Seaborn
sns.set_style("whitegrid")
sns.set_context("poster")
"""
Explanation: Customer Segmentation using Clustering
This mini-project is based on this blog post by yhat. Please feel free to refer to t... |
skasi7/HearthPricer | Intro.ipynb | mit | from hearthpricer import hearthpricer
import numpy
import os.path
import pandas
"""
Explanation: Introduction
This work is inspired by this paper from Elie and Celine Bursztein and will try to reproduce their findings applying some different ideas.
End of explanation
"""
all_sets_filename = os.path.join('data', 'Al... |
kit-cel/wt | wt/vorlesung/ch4_6/clt.ipynb | gpl-2.0 | # importing
import numpy as np
from scipy import stats, special
import matplotlib.pyplot as plt
import matplotlib
# showing figures inline
%matplotlib inline
# plotting options
font = {'size' : 20}
plt.rc('font', **font)
plt.rc('text', usetex=True)
matplotlib.rc('figure', figsize=(18, 6) )
"""
Explanation: Con... |
feffenberger/StatisticalMethods | examples/XrayImage/Modeling.ipynb | gpl-2.0 | from __future__ import print_function
import astropy.io.fits as pyfits
import astropy.visualization as viz
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 10.0)
"""
Explanation: Forward Modeling the X-ray Image data
In this notebook, we'll take a closer loo... |
ES-DOC/esdoc-jupyterhub | notebooks/snu/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', 'snu', 'sandbox-2', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: SNU
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Balance... |
ES-DOC/esdoc-jupyterhub | notebooks/noaa-gfdl/cmip6/models/sandbox-3/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'sandbox-3', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: NOAA-GFDL
Source ID: SANDBOX-3
Topic: Ocean
Sub-Topics: Timestepping Framework,... |
DistrictDataLabs/yellowbrick | examples/bbengfort/rank2d.ipynb | apache-2.0 | # Imports
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from collections import OrderedDict
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import Imputer
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error a... |
KMFleischer/PyEarthScience | Data_Analysis/convert_csv_to_netcdf.ipynb | mit | import numpy as np
from cdo import *
"""
Explanation: Convert a CSV data file to netCDF file
read the CSV file
generate the gridfile from the CSV lon and lat values
write data to file
write netcdf file
Input data
data/input.csv:
lon, lat, value
5.0, 40.0, 1000
5.0, 41.0, 1000
5.0, 42.0, 1200
5.0, 44.0, 1600
5.5, 40.... |
jmhsi/justin_tinker | data_science/lendingclub_bak/dataprep_and_modeling/0.2.1_investigate_investment_rounds_not_having_any_loans_passing_min_score_threshold.ipynb | apache-2.0 | import modeling_utils.data_prep as data_prep
from sklearn.externals import joblib
import time
platform = 'lendingclub'
store = pd.HDFStore(
'/Users/justinhsi/justin_tinkering/data_science/lendingclub/{0}_store.h5'.
format(platform),
append=True)
"""
Explanation: So I chose a min_score from the other jupy... |
scotthuang1989/Python-3-Module-of-the-Week | concurrency/subprocess.ipynb | apache-2.0 | import subprocess
completed = subprocess.run(['ls', '-l'])
completed
"""
Explanation: The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes.
Running External Command
End of explanation
"""
completed = subprocess.run(['ls', '-l'], stdout=sub... |
kit-cel/wt | qc/linear_prediction/Block_Adaptation.ipynb | gpl-2.0 | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import lfilter
import librosa
import librosa.display
import IPython.display as ipd
"""
Explanation: Linear Prediction with Block Adaptation
This code is provided as supplementary material of the lecture Quellencodierung.
This code ... |
thiagoqd/queirozdias-deep-learning | sentiment-rnn/Sentiment_RNN.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... |
csdms/coupling | docs/demos/frost_number.ipynb | mit | # Import standard Python modules
import numpy as np
import pandas
import matplotlib.pyplot as plt
# Import the FrostNumber PyMT model
import pymt.models
frost_number = pymt.models.FrostNumber()
"""
Explanation: Frost Number Model
Link to this notebook: https://github.com/csdms/pymt/blob/master/docs/demos/frost_numb... |
phoebe-project/phoebe2-docs | development/tutorials/LC.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: 'lc' Datasets and Options
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
logger = phoeb... |
alurban/mentoring | tidal_disruption/disruption/disruption_point.ipynb | gpl-3.0 | # Imports.
import numpy as np
from numpy import pi
import matplotlib.pyplot as plt
from matplotlib import ticker
%matplotlib inline
"""
Explanation: Newtonian Tidal Disruption of Compact Binaries
We expect certain types of LIGO signals to have electromagnetic (EM) counterparts — bright, transient explosions visi... |
ivukotic/ML_platform_tests | PerfSONAR/AnomalyDetection/ANN/Testing NN AD on simulated data.ipynb | gpl-3.0 | %matplotlib inline
from time import time
import numpy as np
import pandas as pd
import random
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rc('xtick', labelsize=14)
matplotlib.rc('ytick', labelsize=14)
import tensorflow as tf
from sklearn.model_selection import train_test_split
from sklearn.utils ... |
landmanbester/fundamentals_of_interferometry | 3_Positional_Astronomy/3_2_Hour_Angle.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import HTML
HTML('../style/course.css') #apply general CSS
"""
Explanation: Outline
Glossary
3. Positional Astronomy
Previous: 3.1 Equatorial Coordinates (RA,DEC)
Next: 3.3 Horizontal Coordinates (ALT,AZ)
Import standard m... |
james-prior/cohpy | 20170615-splitting-data.ipynb | mit | MONTH_NDAYS = '''
0:31
1:29
2:31
3:30
4:31
5:30
6:31
7:31
8:30
9:31
10:30
11:31
'''.split()
MONTH_NDAYS
for month_n_days in MONTH_NDAYS:
month, n_days = map(int, month_n_days.split(':'))
print(f'{month} has {n_days}')
"""
Explanation: Inspired by R P Herrold's... |
mne-tools/mne-tools.github.io | 0.22/_downloads/f4e0fde886a45c1a46537066c93815f1/plot_parcellation.ipynb | bsd-3-clause | # Author: Eric Larson <larson.eric.d@gmail.com>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import mne
Brain = mne.viz.get_brain_class()
subjects_dir = mne.datasets.sample.data_path() + '/subjects'
mne.datasets.fetch_hcp_mmp_parcellation(subjects_dir=subjects_dir,
... |
nyoungb2/CLdb | doc/examples/Ecoli/Setup.ipynb | gpl-2.0 | # path to raw files
## CHANGE THIS!
rawFileDir = "~/perl/projects/CLdb/data/Ecoli/"
# directory where the CLdb database will be created
## CHANGE THIS!
workDir = "~/t/CLdb_Ecoli/"
# viewing file links
import os
import zipfile
import csv
from IPython.display import FileLinks
# pretty viewing of tables
## get from: http... |
jdsanch1/SimRC | 02. Parte 2/15. Clase 15/13Class NB.ipynb | mit | #importar los paquetes que se van a usar
import pandas as pd
import numpy as np
import datetime
from datetime import datetime
import scipy.stats as stats
import scipy as sp
import matplotlib.pyplot as plt
import seaborn as sns
import sklearn.covariance as skcov
import cvxopt as opt
from cvxopt import blas, solvers
solv... |
NYUDataBootcamp/Projects | UG_F16/Kustas-Madej-CrimeRatesFinalProject.ipynb | mit | import sys # system module
import pandas as pd # data package
import matplotlib as mpl # graphics package
import matplotlib.pyplot as plt # pyplot module
import datetime as dt # date and time module
import numpy as np
# make plots sh... |
solvebio/solvebio-python | examples/global_search.ipynb | mit | # Importing SolveBio library
from solvebio import login
from solvebio import Filter
from solvebio import GlobalSearch
# Logging to SolveBio
login()
"""
Explanation: Global Search
Global Search allows you to search for vaults, files, folders, and datasets by name, tags, user, date, and other metadata which can be cust... |
poldrack/reproducible-workflows | python_R/Mixed_Python_R_example.ipynb | mit | import numpy
%load_ext rpy2.ipython
x=numpy.random.randn(100)
beta=3
y=beta*x+numpy.random.randn(100)
"""
Explanation: This is an example of using Python and R together within a Jupyter notebook. First, let's generate some data within python.
End of explanation
"""
%%R -i x,y -o beta_est
result=lm(y~x)
beta_est=res... |
quantopian/research_public | notebooks/lectures/Hypothesis_Testing/answers/notebook.ipynb | apache-2.0 | # Useful Libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import t
import scipy.stats
"""
Explanation: Exercises: Hypothesis Testing - Answer Key
By Christopher van Hoecke and Maxwell Margenot
Lecture Link
https://www.quantopian.com/lectures/hypothesis-testing
IMPORTANT... |
SteveDiamond/cvxpy | examples/notebooks/derivatives/queuing_design.ipynb | gpl-3.0 | import cvxpy as cp
import numpy as np
import time
mu = cp.Variable(pos=True, shape=(2,), name='mu')
lam = cp.Variable(pos=True, shape=(2,), name='lambda')
ell = cp.Variable(pos=True, shape=(2,), name='ell')
w_max = cp.Parameter(pos=True, shape=(2,), value=np.array([2.5, 3.0]), name='w_max')
d_max = cp.Parameter(pos=... |
Leguark/pynoddy | docs/notebooks/5-Geophysical-Potential-Fields.ipynb | gpl-2.0 | %matplotlib inline
import sys, os
import matplotlib.pyplot as plt
# adjust some settings for matplotlib
from matplotlib import rcParams
# print rcParams
rcParams['font.size'] = 15
# determine path of repository to set paths corretly below
repo_path = os.path.realpath('../..')
import pynoddy
import matplotlib.pyplot a... |
bastorer/SPINSpy | Demo/.ipynb_checkpoints/Demo_2d-checkpoint.ipynb | mit | %matplotlib inline
# Tells the system to plot in-line, only necessary for iPython notebooks,
# not regular command-line python
import numpy as np
import os
import sys
import matplotlib.pyplot as plt
import time
# Now that we have our packages, we need data. The file 'make_2d_data.py' will
# generate a sample data set... |
besser82/shogun | doc/ipython-notebooks/multiclass/naive_bayes.ipynb | bsd-3-clause | %matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
import numpy as np
import pylab as pl
np.random.seed(0)
n_train = 300
models = [{'mu': [8, 0], 'sigma':
np.array([[np.cos(-np.pi/4),-np.sin(-np.pi/4)],
[np.sin(-np.pi/4), np.cos(-np.pi/4)]]).dot... |
slundberg/shap | notebooks/tabular_examples/model_agnostic/Squashing Effect.ipynb | mit | import numpy as np
import xgboost
import scipy
import shap
import pandas as pd
shap.initjs()
# build a simple dataset
N = 500
M = 4
X = np.random.randn(N, M)
X[0,0] = 0
X[0,1] = 0
X = pd.DataFrame(X, columns=["A", "B", "C", "D"])
# a function (a made up ML model) with an output in "margin" space...
f = lambda X: (X[:... |
google/eng-edu | ml/pc/exercises/fairness_text_toxicity_part2.ipynb | apache-2.0 | !pip install fairness-indicators \
"absl-py==0.8.0" \
"pyarrow==0.15.1" \
"apache-beam==2.17.0" \
"avro-python3==1.9.1" \
"tfx-bsl==0.21.4" \
"tensorflow-data-validation==0.21.5"
"""
Explanation: Fairness Exercise 2: Remediate Bias
Learning Objectives:
* Remediate subgroup bias in the toxic text classifier... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_resample.ipynb | bsd-3-clause | # Authors: Marijn van Vliet <w.m.vanvliet@gmail.com>
#
# License: BSD (3-clause)
from matplotlib import pyplot as plt
import mne
from mne.datasets import sample
"""
Explanation: Resampling data
When performing experiments where timing is critical, a signal with a high
sampling rate is desired. However, having a sign... |
infilect/ml-course1 | keras-notebooks/CNN/4.2. MNIST CNN.ipynb | mit | #Import the required libraries
import numpy as np
np.random.seed(1338)
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Conv2D
from keras.layers.pooling import MaxPooling2D
from keras.utils i... |
blakeflei/IntroScientificPythonWithJupyter | Principal Component Analysis.ipynb | bsd-3-clause | import numpy as np
from matplotlib import pyplot as plt
rand_seed = 1 # set the random number generator so results are repeatable
"""
Explanation: Principal Component Analysis
Data Souces can have many dimensions. To get a sense of the relative variances, Principal Component Analysis (PCA) can be effective. PCA is an ... |
willingc/geekgirl-2015 | intro_to_python/part-1-2015.ipynb | gpl-2.0 | 2 + 2
1.4 + 2.25
4 - 2
2 * 3
4 / 2
0.5/2
"""
Explanation: Introduction to Python Workshop Part 1
Welcome again!
We want to thank the many people that have made this workshop possible.
First, the generosity of our sponsors have provided facilities for the workshop, food and refreshments, and travel assistance for ... |
MaxPowerWasTaken/MaxPowerWasTaken.github.io | jupyter_notebooks/Process many find_replace rules in a corpus fast.ipynb | gpl-3.0 | import pandas as pd
from datetime import datetime
# Read in text-cleaning rules
folder = 'datasets/text_cleaning/'
brit_to_amer = pd.read_csv(folder + 'british to american spellings.csv', header=None)
misspellings = pd.read_csv(folder + 'common_misspellings.csv', header=None)
contractions = pd.read_csv(folder + 'contr... |
Naereen/notebooks | Benchmark_of_the_SHA256_hash_function__Python_Cython_Numba.ipynb | mit | class Hash(object):
""" Common class for all hash methods.
It copies the one of the hashlib module (https://docs.python.org/3.5/library/hashlib.html).
"""
def __init__(self, *args, **kwargs):
""" Create the Hash object."""
self.name = self.__class__.__name__ # https://docs.pyt... |
jaabberwocky/jaabberwocky.github.io | Presentations/Python_V_R/Python.ipynb | mit | # load libraries
import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
import seaborn as sns
from urllib.request import urlopen
from pandas.compat import StringIO
%matplotlib inline
# write function to load data from URL
def loadTitanicData():
url = "http://web.stanford.edu/class/archiv... |
quantumlib/Cirq | docs/tutorials/aqt/getting_started.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... |
bmabey/pyLDAvis | notebooks/sklearn.ipynb | bsd-3-clause | from __future__ import print_function
import pyLDAvis
import pyLDAvis.sklearn
pyLDAvis.enable_notebook()
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.decomposition import LatentDirichletAllocation
"""
Explanation: pyLDAvis.s... |
ondrolexa/sg2 | 12_Strain_calcualtions.ipynb | mit | %pylab inline
"""
Explanation: Strain related calculations with Python
Most of the functions we need are provided by NumPy and Matplotlib, which could be used in jupyter notebook using magic command %pylab with argument inline so all graphics will be shown within notebook
End of explanation
"""
F = array([[1, 1], [0... |
d-grossman/magichour | notebooks/vis/makeD3FromMarket.ipynb | apache-2.0 | import itertools
for p in procLine:
l = p.split(' ')
if len(l) > 1:
comb = itertools.combinations(l, 2)
for start,finish in comb:
val = (start,finish)
edgeDict[val] += 1
edgeSet.add(val)
"""
Explanation: Currenlty the market basket analysis we are perfor... |
ethen8181/machine-learning | deep_learning/seq2seq/2_torch_seq2seq_attention.ipynb | mit | # code for loading the format for the notebook
import os
# path : store the current path to convert back to it later
path = os.getcwd()
os.chdir(os.path.join('..', '..', 'notebook_format'))
from formats import load_style
load_style(css_style='custom2.css', plot_style=False)
os.chdir(path)
# 1. magic for inline plot... |
hich28/mytesttxx | tests/python/acc_cond.ipynb | gpl-3.0 | spot.mark_t()
spot.mark_t([0, 2, 3])
spot.mark_t((0, 2, 3))
"""
Explanation: Acceptance conditions
The acceptance condition of an automaton specifies which of its paths are accepting.
The way acceptance conditions are stored in Spot is derived from the way acceptance conditions are specified in the HOA format. In H... |
darioflute/CS4A | Lecture-shell.ipynb | gpl-3.0 | %load_ext version_information
%version_information numpy, scipy, astropy, matplotlib, version_information
"""
Explanation: Lecture 1
Software required
This is the list of software you should have installed on your computer to follow the classes:
Python (anaconda distribution)
git
bash
Part of the course will be expl... |
harmsm/pythonic-science | chapters/00_inductive-python/key/09_pandas_key.ipynb | unlicense | some_dict = {"x":{"a":1,"b":2,"c":3},
"y":{"a":4,"b":5,"c":6}}
"""
Explanation: Pandas
Sometimes you want a spreadsheet.
Starting point
End of explanation
"""
# Answer
some_dict["y"]["b"]
"""
Explanation: Write a piece of code that prints the number 5, taken from some_dict.
End of explanation
"""
i... |
SuLab/scheduled-bots | scheduled_bots/SPL_ADR_standard_dataset/SPL ADR Standard Data set.ipynb | mit | from wikidataintegrator import wdi_core, wdi_login, wdi_helpers
from wikidataintegrator.ref_handlers import update_retrieved_if_new_multiple_refs
import pandas as pd
from pandas import read_csv
import requests
from tqdm.notebook import trange, tqdm
import ipywidgets
import widgetsnbextension
import time
datasrc = 'da... |
kvr777/deep-learning | transfer-learning/Transfer_Learning.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
vgg_dir = 'tensorflow_vgg/'
# Make sure vgg exists
if not isdir(vgg_dir):
raise Exception("VGG directory doesn't exist!")
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_s... |
tpin3694/tpin3694.github.io | statistics/probability_mass_functions.ipynb | mit | # Load libraries
import matplotlib.pyplot as plt
"""
Explanation: Title: Probability Mass Functions
Slug: probability_mass_functions
Summary: Probability Mass Functions in Python.
Date: 2016-02-08 12:00
Category: Statistics
Tags: Basics
Authors: Chris Albon
Preliminaries
End of explanation
"""
# Create some rand... |
Caranarq/01_Dmine | Datasets/AGEO/.ipynb_checkpoints/AGEO-checkpoint.ipynb | gpl-3.0 | descripciones = {
'P0610': 'Ventas de electricidad',
'P0701': 'Longitud total de la red de carreteras del municipio (excluyendo las autopistas)'
}
# Librerias utilizadas
import pandas as pd
import sys
import urllib
import os
import csv
import zipfile
# Configuracion del sistema
print('Python {} on {}'.format(... |
camigord/Self-Driving-Car-Nanodegree | P2-Traffic-Sign-Recognition/Traffic_Sign_Classifier.ipynb | mit | # Load pickled data
import pickle
import tensorflow as tf
training_file = "traffic-signs-data/train.p"
validation_file= "traffic-signs-data/valid.p"
testing_file = "traffic-signs-data/test.p"
with open(training_file, mode='rb') as f:
train = pickle.load(f)
with open(validation_file, mode='rb') as f:
valid = p... |
CompPhysics/MachineLearning | doc/Programs/ANN/Ann1.ipynb | cc0-1.0 | from IPython.display import YouTubeVideo
YouTubeVideo('bxe2T-V8XRs',width=640,height=360)
"""
Explanation: <p style="text-align: right;"> Nicolas Dronchi </p>
Day 22 Pre-Class assignment: Introduction to Artificial Neural Networks
This entire Artificial Neural Networks module is from Neural Networks Demystified by @st... |
JaviMerino/lisa | ipynb/examples/energy_meter/EnergyMeter_ACME.ipynb | apache-2.0 | import logging
reload(logging)
logging.basicConfig(
format='%(asctime)-9s %(levelname)-8s: %(message)s',
datefmt='%I:%M:%S')
# Enable logging at INFO level
logging.getLogger().setLevel(logging.INFO)
# Generate plots inline
%matplotlib inline
import os
# Support to access the remote target
import devlib
from... |
sassoftware/sas-viya-programming | python/AX2016/Using Python With SAS Cloud Analytic Services (CAS).ipynb | apache-2.0 | import swat
conn = swat.CAS('cas01', 49786)
"""
Explanation: SWAT is the open-source Python interface to SAS’ cloud-based, fault-tolerant, in-memory analytics server.
* Connects to CAS using binary (currently Linux only) or REST interface
* Calls CAS analytic actions and returns results in Python objects
* Implements... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session14/Day2/BuildingPerceptronsForClassificationSolutions.ipynb | mit | def walk_dog(questions, weights=np.array([-2, -1, 5]), threshold=2.5):
'''Perceptron to calculate whether we should walk the dog
Parameters
----------
questions : array-like, size = 3
weights : array-like, optional (default = np.array([-2, -1, 5]))
threshold : float, optional (default = 2.... |
ireapps/cfj-2017 | completed/16. Debugging strategies.ipynb | mit | x = 10
if x > 20
print('x is greater than 20!')
"""
Explanation: Debugging strategies
You will get errors in your scripts. This is not a bad thing! It's just part of the process -- the error messages will help guide you to the solution. The key is to not get discouraged.
A typical development pattern: Write some ... |
dpshelio/2015-EuroScipy-pandas-tutorial | pandas_introduction.ipynb | bsd-2-clause | %matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn
pd.options.display.max_rows = 8
"""
Explanation: <CENTER>
<img src="img/PyDataLogoBig-Paris2015.png" width="50%">
<header>
<h1>Introduction to Pandas</h1>
<h3>April 3rd, 2015</h3>
<h2>Joris Van den Bos... |
dhhagan/py-smps | examples/Fit a Multi-Modal Distribution.ipynb | mit | import smps
import seaborn as sns
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import random
sns.set("notebook", style='ticks', font_scale=1.5, palette='dark')
smps.set()
%matplotlib inline
print ("smps v{}".format(smps.__version__))
print ("seaborn v{}".fo... |
maojrs/riemann_book | Nonlinear_elasticity.ipynb | bsd-3-clause | %matplotlib inline
%config InlineBackend.figure_format = 'svg'
import matplotlib as mpl
mpl.rcParams['font.size'] = 8
figsize =(8,4)
mpl.rcParams['figure.figsize'] = figsize
import numpy as np
from scipy.optimize import fsolve
import matplotlib.pyplot as plt
from utils import riemann_tools
from ipywidgets import inter... |
ucsdlib/python-novice-inflammation | 7-defensive programming and TDD.ipynb | cc0-1.0 | numbers = [1.5, 2.3, 0.7, -0.001, 4.4]
total = 0.0
for n in numbers:
assert n > 0.0, 'Data should only contain positve values'
total += n
print('total is: ', total)
"""
Explanation: Defensive programming
We've covered:
variables and lists,
file i/o,
loops,
conditionals,
and functions
but we haven't shown whe... |
pombredanne/https-gitlab.lrde.epita.fr-vcsn-vcsn | doc/notebooks/polynomial.cotrie.ipynb | gpl-3.0 | import vcsn
"""
Explanation: polynomial.cotrie
Generate a "cotrie" automaton (multiple initial state, single final state automaton: a reversed tree) from a finite series, given as a polynomial of words.
Postconditions:
- Result.is_codeterministic()
- Result = p.cotrie.shortest(N) for a large enough N.
See also:
- cont... |
STREAM3/pyisc | docs/pyISC_sklearn_anomaly_detection.ipynb | lgpl-3.0 | import numpy as np
import pyisc
# Get some data:
X = np.array([[20, 4], [1200, 130], [12, 8], [27, 8], [-9, 13], [2, -6]])
# Create an anomaly detector where the numbers are column indices of the data:
anomaly_detector = pyisc.AnomalyDetector(
pyisc.P_Gaussian([0,1])
)
# The anomaly detector is trained
anomaly_d... |
zonca/healpy | doc/blm_gauss_plot.ipynb | gpl-2.0 | import healpy as hp
import numpy as np
import matplotlib.pyplot as plt
from astropy import units as u
"""
Explanation: Example of generating a Gaussian beam in spherical harmonics space
Generate $b_{lm}$ representation of a Gaussian beam
End of explanation
"""
lmax = 32
pol = True
nside = 64
beam_width = 10 * u.degr... |
aerospace-notebook/aerospace-notebook | Fixed Wing Dynamics.ipynb | bsd-3-clause | P_r, Q_r, R_r, k_P, k_Q, k_R, k_theta, k_phi, k_alpha, k_dh, k_ah, dh_r, V_T_r, k_V_thr, k_rdr_beta, k_ail_beta, k_alpha_thr, alpha_r = \
sympy.symbols('P_r, Q_r, R_r, k_P, k_Q, k_R, k_theta, k_phi, k_alpha, k_dh, k_ah, dh_r, V_T_r, k_V_thr, k_rdr_beta, k_ail_beta, k_alpha_thr, alpha_r')
phi_r = k_P *(P_r - P)
ail... |
srodriguex/coursera_data_management_and_visualization | Week_2.ipynb | mit | # This package is very useful to data analysis in Python.
import pandas as pd
# Read the csv file to a dataframe object.
df = pd.read_csv('data/gapminder.csv')
# Convert all number values to float.
df = df.convert_objects(convert_numeric=True)
# Define the Country as the unique id of the dataframe.
df.index = df.cou... |
mbakker7/ttim | pumpingtest_benchmarks/5_test_of_sioux.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from ttim import *
"""
Explanation: Confined Aquifer Test
This test is taken from AQTESOLV examples.
End of explanation
"""
Q = 6605.754 #constant discharge in m^3/d
b = -15.24 #aquifer thickness in m
rw = 0.1524 #well radius i... |
Tykovka/pet-friendly | PetFriendly.ipynb | mit | from __future__ import division
from IPython.display import display
import pandas as pd
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
import humanize
"""
Explanation: Pet Friendly Travels
An analysis of pet friendly accommodation listings published on Airbnb.
— December 2015 —
The impetus for th... |
gojomo/gensim | docs/notebooks/translation_matrix.ipynb | lgpl-2.1 | import os
from gensim import utils
from gensim.models import translation_matrix
from gensim.models import KeyedVectors
"""
Explanation: Tranlation Matrix Tutorial
What is it ?
Suppose we are given a set of word pairs and their associated vector representaion ${x_{i},z_{i}}{i=1}^{n}$, where $x{i} \in R^{d_{1}}$ is the... |
McIntyre-Lab/papers | fear_ase_2016/scripts/cis_summary/maren_equations_part2.ipynb | lgpl-3.0 | # Set-up default environment
%run '../ipython_startup.py'
# Import additional libraries
import sas7bdat as sas
import cPickle as pickle
from ase_cisEq import marenEq
from ase_cisEq import marenPrintTable
from ase_normalization import meanStd
from ase_plotting import dfPanelScatter
"""
Explanation: Maren Equations
... |
hathix/searchbetter | notebooks/searchbetter-demo.ipynb | mit | # First, let's get all the imports out of the way...
import gensim.models.word2vec as word2vec
from pprint import pprint
import sys
sys.path.append('../')
sys.path.append('../src/')
import searchbetter.search as search
reload(search)
import searchbetter.rewriter as rewriter
reload(rewriter)
import secure
"""
Expla... |
Chris35Wills/Chris35Wills.github.io | _drafts/CONVOLUTION/MovingWindows_Convolution_1D_2D.ipynb | mit | import numpy as np
def rolling_apply(fun, a, w):
r = np.empty(a.shape)
r.fill(np.nan)
for i in range(w - 1, a.shape[0]):
r[i] = fun(a[(i-w+1):i+1])
return r
"""
Explanation: Moving windows
1D example
All text below adapted from: https://rigtorp.se/2011/01/01/rolling-statistics-numpy.html
To ... |
google/applied-machine-learning-intensive | content/00_prerequisites/01_intermediate_python/01-exceptions.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... |
drvinceknight/TwoThirds | demo.ipynb | mit | import twothirds
import random
"""
Explanation: Demo of the two thirds library
This notebook gives a demo of the two thirds library which can be used to analyse runnings of the two thirds library.
To install the library you can run pip install twothirds or get the git repository here.
A basic single game
End of expla... |
AllenDowney/ProbablyOverthinkingIt | gluten.ipynb | mit | from __future__ import print_function, division
import thinkbayes2
import thinkplot
from scipy import stats
%matplotlib inline
"""
Explanation: Evidence of gluten sensitivity
This notebook contains an exploration of results from this paper:
http://onlinelibrary.wiley.com/doi/10.1111/apt.13372/epdf
which reports res... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a/td1a_correction_session2.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 1A.1 - Variables, boucles, tests (correction)
Boucles, tests, correction.
End of explanation
"""
l = [ 4, 3, 0, 2, 1 ]
i = 0
while l[i] != 0 :
i = l[i]
print (i) # que vaut l[i] à la fin ?
"""
Explanation: Partie 3 :... |
jasonding1354/PRML_Notes | 1.PROBABILITY_DISTRIBUTIONS/1.3 The_Gaussian_Distribution.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import uniform
from scipy.stats import binom
from scipy.stats import norm as norm_dist
def uniform_central_limit(n, length):
"""
@param:
n:计算rv的n次平均值, length:平均随机变量的样本数
@return:
rv_mean: 长度为length的数组,它是平均随机变量的样本... |
giacomov/3ML | docs/notebooks/spectral_models.ipynb | bsd-3-clause | from astromodels.functions.function import Function1D, FunctionMeta, ModelAssertionViolation
"""
Explanation: Spectral Models
Spectral models are provided via astromodels. For details, visit the astromodels documentation.
The important points are breifly covered below.
Building Custom Models
One of the most powerful... |
CrowdTruth/CrowdTruth-core | tutorial/tutorial.ipynb | apache-2.0 | !pip install crowdtruth
"""
Explanation: Getting Started with CrowdTruth metrics
This tutorial will explain how to use CrowdTruth metrics to process data that was collected with crowdsourcing. For more information about the metrics and how they work, read this paper.
Installing the library
First, you will need to inst... |
mdda/fossasia-2016_deep-learning | notebooks/2-CNN/4-ImageNet/2-googlenet_theano.ipynb | mit | import theano
import theano.tensor as T
import lasagne
from lasagne.utils import floatX
import numpy as np
import scipy
import matplotlib.pyplot as plt
%matplotlib inline
import os
import json
import pickle
"""
Explanation: ImageNet with GoogLeNet
Input
GoogLeNet (the neural network structure which this notebook u... |
karlstroetmann/Artificial-Intelligence | Python/2 Constraint Solver/Crypto-Arithmetic.ipynb | gpl-2.0 | def allDifferent(Variables):
return { f'{x} != {y}' for x in Variables
for y in Variables
if x < y
}
"""
Explanation: A Crypto-Arithmetic Puzzle
In this notebook we formulate the crypto-arithmetic puzzle shown in the picture below as a constraint s... |
phoebe-project/phoebe2-docs | 2.2/tutorials/plotting.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: Plotting
This tutorial explains the high-level interface to plotting provided by the Bundle. You are of course always welcome to access arrays and plot manually.
PHOEBE 2.2 uses autofig 1.1 as an intermediate layer for highend functionality to matplotlib.
Setup
Let'... |
joannekoong/neuroscience_tutorials | basic/2. Frequency analysis.ipynb | bsd-2-clause | %pylab inline
"""
Explanation: 2. Frequency analysis
This tutorial covers basic frequency analysis of the EEG signal. The recording that is used is of a subject performing the SSVEP (steady-state visual evoked potential) paradigm. In simplest terms: when we look at a light that is flashing on and off at a certain freq... |
NEONScience/NEON-Data-Skills | tutorials-in-development/CyverseNEON/hyperspectral/Unsupervised_Hyperspectral_Classification_KMeans_PCA.ipynb | agpl-3.0 | from spectral import *
import spectral.io.envi as envi
import numpy as np
import matplotlib
"""
Explanation: Unsupervised Hyperspectral Classification
KMeans, Principal Component Analysis
In this tutorial, we will use the Spectral Python (SPy) package to run KMeans and Principal Component Analysis unsupervised classif... |
jgarciab/wwd2017 | class7/class7_linearRegression.ipynb | gpl-3.0 | ##Some code to run at the beginning of the file, to be able to show images in the notebook
##Don't worry about this cell
#Print the plots in this screen
%matplotlib inline
#Be able to plot images saved in the hard drive
from IPython.display import Image
#Make the notebook wider
from IPython.core.display import dis... |
zerothi/ts-tbt-sisl-tutorial | TB_07/run.ipynb | gpl-3.0 | square = sisl.Geometry([0,0,0], sisl.Atom(1, R=1.0), sc=sisl.SuperCell(1, nsc=[3, 3, 1]))
on, nn = 4, -1
H_minimal = sisl.Hamiltonian(square)
H_minimal.construct([[0.1, 1.1], [on, nn]])
H_elec = H_minimal.tile(100, 1).tile(2, 0)
H_elec.set_nsc([3, 1, 1])
H_elec.write('ELEC.nc')
H = H_elec.tile(50, 0)
# Make a constr... |
michaelneuder/image_quality_analysis | bin/nets/old/conv_net_single.ipynb | mit | #!/usr/bin/env python3
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import numpy as np
np.set_printoptions(threshold=np.nan)
import tensorflow as tf
import time
import pandas as pd
import matplotlib.pyplot as plt
import progressbar
"""
Explanation: single patch conv net
this notebook it an attempt to solve some of... |
NYUDataBootcamp/Projects | MBA_S16/Stillman-Restaurants-Project.ipynb | mit | import sys # system module
import pandas as pd # data package
import matplotlib.pyplot as plt # graphics module
import datetime as dt # date and time module
import numpy as np # foundation for Pandas
import seaborn.apionly as s... |
leoferres/prograUDD | certamenes/Certamen2_B_TI2_2017_1.ipynb | mit | ##escriba la función aqui##
horaValida('13:00:00')
"""
Explanation: Certamen 2B, TI 2, 2017-1
Leo Ferres & Rodrigo Trigo
UDD
Pregunta 1
Cree la función horaValida(fecha) que devuelva True si el argumento es una hora real, o False si no. Ejemplo, "15:61:01" no es válida. La hora se dará en el siguiente formato: hh:mm:... |
timothydmorton/usrp-sciprog | day2/exercises/solarsystem-test.ipynb | mit | from solarsystem import Planet, Star, System
sun = Star()
print(sun)
"""
Explanation: Write a solarsystem.py file that implements the Planet, Star, and System objects such that running the cells in this notebook produce the desired output. For calculating planet densities, just use that the density of Earth is 5.51 ... |
mne-tools/mne-tools.github.io | 0.21/_downloads/974f822d2280f83b67727ee3355c7c2f/plot_sensor_connectivity.ipynb | bsd-3-clause | # Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import mne
from mne import io
from mne.connectivity import spectral_connectivity
from mne.datasets import sample
from mne.viz import plot_sensors_connectivity
print(__doc__)
"""
Explanation: Compute all-to-all connectivity in sensor sp... |
manparvesh/manparvesh.github.io | oldsitejekyll/markdown_generator/talks.ipynb | mit | import pandas as pd
import os
"""
Explanation: Talks markdown generator for academicpages
Takes a TSV of talks with metadata and converts them for use with academicpages.github.io. This is an interactive Jupyter notebook (see more info here). The core python code is also in talks.py. Run either from the markdown_gener... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/contrasts.ipynb | bsd-3-clause | import numpy as np
import statsmodels.api as sm
"""
Explanation: Contrasts Overview
End of explanation
"""
import pandas as pd
url = "https://stats.idre.ucla.edu/stat/data/hsb2.csv"
hsb2 = pd.read_table(url, delimiter=",")
hsb2.head(10)
"""
Explanation: This document is based heavily on this excellent resource fr... |
jakobrunge/tigramite | tutorials/tigramite_tutorial_prediction.ipynb | gpl-3.0 | # Imports
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
%matplotlib inline
## use `%matplotlib notebook` for interactive figures
# plt.style.use('ggplot')
import sklearn
import tigramite
from tigramite import data_processing as pp
from tigramite.toymodels import structural_causal_proce... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.