repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
ES-DOC/esdoc-jupyterhub | notebooks/miroc/cmip6/models/sandbox-1/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'miroc', 'sandbox-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: MIROC
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Transport, Emissions, Con... |
guilgautier/DPPy | notebooks/Tuto_DPPy.ipynb | mit | # !pip install dppy
"""
Explanation: DPPy stands for "DPPs in Python". It is a Python Toolbox for sampling DPPs.
If you use this this toolbox please consider citing the corresponding JMLR-MLOSS companion paper
In this notebook, we showcase the DPP samplers featured in DPPy, and highlight some of the tools behind the s... |
bayesimpact/bob-emploi | data_analysis/notebooks/datasets/rome/name_gendering.ipynb | gpl-3.0 | from itertools import chain
import pandas as pd
import re
from bob_emploi.data_analysis.lib import cleaned_data
jobs = cleaned_data.rome_jobs('../../../data')
"""
Explanation: Author: Paul Duan
Skip the run test because the ROME version has to be updated to make it work in the exported repository. TODO: Update ROME ... |
maxis42/ML-DA-Coursera-Yandex-MIPT | 5 Data analysis applications/Lectures notebooks/1 wine sales time series/wine.ipynb | mit | %pylab inline
import pandas as pd
from scipy import stats
import statsmodels.api as sm
import matplotlib.pyplot as plt
import warnings
from itertools import product
def invboxcox(y,lmbda):
if lmbda == 0:
return(np.exp(y))
else:
return(np.exp(np.log(lmbda*y+1)/lmbda))
wine = pd.read_csv('monthly-aust... |
LucaCanali/Miscellaneous | Trino_Presto_Jupyter/Trino_histograms.ipynb | apache-2.0 | # Connect to trino using the Python library
# See also https://github.com/trinodb/trino-python-client
!pip install trino
"""
Explanation: How to generate histograms using Trino and Presto
This provides and example of how to generate frequency histograms using Trino and Presto.
Disambiguation: we refer here to computin... |
mne-tools/mne-tools.github.io | 0.24/_downloads/efd09079125b2bd222e2dd62aaaccfa4/source_space_snr.ipynb | bsd-3-clause | # Author: Padma Sundaram <tottochan@gmail.com>
# Kaisu Lankinen <klankinen@mgh.harvard.edu>
#
# License: BSD-3-Clause
import mne
from mne.datasets import sample
from mne.minimum_norm import make_inverse_operator, apply_inverse
import numpy as np
import matplotlib.pyplot as plt
print(__doc__)
data_path = samp... |
3DGenomes/tadbit | doc/notebooks/tutorial_4-Mapping.ipynb | gpl-3.0 | from pytadbit.mapping.full_mapper import full_mapping
"""
Explanation: Iterative vs fragment-based mapping
Iterative mapping first proposed by <a name="ref-1"/>(Imakaev et al., 2012), allows to map usually a high number of reads. However other methodologies, less "brute-force" can be used to take into account the chim... |
junhwanjang/DataSchool | Lecture/17. 분류의 기초/4) 분류(classification) 성능 평가.ipynb | mit | from sklearn.metrics import confusion_matrix
y_true = [2, 0, 2, 2, 0, 1]
y_pred = [0, 0, 2, 2, 0, 2]
confusion_matrix(y_true, y_pred)
y_true = ["cat", "ant", "cat", "cat", "ant", "bird"]
y_pred = ["ant", "ant", "cat", "cat", "ant", "cat"]
confusion_matrix(y_true, y_pred, labels=["ant", "bird", "cat"])
"""
Explanatio... |
NeuroDataDesign/seelviz | Tony/ipynb/FA Visualizations Final.ipynb | apache-2.0 | from dipy.reconst.dti import fractional_anisotropy, color_fa
from argparse import ArgumentParser
from scipy import ndimage
import os
import re
import numpy as np
import nibabel as nb
import sys
import matplotlib
matplotlib.use('Agg') # very important above pyplot import
import matplotlib.pyplot as plt
import vtk
fr... |
tmolteno/TART | doc/calibration/phase/Far_Field.ipynb | lgpl-3.0 | import sympy as sp
sp.init_printing(use_latex="mathjax")
r = sp.Symbol('r', real=True, positive=True)
b = sp.Symbol('b', real=True, positive=True)
distance_error = sp.simplify(r*(1 - sp.cos(sp.asin(b/r))))
distance_error
"""
Explanation: Far field calculations for phase calibration
For a source at distance $r$ fro... |
jreback/pandas | doc/source/user_guide/style.ipynb | bsd-3-clause | import matplotlib.pyplot
# We have this here to trigger matplotlib's font cache stuff.
# This cell is hidden from the output
import pandas as pd
import numpy as np
np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],
... |
MTgeophysics/mtpy | examples/notebooks/plot_resistivity_seismic_simplified.ipynb | gpl-3.0 | %%capture
# Add mtpy folder to python path. This may not be necessary
# depending on how mtpy was installed.
import sys
#sys.path.append('/path/to/mtpy')
sys.path.append('/media/data/work/GA/ausLAMP/codes/mtGeoMtpy/')
from mtpy.modeling.modem.plot_slices import PlotSlices
%matplotlib inline
"""
Explanation: Plott... |
kazzz24/deep-learning | tensorboard/.ipynb_checkpoints/Anna KaRNNa Summaries-checkpoint.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is base... |
probml/pyprobml | notebooks/misc/linreg_pymc3.ipynb | mit | %matplotlib inline
import sklearn
import scipy.stats as stats
import scipy.optimize
import matplotlib.pyplot as plt
import seaborn as sns
import time
import numpy as np
import os
import pandas as pd
# We install various packages for approximate Bayesian inference
# To avoid installing packages the internet every time ... |
AnasFullStack/Awesome-Full-Stack-Web-Developer | algorithms/python_revision.ipynb | mit | print(2 ** 10)
print(2 ** 100)
print(7 // 3)
print(7 / 3)
print(7 % 3)
"""
Explanation: Python Quick Revision
Book URL
1.8. Getting Started with Data
End of explanation
"""
fakeList = ['str', 12, True, 1.232] # heterogeneous
print(fakeList)
myList = [1,2,3,4]
A = [myList] * 3
print(A)
myList[2]=45454545
print(A)
""... |
ProfessorKazarinoff/staticsite | content/code/ENGR213/Problem_4C1.ipynb | gpl-3.0 | h = 40
b = 60
ha = 2
hs = h - 2*ha
Ea = 75*10**3 #Elastic modulus in MPa
Es = 200*10**3 #Elastic modulus in MPa
M = 1500*10**3 # N mm
"""
Explanation: Below is an engineering mechanics problem that can be solved with Python. Follow along to see how to solve the problem with code.
Problem
Given:
Two aluminum strips and... |
alexvmarch/atomic | docs/source/notebooks/03_orbitals.ipynb | apache-2.0 | import exatomic
from exatomic.base import resource # Easy access to static files
from exatomic import UniverseWidget as UW # The visualization system
"""
Explanation: Visualize Orbitals
End of explanation
"""
from exatomic import gaussian
uni = gaussian.Output(resource('g09-ch3nh2-631g.out')).to_universe()... |
a-mt/dev-roadmap | docs/!ml/notebooks/Logistic Regression.ipynb | mit | df = pd.DataFrame({
'Age': [20,16.2,20.2,18.8,18.9,16.7,13.6,20.0,18.0,21.2,
25,31.2,25.2,23.8,23.9,21.7,18.6,25.0,23.0,26.2],
'Experience': [2.3,2.2,1.8,1.4,3.2,3.9,1.4,1.4,3.6,4.3,
4.3,4.2,3.8,3.4,5.2,5.9,3.4,3.4,5.6,6.3],
'Badass': [0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/images/mnist_linear.ipynb | apache-2.0 | import tensorflow as tf
print(tf.__version__)
!pip freeze | grep tensorflow==2.0.0b1 || pip install tensorflow==2.0.0b1
import os
import shutil
import unittest
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.keras import Sequential
from tensorflow.keras.layers import Dense, Flatten, Softmax
from ... |
undercertainty/ou_nlp | semeval_experiments/linear-regression-beetles.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
import tensorflow as tf
import pandas as pd
from sklearn.decomposition import PCA
from sklearn.model_selection import train_test_split
# to make this notebook's ou... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/SDK_AutoML_Video_Classification.ipynb | apache-2.0 | !pip3 uninstall -y google-cloud-aiplatform
!pip3 install google-cloud-aiplatform
import IPython
app = IPython.Application.instance()
app.kernel.do_shutdown(True)
"""
Explanation: Feedback or issues?
For any feedback or questions, please open an issue.
Vertex SDK for Python: AutoML Video Classification Example
To use ... |
sony/nnabla | tutorial/debugging.ipynb | apache-2.0 | !pip install nnabla-ext-cuda100
!git clone https://github.com/sony/nnabla.git
%cd nnabla/tutorial
import numpy as np
import nnabla as nn
import nnabla.logger as logger
import nnabla.functions as F
import nnabla.parametric_functions as PF
import nnabla.solvers as S
def block(x, maps, test=False, name="block"):
h =... |
DistrictDataLabs/ceb-training | 04 - Classification Models.ipynb | mit | # Using the IRIS data set - the classic classification data set.
from sklearn.cross_validation import train_test_split as tts
from sklearn.datasets import load_iris
from sklearn.metrics import classification_report
data = load_iris()
X_train, X_test, y_train, y_test = tts(data.data, data.target)
"""
Explanation: Cla... |
flohorovicic/pynoddy | Example3DvisualizationPyNoddyAndCSV2History.ipynb | gpl-2.0 | # Determine the path to the noddy file
#(comment the first line and uncomment the second to see the second model -
#which takes around a minute to generate)
modelfile = 'examples/strike_slip.his'
#modelfile = 'examples/Scenario3_MedResolution.his'
# Determine the path to the noddy executable
noddy_path = 'noddy.exe'
... |
csdms/bmi-live-2017 | nb/run-model-from-bmi.ipynb | mit | import numpy as np
"""
Explanation: <img src="img/csdms_logo.jpg">
BMI Live!
Let's use this notebook to test our BMI as we develop it.
Setup
Before we start, make sure you've installed the basic-modeling-interface package:
$ pip install basic-modeling-interface
Also install our bmi-live-2017 package in developer mode... |
datala/311-analysis | 311 Combining CSV Datasets, Parsing by Week.ipynb | mit | fifteen = pd.read_csv("MyLA311_Service_Request_Data_2015.csv", low_memory = False)
sixteen = pd.read_csv("MyLA311_Service_Request_Data_2016.csv", low_memory = False)
seventeen = pd.read_csv("MyLA311_Service_Request_Data_2017.csv", low_memory = False)
eighteen = pd.read_csv("MyLA311_Service_Request_Data_2018.csv", low_m... |
Olsthoorn/TransientGroundwaterFlow | Syllabus_in_notebooks/Sec6_5_Theis-well.ipynb | gpl-3.0 | from scipy.special import exp1
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import pdb
def newfig(title="title", xlabel="xlabel", ylabel="ylabel", xlim=None, ylim=None, xscale=None, yscale=None, size_inches=(12, 8),
fontsize=15):
fig, ax = plt.subplots()
fig.set_size_inches... |
TESScience/httm | test/notebooks/demo.ipynb | gpl-3.0 | %matplotlib inline
%config InlineBackend.figure_format = 'png'
import matplotlib
matplotlib.rcParams['figure.figsize'] = (8, 8)
"""
Explanation: Demo
Demonstrate httm image transformations.
Getting Started
Importing matplotlib
To start, we will import matplotlib and increase the figure size so we can reasonably see a... |
jmlon/PythonTutorials | numpy/VectorAndMatrixOperations.ipynb | gpl-3.0 | import numpy as np
"""
Explanation: Operaciones con vectores y matrices
NumPy ofrece un repertorio completo de operaciones entre escalares, vectores y matrices representados por ndarrays.
End of explanation
"""
a = np.array([ 1., 2., 3. ])
a+1
2*a
a**2
2**a
b = np.array([ [1,2,3], [4,5,6] ])
b
2*b+1
"""
Explan... |
rouseguy/europython2016_dl-nlp | notebooks/0. Introduction to DL and Keras.ipynb | mit | import numpy as np
import pandas as pd
# fix random seed for reproducibility
seed = 7
np.random.seed(seed)
#Read the dataset
data = pd.read_csv("../data/sonar.csv", header=None)
#View the first 5 records
#Find number of rows and columns in data
#Find count of R and M in the target
# split into input (X) and o... |
raoyvn/deep-learning | 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... |
ES-DOC/esdoc-jupyterhub | notebooks/cas/cmip6/models/sandbox-3/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cas', 'sandbox-3', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: CAS
Source ID: SANDBOX-3
Topic: Landice
Sub-Topics: Glaciers, Ice.
Properties: 3... |
GoogleCloudPlatform/training-data-analyst | blogs/bqml/taxifare_bqml.ipynb | apache-2.0 | %pip install google-cloud-bigquery seaborn
"""
Explanation: <h1> Structured data prediction using BigQuery ML </h1>
This notebook illustrates:
<ol>
<li> Training Machine Learning models using BQML
<li> Predicting with model
<li> Using spatial queries in BigQuery
<li> Building a linear regression model with feature cr... |
vanessajurtz/lasagne4bio | subcellular_localization/notebook tutorial/FFN.ipynb | gpl-3.0 | # Import all the necessary modules
import os
os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,optimizer=None,device=cpu,floatX=float32"
import sys
sys.path.insert(0,'..')
import numpy as np
import theano
import theano.tensor as T
import lasagne
from confusionmatrix import ConfusionMatrix
from utils import iterate_minibatche... |
phungkh/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 ... |
NYUDataBootcamp/Materials | Code/notebooks/bootcamp_pandas-merge.ipynb | mit | import pandas as pd # data package
import matplotlib.pyplot as plt # graphics
import sys # system module, used to get Python version
import os # operating system tools (check files)
import datetime as dt # date tools, used to note current date
# thes... |
georgetown-analytics/team-buzzfeed | tests/country_title.ipynb | mit | data.shape
"""
Explanation: The csv file only contains titles and countries of origin
End of explanation
"""
data['country_number'] = data.country.map({'en-us':0, 'en-uk':1, 'en-au':2, 'en-in':3, 'en-ca':4, 'fr-fr':5})
data.head(10)
"""
Explanation: (77245, 2)
End of explanation
"""
X = data.title
y = data.count... |
mne-tools/mne-tools.github.io | 0.18/_downloads/4365eab31ed2fa347de7f294ac9500c3/plot_label_from_stc.ipynb | bsd-3-clause | # Author: Luke Bloy <luke.bloy@gmail.com>
# Alex Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.minimum_norm import read_inverse_operator, apply_inverse
from mne.datasets import sample
print(__doc__)
data_pa... |
zingale/pyreaclib | electron-captures.ipynb | bsd-3-clause | import pynucastro as pyna
"""
Explanation: Combining ReacLib Rates with Electron Capture Tables
Here's an example of using tabulated weak rates from Suzuki et a. (2016) together with rates from the ReacLib database.
We'll build a network suitable for e-capture supernovae.
End of explanation
"""
reaclib_library = pyn... |
probml/pyprobml | notebooks/misc/sinkhorn_knopp_algorithm.ipynb | mit | import jax
import jax.numpy as jnp
from jax import jit
import numpy as np
import matplotlib.pyplot as plt
from tqdm.notebook import trange
from sklearn.datasets import make_circles
from scipy.spatial import distance_matrix
"""
Explanation: Installing packages
The code is from https://michielstock.github.io/posts/2017... |
nicolasfauchereau/paleopy | notebooks/WR.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import pandas as pd
"""
Explanation: Illustrates the use of the WR (Weather Regime) class
End of explanation
"""
import sys
sys.path.insert(0, '../')
from paleopy import proxy
from paleopy import analogs
from paleopy import ensemble
djsons = '../jsons/'
pjson... |
chusine/dlnd | language-translation/dlnd_language_translation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
dereneaton/RADmissing | old_sim_nb.ipynb | mit | ## Requirements
## - Python 2.7
## - pyrad v.3.1.0 (http://github.com/dereneaton/pyrad)
## - simrrls v.0.0.7 (http://github.com/dereneaton/simrrls)
import itertools
import ete2
import numpy as np
import toyplot
from collections import OrderedDict, Counter
"""
Explanation: Notebook 16: Simulating RADseq data
E... |
yangw1234/BigDL | python/orca/colab-notebook/quickstart/ncf_xshards_pandas.ipynb | apache-2.0 | # Install jdk8
!apt-get install openjdk-8-jdk-headless -qq > /dev/null
import os
# Set environment variable JAVA_HOME.
os.environ["JAVA_HOME"] = "/usr/lib/jvm/java-8-openjdk-amd64"
!update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
!java -version
"""
Explanation: <a href="https://cola... |
cwhy/mynotebooks | bday.ipynb | mit | # A decorator that memoize functions
def dynamic_programme(_F):
cache = {}
def memoizedF(*args):
if args not in cache:
cache[args] = _F(*args)
return cache[args]
dynamic_programme.cache = cache
return memoizedF
def fac_ratio(n): # n:int, returns n!/(n^n)
_r = 1
... |
urgedata/pythondata | fbprophet/fbprophet_part_one.ipynb | mit | import pandas as pd
import numpy as np
from fbprophet import Prophet
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize']=(20,10)
plt.style.use('ggplot')
"""
Explanation: Import necessary libraries
End of explanation
"""
sales_df = pd.read_csv('../examples/retail_sales.csv', index_co... |
GreatEmerald/geoscripting | Lesson14/Twitter assignment.ipynb | apache-2.0 | from __future__ import division
import tweepy
import datetime
import json
import os
from pysqlite2 import dbapi2 as sqlite3
"""
Explanation: Twitter data mining using Python assignment 14
Team Rython: Dainius Masiliunas and Tim Weerman
Date: 21st of January, 2016
Apache License 2.0
Imports
Make sure you have pysqlit... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_stats_spatio_temporal_cluster_sensors.ipynb | bsd-3-clause | # Authors: Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mne.viz import plot_topomap
import mne
from mne.stats import spatio_temporal_cluster_test
from mne.datasets import sample
fro... |
google-research/ott | docs/notebooks/GWLRSinkhorn.ipynb | apache-2.0 | import jax.numpy as jnp
import jax
import matplotlib.pyplot as plt
def create_points(rng, n, m, d1, d2):
rngs = jax.random.split(rng, 5)
x = jax.random.uniform(rngs[0], (n, d1))
y = jax.random.uniform(rngs[1], (m, d2))
a = jax.random.uniform(rngs[2], (n,))
b = jax.random.uniform(rngs[3], (m,))
a = a / jnp.... |
ES-DOC/esdoc-jupyterhub | notebooks/cccr-iitm/cmip6/models/sandbox-3/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-3', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: SANDBOX-3
Topic: Ocnbgchem
Sub-Topics: Tracers.
P... |
kingmolnar/DataScienceProgramming | 10-Information-Based-Learning/HW10/README_orig.ipynb | cc0-1.0 | import pandas as pd
import numpy as np
from __future__ import division
%%sh
## RUN BUT DO NOT EDIT THIS CELL
## run this cell to download the cereal dataset into your current directory
cp /home/data/cereal/cereal.csv .
## RUN BUT DO NOT EDIT THIS CELL
# load the data, define ratingID
cer = pd.read_csv('cereal.csv',... |
gigjozsa/HI_analysis_course | chapter_05_rfi_cont/.ipynb_checkpoints/05_01_contsub-checkpoint.ipynb | gpl-2.0 | print '# Executing MIRIAD commands'
simuv='sim01.uv'
if os.path.exists(simuv): shutil.rmtree(simuv)
run_uvgen=Run('uvgen source=pointsource01.txt ant=ew_layout.txt baseunit=-51.0204 radec=19:39:25.0,-83:42:46 freq=1.4,0 corr=256,1,0,100 out=%s harange=-6,6,0.016667 systemp=0 lat=-30.7 jyperk=19.28'%(simuv))
print '# Do... |
AllenDowney/ModSimPy | examples/bungee2.ipynb | mit | # install Pint if necessary
try:
import pint
except ImportError:
!pip install pint
# download modsim.py if necessary
from os.path import exists
filename = 'modsim.py'
if not exists(filename):
from urllib.request import urlretrieve
url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/'
... |
vbsteja/code | Python/ML_DL/DL/Neural-Networks-Demystified-master/Part 3 Gradient Descent.ipynb | apache-2.0 | from IPython.display import YouTubeVideo
YouTubeVideo('5u0jaA3qAGk')
"""
Explanation: <h1 align = 'center'> Neural Networks Demystified </h1>
<h2 align = 'center'> Part 3: Gradient Descent </h2>
<h4 align = 'center' > @stephencwelch </h4>
End of explanation
"""
%pylab inline
#Import code from last time:
from partT... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/.ipynb_checkpoints/L1_Starter_Code-checkpoint.ipynb | bsd-3-clause | import unicodecsv
## Longer version of code (replaced with shorter, equivalent version below)
# enrollments = []
# f = open('enrollments.csv', 'rb')
# reader = unicodecsv.DictReader(f)
# for row in reader:
# enrollments.append(row)
# f.close()
with open('enrollments.csv', 'rb') as f:
reader = unicodecsv.Dict... |
aidiary/notebooks | keras/171218-sequence-echo-problem.ipynb | mit | import numpy as np
import random
import pandas
from pandas import DataFrame
from keras.models import Sequential
from keras.layers import LSTM, Dense, TimeDistributed, RepeatVector
random.randint(0, 99)
# generate a sequence of random numbers in [0, 99]
def generate_sequence(length=25):
return [random.randint(0, 9... |
thisisbasil/SarcasmDetectionTwitter | Workflow3.ipynb | gpl-3.0 | subset = master[master['type']=='sarcastic'][:8000].append(master[master['type']=='genuine'][:8000])
# test_subset = master[master['type']=='sarcastic'][6000:8000].append(master[master['type']=='genuine'][6000:8000])
from sklearn.feature_extraction.text import CountVectorizer
# from sklearn.feature_extraction import D... |
silburt/rebound2 | ipython_examples/TransitTimingVariations.ipynb | gpl-3.0 | import rebound
import numpy as np
"""
Explanation: Calculating Transit Timing Variations (TTV) with REBOUND
The following code finds the transit times in a two planet system. The transit times of the inner planet are not exactly periodic, due to planet-planet interactions.
First, let's import the REBOUND and numpy pac... |
amirziai/learning | reinforcement-learning/kwik.ipynb | mit | from collections import Counter
class Kwik:
def __init__(self, number_of_patrons):
# Init
self.current_i_do_not_knows = 0
self.number_of_patrons = number_of_patrons
self.max_i_do_not_knows = self.number_of_patrons * (self.number_of_patrons - 1)
self.instigator = None
... |
diegocavalca/Studies | programming/Python/tensorflow/exercises/Seq2Seq_solutions.ipynb | cc0-1.0 | # Inputs and outputs: ten digits
x = tf.placeholder(tf.int32, shape=(32, 10))
y = tf.placeholder(tf.int32, shape=(32, 10))
# One-hot encoding
enc_inputs = tf.one_hot(x, 10)
dec_inputs = tf.concat((tf.zeros_like(y[:, :1]), y[:, :-1]), -1)
dec_inputs = tf.one_hot(dec_inputs, 10)
# encoder
encoder_cell = tf.contrib.rnn.... |
balarsen/pymc_learning | tutorial_examples/0_linear_regression.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import pymc3 as pm
from scipy import optimize
%matplotlib inline
"""
Explanation: This is the most basic example from pymc3's "Get started with PyMC3" page
Assume you have a variable mu that is distributed as a normal distrbution,
Y ~ N(mu, var) where "~" means is dis... |
facebookincubator/prophet | notebooks/diagnostics.ipynb | bsd-3-clause | fig = plt.figure(facecolor='w', figsize=(10, 6))
ax = fig.add_subplot(111)
ax.plot(m.history['ds'].values, m.history['y'], 'k.')
ax.plot(df_cv['ds'].values, df_cv['yhat'], ls='-', c='#0072B2')
ax.fill_between(df_cv['ds'].values, df_cv['yhat_lower'],
df_cv['yhat_upper'], color='#0072B2',
... |
solowPy/binder | notebooks/2 Finding the steady state.ipynb | mit | # define model parameters
ces_params = {'A0': 1.0, 'L0': 1.0, 'g': 0.02, 'n': 0.03, 's': 0.15,
'delta': 0.05, 'alpha': 0.33, 'sigma': 0.95}
# create an instance of the solow.Model class
ces_model = solowpy.CESModel(params=ces_params)
"""
Explanation: 2. Computing the steady state
Traditionally, most ana... |
cholla-hydro/cholla | python_scripts/Projection_Slice_Tutorial.ipynb | mit | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import h5py
from mpl_toolkits.axes_grid1 import make_axes_locatable
"""
Explanation: This notebook shows how to make a column density plot and a temperature slice from a 3D Cholla dataset.
End of explanation
"""
mp = 1.672622e-24 # mass of hydrogre... |
fja05680/pinkfish | examples/050.golden-cross/golden-cross-tutorial.ipynb | mit | import datetime
import matplotlib.pyplot as plt
import pandas as pd
import pinkfish as pf
# Format price data
pd.options.display.float_format = '{:0.2f}'.format
%matplotlib inline
# Set size of inline plots
'''note: rcParams can't be in same cell as import matplotlib
or %matplotlib inline
%matplotlib not... |
PyPSA/PyPSA | examples/notebooks/scigrid-lopf-then-pf.ipynb | mit | import pypsa
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
%matplotlib inline
network = pypsa.examples.scigrid_de(from_master=True)
"""
Explanation: Non-linear power flow after LOPF
In this example, the dispatch of generators is optimised using the linear... |
AllenDowney/ModSim | soln/chap11.ipynb | gpl-2.0 | # install Pint if necessary
try:
import pint
except ImportError:
!pip install pint
# download modsim.py if necessary
from os.path import exists
filename = 'modsim.py'
if not exists(filename):
from urllib.request import urlretrieve
url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/'
... |
GoogleCloudPlatform/training-data-analyst | courses/ai-for-finance/practice/kalman_filters.ipynb | apache-2.0 | !pip install pykalman
!pip install qq-training-wheels auquan_toolbox --upgrade
# Import a Kalman filter and other useful libraries
from pykalman import KalmanFilter
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import poly1d
from backtester.dataSource.yahoo_data_source import Yaho... |
dominikgrimm/ridge_and_svm | Anwendungsbeispiel.ipynb | mit | %matplotlib inline
import scipy as sp
import matplotlib
import pylab as pl
matplotlib.rcParams.update({'font.size': 15})
from sklearn.linear_model import Ridge
from sklearn.svm import SVC
from sklearn.model_selection import KFold, StratifiedKFold, GridSearchCV,StratifiedShuffleSplit
from sklearn.model_selection import... |
rueedlinger/machine-learning-snippets | notebooks/automl/regression_with_automl.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from sklearn import datasets, metrics, model_selection, preprocessing, pipeline
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import autosklearn.regression
"""
Explanation... |
google-aai/sc17 | cats/nn_demo_part1.ipynb | apache-2.0 | import numpy as np
# Set up the data and network:
n_outputs = 5 # We're attempting to learn XOR in this example, so our inputs and outputs will be the same.
n_hidden_units = 10 # We'll use a single hidden layer with this number of hidden units in it.
n_obs = 500 # How many observations of the XOR input to output ve... |
csdms/pymt | notebooks/ecsimplesnow.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
# Load PyMT model(s)
import pymt.models
ec = pymt.models.ECSimpleSnow()
"""
Explanation: ECSimpleSnow component
ECSimpleSnow is an empirical algorithm to melt snow according to the surface temperature and increase snow depth accor... |
jarvis-fga/Projetos | Problema 2/Daniel - Julliana/.ipynb_checkpoints/Amazon-checkpoint.ipynb | mit | import codecs
with codecs.open("imdb_labelled.txt", "r", "utf-8") as arquivo:
vetor = []
for linha in arquivo:
vetor.append(linha)
with codecs.open("amazon_cells_labelled.txt", "r", "utf-8") as arquivo:
for linha in arquivo:
vetor.append(linha)
with codecs.open("yelp_labelled.txt", "r", "... |
tensorflow/docs-l10n | site/ja/guide/intro_to_graphs.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... |
kimkipyo/dss_git_kkp | Python 복습/12일차.금_Pandas의 고급기능_DB/12일차_3T_Pandas Basic (3) - 데이터 그룹화 ( df.groupby ).ipynb | mit | df = pd.DataFrame(columns=["시", "동"])
df
df.loc[0] = ["서울", "신사동"]
df.loc[1] = ["서울", "대치동"]
df.loc[2] = ["서울", "봉천동"]
df.loc[3] = ["부산", "부산 1동"]
df.loc[4] = ["부산", "부산 2동"]
df.loc[5] = ["경북", "효자동"]
df.loc[6] = ["경북", "지곡동"]
df
"""
Explanation: 3T_Pandas Basic (3) - 데이터 그룹화 ( df.groupby )
Group by라는 기능. 그룹을 나눈다... |
IIPBC/Material | machine_learning_Nina/Exercise0-1.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Exercício 0-1
Básico do básico<br>
Apenas para acostumar-se com conjunto de dados (quem é $\mathbf{x}$, quem é $y$), como plotá-los.
1. Importar algumas bibliotecas
End of explanation
"""
# O arquivo de dados é um txt no qual cada linha
# contém doi... |
Lstyle1/Deep_learning_projects | transfer-learning/Transfer_Learning.ipynb | mit | !pip install tqdm
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, bl... |
desihub/desitarget | doc/nb/Ledgers.ipynb | bsd-3-clause | # Standard target files, hp 39 only.
targets = Table.read('/project/projectdirs/desi/target/catalogs/dr8/0.39.0/targets/sv/resolve//dark/sv1-targets-dr8-hp-39.fits')
targets
"""
Explanation: Original documentation
https://github.com/desihub/desitarget/pull/635
Grab a starting targets file.
End of explanation
"""
# ... |
miykael/nipype_tutorial | notebooks/advanced_interfaces_caching.ipynb | bsd-3-clause | from nipype.caching import Memory
mem = Memory(base_dir='.')
"""
Explanation: Interface caching
This section details the interface-caching mechanism, exposed in the nipype.caching module.
Interface caching: why and how
Pipelines (also called workflows) specify processing by an execution graph. This is useful because ... |
patonelli/estocastico | BrownianMotion.ipynb | gpl-2.0 | from scipy.stats import norm
# Process parameters
delta = 0.25
dt = 0.1
# Initial condition.
x = 0.0
# Number of iterations to compute.
n = 20
# Iterate to compute the steps of the Brownian motion.
for k in range(n):
print(k)
x = x + norm.rvs(scale=delta**2*dt)
print(x)
"""
Explanation: Brownian Motion... |
Mashimo/datascience | 01-Regression/moneyball.ipynb | apache-2.0 | import pandas as pd
baseball = pd.read_csv("../datasets/baseball.csv")
baseball.head()
baseball.columns
"""
Explanation: Moneyball: a linear regression example
a linear regression example
The book (and later a movie) Moneyball by Michael Lewis tells the story of how the USA baseball team Oakland Athletics in 2002 l... |
ARM-software/lisa | ipynb/deprecated/examples/wlgen/rtapp_custom_example.ipynb | apache-2.0 | # Setup a target configuration
my_conf = {
# Define the kind of target platform to use for the experiments
"platform" : 'linux', # Linux system, valid other options are:
# android - access via ADB
# linux - access via SSH
... |
jwjohnson314/data-801 | notebooks/introduction_to_python.ipynb | mit | # This is a code cell. In this cell, any line prefaced with a # is not executed
# the canonical first program
print('Hello World!')
"""
Explanation: Python is a general-purpose programming language that can be used for many scientific, statistical, and analytical tasks. Python has an elegant structure, clean and intu... |
anshbansal/anshbansal.github.io | udacity_machine_learning_notes/deep_learning/1_notmnist.ipynb | mit | # These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.line... |
gregtucker/landlab_algo_testing | flux_divergence_algorithms.ipynb | mit | from landlab import RasterModelGrid
import numpy as np
rg = RasterModelGrid(3, 4, 10.0)
z = rg.add_zeros('node', 'topographic__elevation')
rg.set_closed_boundaries_at_grid_edges(True, True, False, False)
#rg.set_closed_nodes([3, 7, 8, 9, 10, 11])
z[5] = 50.
z[6] = 36.
print(z)
"""
Explanation: This notebook contains... |
aflaxman/siaman16-va-minitutorial | 1-tutorial-notebooks/1-siamam16-intro.ipynb | gpl-3.0 | # this is a python comment
# this cell contains python code
# executing the cell yields the results of the python command
"""
Explanation: Welcome to the Jupyter Notebook
I might slip and call it the "IPython Notebook" sometimes, because it was originally just for interactive Python sessions. But it does much more ... |
OriolAbril/Statistics-Rocks-MasterCosmosUAB | Oriol/Optative_exercises.ipynb | mit | # Data of the problem
x_ex1 = np.arange(2, 3.1, 0.1)
y_ex1 = np.array([2.78, 3.29, 3.29, 3.33, 3.23, 3.69, 3.46, 3.87, 3.62, 3.40, 3.99])
sigma_ex1 = 0.3
"""
Explanation: Statistics Block 2: Exercises
1.Error propagation and confidence interval
Exercise 1.1
Consider $N$ measurements $(x_i,y_i)$ where the $y_i$ are ind... |
paninski-lab/yass | examples/evaluate/evaluation.ipynb | apache-2.0 | import numpy as np
import scipy.io
from yass.evaluate import stability, util, visualization, analyzer
"""
Explanation: Import the necessary libraries from yass
End of explanation
"""
# Get the gold standard spike train which shape (N, 2)
map_ = scipy.io.loadmat('/ssd/data/peter/ej49_dataset/groundtruth_ej49_data1_se... |
feststelltaste/software-analytics | notebooks/Spotting performance issues with vmstat.ipynb | gpl-3.0 | import pandas as pd
vmstat_raw = pd.read_csv("datasets/vmstat_load90.log", sep="\n", header=None, skiprows=1, names=["raw"])
vmstat_raw.head(2)
"""
Explanation: Introduction
Recentlym I came across the talk talk from the Diabolia
Among all the great tips, the vmstat command line utility seems to deliver great insights... |
ziky5/F4500_Python_pro_fyziky | lekce_03/cestakoreny.ipynb | mit | import matplotlib.pyplot as plt # plt je vseobecne uzivana zkratka, grafy si kreslime primo do notebookove stranky:
%matplotlib inline
"""
Explanation: <h1>Cesta ke kořenům</h1>
<p>Moto: panda v koruně pevného stromu</p>
<ul>
<li>Grafy bodů</li>
<li>Seznamy</li>
<li>Vektory v numpy</li>
<li>Grafy funkcí</li>
<li>... |
jseabold/statsmodels | examples/notebooks/quasibinomial.ipynb | bsd-3-clause | import statsmodels.api as sm
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from io import StringIO
"""
Explanation: Quasi-binomial regression
This notebook demonstrates using custom variance functions and non-binary data
with the quasi-binomial GLM family to perform a regression analysis using... |
rrbb014/data_science | fastcampus_dss/2016_06_23/0623_01.digits_rec_decision.ipynb | mit | digits.target_names
import StringIO
import pydot
from sklearn.tree import export_graphviz
from IPython.core.display import Image
def draw_decision_tree(classifier):
command_buf = StringIO.StringIO()
export_graphviz(classifier, out_file=command_buf )
graph = pydot.graph_from_dot_data(command_buf.getvalue(... |
rsheftel/pandas_market_calendars | examples/usage.ipynb | mit | nyse = mcal.get_calendar('NYSE')
"""
Explanation: Calendars
Basic Usage
Setup new exchange calendar
End of explanation
"""
nyse.tz.zone
"""
Explanation: Get the time zone
End of explanation
"""
holidays = nyse.holidays()
holidays.holidays[-5:]
"""
Explanation: Get the AbstractHolidayCalendar object
End of explan... |
KaoruNasuno/DataScienceTutorial | Lecture_01.ipynb | apache-2.0 | # TODO: You Must Change the setting bellow
MYSQL = {
'user': 'root',
'passwd': '',
'db': 'coupon_purchase',
'host': '127.0.0.1',
'port': 3306,
'local_infile': True,
'charset': 'utf8',
}
DATA_DIR = '/home/nasuno/recruit_kaggle_datasets' # ディレクトリの名前に日本語(マルチバイト文字)は使わないでください。
OUTPUTS_DIR = '/h... |
bloomberg/bqplot | examples/Marks/Object Model/Bins.ipynb | apache-2.0 | # Create a sample of Gaussian draws
np.random.seed(0)
x_data = np.random.randn(1000)
"""
Explanation: Bins Mark
This Mark is essentially the same as the Hist Mark from a user point of view, but is actually a Bars instance that bins sample data.
The difference with Hist is that the binning is done in the backend, so it... |
andrewosh/notebooks | worker/notebooks/thunder/tutorials/clustering.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('darkgrid')
sns.set_palette('muted')
sns.set_context('notebook')
from thunder import Colorize
image = Colorize.image
"""
Explanation: Clustering
KMeans clustering is a simple way to explore structure in series data, by finding grou... |
nick-youngblut/SIPSim | ipynb/bac_genome/fullCyc/Day1_fullDataset/.ipynb_checkpoints/rep3-checkpoint.ipynb | mit | import os
import glob
import re
import nestly
%load_ext rpy2.ipython
%load_ext pushnote
%%R
library(ggplot2)
library(dplyr)
library(tidyr)
library(gridExtra)
library(phyloseq)
"""
Explanation: Goal
Simulating fullCyc Day1 control gradients
Not simulating incorporation (all 0% isotope incorp.)
Don't know how much tr... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/building_production_ml_systems/solutions/4a_streaming_data_training_vertex.ipynb | apache-2.0 | import os
import shutil
from datetime import datetime
import pandas as pd
import tensorflow as tf
from google.cloud import aiplatform
from matplotlib import pyplot as plt
from tensorflow import keras
from tensorflow.keras.callbacks import TensorBoard
from tensorflow.keras.layers import Dense, DenseFeatures
from tensor... |
CrazyGuo/bokeh | examples/interactions/interactive_bubble/gapminder.ipynb | bsd-3-clause | fertility_df, life_expectancy_df, population_df_size, regions_df, years, regions = process_data()
sources = {}
region_color = regions_df['region_color']
region_color.name = 'region_color'
for year in years:
fertility = fertility_df[year]
fertility.name = 'fertility'
life = life_expectancy_df[year]
li... |
ekostat/ekostat_calculator | notebooks/.ipynb_checkpoints/lv_notebook_sharkwebdata-checkpoint.ipynb | mit | root_directory = 'D:/github/w_vattenstatus/ekostat_calculator'#"../" #os.getcwd()
workspace_directory = root_directory + '/workspaces'
resource_directory = root_directory + '/resources'
#alias = 'lena'
user_id = 'test_user' #kanske ska vara off_line user?
# workspace_alias = 'lena_indicator' # kustzonsmodellen_3daydat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.