repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
TvBMcMaster/pymeasure | examples/Notebook Experiments/script2.ipynb | mit | %%writefile my_config.ini
[Filename]
prefix = my_data_
dated_folder = 1
directory = data
ext = csv
index =
datetimeformat = %Y%m%d_%H%M%S
[Logging]
console = 1
console_level = WARNING
filename = test.log
file_level = DEBUG
[matplotlib.rcParams]
axes.axisbelow = True
axes.color_cycle = [(0.2980392156862745, 0.4470588... |
NuGrid/NuPyCEE | regression_tests/.ipynb_checkpoints/SYGMA_SSP_h_yield_input-checkpoint.ipynb | bsd-3-clause | #from imp import *
#s=load_source('sygma','/home/nugrid/nugrid/SYGMA/SYGMA_online/SYGMA_dev/sygma.py')
#%pylab nbagg
import sys
import sygma as s
print s.__file__
reload(s)
s.__file__
#import matplotlib
#matplotlib.use('nbagg')
import matplotlib.pyplot as plt
#matplotlib.use('nbagg')
import numpy as np
from scipy.integ... |
bloomberg/bqplot | examples/Marks/Object Model/GridHeatMap.ipynb | apache-2.0 | np.random.seed(0)
data = np.random.randn(10, 10)
"""
Explanation: Get Data
End of explanation
"""
col_sc = ColorScale()
grid_map = GridHeatMap(color=data, scales={"color": col_sc})
Figure(marks=[grid_map], padding_y=0.0)
grid_map.display_format = ".2f"
grid_map.font_style = {"font-size": "12px", "fill": "black", ... |
darcamo/pyphysim | ipython_notebooks/TDL_Channel_Frequency_Response.ipynb | gpl-2.0 | %matplotlib inline
import math
import sys
from matplotlib import pyplot as plt
from pyphysim.channels import fading, fading_generators
from pyphysim.util.conversion import linear2dB
"""
Explanation: Simulate and visualize the channe frequency response of a TDL channel
Here in this notebook we will show the frequenc... |
ivazquez/genetic-variation | src/figure4.ipynb | mit | # Load external dependencies
from setup import *
# Load internal dependencies
import config,plot,utils
%load_ext autoreload
%autoreload 2
%matplotlib inline
"""
Explanation: Supplemental Information:
"Clonal heterogeneity influences the fate of new adaptive mutations"
Ignacio Vázquez-García, Francisco Salinas, Jing... |
IBMDecisionOptimization/tutorials | jupyter/Beyond_Linear_Programming.ipynb | apache-2.0 | import sys
try:
import cplex
except:
if hasattr(sys, 'real_prefix'):
#we are in a virtual env.
!pip install cplex
else:
!pip install --user cplex
"""
Explanation: Tutorial: Beyond Linear Programming, (CPLEX Part2)
This notebook describes some special cases of LP, as well as some oth... |
wasit7/PythonDay | notebook/02 Learn to Code with Python.ipynb | bsd-3-clause | #from tutor import check
print('Hello, World!')
# This is a comment, it isn't run as code, but often they are helpful
"""
Explanation: <a href="http://nbviewer.ipython.org/urls/bitbucket.org/amjoconn/watpy-learning-to-code-with-python/raw/3441274a54c7ff6ff3e37285aafcbbd8cb4774f0/notebook/Learn%20to%20Code%20with%20Pyt... |
CrowdTruth/CrowdTruth-core | tutorial/notebooks/Sparse Multiple Choice Task - Event Extraction.ipynb | apache-2.0 | import pandas as pd
test_data = pd.read_csv("../data/event-text-sparse-multiple-choice.csv")
test_data.head()
"""
Explanation: CrowdTruth for Sparse Multiple Choice Tasks: Event Extraction
In this tutorial, we will apply CrowdTruth metrics to a sparse multiple choice crowdsourcing task for Event Extraction from sente... |
dfm/emcee | docs/tutorials/quickstart.ipynb | mit | %config InlineBackend.figure_format = "retina"
from matplotlib import rcParams
rcParams["savefig.dpi"] = 100
rcParams["figure.dpi"] = 100
rcParams["font.size"] = 20
"""
Explanation: (quickstart)=
Quickstart
End of explanation
"""
import numpy as np
"""
Explanation: The easiest way to get started with using emcee ... |
mdpiper/topoflow-notebooks | Meteorology-SnowDegreeDay.ipynb | mit | from cmt.components import Meteorology, SnowDegreeDay
met, sno = Meteorology(), SnowDegreeDay()
"""
Explanation: Meteorology-SnowDegreeDay coupling
Goal: Try to successfully run a coupled Meteorology-SnowDegreeDay simulation, with Meteorology as the driver. Each component runs to completion in stand-alone mode.
Import... |
dewitt-li/deep-learning | sentiment-network/Sentiment_Classification_Projects.ipynb | mit | def pretty_print_review_and_label(i):
print(labels[i] + "\t:\t" + reviews[i][:80] + "...")
g = open('reviews.txt','r') # What we know!
reviews = list(map(lambda x:x[:-1],g.readlines()))
g.close()
g = open('labels.txt','r') # What we WANT to know!
labels = list(map(lambda x:x[:-1].upper(),g.readlines()))
g.close()... |
cmorgan/toyplot | docs/units.ipynb | bsd-3-clause | import numpy
x = numpy.linspace(0, 1)
y = x ** 2
import toyplot
toyplot.plot(x, y, width="3in", height="2in");
"""
Explanation: .. _units:
Units
There are several places in Toyplot where you will need to specify quantities with real-world units, including canvas dimensions, font sizes, and target dimensions for docum... |
nimagh/MachineLearning | GaussianProcesses/GPC.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from scipy.optimize import fmin
from scipy.linalg import cholesky, cho_solve, inv
#np.set_printoptions(formatter={'float': '{: 0.4f}'.format})
%matplotlib inline
%load_ext autoreload
%autoreload 2
"""
Explanation: Gausssian Process for C... |
hhain/sdap17 | notebooks/henrik_ueb01/.ipynb_checkpoints/02_Classification-checkpoint.ipynb | mit | # Load neccessary libraries changed pandas import for convinience
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_classification
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import train... |
justanr/notebooks | curryable_and_memoized_classes.ipynb | mit | from toolz import curry, memoize
@curry
class Person(object):
def __init__(self, name, age):
self.name = name
self.age = age
def __repr__(self):
return "Person(name={!r}, age={!r})".format(self.name, self.age)
p = Person(name='alec')
p(age=26)
"""
Explanation: I've been playin... |
mne-tools/mne-tools.github.io | 0.17/_downloads/b1d9746cf2e2e8e3cf75583228f88282/plot_receptive_field.ipynb | bsd-3-clause | # Authors: Chris Holdgraf <choldgraf@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
# sphinx_gallery_thumbnail_number = 7
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.decoding import ReceptiveField, TimeDelayingRidge
from scipy.stats import multivar... |
drvinceknight/gt | nbs/chapters/01-Normal-Form-Games.ipynb | mit | import nashpy as nash
A = [[3, 1], [0, 2]]
B = [[2, 1], [0, 3]]
"""
Explanation: Normal Form Games
Video
Game theory is the study of interactive decision making. Consider the following situation:
Two friends must decide what movie to watch at the cinema. Alice would like to watch a sport movie and Bob would like to w... |
kastnerkyle/kastnerkyle.github.io-nikola | blogsite/posts/linear-regression.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: When presented with an unknown dataset, it is very common to attempt to find trends or patterns.
The most basic form of this is visual inspection - how is the data trendi... |
ceos-seo/data_cube_notebooks | notebooks/machine_learning/Uruguay_Random_Forest/Random_Forest/4. Display and Package Classifier.ipynb | apache-2.0 | import sys
import os
sys.path.append(os.environ.get('NOTEBOOK_ROOT'))
import datacube
import datetime
import folium
import numpy as np
import pandas as pd
import utils.data_cube_utilities.dc_display_map as dm
import xarray as xr
from folium import plugins
from sklearn.externals import joblib
from sklearn.preprocessi... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/basic_intro_logistic_regression.ipynb | apache-2.0 | # The OS module in python provides functions for interacting with the operating system
import os
# The matplotlib module provides all the fuctionalities for visualizing model
import matplotlib.pyplot as plt
# Here we'll import data processing libraries like tensorflow
import tensorflow as tf
# Here we'll show the cur... |
lfairchild/PmagPy | data_files/notebooks/Py2toPy3.ipynb | bsd-3-clause | #python2 syntax, now throws an error
print "hello world"
#python3 syntax, this also works in python2 (2.5+) though in python3 this is the only option
print("hello world")
#documentation on the python3 print function
help(print)
"""
Explanation: Coding in Python3
So now that PmagPy has made the conversion to python... |
ForestClaw/forestclaw | applications/elliptic/poisson/results/mgtest_results.ipynb | bsd-2-clause | ex_list = ['star_center_32']
example = ex_list[0]
compare_list = ['Matlab','FISHPACK']
"""
Explanation: <hr style="border-width:4px; border-color:coral"/>
List of examples
<hr style="border-width:4px; border-color:coral"/>
End of explanation
"""
# -------------------------------------
# Set up DataFrame for compa... |
ES-DOC/esdoc-jupyterhub | notebooks/cccr-iitm/cmip6/models/sandbox-1/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-1', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: SANDBOX-1
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, En... |
IS-ENES-Data/submission_forms | test/forms/CORDEX/CORDEX_ki_t1.ipynb | apache-2.0 | from dkrz_forms import form_widgets
form_widgets.show_status('form-submission')
"""
Explanation: CORDEX ESGF submission form
General Information
Data to be submitted for ESGF data publication must follow the rules outlined in the Cordex Archive Design Document <br /> (https://verc.enes.org/data/projects/documents/c... |
mne-tools/mne-tools.github.io | stable/_downloads/7e56fc2a505e3dee7f66caa4ffeea6fe/40_visualize_raw.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_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file)
raw.crop(tmax=60).load_data()
"""
Explanation: Built-in plotti... |
arcyfelix/Courses | 17-09-17-Python-for-Financial-Analysis-and-Algorithmic-Trading/04-Visualization-Matplotlib-Pandas/04a-Matplotlib/02 - (Optional-No Video) - Advanced Matplotlib Concepts.ipynb | apache-2.0 | fig, axes = plt.subplots(1, 2, figsize = (10,4))
axes[0].plot(x, x ** 2, x, np.exp(x))
axes[0].set_title("Normal scale")
axes[1].plot(x, x ** 2, x, np.exp(x))
axes[1].set_yscale("log")
axes[1].set_title("Logarithmic scale (y)");
"""
Explanation: Advanced Matplotlib Concepts Lecture
In this lecture we cover so... |
relopezbriega/mi-python-blog | content/notebooks/CategoricalPython.ipynb | gpl-2.0 | # <!-- collapse=True -->
# importando modulos necesarios
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from pydataset import data
# parametros esteticos de seaborn
sns.set_palette("deep", desat=.6)
sns.set_context(rc={"figure.figsize": (8, 4)})
# i... |
timnon/pyschedule | example-notebooks/employee-scheduling.ipynb | apache-2.0 | employee_names = ['A','B','C','D','E','F','G','H']
n_days = 14 # number of days
days = list(range(n_days))
max_seq = 5 # max number of consecutive shifts
min_seq = 2 # min sequence without gaps
max_work = 10 # max total number of shifts
min_work = 7 # min total number of shifts
max_weekend = 3 # max number of weekend ... |
rashikaranpuria/Machine-Learning-Specialization | Classification/Week 7/module-10-online-learning-assignment-blank.ipynb | mit | from __future__ import division
import graphlab
"""
Explanation: Training Logistic Regression via Stochastic Gradient Ascent
The goal of this notebook is to implement a logistic regression classifier using stochastic gradient ascent. You will:
Extract features from Amazon product reviews.
Convert an SFrame into a Num... |
mne-tools/mne-tools.github.io | stable/_downloads/508d9d76b6c08ece701565f76bf102db/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')
head_pos = mne.chpi.read_head_pos(op.join(data_path, 'simulated_quat... |
AtmaMani/pyChakras | stats_101/04_probability_distributions_binomial_poisson.ipynb | mit | import math
def bin_prob(n,y,pi):
a = math.factorial(n)/(math.factorial(y)*math.factorial(n-y))
b = math.pow(pi, y) * math.pow((1-pi), (n-y))
p_y = a*b
return p_y
"""
Explanation: Random variables
When the objective is to predict the category (qualitative, such as predicting political party affiliatio... |
DJCordhose/ai | notebooks/talks/2017_intro_nordic_coding.ipynb | mit | import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
%pylab inline
import matplotlib.pylab as plt
import numpy as np
from distutils.version import StrictVersion
import sklearn
print(sklearn.__version__)
assert StrictVersion(sklearn.__version__ ) >= StrictVersion('0.18.1')
# Evtl. hat Azure nur 0.1... |
sys-bio/tellurium | examples/notebooks/core/tesedmlExample.ipynb | apache-2.0 | from __future__ import print_function
import tellurium as te
te.setDefaultPlottingEngine('matplotlib')
%matplotlib inline
import phrasedml
antimony_str = '''
model myModel
S1 -> S2; k1*S1
S1 = 10; S2 = 0
k1 = 1
end
'''
phrasedml_str = '''
model1 = model "myModel"
sim1 = simulate uniform(0, 5, 100)
task1 =... |
DB2-Samples/db2odata | Notebooks/DB2 OData Gateway Tutorial.ipynb | apache-2.0 | %run db2odata.ipynb
"""
Explanation: DB2 OData Tutorial
This tutorial will explain some of the features that are available in the IBM Data Server Gateway for OData Version 1.0.0. IBM Data Server Gateway for OData enables you to quickly create OData RESTful services to query and update data in IBM DB2 LUW.
An intro... |
jgarciab/wwd2017 | class2/class2b_tidy_data.ipynb | gpl-3.0 | #Normal inputs
import pandas as pd
import numpy as np
import seaborn as sns
import pylab as plt
%matplotlib inline
from IPython.display import Image, display
#Make the notebook wider
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:90% !important; }</style>"))
#Create a toy dat... |
lindsayad/jupyter_notebooks | serpent_simulations.ipynb | mit | k_nom = 1.0545
k_f_1144 = 1.04149
fuel_reactivity = (k_f_1144 - k_nom) / k_nom / 400
print(fuel_reactivity)
"""
Explanation: 3/10/17
Trying to get a critical infinite serpent simulation, e.g. $k_{\infty}$ = 1
U235 = .418%
U238 = .8625%
k = 1.07238
msr2g_enrU
2/10/17
Serpent run yielded k_eff of 1.03
msr2g_part_U_s... |
Misteir/Machine_Learning | linear_regression/linear_regression2.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Import librairies
End of explanation
"""
data = pd.read_csv('ex1data2.txt', header=None, names=['size', 'bedrooms', 'price'])
data.head()
"""
Explanation: reading file and describing it
End of explanation
"""
... |
abhi1509/deep-learning | transfer-learning/Transfer_Learning_Solution.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... |
Vasilyeu/mobile_customer | Vasilev_Sergey_eng.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation import train_test_split
from sklearn.linear_model import LogisticRegressio... |
minh5/cpsc | reports/neiss.ipynb | mit | import pandas as pd
import statsmodels.formula.api as smf
import statsmodels.api as sm
import numpy as np
import neiss
import plotly.offline
plotly.offline
#loading in data and preparations
raw = pd.read_csv('/home/datauser/cpsc/data/processed/neiss/neiss-2015.csv')
cleaned = neiss.cleaner(raw)
data = neiss.query(cl... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/04_03/Begin/Indexing.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
produce_dict = {'veggies': ['potatoes', 'onions', 'peppers', 'carrots'],'fruits': ['apples', 'bananas', 'pineapple', 'berries']}
produce_df = pd.DataFrame(produce_dict)
produce_df
"""
Explanation: Indexing and Selection
| Operation | Syntax | Result ... |
ecervera/UJI_AMR | solutions/Angle.ipynb | mit | import packages.initialization
import pioneer3dx as p3dx
p3dx.init()
"""
Explanation: <img align="right" src="../img/exercise_turning.png" />
Exercise: Turn the robot for an angle.
You are going to make a program for turning the robot from the initial position at the start of the simulation, in the center of the room.... |
trangel/Data-Science | deep_learning_ai/Planar+data+classification+with+one+hidden+layer+v5.ipynb | gpl-3.0 | # Package imports
import numpy as np
import matplotlib.pyplot as plt
from testCases_v2 import *
import sklearn
import sklearn.datasets
import sklearn.linear_model
from planar_utils import plot_decision_boundary, sigmoid, load_planar_dataset, load_extra_datasets
%matplotlib inline
np.random.seed(1) # set a seed so tha... |
phuongxuanpham/SelfDrivingCar | CarND-LeNet-Lab/LeNet-Lab.ipynb | gpl-3.0 | from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", reshape=False)
X_train, y_train = mnist.train.images, mnist.train.labels
X_validation, y_validation = mnist.validation.images, mnist.validation.labels
X_test, y_test = mnist.test.images, mn... |
radhikapc/foundation-homework | homework_sql/Homework_2_Radhika.ipynb | mit | import pg8000
conn = pg8000.connect(user='postgres', password='password', database="homework2_radhika")
"""
Explanation: Homework 2: Working with SQL (Data and Databases 2016)
This homework assignment takes the form of an IPython Notebook. There are a number of exercises below, with notebook cells that need to be comp... |
tensorflow/tfx | docs/tutorials/tfx/python_function_component.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... |
seg/2016-ml-contest | geoLEARN/Submission_4_XGBoost1.ipynb | apache-2.0 | ###### Importing all used packages
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import make_axes_locatable
import seaborn as sns
# imp... |
volodymyrss/3ML | docs/notebooks/Building Plugins from TimeSeries.ipynb | bsd-3-clause |
cspec_file = get_path_of_data_file('datasets/glg_cspec_n3_bn080916009_v01.pha')
tte_file = get_path_of_data_file('datasets/glg_tte_n3_bn080916009_v01.fit.gz')
gbm_rsp = get_path_of_data_file('datasets/glg_cspec_n3_bn080916009_v00.rsp2')
gbm_cspec = TimeSeriesBuilder.from_gbm_cspec_or_ctime('nai3_cspec',
... |
HUDataScience/StatisticalMethods2016 | notebooks/Exo6_correction_IntrinsicDispersion.ipynb | apache-2.0 | sigma_int = 0.10
mu = -0.5
error = 0.12
error_noise = 0.03 # This means that the errors will be 0.12 +/- 0,03
npoints = 1000
errors = np.random.normal(loc=error, scale=error_noise, size=npoints)
data = np.random.normal(loc=mu, scale=sigma_int, size=npoints) + np.random.normal(loc=0,scale=errors)
fig = mpl.figure(fi... |
PyLCARS/PythonUberHDL | myHDL_DigLogicFundamentals/myHDL_Combinational/Multiplexers(MUX).ipynb | bsd-3-clause | #This notebook also uses the `(some) LaTeX environments for Jupyter`
#https://github.com/ProfFan/latex_envs wich is part of the
#jupyter_contrib_nbextensions package
from myhdl import *
from myhdlpeek import Peeker
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
from sympy im... |
TomTranter/OpenPNM | examples/io_and_visualization/Statoil Import and Permeability Calculation.ipynb | mit | import warnings
import scipy as sp
import numpy as np
import openpnm as op
np.set_printoptions(precision=4)
np.random.seed(10)
%matplotlib inline
"""
Explanation: Part 1: Import Networks from Statoil Files
This example explains how to use the OpenPNM.Utilies.IO.Statoil class to import a network produced by the Maximal... |
jwjohnson314/data-803 | notebooks/Logistic Regression II.ipynb | mit | # synthetic data
X, y = make_classification(n_samples=10000, n_features=50, n_informative=12,
n_redundant=2, n_classes=2, random_state=0)
# statsmodels uses logit, not logistic
lm = sm.Logit(y, X).fit()
results = lm.summary()
print(results)
# hard problem
lm = sm.Logit(y, X).fit(maxiter=100... |
janmtl/drift_qec | TwoAngleBayes.ipynb | isc | def get_PB(d):
theta1 = np.linspace(0.0, np.pi, 201)
Ntheta = np.floor(len(theta1)*np.sin(theta1) + 1).astype(np.int)
theta2 = []
for ntheta in Ntheta:
theta2 = theta2 + list(np.linspace(-np.pi, np.pi, ntheta))
theta2 = np.r_[theta2]
theta1 = np.repeat(theta1, Ntheta)
a = np.sin(thet... |
tensorflow/docs | site/en/tutorials/load_data/text.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... |
afeiguin/comp-phys | 01_00_numerical_differentiation.ipynb | mit | dx = 1.
x = 1.
while(dx > 1.e-10):
dy = (x+dx)*(x+dx)-x*x
d = dy / dx
print("%6.0e %20.16f %20.16f" % (dx, d, d-2.))
dx = dx / 10.
"""
Explanation: A primer on numerical differentiation
In order to numerically evaluate a derivative $y'(x)=dy/dx$ at point $x_0$, we approximate is by using finite di... |
Stanford-BIS/syde556 | SYDE 556 Lecture 4 Transformation.ipynb | gpl-2.0 | %pylab inline
import numpy as np
import nengo
from nengo.dists import Uniform
from nengo.processes import WhiteSignal
from nengo.solvers import LstsqL2
T = 1.0
max_freq = 10
model = nengo.Network('Communication Channel', seed=3)
with model:
stim = nengo.Node(output=WhiteSignal(T, high=max_freq, rms=0.5))
en... |
joferkington/scipy2015-3d_printing | Scipy 2015 - 3D Printing with Python.ipynb | mit | %run slice_3d_example.py
"""
Explanation: Touch your data! 3D Color Printing with Python
Joe Kington, Chevron
<img src="images/3d_seismic_together.jpg" style="float: left; width: 30%; margin-left: 4%;">
<img src="images/3d_seismic_hand.jpg" style="float: left; width: 30%; margin-left: 1%;">
<img src="images/alaska_m... |
coolharsh55/advent-of-code | 2016/python3/Day21.ipynb | mit | def swap_position(password, x, y):
x = int(x)
y = int(y)
password[x], password[y] = password[y], password[x]
return password
"""
Explanation: Day 21: Scrambled Letters and Hash
author: Harshvardhan Pandit
license: MIT
link to problem statement
The computer system you're breaking into uses a weird scram... |
idekerlab/cyrest-examples | notebooks/cookbook/Python-cookbook/Layout.ipynb | mit | # import data from url
from py2cytoscape.data.cyrest_client import CyRestClient
from IPython.display import Image
import json
# Create REST client for Cytoscape
cy = CyRestClient()
# Reset current session for fresh start
cy.session.delete()
# Load a sample network
network = cy.network.create_from('../sampleData/galF... |
diegocavalca/Studies | programming/Python/tensorflow/exercises/Neural_Network_Part2.ipynb | cc0-1.0 | from __future__ import print_function
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
from datetime import date
date.today()
author = "kyubyong. https://github.com/Kyubyong/tensorflow-exercises"
tf.__version__
np.__version__
"""
Explanation: Neural Network Part2
End of... |
ES-DOC/esdoc-jupyterhub | notebooks/mpi-m/cmip6/models/mpi-esm-1-2-hr/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mpi-m', 'mpi-esm-1-2-hr', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: MPI-M
Source ID: MPI-ESM-1-2-HR
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, ... |
Danghor/Algorithms | Python/Chapter-10/Permutation.ipynb | gpl-2.0 | import random as rnd
def permute(L):
if len(L) == 1:
return L
k = rnd.randint(0, len(L)-1)
return permute(L[:k] + L[k+1:]) + [L[k]]
for _ in range(20):
print(permute([1,2,3,4,5]))
"""
Explanation: Generating Random Permutations
End of explanation
"""
Values = { "2", "3", "4", "5", "6", "7",... |
neuropycon/ephypype | examples/.ipynb_checkpoints/ipynb_report-checkpoint.ipynb | bsd-3-clause | name_sel = widgets.Select(
description='Subject ID:',
options=subject_ids
)
display(name_sel)
cond_sel = widgets.RadioButtons(
description='Condition:',
options=sessions,
)
display(cond_sel)
%%capture
if cond_sel.value == sessions[0]:
session = sessions[0]
elif cond_sel.value == sessions[1]:
s... |
SHDShim/pytheos | examples/6_p_scale_test_Shim_Au.ipynb | apache-2.0 | %config InlineBackend.figure_format = 'retina'
"""
Explanation: For high dpi displays.
End of explanation
"""
import matplotlib.pyplot as plt
import numpy as np
from uncertainties import unumpy as unp
import pytheos as eos
"""
Explanation: 0. General note
This example compares pressure calculated from pytheos and o... |
dietmarw/EK5312_ElectricalMachines | Chapman/Ch6-Problem_6-21.ipynb | unlicense | %pylab notebook
"""
Explanation: Excercises Electric Machinery Fundamentals
Chapter 6
Problem 6-21
End of explanation
"""
R1 = 0.54 # [Ohm]
R2 = 0.488 # [Ohm]
Xm = 51.12 # [Ohm]
X1 = 2.093 # [Ohm]
X2 = 3.209 # [Ohm]
Pcore = 150 # [W]
Pf_w = 150 # [W]
Pmisc = 50 # [W]
V = 460 # [V]
p = 4
fse = 60 # [Hz]
""... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a_algo/td1a_cenonce_session8.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 1A.algo - Arbre et Trie
Le mot trie est anglais et se prononce traïlle. Il sera défini plus bas. Cette structure de données est très adaptée à la recherche d'un mot dans une liste ordonnée. C'est aussi une histoire de dictionnaires imbriq... |
streety/biof509 | Wk08-machine-learning-workflow.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
%matplotlib inline
"""
Explanation: Week 8 - The Machine Learning Workflow
End of explanation
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model, decomposition, datasets
from sklearn.metrics import accuracy_... |
gaufung/Data_Analytics_Learning_Note | python-statatics-tutorial/basic-theme/python-language/Itertools.ipynb | mit | from itertools import *
"""
Explanation: itertools module
End of explanation
"""
for value in chain('gau', 'fung'):
print value,
"""
Explanation: 1 chain(*iterables)
Make an iterator that returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterabl... |
daviddesancho/mdtraj | examples/WebGL-Viewer.ipynb | lgpl-2.1 | from __future__ import print_function
import mdtraj as md
traj = md.load_pdb('http://www.rcsb.org/pdb/files/2M6K.pdb')
print(traj)
"""
Explanation: Interactive WebGL trajectory widget
Note: this feature requires a 'running' notebook, connected to a live kernel. It will not work with a staticly rendered display. For a... |
yevheniyc/Python | 1m_ML_Security/notebooks/day_2/Worksheet 3 - EDA Worksheet.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
%pylab inline
"""
Explanation: <img src="../../img/logo_white_bkg_small.png" align="left" />
Worksheet 3: EDA Worksheet
This worksheet covers concepts covered in the first half of Module 1 - Exploratory Data Analysis in On... |
kingb12/languagemodelRNN | report_notebooks/encdec_noing10_bow_200_512_04drb.ipynb | mit | report_file = '/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing10_bow_200_512_04drb/encdec_noing10_bow_200_512_04drb.json'
log_file = '/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing10_bow_200_512_04drb/encdec_noing10_bow_200_512_04drb_logs.json'
import json
import ... |
ceos-seo/data_cube_notebooks | notebooks/general/Notebook_Template.ipynb | apache-2.0 | # Enable importing of our utilities.
import sys
import os
sys.path.append(os.environ.get('NOTEBOOK_ROOT'))
# Import the most commonly used packages in our notebooks.
import datacube # Facilitates loading data from the Data Cube
import numpy as np # Numerical processing, including time
import pandas as pd # Tabular dat... |
manoharan-lab/structural-color | event_distribution_tutorial.ipynb | gpl-3.0 | import time
import numpy as np
import matplotlib.pyplot as plt
import structcol as sc
import structcol.refractive_index as ri
from structcol import montecarlo as mc
from structcol import detector as det
from structcol import event_distribution as ed
import seaborn as sns
sns.set_style('white')
# For Jupyter notebooks ... |
google/qkeras | notebook/AutoQKeras.ipynb | apache-2.0 | import sys
print(sys.version)
"""
Explanation: Introduction
In this notebook, we show how to quantize a model using AutoQKeras.
As usual, let's first make sure we are using Python 3.
End of explanation
"""
import warnings
warnings.filterwarnings("ignore")
import json
import pprint
import numpy as np
import six
impo... |
cliburn/sta-663-2017 | homework/10_Probability_And_Simulations_Solutions.ipynb | mit | %%file rng.cpp
<%
cfg['compiler_args'] = ['-std=c++11']
cfg['include_dirs'] = ['eigen']
setup_pybind11(cfg)
%>
#include <pybind11/pybind11.h>
#include <pybind11/eigen.h>
#include <Eigen/Cholesky>
#include <random>
namespace py = pybind11;
Eigen::MatrixXd mvn(Eigen::VectorXd mu, Eigen::MatrixXd sigma, int n) {
s... |
zhuanxuhit/deep-learning | gan_mnist/my_Intro_to_GANs_Exercises.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import pickle as pkl
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data')
"""
Explanation: Generative Adversarial Network
... |
GoogleCloudPlatform/cloudml-samples | notebooks/xgboost/TrainingAndPredictionWithXGBoost.ipynb | apache-2.0 | %pip install xgboost
"""
Explanation: Overview
This notebook uses the Census Income Data Set to demonstrate how to train a model and generate local predictions using XGBoost.
Dataset
The Census Income Data Set that this sample
uses for training is provided by the UC Irvine Machine Learning
Repository.
Disclaimer
This ... |
ktakagaki/kt-2015-DSPHandsOn | MedianFilter/Python/04. Summaries/Summary of the error rate of the median with different window lengths.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
import sys
# Add a new path with needed .py files.
sys.path.insert(0, 'C:\Users\Dominik\Documents\GitRep\kt-2015-DSPHandsOn\MedianFilter\Python')
import functions
import gitInformation
%matplotlib inline
gitInformation.printInformation()
"""
Explanation: Error of ... |
arcyfelix/Courses | 17-09-27-AWS Machine Learning A Complete Guide With Python/04 - Linear Regression/02 - ml_linear_examples.ipynb | apache-2.0 | def straight_line(x):
return 5 * x + 8
straight_line(25)
straight_line(1.254)
np.random.seed(5)
samples = 150
x_vals = pd.Series(np.random.rand(samples) * 20)
y_vals = x_vals.map(straight_line)
# Add random noise
y_noisy_vals = y_vals + np.random.randn(samples) * 3
df = pd.DataFrame({'x': x_vals,
... |
joshspeagle/dynesty | demos/Examples -- Importance Reweighting.ipynb | mit | # system functions that are always useful to have
import time, sys, os
# basic numeric setup
import numpy as np
from numpy import linalg
# inline plotting
%matplotlib inline
# plotting
import matplotlib
from matplotlib import pyplot as plt
# seed the random number generator
rstate = np.random.default_rng(510)
# re... |
fcollonval/coursera_data_visualization | Making_Data_Management.ipynb | mit | # Load a useful Python libraries for handling data
import pandas as pd
import numpy as np
from IPython.display import Markdown, display
# Read the data
data_filename = r'gapminder.csv'
data = pd.read_csv(data_filename, low_memory=False)
data = data.set_index('country')
"""
Explanation: Assignment: Making Data Managem... |
Boussau/Notebooks | Notebooks/clockModelComparison.ipynb | gpl-2.0 | import sys
from ete3 import Tree, TreeStyle, NodeStyle
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
import scipy
import re
def readMAPChronogramFromRBOutput (file):
try:
f=open(file, 'r')
except IOError:
print ("Unknown file: "+file)
sys.exit()
... |
mne-tools/mne-tools.github.io | 0.19/_downloads/89050e30106bf5c25f0fafb6d50732da/plot_phantom_4DBTi.ipynb | bsd-3-clause | # Authors: Alex Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
from mne.datasets import phantom_4dbti
import mne
"""
Explanation: ============================================
4D Neuroimaging/BTi phantom dataset tutorial
======================================... |
ernestyalumni/CUDACFD_out | lid-driven-cavity_gpu-gfx/lid-driven-cavity-gpu-gfx.ipynb | mit | # %matplotlib inline
"""
Explanation: Lid driven Cavity (GPU)
The following command is important to view matplotlib plots on a jupyter notebook
End of explanation
"""
%matplotlib notebook
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import os, sys
from matplotlib.mlab import griddata
... |
JanetMatsen/Machine_Learning_CSE_546 | HW2/notebooks/Q-1-2_multiclass_kernel_trick.ipynb | mit | R = np.random.normal(size=(train_X.shape[1], 10000))
XR = train_X.dot(R).clip(min=0)
XR = train_X.dot(R)
"""
Explanation: Make the big random matrix
End of explanation
"""
hyper_explorer = HyperparameterExplorer(X=XR, y=train_y,
model=RidgeMulti,
... |
Vvkmnn/books | ThinkBayes/03_Estimation.ipynb | gpl-3.0 | from dice import Dice
suite = Dice([4, 6, 8, 12, 20])
"""
Explanation: Estimation
The dice problem
Suppose I have a box of dice that contains a 4-sided die, a 6-sided die,
an 8-sided die, a 12-sided die, and a 20-sided die. If you have ever
played Dungeons & Dragons, you know what I am talking
about.
Suppose I select... |
mdda/fossasia-2016_deep-learning | notebooks/0-Frameworks/0-TheanoBasics.ipynb | mit | import theano
import theano.tensor as T
"""
Explanation: Theano : The Basics
Theano is an optimizing compiler for symbolic math expressions.
( Credit for this workbook : Eben Olson :: https://github.com/ebenolson/pydata2015 )
End of explanation
"""
x = T.scalar()
x
"""
Explanation: Symbolic variables
Rather than m... |
ColeLab/informationtransfermapping | MasterScripts/ManuscriptS4_Network2NetworkInformationTransferNullModel_withinNet.ipynb | gpl-3.0 | import sys
sys.path.append('utils/')
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
import statsmodels.sandbox.stats.multicomp as mc
import multiprocessing as mp
%matplotlib inline
import os
os.environ['OMP_NUM_THREADS'] = str(1)
import warnings
warnings.filterwarnings('ignore')
from sta... |
ES-DOC/esdoc-jupyterhub | notebooks/noaa-gfdl/cmip6/models/gfdl-esm4/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'gfdl-esm4', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: NOAA-GFDL
Source ID: GFDL-ESM4
Topic: Atmoschem
Sub-Topics: Transport, ... |
phoebe-project/phoebe2-docs | 2.1/tutorials/l3.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.1,<2.2"
"""
Explanation: "Third" Light
Setup
Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""
%matplotlib inline
import... |
CCI-Tools/sandbox | notebooks/norman/xarray-ex-3.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import pandas as pd
import xarray as xr
from netCDF4 import num2date
import matplotlib.pyplot as plt
print("numpy version : ", np.__version__)
print("pandas version : ", pd.__version__)
print("xarray version : ", xr.__version__)
"""
Explanation: Calculating Seasonal Averages f... |
dseuss/notebooks | Compressed Sensing/IHT -- Compressed Sensing.ipynb | unlicense | import numpy as np
from numpy.linalg import norm
import matplotlib.pyplot as pl
import cvxpy as cvx
import itertools as it
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
import sys
sys.path.append('/Users/dsuess/Code/Pythonlibs/')
# see https://github.com/dseuss/pythonlibs
from tools.... |
dkirkby/astroml-study | Chapter3/Chapter3.ipynb | mit | %pylab inline
import astroML
"""
Explanation: # Chapter 3
End of explanation
"""
from astroML.plotting import setup_text_plots
setup_text_plots(fontsize=8, usetex=True)
def banana_distribution(N=10000):
"""This generates random points in a banana shape"""
# create a truncated normal distribution
theta ... |
spohnan/geowave | examples/data/notebooks/jupyter/geowave-gpx.ipynb | apache-2.0 | #!pip install --user --upgrade pixiedust
import pixiedust
import geowave_pyspark
"""
Explanation: Geowave GPX Demo
This Demo runs KMeans on the GPX dataset consisting of approximately 285 million point locations. We use a cql filter to reduce the KMeans set to a bounding box over Berlin, Germany. Simply focus a cell ... |
neuropower/neurodesign | examples/comparison_neurodesign.ipynb | mit | from neurodesign import optimisation,experiment
import matplotlib.pyplot as plt
from scipy.stats import t
import seaborn as sns
import pandas as pd
import numpy as np
%matplotlib inline
%load_ext rpy2.ipython
cycles = 1000
sims = 5000
"""
Explanation: Neurodesign comparison of design generators
In this notebook, we ... |
maibkey/udacity | 泰坦尼克号生存率的影响因素/.ipynb_checkpoints/taitannikehao-checkpoint.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pylab as pl
%matplotlib inline
filename = './titanic-data.csv'
titanic_df = pd.read_csv(filename)
titanic_df.describe()
"""
Explanation: 关于泰坦尼克号生存率的数据分析
首先通过观察数据,可以了解到每位旅客的详细数据:
Survived:是否存活(0代表否,1代表是)
Pclass:舱位(一等舱,二等舱,三等舱)
Name:船上乘客的名字
... |
CopernicusMarineInsitu/INSTACTraining | PythonNotebooks/IndexFilePlots/read_CMEMS_indexfile.ipynb | mit | indexfile = "datafiles/index_latest.txt"
"""
Explanation: This notebook shows how to use an index file.<br/>
This example uses the index file from the Mediterranean Sea region (INSITU_MED_NRT_OBSERVATIONS_013_035) corresponding to the latest data.<br/>
If you download the same file, the results will be slightly differ... |
qgoisnard/Exercice-update | 02-LinearFrame.ipynb | mit | from frame import *
%matplotlib inline
from sympy.interactive import printing
printing.init_printing()
"""
Explanation: From straight beams to frames
A frame is obtained by assembling several straight beams with different orientations.
Different from the case of classes, the beams are clamped one to each other (and... |
google/prog-edu-assistant | exercises/dataframe-pre2-master.ipynb | apache-2.0 | # CSVファイルからデータを読み込みましょう。 Read the data from CSV file.
df = pd.read_csv('data/16-July-2019-Tokyo-hourly.csv')
print("行数は %d です" % len(df))
print(df.dtypes)
df.head()
"""
Explanation: Data frames 2. 可視化 (Visualization)
```
ASSIGNMENT METADATA
assignment_id: "DataFrame2"
```
lang:en
In this unit, we will get acquainted w... |
fja05680/pinkfish | examples/220.asset-allocation-portfolio/strategy.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 n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.