repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
jbchouinard/dand_project1 | Data Analyst Nanodegree Project 1.ipynb | mit | # Imports
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from scipy.stats import ttest_rel, norm
# Read in data
df = pd.read_csv('stroopdata.csv')
"""
Explanation: Test a Perceptual Phenomenon
End of explanation
"""
IQR_congruent = df['Congruent'].quantile(0.75) - ... |
trangel/Data-Science | reinforcement_learning/crossentropy_method.ipynb | gpl-3.0 | # In Google Colab, uncomment this:
# !wget https://bit.ly/2FMJP5K -O setup.py && bash setup.py
# XVFB will be launched if you run on a server
import os
if type(os.environ.get("DISPLAY")) is not str or len(os.environ.get("DISPLAY")) == 0:
!bash ../xvfb start
os.environ['DISPLAY'] = ':1'
import gym
import numpy... |
statsmaths/stat665 | lectures/lec22/notebook22.ipynb | gpl-2.0 | %pylab inline
import copy
import numpy as np
import pandas as pd
import sys
import os
import re
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD, RMSprop
from keras.layers.normalization import BatchNormalization
from keras.layers.wrappers i... |
sonium0/pymatgen | examples/Ordering Disordered Structures.ipynb | mit | # Let us start by creating a disordered CuAu fcc structure.
from pymatgen import Structure, Lattice
specie = {"Cu0+": 0.5, "Au0+": 0.5}
cuau = Structure.from_spacegroup("Fm-3m", Lattice.cubic(3.677), [specie], [[0, 0, 0]])
print cuau
"""
Explanation: Introduction
This notebook demonstrates how to carry out an orderi... |
AllenDowney/ModSimPy | soln/chap02soln.ipynb | mit | # Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
# import functions from the modsim library
from modsim import *
# set the random number generator
np.ran... |
statsmodels/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... |
kinshuk4/MoocX | k2e/dev/languages/python/python_classes.ipynb | mit | # Import display
from IPython.display import display
# Example of instantiating a class
# Create a class
class Add:
def __init__(self, num_1, num_2):
self.num_1 = num_1
self.num_2 = num_2
def sum_all(self):
print("Method sum_all in class Add")
return self.num_1 + self.... |
nagordon/mechpy | tutorials/testing.ipynb | mit | # setup
import numpy as np
import sympy as sp
import pandas as pd
import scipy
from pprint import pprint
sp.init_printing(use_latex='mathjax')
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (12, 8) # (width, height)
plt.rcParams['font.size'] = 14
plt.rcParams['legend.fontsize'] = 16
from matplotlib... |
sjschmidt44/bike_share | bike_share_data_2.ipynb | mit | from pandas import DataFrame, Series
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
weather = pd.read_table('daily_weather.tsv')
usage = pd.read_table('usage_2012.tsv')
stations = pd.read_table('stations.tsv')
newseasons = {'Summer': 'Spring', 'Spring': 'Winter', 'Fall': 'S... |
rvernagus/data-science-notebooks | Data Science From Scratch/6 - Probability.ipynb | mit | def uniform_pdf(x):
return 1 if x >= 0 and x < 1 else 0
xs = np.arange(-1, 2, .001)
ys = [uniform_pdf(x) for x in xs]
plt.plot(xs, ys);
uniform_pdf(-0.01)
"""
Explanation: Probabilities are a way of quantifying the possibility of the occurrence of a specific event or events given the set of all possible events.
... |
mne-tools/mne-tools.github.io | stable/_downloads/1242d47b65d952f9f80cf19fb9e5d76e/35_eeg_no_mri.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Joan Massich <mailsik@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import numpy as np
import mne
from mne.datasets import eegbci
from mne.datasets import fetch_fsaverage
# Download fsa... |
dpshelio/2015-EuroScipy-pandas-tutorial | solved - 03 - Indexing and selecting data.ipynb | bsd-2-clause | %matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
try:
import seaborn
except ImportError:
pass
data = {'country': ['Belgium', 'France', 'Germany', 'Netherlands', 'United Kingdom'],
'population': [11.3, 64.3, 81.3, 16.9, 64.9],
'area': [30510, 671308, 357... |
mcs07/PubChemPy | examples/Chemical fingerprints and similarity.ipynb | mit | import pubchempy as pcp
from IPython.display import Image
"""
Explanation: Chemical similarity using PubChem fingerprints
End of explanation
"""
coumarin = pcp.Compound.from_cid(323)
Image(url='https://pubchem.ncbi.nlm.nih.gov/image/imgsrv.fcgi?cid=323&t=l')
coumarin_314 = pcp.Compound.from_cid(72653)
Image(url='ht... |
menpo/menpo3d-notebooks | notebooks/Rasterization Basics.ipynb | bsd-3-clause | import numpy as np
import menpo3d.io as mio
mesh = mio.import_builtin_asset('james.obj')
"""
Explanation: Offscreen Rasterization Basics
Menpo3D wraps a subproject called cyrasterize which allows for simple rasterization of 3D meshes. At the moment, only basic rendering is support, with no lighting. However, in the n... |
balarsen/pymc_learning | Distributions/fatiguelife.ipynb | bsd-3-clause | import itertools
import matplotlib.pyplot as plt
import matplotlib as mpl
from pymc3 import Model, Normal, Slice
from pymc3 import sample
from pymc3 import traceplot
from pymc3.distributions import Interpolated
import pymc3 as mc
from theano import as_op
import theano.tensor as tt
import numpy as np
from scipy import ... |
HrantDavtyan/Data_Scraping | Week 4/JSON.ipynb | apache-2.0 | import json
"""
Explanation: Working with JSON documents
JSON documents are very popular, especially when it comes to API responces and/or financial data. They provide nice, dictionary-like interface to data with the opportunity of working with keys rather than indecies only. Thus, Python has a built-in support for JS... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/launching_into_ml/solutions/supplemental/decision_trees_and_random_Forests_in_Python.ipynb | apache-2.0 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
%matplotlib inline
"""
Explanation: Decision Trees and Random Forests in Python
Learning Objectives
Explore and analyze data using a Pairplot
Train a single Decision Tree
Predict and evaluate the Decision Tree
Compare the De... |
Naereen/notebooks | euler/Project Euler (Python 3) - to problem 100.ipynb | mit | %load_ext Cython
%%cython
import math
def erathostene_sieve(int n):
cdef list primes = [False, False] + [True] * (n - 1) # from 0 to n included
cdef int max_divisor = math.floor(math.sqrt(n))
cdef int i = 2
for divisor in range(2, max_divisor + 1):
if primes[divisor]:
number = 2*d... |
bataeves/kaggle | sber/Model-Copy-0.31592.ipynb | unlicense | # train_raw = pd.read_csv("data/train.csv")
train_raw = pd.read_csv("data/train_without_noise.csv")
macro = pd.read_csv("data/macro.csv")
train_raw.head()
def preprocess_anomaly(df):
df["full_sq"] = map(lambda x: x if x > 10 else float("NaN"), df["full_sq"])
df["life_sq"] = map(lambda x: x if x > 5 else float(... |
GoogleCloudPlatform/ai-platform-samples | ai-platform/tutorials/unofficial/pytorch-on-google-cloud/sentiment_classification/pytorch-text-classification-caip-training.ipynb | apache-2.0 | !pip -q install torch==1.7
!pip -q install transformers
!pip -q install datasets
!pip -q install tqdm
"""
Explanation: Training PyTorch Model on Google Cloud AI Platform Training
Fine Tuning Pretrained BERT Model for Sentiment Classification Task
Overview
This example is inspired from Token-Classification notebook and... |
NervanaSystems/neon_course | 07 visualization callback.ipynb | apache-2.0 | from neon.backends import gen_backend
from neon.initializers import Gaussian
from neon.layers import Affine
from neon.data import MNIST
from neon.transforms import Rectlin, Softmax
from neon.models import Model
from neon.layers import GeneralizedCost
from neon.transforms import CrossEntropyMulti
from neon.optimizers im... |
WNoxchi/Kaukasos | FADL1/dogbreeds.ipynb | mit | # data = get_data(sz, bs)
# labels_df = pd.read_csv(labels_csv)
# labels_df.pivot_table(index='breed', aggfunc=len).sort_values('id', ascending=False)
# fn = PATH + data.trn_ds.fnames[0]
# PIL.Image.open(fn)
# size_d = {k: PIL.Image.open(PATH+k).size for k in data.trn_ds.fnames}
# row_sz, col_sz = list(zip(*size_d.v... |
phoebe-project/phoebe2-docs | development/tutorials/building_a_system.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt
logger = phoebe.logger()
b = phoebe.Bundle()
"""
Explanation: Advanced: Building a System
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this l... |
scoaste/showcase | machine-learning/regression/week-6-local-regression-assignment-completed.ipynb | mit | import graphlab
"""
Explanation: Predicting house prices using k-nearest neighbors regression
In this notebook, you will implement k-nearest neighbors regression. You will:
* Find the k-nearest neighbors of a given query input
* Predict the output for the query input using the k-nearest neighbors
* Choose the be... |
STREAM3/pyisc | docs/pyISC_classification_example.ipynb | lgpl-3.0 | import pyisc;
import numpy as np
from scipy.stats import poisson, norm, multivariate_normal
%matplotlib inline
from pylab import plot, figure
"""
Explanation: pyISC Example: Anomaly Detection with Classes
In this example, we extend the multivariate example to the use of classes. ISC also makes it possible to compute t... |
keras-team/keras-io | examples/keras_recipes/ipynb/bayesian_neural_networks.ipynb | apache-2.0 | import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import tensorflow_datasets as tfds
import tensorflow_probability as tfp
"""
Explanation: Probabilistic Bayesian Neural Networks
Author: Khalid Salama<br>
Date created: 2021/01/15<br>
Last modified: 2021/01/15<br... |
jaety/little-pieces | py/Rock Paper Scissors.ipynb | bsd-3-clause | import numpy as np
from numpy.linalg import matrix_power
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Rock, Paper, Scissors or... People are Predictable
The NY Times created a Rock, Paper, Scissors bot. If you try it, chances are it'll win handily. No matter how hard you try, you're going to fa... |
scoaste/showcase | machine-learning/regression/week-5-lasso-assignment-1-completed.ipynb | mit | import graphlab
"""
Explanation: Regression Week 5: Feature Selection and LASSO (Interpretation)
In this notebook, you will use LASSO to select features, building on a pre-implemented solver for LASSO (using GraphLab Create, though you can use other solvers). You will:
* Run LASSO with different L1 penalties.
* Choose... |
tensorflow/docs | site/en/tutorials/images/transfer_learning_with_hub.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... |
taliamo/Final_Project | organ_pitch/Scripts/.ipynb_checkpoints/upload_env_data-checkpoint.ipynb | mit | # I import useful libraries (with functions) so I can visualize my data
# I use Pandas because this dataset has word/string column titles and I like the readability features of commands and finish visual products that Pandas offers
import pandas as pd
import matplotlib.pyplot as plt
import re
import numpy as np
%matp... |
AllenDowney/ThinkBayes2 | examples/reddit_exam.ipynb | mit | # If we're running on Colab, install empiricaldist
# https://pypi.org/project/empiricaldist/
import sys
IN_COLAB = 'google.colab' in sys.modules
if IN_COLAB:
!pip install empiricaldist
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from empiricaldist import Pmf
"""
Explanation: Think Ba... |
SKA-ScienceDataProcessor/crocodile | examples/notebooks/aaf.ipynb | apache-2.0 | %matplotlib inline
import sys
sys.path.append('../..')
from matplotlib import pylab
pylab.rcParams['figure.figsize'] = 12, 10
import numpy
import scipy
import scipy.special
from crocodile.clean import *
from crocodile.synthesis import *
from crocodile.simulate import *
from crocodile.antialias import *
from util.... |
AtmaMani/pyChakras | udemy_ml_bootcamp/Python-for-Data-Visualization/Geographical Plotting/Choropleth Maps.ipynb | mit | import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
Choropleth Maps
Offline Plotly Usage
Get imports and set everything up to be workin... |
chili-epfl/paper-JLA-deep-teaching-analytics | notebooks/evaluationFramework.ipynb | mit | import numpy
import pandas
from sklearn.cross_validation import cross_val_score
from sklearn.preprocessing import LabelEncoder, label_binarize
from sklearn.cross_validation import StratifiedKFold
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
import matplotlib.pyplot as plt
from ... |
mari-linhares/tensorflow-workshop | code_samples/RNN/colorbot/colorbot_including_solutions.ipynb | apache-2.0 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Tensorflow
import tensorflow as tf
print('Tested with TensorFlow 1.2.0')
print('Your TensorFlow version:', tf.__version__)
# Feeding function for enqueue data
from tensorflow.python.estimator.inputs.queues ... |
phoebe-project/phoebe2-docs | 2.2/examples/rossiter_mclaughlin.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
%matplotlib inline
"""
Explanation: Rossiter-McLaughlin Effect
Setup
Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation... |
physion/ovation-python | examples/requisitions-and-documents.ipynb | gpl-3.0 | import uuid
from pprint import pprint
from datetime import date
from ovation.session import connect
"""
Explanation: Requisitions and Documents
This example shows the Ovation Service Lab (OSL) APIs for sample accessioning and report download. We'll create a simple Requisition with one sample. Next, we'll upload supp... |
4dsolutions/Python5 | Public Key Cryptography.ipynb | mit | import math
def totatives(n : int) -> list:
"""get co-primes to n between 0 and n"""
return [totative for totative in range(n) if math.gcd(totative, n) == 1]
def totient(n):
"""how many totatives have we?"""
return len(totatives(n))
print("Totient of 12:", totient(12))
print("Totient of 100:", to... |
mne-tools/mne-tools.github.io | 0.19/_downloads/638c39682b0791ce4e430e4d2fcc4c45/plot_tf_dics.ipynb | bsd-3-clause | # Author: Roman Goj <roman.goj@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne.event import make_fixed_length_events
from mne.datasets import sample
from mne.time_frequency import csd_fourier
from mne.beamformer import tf_dics
from mne.viz import plot_source_spectrogram
print(__doc__)
data_path = sample.d... |
agile-geoscience/striplog | docs/tutorial/11_Parse_a_description_into_components.ipynb | apache-2.0 | import striplog
striplog.__version__
"""
Explanation: Parse a description into components
This notebook requires at least version 0.8.8.
End of explanation
"""
text = "wet silty fine sand with tr clay"
"""
Explanation: We have some text:
End of explanation
"""
from striplog import Lexicon
lex_dict = {
'lith... |
staeiou/reddit_downvote | swingers/swingers-analysis.ipynb | mit | !pip install bokeh
import pandas as pd
import seaborn as sns
from bokeh.charts import TimeSeries, output_file, show
%matplotlib inline
posts_df = pd.DataFrame.from_csv("reddit_posts_swingers_201503.csv")
posts_df[0:5]
posts_df['created'] = pd.to_datetime(posts_df.created_utc, unit='s')
posts_df['created_date'] = po... |
vravishankar/Jupyter-Books | Conditional+Statements.ipynb | mit | x = 1
if x > 0:
print(x,"is positive number")
"""
Explanation: Python Statements
if..elif..else
The "if..elif..else" statement is used for decision making based on some conditions.
if statement
The syntax of "if" statement is
python
if test expression:
statement(2)
End of explanation
"""
x = 1
if x > 0:
... |
ES-DOC/esdoc-jupyterhub | notebooks/mri/cmip6/models/mri-agcm3-2/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mri', 'mri-agcm3-2', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: MRI
Source ID: MRI-AGCM3-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Bal... |
rishuatgithub/MLPy | PyTorchStuff.ipynb | apache-2.0 | import torch
"""
Explanation: <a href="https://colab.research.google.com/github/rishuatgithub/MLPy/blob/master/PyTorchStuff.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
All about Pytorch
End of explanation
"""
x = torch.empty(5,3) ## empty
x
x... |
YAtOff/python0-reloaded | week3/Print.ipynb | mit | print(2)
print("is even.")
print(2, "is even.")
"""
Explanation: print
Процедурата print приема 1 или повече аргумента и ги извежда на екрана разделени разделени със интервал.
След изпълнението на и курсурът минава на следващия ред.
Аргументите може да бъдат от различни типове.
End of explanation
"""
print(1, 2, 3)
... |
jameslao/Algorithmic-Pearls | Normal.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sigma = 1
mu = 0
sns.set(style="dark", palette="muted", color_codes=True, font_scale=1.5)
x = [np.arange(i - 4, i - 3, 0.01) for i in range(8)]
f = [1/(sigma * np.sqrt(2 * np.pi)) * np.exp( - (x[i] - mu)**2 / (2 * sigma**2) ) fo... |
marc-moreaux/Deep-Learning-classes | notebooks/Classification.ipynb | mit | import keras
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
print "input of training set has shape {} and output has shape {}".format(x_train.shape, y_train.shape)
print "input of testing set has shape {} and output has shape {}".format(x_test.shape, y_test.shape)
"""
Explan... |
qwertzuhr/2015_Data_Analyst_Project_3 | Data Analysis Project 3 - Data Wrangle OpenStreetMaps Data.ipynb | agpl-3.0 | from Project.notebook_stub import project_coll
import pprint
# Query used - see function Project.audit_stats_map.stats_general
pipeline = [
{"$group": {"_id": "$type", "count": {"$sum": 1}}},
{"$match": {"_id": {"$in": ["node", "way"]}}}
]
l = list(project_coll.aggregate(pipeline))
pprint.pprint(l)... |
taspinar/siml | notebooks/WV1 - Using PyWavelets for Wavelet Analysis.ipynb | mit | import pywt
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
"""
Explanation: This jupyter notebooks provides the code to give an introduction to the PyWavelets library.
To get some more background information, please have a look at the accompanying blog-post:
http://ataspinar.... |
tensorflow/lattice | docs/tutorials/custom_estimators.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... |
modin-project/modin | examples/tutorial/jupyter/execution/omnisci_on_native/local/exercise_1.ipynb | apache-2.0 | import modin.config as cfg
cfg.StorageFormat.put('omnisci')
# Note: Importing notebooks dependencies. Do not change this code!
import numpy as np
import pandas
import sys
import modin
pandas.__version__
modin.__version__
# Implement your answer here. You are also free to play with the size
# and shape of the DataFr... |
rriehle/Python300-2017q3 | 2017-07-19.ipynb | gpl-3.0 | cond1 = True
def func1(): print("Hi I'm func1")
"""
Explanation: Functional Programming
Expression based flow control
Using the basic structure of an if/elif chain....
if <cond1>:
func1()
elif <cond3>:
func2()
else:
func3()
...combined with what we know about logical truth tables....
```
AND ... |
w4zir/ml17s | lectures/lec05-multivariate-regression.ipynb | mit | %matplotlib inline
import pandas as pd
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt
import matplotlib as mpl
# read data in pandas frame
dataframe = pd.read_csv('datasets/house_dataset2.csv', encoding='utf-8')
# check data by printing first few rows
dataframe.head()
from mpl_t... |
arne-cl/alt-mulig | python/python-metaprogramming-david-beazley.ipynb | gpl-3.0 | from functools import wraps
def debug(func):
msg = func.__name__
# wraps is used to keep the metadata of the original function
@wraps(func)
def wrapper(*args, **kwargs):
print(msg)
return func(*args, **kwargs)
return wrapper
@debug
def add(x,y):
return x+y
add(2,3)
def add(x,... |
daniel-koehn/Theory-of-seismic-waves-II | 02_Mesh_generation/3_Quad_mesh_TFI_sea_dike.ipynb | gpl-3.0 | # Execute this cell to load the notebook's style sheet, then ignore it
from IPython.core.display import HTML
css_file = '../style/custom.css'
HTML(open(css_file, "r").read())
"""
Explanation: Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2018 D. Koehn, notebook style s... |
woters/ds101 | Titanic_completed.ipynb | mit | # pandas
import pandas as pd
from pandas import DataFrame
import re
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')
%matplotlib inline
# machine learning
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from skl... |
tsivula/BDA_py_demos | demos_ch4/demo4_1.ipynb | gpl-3.0 | import numpy as np
from scipy import optimize, stats
%matplotlib inline
import matplotlib.pyplot as plt
import os, sys
# add utilities directory to path
util_path = os.path.abspath(os.path.join(os.path.pardir, 'utilities_and_data'))
if util_path not in sys.path and os.path.exists(util_path):
sys.path.insert(0, ut... |
hannorein/reboundx | ipython_examples/EccAndIncDamping.ipynb | gpl-3.0 | import rebound
import reboundx
import numpy as np
sim = rebound.Simulation()
ainner = 1.
aouter = 10.
e0 = 0.1
inc0 = 0.1
sim.add(m=1.)
sim.add(m=1e-6,a=ainner,e=e0, inc=inc0)
sim.add(m=1e-6,a=aouter,e=e0, inc=inc0)
sim.move_to_com() # Moves to the center of momentum frame
ps = sim.particles
"""
Explanation: Eccentri... |
t-vi/candlegp | notebooks/gp_regression.ipynb | apache-2.0 | from matplotlib import pyplot
%matplotlib inline
import IPython
import torch
import numpy
import sys, os
sys.path.append(os.path.join(os.getcwd(),'..'))
pyplot.style.use('ggplot')
import candlegp
import candlegp.training.hmc
"""
Explanation: Gaussian Process Regression in Pytorch
Thomas Viehmann, tv@&... |
peterwittek/ipython-notebooks | Unbounded_randomness.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from itertools import product
from math import sqrt, sin, cos, pi, atan
from qutip import tensor, basis, sigmax, sigmaz, expect, qeye
from ncpol2sdpa import SdpRelaxation, flatten, generate_measurements, \
projective_measure... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_cluster_stats_evoked.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.stats import permutation_cluster_test
from mne.datasets import sample
print(__doc__)
"""
Explanation: Permutation F-test on sensor data with 1D c... |
dietmarw/EK5312_ElectricalMachines | Chapman/Ch9-Problem_9-03.ipynb | unlicense | %pylab notebook
%precision %.4g
"""
Explanation: Excercises Electric Machinery Fundamentals
Chapter 9
Problem 9-3
End of explanation
"""
V = 120 # [V]
p = 4
R1 = 2.0 # [Ohm]
R2 = 2.8 # [Ohm]
X1 = 2.56 # [Ohm]
X2 = 2.56 # [Ohm]
Xm = 60.5 # [Ohm]
n = 400 # [r/min]
Prot = 51 # [W]
n_sync = 1800 ... |
kgrodzicki/machine-learning-specialization | course-3-classification/module-6-decision-tree-practical-assignment-blank.ipynb | mit | import graphlab
"""
Explanation: Decision Trees in Practice
In this assignment we will explore various techniques for preventing overfitting in decision trees. We will extend the implementation of the binary decision trees that we implemented in the previous assignment. You will have to use your solutions from this pr... |
Heerozh/deep-learning | image-classification/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
mne-tools/mne-tools.github.io | 0.15/_downloads/plot_movement_compensation.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
from os import path as op
import mne
from mne.preprocessing import maxwell_filter
print(__doc__)
data_path = op.join(mne.datasets.misc.data_path(verbose=True), 'movement')
pos = mne.chpi.read_head_pos(op.join(data_path, 'simulated_quats.p... |
fullmetalfelix/ML-CSC-tutorial | LMBTR.ipynb | gpl-3.0 | # --- INITIAL DEFINITIONS ---
from dscribe.descriptors import LMBTR
import numpy as np
from visualise import view
from ase import Atoms
import ase.data
import matplotlib.pyplot as mpl
"""
Explanation: Local Many Body Tensor Representation
LMBTR is a local descriptor for an atom in a molecule/unit cell. It eliminates r... |
UltronAI/Deep-Learning | CS231n/reference/CS231n-master/assignment2/ConvolutionalNetworks.ipynb | mit | # As usual, a bit of setup
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.cnn import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient_array, eval_numerical_gradient
from cs231n.layers import *
from cs231n.fast_layers import *
from cs... |
liufuyang/ManagingBigData_MySQL_DukeUniv | notebooks/MySQL_Exercise_03_Formatting_Selected_Data.ipynb | mit | %load_ext sql
%sql mysql://studentuser:studentpw@mysqlserver/dognitiondb
%sql USE dognitiondb
%config SqlMagic.displaylimit=25
"""
Explanation: Copyright Jana Schaich Borg/Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
MySQL Exercise 3: Formatting Selected Data
In this lesson, we are going to learn about ... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/sandbox-2/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'sandbox-2', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: NERC
Source ID: SANDBOX-2
Sub-Topics: Radiative Forcings.
Properties: 85 (42 ... |
agile-geoscience/xlines | notebooks/13_Physical_units_with_pint.ipynb | apache-2.0 | #!pip install pint
#!pip install git+https://github.com/hgrecco/pint-pandas#egg=Pint-Pandas-0.1.dev0
"""
Explanation: X LINES OF PYTHON
Physical units with pint
This notebook goes with a blog post on the same subject.
Have you ever wished you could carry units around with your quantities — and have the computer ... |
obulpathi/datascience | scikit/Chapter 2/Linear models.ipynb | apache-2.0 | from sklearn.datasets import make_regression
from sklearn.cross_validation import train_test_split
X, y, true_coefficient = make_regression(n_samples=80, n_features=30, n_informative=10, noise=100, coef=True, random_state=5)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=5)
print(X_train.shape)... |
tuanavu/coursera-university-of-washington | machine_learning/2_regression/lecture/week5/.ipynb_checkpoints/Overfitting_Demo_Ridge_Lasso-checkpoint.ipynb | mit | import sys
sys.path.append('C:\Anaconda2\envs\dato-env\Lib\site-packages')
import graphlab
import math
import random
import numpy
from matplotlib import pyplot as plt
%matplotlib inline
"""
Explanation: Overfitting demo
Create a dataset based on a true sinusoidal relationship
Let's look at a synthetic dataset consist... |
mne-tools/mne-tools.github.io | 0.21/_downloads/ef89d1f7daeb4e357098461753c3af0f/plot_source_alignment.ipynb | bsd-3-clause | import os.path as op
import numpy as np
import nibabel as nib
from scipy import linalg
import mne
from mne.io.constants import FIFF
data_path = mne.datasets.sample.data_path()
subjects_dir = op.join(data_path, 'subjects')
raw_fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis_raw.fif')
trans_fname = op.join(... |
tensorflow/docs-l10n | site/ja/tutorials/keras/classification.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... |
saudijack/unfpyboot | Day_00/02_Strings_and_FileIO/00 Strings in Python.ipynb | mit | s1 = 'Godzilla'
print s1, s1.upper(), s1
"""
Explanation: Strings in Python
What is a string?
A "string" is a series of characters of arbitrary length.
Strings are immutable - they cannot be changed once created. When you modify a string, you automatically make a copy and modify the copy.
End of explanation
"""
"God... |
matthiaskoenig/sbmlutils | docs_builder/notebooks/sbml_distrib.ipynb | lgpl-3.0 | %load_ext autoreload
%autoreload 2
from notebook_utils import print_xml
from sbmlutils.factory import *
from sbmlutils.validation import validate_doc
"""
Explanation: SBML distrib
The following examples demonstrate the creation of SBML models with SBML distrib information.
End of explanation
"""
class U(Units):
... |
ellisztamas/faps | docs/tutorials/00_quickstart_guide.ipynb | mit | import faps as fp
import numpy as np
"""
Explanation: Quickstart guide to FAPS
Tom Ellis, May 2020.
If you are impatient to do an analyses as quickly as possible without reading the rest of the documentation, this page provides a minimal example. The work flow is as follows:
Import marker data on offspring and parent... |
phoebe-project/phoebe2-docs | 2.2/examples/extinction_wd_subdwarf.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: Extinction: White Dwarf - Subdwarf Binary
In this example, we'll reproduce Figure 4 in the extinction release paper (Jones et al. 2020).
"SDSS J2355 is a short-period post-CE binary comprising a relatively cool white dwarf (Teff∼13,250 K) and a low-mass, metal-poor,... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_cluster_stats_spatio_temporal.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
import os.path as op
import numpy as np
from numpy.random import randn
from scipy import stats as stats
import mne
from mne import (io, spatial_tris_connectivity, compute... |
mne-tools/mne-tools.github.io | 0.22/_downloads/ad79868fcd6af353ce922b8a3a2fc362/plot_30_info.ipynb | bsd-3-clause | import os
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_filt-0-40_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file)
"""
Explanation: The Info data structure
This tutori... |
QuantScientist/Deep-Learning-Boot-Camp | day03/3.1 AutoEncoders and Embeddings.ipynb | mit | # based on: https://blog.keras.io/building-autoencoders-in-keras.html
encoding_dim = 32
input_img = Input(shape=(784,))
encoded = Dense(encoding_dim, activation='relu')(input_img)
decoded = Dense(784, activation='sigmoid')(encoded)
autoencoder = Model(input=input_img, output=decoded)
encoder = Model(input=input_img,... |
nwjs/chromium.src | third_party/tensorflow-text/src/docs/tutorials/nmt_with_attention.ipynb | bsd-3-clause | #@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... |
ernestyalumni/MLgrabbag | SVM_theano.ipynb | mit | %matplotlib inline
import theano
from theano import function, config, sandbox, shared
import theano.tensor as T
print( theano.config.device )
print( theano.config.lib.cnmem) # cf. http://deeplearning.net/software/theano/library/config.html
print( theano.config.print_active_device)# Print active device at when the ... |
SJSlavin/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
"""
Image(filename='silver-feature-unpredictable-21.png')
Image(filename='silver-feature-unpredictable-1.png')
"""
Explanation: Graphical excellence and integrity
Find a data-focused visual... |
risantos/schoolwork | Física Computacional/Ficha 1 - Interpolacao.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Departamento de Física - Faculdade de Ciências e Tecnologia da Universidade de Coimbra
Física Computacional - Ficha 1 - Interpolação
Rafael Isaque Santos - 2012144694 - Licenciatura em Física
End of explanation
"""
func_x = lambd... |
olavurmortensen/gensim | docs/notebooks/word2vec.ipynb | lgpl-2.1 | # import modules & set up logging
import gensim, logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
sentences = [['first', 'sentence'], ['second', 'sentence']]
# train word2vec on the two sentences
model = gensim.models.Word2Vec(sentences, min_count=1)
"""
Explanation:... |
Diyago/Machine-Learning-scripts | clustering/ods_unsupervised_learning.ipynb | apache-2.0 | import numpy as np
import pandas as pd
import seaborn as sns
from tqdm import tqdm_notebook
%matplotlib inline
from matplotlib import pyplot as plt
plt.style.use(['seaborn-darkgrid'])
plt.rcParams['figure.figsize'] = (12, 9)
plt.rcParams['font.family'] = 'DejaVu Sans'
from sklearn import metrics
from sklearn.cluster ... |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_forward_sensitivity_maps.ipynb | bsd-3-clause | # Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne.datasets import sample
import matplotlib.pyplot as plt
print(__doc__)
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
fwd_fname = data_path + '/MEG/sample/sample_audvis-meg-eeg-... |
pyoceans/erddapy | notebooks/searchfor.ipynb | bsd-3-clause | from erddapy import ERDDAP
e = ERDDAP(
server="https://upwell.pfeg.noaa.gov/erddap",
protocol="griddap"
)
"""
Explanation: Searching datasets
erddapy can wrap the same form-like search capabilities of ERDDAP with the search_for keyword.
End of explanation
"""
import pandas as pd
search_for = "HFRadar"
ur... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/03_tensorflow/a_tfstart.ipynb | apache-2.0 | import tensorflow as tf
import numpy as np
print(tf.__version__)
"""
Explanation: <h1> Getting started with TensorFlow </h1>
In this notebook, you play around with the TensorFlow Python API.
End of explanation
"""
a = np.array([5, 3, 8])
b = np.array([3, -1, 2])
c = np.add(a, b)
print(c)
"""
Explanation: <h2> Add... |
henriquepgomide/caRtola | src/python/desafio_valorizacao/.ipynb_checkpoints/Descobrindo o algoritmo de valorização do Cartola FC - Parte I-checkpoint.ipynb | mit | # Importar bibliotecas
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import linear_model
from sklearn.metrics import mean_squared_error, r2_score
pd.options.mode.chained_assignment = None # default='warn'
# Abrir banco de dados
dados = pd.read_csv('~/caRto... |
tensorflow/docs-l10n | site/zh-cn/guide/keras/functional.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... |
AllenDowney/ThinkBayes2 | soln/chap04.ipynb | mit | # If we're running on Colab, install empiricaldist
# https://pypi.org/project/empiricaldist/
import sys
IN_COLAB = 'google.colab' in sys.modules
if IN_COLAB:
!pip install empiricaldist
# Get utils.py
from os.path import basename, exists
def download(url):
filename = basename(url)
if not exists(filename... |
sysid/nbs | lstm/nietzsche.ipynb | mit | path = get_file('nietzsche.txt', origin="https://s3.amazonaws.com/text-datasets/nietzsche.txt")
text = open(path).read().lower()
print('corpus length:', len(text))
path
!tail {path} -n25
#path = 'data/wiki/'
#text = open(path+'small.txt').read().lower()
#print('corpus length:', len(text))
#text = text[0:1000000]
c... |
pastas/pasta | examples/notebooks/04_adding_rivers.ipynb | mit | import pandas as pd
import pastas as ps
import matplotlib.pyplot as plt
ps.show_versions()
ps.set_log_level("INFO")
"""
Explanation: Adding river levels
Developed by R.A. Collenteur & D. Brakenhoff
In this example it is shown how to create a Pastas model that not only includes precipitation and evaporation, but also ... |
gidden/aneris | doc/source/tutorial.ipynb | apache-2.0 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import aneris
from aneris.tutorial import load_data
%matplotlib inline
"""
Explanation: Getting Started
This is a simple example of the basic capabilities of aneris.
First, model and history data are read in. The model is then harmonized. Fina... |
IBMDecisionOptimization/docplex-examples | examples/cp/jupyter/sched_square.ipynb | apache-2.0 | import sys
try:
import docplex.cp
except:
if hasattr(sys, 'real_prefix'):
#we are in a virtual env.
!pip install docplex
else:
!pip install --user docplex
"""
Explanation: Sched Square
This tutorial includes everything you need to set up decision optimization engines, build constrai... |
pligor/predicting-future-product-prices | 04_time_series_prediction/.ipynb_checkpoints/13_price_history_seq2seq-raw-checkpoint.ipynb | agpl-3.0 | from __future__ import division
import tensorflow as tf
from os import path
import numpy as np
import pandas as pd
import csv
from sklearn.model_selection import StratifiedShuffleSplit
from time import time
from matplotlib import pyplot as plt
import seaborn as sns
from mylibs.jupyter_notebook_helper import show_graph
... |
wuafeing/Python3-Tutorial | 01 data structures and algorithms/01.13 sort list of dicts by key.ipynb | gpl-3.0 | rows = [
{"fname": "Brian", "lname": "Jones", "uid": 1003},
{"fname": "David", "lname": "Beazley", "uid": 1002},
{"fname": "John", "lname": "Cleese", "uid": 1001},
{"fname": "Big", "lname": "Jones", "uid": 1004}
]
"""
Explanation: Previous
1.13 通过某个关键字排序一个字典列表
问题
你有一个字典列表,你想根据某个或某几个字典字段来排序这个列表。
解决方案
通过... |
zoofIO/flexx-notebooks | flexx_tutorial_app.ipynb | bsd-3-clause | from flexx import flx
"""
Explanation: Tutorial for flexx.app - connecting to the browser
End of explanation
"""
%gui asyncio
flx.init_notebook()
class MyComponent(flx.JsComponent):
foo = flx.StringProp('', settable=True)
@flx.reaction('foo')
def on_foo(self, *events):
if self.foo:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.