repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
cyang019/blight_fight
Final_Report.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt from IPython.display import Image %matplotlib inline """ Explanation: Study of Correlation Between Building Demolition and Associated Features Capstone Project for Data Science at Scale on Coursera Repo is located here Chen Yang yangcnju@gmail.co...
mattpitkin/corner.py
docs/_static/notebooks/quickstart.ipynb
bsd-2-clause
import corner import numpy as np ndim, nsamples = 2, 10000 np.random.seed(42) samples = np.random.randn(ndim * nsamples).reshape([nsamples, ndim]) figure = corner.corner(samples) """ Explanation: Getting started The only user-facing function in the module is corner.corner and, in its simplest form, you use it like th...
tbphu/fachkurs_bachelor
tellurium/tellurium_introduction_empty.ipynb
mit
import tellurium as te; te.setDefaultPlottingEngine('matplotlib') %matplotlib inline antimony_model = '''J0: -> y; -x;J1: -> x; y;x = 1.0;y = 0.2;''' r = te.loada(antimony_model) r.simulate(0,100,1000) r.plot() """ Explanation: Tellurium Introduction: Motivation ... a minimal example! Just a few lines of code allow a...
cranndarach/namegen
explore_names.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.stats import gaussian_kde """ Explanation: Exploring the names database I might like to try some sort of frequency-weighting for namegen, but instead of including each name the same number of times that it appears in the corpus, I will t...
phoebe-project/phoebe2-docs
2.2/tutorials/reflection_heating.ipynb
gpl-3.0
!pip install -I "phoebe>=2.2,<2.3" """ Explanation: Reflection and Heating For a comparison between "Horvat" and "Wilson" methods in the "irad_method" parameter, see the tutorial on Lambert Scattering. Setup Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you...
Diyago/Machine-Learning-scripts
statistics/CreditScore.ipynb
apache-2.0
import numpy as np import pandas as pd import math from scipy.stats import chisquare from statsmodels.stats.descriptivestats import sign_test from statsmodels.sandbox.stats.multicomp import multipletests import scipy import scipy as sc from statsmodels.stats.weightstats import * import pandas as pd import statsmod...
tolaoniyangi/dmc
notebooks/week-2/04 - Lab 2 Assignment.ipynb
apache-2.0
import random """ Explanation: Lab 2 assignment This assignment will get you familiar with the basic elements of Python by programming a simple card game. We will create a custom class to represent each player in the game, which will store information about their current pot, as well as a series of methods defining ho...
barjacks/foundations-homework
07/.ipynb_checkpoints/Animal_Panda_Homework_7_Skinner-checkpoint.ipynb
mit
import pandas as pd """ Explanation: *1. Import pandas with the right name End of explanation """ %matplotlib inline """ Explanation: *2. Set all graphics from matplotlib to display inline End of explanation """ #for encoding the command would look smth like this: #df = pd.read_csv("XXXXXXXXXXXXXXXXX.csv", encodi...
dlsun/symbulate
docs/common_joint.ipynb
mit
from symbulate import * %matplotlib inline """ Explanation: Symbulate Documentation Common Joint Distributions Introduction to joint distributions BivariateNormal MultivariateNormal < Methods for common discrete and continuous distributions | Contents | Common random processes > Be sure to import Symbulate using the...
spencerkclark/aospy
aospy/examples/tutorial.ipynb
apache-2.0
import os # Python built-in package for working with the operating system import aospy rootdir = os.path.join(aospy.__path__[0], 'test', 'data', 'netcdf') """ Explanation: aospy Tutorial This notebook closely follows the descriptions, objects created, and code executed in the examples page in the documentation. Pre...
feststelltaste/software-analytics
notebooks/Finding tested code with jQAssistant.ipynb
gpl-3.0
import py2neo import pandas as pd graph = py2neo.Graph() query = """ MATCH (testMethod:Method) -[:ANNOTATED_BY]->()-[:OF_TYPE]-> (:Type {fqn:"org.junit.Test"}), (testType:Type)-[:DECLARES]->(testMethod), (type)-[:DECLARES]->(method:Method), (testMethod)-[i:INVOKES]->(method) WHERE NOT type.name E...
whitead/numerical_stats
unit_6/lectures/lecture_3.ipynb
gpl-3.0
import matplotlib.pyplot as plt import numpy as np %matplotlib inline import matplotlib """ Explanation: Unit 6, Lecture 3 Numerical Methods and Statistics Prof. Andrew White, Feb 22 2020 Lecture Goals Know what a python function is and be able to define one Be able to call a function and understand how arguments ar...
agile-geoscience/welly
docs/_userguide/Quick_start.ipynb
apache-2.0
import numpy as np import matplotlib.pyplot as plt import welly welly.__version__ """ Explanation: Quick start Welcome to the Quick start guide! This should help you get started using welly. First some preliminaries... End of explanation """ project = welly.read_las('https://geocomp.s3.amazonaws.com/data/P-129.LAS'...
ComputationalPhysics2015-IPM/floating-points
Floating_Points.ipynb
gpl-2.0
a = 0 dx = 10**-9 for i in range(10**9): a += dx print(a) """ Explanation: Floating Points Lets start with a simple example: $10^9 \times 10^{-9} = ?$ It is supposed to be 1. End of explanation """ a = 0 dx = 2**-30 for i in range(2**30): a += dx print(a) """ Explanation: It is not! lets try anoth...
mne-tools/mne-tools.github.io
0.18/_downloads/635035741daf88c18928d17907998cb3/plot_run_ica.ipynb
bsd-3-clause
# Authors: Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import mne from mne.preprocessing import ICA, create_ecg_epochs from mne.datasets import sample print(__doc__) """ Explanation: Compute ICA components on epochs ICA is fit to MEG raw data. We assume that the non-stationary EOG artifacts...
cliburn/sta-663-2017
notebook/15B_ResamplingAndSimulation.ipynb
mit
np.random.seed(123) """ Explanation: Resampling and Monte Carlo Simulations Broadly, any simulation that relies on random sampling to obtain results falls into the category of Monte Carlo methods. Another common type of statistical experiment is the use of repeated sampling from a data set, including the bootstrap, ja...
vinhqdang/my_mooc
coursera/advanced_machine_learning_spec/4_nlp/natural-language-processing-master/week4/week4-seq2seq.ipynb
mit
import random def generate_equations(allowed_operators, dataset_size, min_value, max_value): """Generates pairs of equations and solutions to them. Each equation has a form of two integers with an operator in between. Each solution is an integer with the result of the operaion. allo...
Parsl/parsl_demos
Bash-Tutorial.ipynb
apache-2.0
# Import Parsl import parsl from parsl import * print(parsl.__version__) # The version should be v0.2.1+ """ Explanation: Parsl Bash Tutorial This tutorial will show you how to run Bash scripts as Parsl apps. Load parsl Import parsl, and check the module version. This tutorial requires version 0.2.0 or above. End of...
machow/siuba
docs/key_features.ipynb
mit
# this is a hidden cell print(""" <div class="output_area rendered_html docutils container"> {table} </div> """.format(table = table.replace('\n', ""))) """ Explanation: Key features End of explanation """ import pandas as pd from siuba import _, mutate my_data = pd.DataFrame({ 'g': ['a', 'a', 'b'], 'x':...
bismayan/MaterialsMachineLearning
notebooks/old_ICSD_Notebooks/Parsing unique entries and the element information.ipynb
mit
from __future__ import division, print_function import pylab as plt import matplotlib.pyplot as mpl from pymatgen.core import Element, Composition %matplotlib inline """ Explanation: In this notebook we shall try to remove duplicates from the icsd csv file and then store the Elements(and their frequencies) for each...
lilleswing/deepchem
examples/tutorials/16_Learning_Unsupervised_Embeddings_for_Molecules.ipynb
mit
!curl -Lo conda_installer.py https://raw.githubusercontent.com/deepchem/deepchem/master/scripts/colab_install.py import conda_installer conda_installer.install() !/root/miniconda/bin/conda info -e !pip install --pre deepchem import deepchem deepchem.__version__ """ Explanation: Tutorial Part 16: Learning Unsupervised...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/tensorflow/b_estimator.ipynb
apache-2.0
# Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.6 import tensorflow as tf import pandas as pd import numpy as np import shutil print(tf.__version__) """ Explanation: <h1> Machine Learning using tf.estimator </h1> In this notebook, we will create a machine learning model using...
aurix/lammps-induced-dipole-polarization-pair-style
python/examples/pylammps/interface_usage_bonds.ipynb
gpl-2.0
from lammps import IPyLammps L = IPyLammps() # 2d circle of particles inside a box with LJ walls import math b = 0 x = 50 y = 20 d = 20 # careful not to slam into wall too hard v = 0.3 w = 0.08 L.units("lj") L.dimension(2) L.atom_style("bond") L.boundary("f f p") L.lattice("hex", 0.85) L.region("...
landlab/landlab
notebooks/tutorials/overland_flow/overland_flow_driver.ipynb
mit
from landlab.components.overland_flow import OverlandFlow from landlab.plot.imshow import imshow_grid from landlab.plot.colors import water_colormap from landlab import RasterModelGrid from landlab.io.esri_ascii import read_esri_ascii from matplotlib.pyplot import figure import numpy as np from time import time %matpl...
bashtage/statsmodels
examples/notebooks/statespace_sarimax_pymc3.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd import pymc3 as pm import statsmodels.api as sm import theano import theano.tensor as tt from pandas.plotting import register_matplotlib_converters from pandas_datareader.data import DataReader plt.style.use("seaborn") register_m...
philmui/datascience2016fall
lecture03.numpy.pandas/lecture03.numpy.ipynb
mit
import numpy dir(numpy) help(numpy.zeros) a = numpy.zeros( (3,5) ) a a[(2,2)] = 3 a import numpy as np """ Explanation: Numpy NumPy, short for Numerical Python, is the fundamental package required for high performance scientific computing and data analysis. While NumPy by itself does not provide very muc...
darioizzo/d-CGP
doc/sphinx/notebooks/symbolic_regression_2.ipynb
gpl-3.0
# Some necessary imports. import dcgpy import pygmo as pg # Sympy is nice to have for basic symbolic manipulation. from sympy import init_printing from sympy.parsing.sympy_parser import * init_printing() # Fundamental for plotting. from matplotlib import pyplot as plt %matplotlib inline """ Explanation: Learning const...
sdpython/ensae_teaching_cs
_doc/notebooks/exams/td_note_2015_rattrapage_enonce.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.e - TD noté 2015 rattrapage (énoncé, écrit et oral) Questions posées à l'oral autour du jeu 2048 et d'un exercice Google Jam sur le position de carreaux dans un plus grand carré : Problem D. Cut Tiles. End of explanation """ mat = [[...
godfreyduke/deep-learning
dcgan-svhn/DCGAN.ipynb
mit
%matplotlib inline import pickle as pkl import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat import tensorflow as tf !mkdir data """ Explanation: Deep Convolutional GANs In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a De...
amirziai/learning
deep-learning/tangent.ipynb
mit
import tangent import tensorflow as tf def f(x): a = x * x b = x * a c = a + b return c df = tangent.grad(f) df df(33) """ Explanation: tangent Source-to-Source Debuggable Derivatives in Pure Python As a result, you can finally read your automatic derivative code just like the rest of your program...
Autodesk/molecular-design-toolkit
moldesign/_notebooks/Example 1. Build and simulate DNA.ipynb
apache-2.0
import moldesign as mdt from moldesign import units as u %matplotlib inline from matplotlib.pyplot import * # seaborn is optional -- it makes plots nicer try: import seaborn except ImportError: pass """ Explanation: <span style="float:right"><a href="http://moldesign.bionano.autodesk.com/" target="_blank" title="A...
dereneaton/RADmissing
emp_nb_Danio.ipynb
mit
### Notebook 7 ### Data set 7 (Danio) ### Authors: McCluskey (20xx) ### Data Location: SRP065811 """ Explanation: Notebook 7: This is an IPython notebook. Most of the code is composed of bash scripts, indicated by %%bash at the top of the cell, otherwise it is IPython code. This notebook includes code to download, as...
tensorflow/docs-l10n
site/en-snapshot/hub/tutorials/cross_lingual_similarity_with_tf_hub_multilingual_universal_encoder.ipynb
apache-2.0
# Copyright 2019 The TensorFlow Hub Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
fifabsas/talleresfifabsas
python/Extras/Dinamica_no_Lineal/mapas/mapasembebidos.ipynb
mit
from matplotlib import pyplot as plt #basic plotting from mpl_toolkits.mplot3d import Axes3D #for 3D plots import numpy as np #vectorial calculus import os #basic file handling #inline plotting %matplotlib inline #matplotlib font settings from matplotlib import rc as rc font = {'family' : 'sans', 'weight' : 'no...
jegibbs/phys202-2015-work
assignments/midterm/InteractEx06.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import math from IPython.display import Image from IPython.html.widgets import interact, interactive, fixed """ Explanation: Interact Exercise 6 Imports Put the standard imports for Matplotlib, Numpy and the IPython widgets in the following cell. E...
cathalmccabe/PYNQ
boards/Pynq-Z1/logictools/notebooks/boolean_generator.ipynb
bsd-3-clause
from pynq.overlays.logictools import LogicToolsOverlay logictools_olay = LogicToolsOverlay('logictools.bit') """ Explanation: Boolean Generator This notebook will show how to use the boolean generator to generate a boolean combinational function. The function that is implemented is a 2-input XOR. Step 1: Download the...
survey-methods/samplics
docs/source/tutorial/replicate_weights.ipynb
mit
import numpy as np import pandas as pd import samplics from samplics.datasets import PSUSample, SSUSample from samplics.weighting import ReplicateWeight """ Explanation: Replicate weights Replicate weights are usually created for the purpose of variance (uncertainty) estimation. One common use case for replication-ba...
newworldnewlife/TensorFlow-Tutorials
12_Adversarial_Noise_MNIST.ipynb
mit
from IPython.display import Image Image('images/12_adversarial_noise_flowchart.png') """ Explanation: TensorFlow Tutorial #12 Adversarial Noise for MNIST by Magnus Erik Hvass Pedersen / GitHub / Videos on YouTube Introduction The previous Tutorial #11 showed how to find so-called adversarial examples for a state-of-th...
phoebe-project/phoebe2-docs
development/tutorials/datasets_advanced.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.4,<2.5" """ Explanation: Advanced: Datasets Datasets tell PHOEBE how and at what times to compute the model. In some cases these will include the actual observational data, and in other cases may only include the times at which you want to compute a synthetic model. If you're not already f...
unnikrishnankgs/va
venv/lib/python3.5/site-packages/nbconvert/tests/files/Widget_List.ipynb
bsd-2-clause
import ipywidgets as widgets widgets.Widget.widget_types """ Explanation: Index - Back - Next Widget List Complete list For a complete list of the GUI widgets available to you, you can list the registered widget types. Widget and DOMWidget, not listed below, are base classes. End of explanation """ widgets.IntSlide...
keras-team/keras-io
examples/nlp/ipynb/nl_image_search.ipynb
apache-2.0
import os import collections import json import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import tensorflow_hub as hub import tensorflow_text as text import tensorflow_addons as tfa import matplotlib.pyplot as plt import matplotlib.image as mpimg from tqdm impo...
sysid/nbs
LP/Introduction-to-linear-programming/Introduction to Linear Programming with Python - Part 5.ipynb
mit
import pandas as pd import pulp factories = pd.DataFrame.from_csv('csv/factory_variables.csv', index_col=['Month', 'Factory']) factories """ Explanation: Introduction to Linear Programming with Python - Part 5 Using PuLP with pandas and binary constraints to solve a scheduling problem In this example, we'll be solvin...
aje/POT
notebooks/plot_otda_color_images.ipynb
mit
# Authors: Remi Flamary <remi.flamary@unice.fr> # Stanislas Chambon <stan.chambon@gmail.com> # # License: MIT License import numpy as np from scipy import ndimage import matplotlib.pylab as pl import ot r = np.random.RandomState(42) def im2mat(I): """Converts and image to matrix (one pixel per line)""...
HydPy/HydPy-meetups
2020/2020-02-29/MetaProgramming In Python.ipynb
mit
class Test: pass a = Test() a type(a) type(Test) type(type) """ Explanation: MetaProgramming In Python Classes in Python - What is a class in Python? End of explanation """ type? TestWithType = type('TestWithType', (object,), {}) type(TestWithType) ins1 = TestWithType() type(ins1) type('TestWithType', (...
fastai/fastai
nbs/70a_callback.tensorboard.ipynb
apache-2.0
#|export import tensorboard from torch.utils.tensorboard import SummaryWriter from fastai.callback.fp16 import ModelToHalf from fastai.callback.hook import hook_output #|export class TensorBoardBaseCallback(Callback): order = Recorder.order+1 "Base class for tensorboard callbacks" def __init__(self): self....
sdpython/ensae_teaching_cs
_doc/notebooks/td1a/td1a_cenonce_session3.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.1 - Dictionnaires, fonctions, code de Vigenère Le dictionnaire est une structure de données très utilisée. Elle est illustrée pour un problème de décryptage. End of explanation """ def polynome ( x ) : x2 = x*x return x2 + x ...
timkpaine/lantern
experimental/widgets/6_Widget Asynchronous.ipynb
apache-2.0
%gui asyncio """ Explanation: Index - Back Asynchronous Widgets This notebook covers two scenarios where we'd like widget-related code to run without blocking the kernel from acting on other execution requests: Pausing code to wait for user interaction with a widget in the frontend Updating a widget in the background...
ihmeuw/dismod_mr
examples/few_data_types.ipynb
agpl-3.0
import matplotlib.pyplot as plt, numpy as np import dismod_mr models = {} #iter=101; burn=0; thin=1 # use these settings to run faster iter=10_000; burn=5_000; thin=5 # use these settings to make sure MCMC converges """ Explanation: Consistent models in DisMod-MR without many different types of data In DisMod-II th...
malcolmw/seismic-python
jupyter/fd_first_order_1d.ipynb
gpl-3.0
# Parameterize the propagation domain c = 100 # Wave speed [m/s] xmin, xmax = -1000, 1000 # Computational domain [m] tmin, tmax = 0, 20 # Computational domain [s] f0 = 20 # Dominant frequency [1/s] t0 = 4 / f0 # Zero-crossing time [s] s0 = 0 # S...
synthicity/activitysim
activitysim/examples/example_estimation/notebooks/14_joint_tour_scheduling.ipynb
agpl-3.0
import os import larch # !conda install larch -c conda-forge # for estimation import pandas as pd """ Explanation: Estimating Joint Tour Scheduling This notebook illustrates how to re-estimate the joint tour scheduling component for ActivitySim. This process includes running ActivitySim in estimation mode to read h...
ledeprogram/algorithms
class7/donow/Kromreig_Georgia_7_donow.ipynb
gpl-3.0
import pandas as pd %matplotlib inline import numpy as np from sklearn.linear_model import LogisticRegression import statsmodels.formula.api as smf """ Explanation: Apply logistic regression to categorize whether a county had high mortality rate due to contamination 1. Import the necessary packages to read in the data...
gaoshuming/udacity
tv-script-generation/dlnd_tv_script_generation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper data_dir = './data/simpsons/moes_tavern_lines.txt' text = helper.load_data(data_dir) # Ignore notice, since we don't use it for analysing the data text = text[81:] """ Explanation: TV Script Generation In this project, you'll generate your own Simpsons TV scrip...
Illumina/interop
docs/src/Tutorial_01_Intro.ipynb
gpl-3.0
run_folder = r"D:\RTA.Data\InteropData\MiSeqDemo" """ Explanation: Using the Illumina InterOp Library in Python Install If you do not have the Python InterOp library installed, then you can do the following: $ pip install -f https://github.com/Illumina/interop/releases/latest interop You can verify that InterOp is pr...
jeancochrane/learning
python-machine-learning/code/ch02solutions.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd from algos.perceptron import Perceptron df = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data', header=None) y = df.iloc[0:100, 4].values y = np.where(y == 'Iris-setosa', 1, -1) X = df.iloc[...
ES-DOC/esdoc-jupyterhub
notebooks/cnrm-cerfacs/cmip6/models/cnrm-cm6-1/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cnrm-cerfacs', 'cnrm-cm6-1', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: CNRM-CERFACS Source ID: CNRM-CM6-1 Topic: Land Sub-Topics: Soil, Snow, Vegeta...
kaleoyster/nbi-data-science
Bridge Life-Cycle Models/CDF+Probability+Reconstruction+vs+Age+of+Bridges+in+the+Northeast+United+States.ipynb
gpl-2.0
import pymongo from pymongo import MongoClient import time import pandas as pd import numpy as np import seaborn as sns from matplotlib.pyplot import * import matplotlib.pyplot as plt import folium import datetime as dt import random as rnd import warnings import datetime as dt import csv %matplotlib inline """ Explan...
science-of-imagination/nengo-buffer
Project/trained_mental_rotation_ens_compare.ipynb
gpl-3.0
import nengo import numpy as np import cPickle from nengo_extras.data import load_mnist from nengo_extras.vision import Gabor, Mask from matplotlib import pylab import matplotlib.pyplot as plt import matplotlib.animation as animation import scipy.ndimage from skimage.measure import compare_ssim as ssim """ Explanation...
mne-tools/mne-tools.github.io
0.23/_downloads/ed1a04dd775648ca869bfcffae26faca/30_mne_dspm_loreta.ipynb
bsd-3-clause
import os.path as op import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.minimum_norm import make_inverse_operator, apply_inverse """ Explanation: Source localization with MNE/dSPM/sLORETA/eLORETA The aim of this tutorial is to teach you how to compute and apply a l...
ES-DOC/esdoc-jupyterhub
notebooks/cas/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', 'cas', 'sandbox-1', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: CAS Source ID: SANDBOX-1 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Balance...
fagonzalezo/is-2016-1
exam_is.ipynb
mit
def bn_model(data, k): ''' data: training data as a list of lists [[x_1, x_2, ..., X_n, A, B] [x_1, x_2, ..., X_n, A, B] : [x_1, x_2, ..., X_n, A, B] ] k: Laplace's smoothing parameter returns: It must return the model as a dictionary with the following form: For...
dinrker/PredictiveModeling
Session 2 - Overfitting_Regularization_ModelSelection.ipynb
mit
import numpy as np import pandas as pd from IPython.display import Image """ Explanation: End of explanation """ def mean_squared_error(y_true, y_pred): """ calculate the mean_squared_error given a vector of true ys and a vector of predicted ys """ diff = y_true - y_pred return np.dot(diff, dif...
Jonestj1/mbuild
docs/tutorials/tutorial_methane.ipynb
mit
import mbuild as mb class Methane(mb.Compound): def __init__(self): super(Methane, self).__init__() """ Explanation: Methane: Compounds and bonds The primary building block in mBuild is a Compound. Anything you construct will inherit from this class. Let's start with some basic imports and initialization:...
tensorflow/docs-l10n
site/ja/quantum/tutorials/barren_plateaus.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...
jrg365/gpytorch
examples/08_Advanced_Usage/Simple_Batch_Mode_GP_Regression.ipynb
mit
import math import torch import gpytorch from matplotlib import pyplot as plt %matplotlib inline """ Explanation: Batch GP Regression Introduction In this notebook, we demonstrate how to train Gaussian processes in the batch setting -- that is, given b training sets and b separate test sets, GPyTorch is capable of tr...
albahnsen/ML_SecurityInformatics
notebooks/01-IntroMachineLearning.ipynb
mit
# Import libraries %matplotlib inline import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt plt.style.use('ggplot') # Create a random set of examples from sklearn.datasets.samples_generator import make_blobs X, Y = make_blobs(n_samples=50, centers=2,random_state=23, cluster_std=2.90) plt.scatter...
mne-tools/mne-tools.github.io
0.17/_downloads/a35e576fa66929a73782579dc334f91a/plot_time_frequency_mixed_norm_inverse.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.minimum_norm import make_inverse_operator, apply_inverse from mne.inverse_sparse impor...
dennisobrien/PublicNotebooks
fivethirtyeight/2017-06-30 Who steals the most in a town full of theives.ipynb
mit
(999/1000)**999 """ Explanation: The Riddler https://fivethirtyeight.com/features/who-steals-the-most-in-a-town-full-of-thieves/ A town of 1,000 households has a strange law intended to prevent wealth-hoarding. On January 1 of every year, each household robs one other household, selected at random, moving all of that...
RafaelNH/Free-water-elimination-DTI
notebook/run_simulations_1.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt import matplotlib import time import sys import os %matplotlib inline # Change directory to the code folder os.chdir('..//code') # Functions to sample the diffusion-weighted gradient directions from dipy.core.sphere import disperse_charges, HemiSphere # Function to...
aakashm301/Workshop
Refactored_Py_DS_ML_Bootcamp-master/09-Geographical-Plotting/02-Choropleth Maps Exercise.ipynb
gpl-3.0
import plotly.graph_objs as go from plotly.offline import init_notebook_mode,iplot init_notebook_mode(connected=True) """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> Choropleth Maps Exercise Welcome to the Choropleth Maps Exercise! In this exercise we will give you ...
bioe-ml-w18/bioe-ml-winter2018
homeworks/Week6-DynamicalModels.ipynb
mit
% matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint from scipy.optimize import least_squares # 104, 105, 107 V0 = np.array([52., 643., 77.])*1.0e3 c = np.array([3.68, 2.06, 3.09]) delta = np.array([0.5, 0.53, 0.5]) Ttot = np.array([2., 11., 412.])*1.0e3 tdelay = n...
anukarsh1/deep-learning-coursera
Improving Deep Neural networks- Hyperparameter Tuning - Regularization and Optimization/Initialization.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import sklearn import sklearn.datasets from init_utils import sigmoid, relu, compute_loss, forward_propagation, backward_propagation from init_utils import update_parameters, predict, load_dataset, plot_decision_boundary, predict_dec %matplotlib inline plt.rcParams['f...
drericstrong/Blog
20170119_Visualizing Dice Distributions.ipynb
agpl-3.0
import numpy as np import seaborn as sns from scipy.stats import norm import matplotlib.pyplot as plt from itertools import combinations_with_replacement as cwr %matplotlib inline props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) def find_hist(num_dice, dice_type): formula = range(1,dice_type+1) co...
theandygross/TCGA_differential_expression
Notebooks/GABA_Receptors_GTEX.ipynb
mit
import NotebookImport from metaPCNA import * import GTEX as GTEX f_win.order().tail() gabr = [g for g in rna_df.index if g.startswith('GABR')] f = dx_rna.ix[gabr].dropna() f.join(f_win).sort(f_win.name) GTEX.plot_tissues_across_gene('GABRD', log=True) gtex = np.log2(GTEX.gtex) meta = GTEX.meta tissue_type = GTEX.t...
streety/biof509
Wk04-Data-retrieval-and-preprocessing.ipynb
mit
# required packages: import numpy as np import pandas as pd import sklearn import skimage import sqlalchemy as sa import urllib.request import requests import sys import json import pickle import gzip from pathlib import Path import matplotlib import matplotlib.pyplot as plt %matplotlib inline !pip install pymysql i...
phuongxuanpham/SelfDrivingCar
CarND-LaneLines-Project1/P1.ipynb
gpl-3.0
#importing some useful packages import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 %matplotlib inline import pdb """ Explanation: Self-Driving Car Engineer Nanodegree Project: Finding Lane Lines on the Road In this project, you will use the tools you learned about in the le...
Thylossus/tud-movie-character-insights
Server/Tools/InsightsAutoEncoder/AutoEncoderInsights.ipynb
apache-2.0
# Tell matplotlib to show the results directly within the notebook instead # of using popup windows %matplotlib inline # Basic keras functionality to define network models from keras.models import Model # Needed layer classes for "normal" autoencoders ... from keras.layers import Input, Dense # ... and those we need...
SteveDiamond/cvxpy
examples/notebooks/WWW/nonneg_matrix_fact.ipynb
gpl-3.0
import cvxpy as cp import numpy as np # Ensure repeatably random problem data. np.random.seed(0) # Generate random data matrix A. m = 10 n = 10 k = 5 A = np.random.rand(m, k).dot(np.random.rand(k, n)) # Initialize Y randomly. Y_init = np.random.rand(m, k) """ Explanation: Nonnegative matrix factorization A derivati...
sysid/nbs
LP/Introduction-to-linear-programming/LaTeX_formatted_ipynb_files/Introduction to Linear Programming with Python - Part 6.ipynb
mit
def make_io_and_constraint(y1, x1, x2, target_x1, target_x2): """ Returns a list of constraints for a linear programming model that will constrain y1 to 1 when x1 = target_x1 and x2 = target_x2; where target_x1 and target_x2 are 1 or 0 """ binary = [0,1] assert target_x1 in binary a...
DiCarloLab-Delft/PycQED_py3
examples/MeasurementControl.ipynb
mit
import pycqed as pq import numpy as np from pycqed.measurement import measurement_control from pycqed.measurement.sweep_functions import None_Sweep import pycqed.measurement.detector_functions as det from qcodes import station station = station.Station() """ Explanation: Tutorial 1. The Measurement Control This tutor...
miaecle/deepchem
examples/tutorials/03_Modeling_Solubility.ipynb
mit
%tensorflow_version 1.x !curl -Lo deepchem_installer.py https://raw.githubusercontent.com/deepchem/deepchem/master/scripts/colab_install.py import deepchem_installer %time deepchem_installer.install(version='2.3.0') """ Explanation: Tutorial Part 3: Modeling Solubility Computationally predicting molecular solubility t...
mne-tools/mne-tools.github.io
0.20/_downloads/fd92a90eaeac818b497ef44c9c13172a/plot_eeg_csd.ipynb
bsd-3-clause
# Authors: Alex Rockhill <aprockhill206@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() """ Explanation: Transform EEG data using current source density (CSD) This script shows an exa...
MotokiShiga/stem-nmf
old/python_ver0.1/demo.ipynb
mit
%matplotlib inline import numpy as np import scipy.io as sio from libnmf import NMF, NMF_SO, NMF_ARD_SO """ Explanation: Demo of NMF-SO and NMF-ARD-SO [1] Motoki Shiga, Kazuyoshi Tatsumi, Shunsuke Muto, Koji Tsuda, Yuta Yamamoto, Toshiyuki Mori, Takayoshi Tanji, "Sparse Modeling of EELS and EDX Spectral Imaging Data b...
tuanavu/coursera-university-of-washington
machine_learning/2_regression/lecture/week1/.ipynb_checkpoints/PhillyCrime-checkpoint.ipynb
mit
import sys sys.path.append('C:\Anaconda2\envs\dato-env\Lib\site-packages') import graphlab """ Explanation: Fire up graphlab create End of explanation """ sales = graphlab.SFrame.read_csv('Philadelphia_Crime_Rate_noNA.csv/') sales """ Explanation: Load some house value vs. crime rate data Dataset is from Philadelp...
phoebe-project/phoebe2-docs
2.0/examples/binary_spots.ipynb
gpl-3.0
!pip install -I "phoebe>=2.0,<2.1" """ Explanation: Binary with Spots Setup Let's first make sure we have the latest version of PHOEBE 2.0 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 im...
studentofdata/qcew
vmfiles/IPNB/Examples/a Basic/03 Matplotlib essentials.ipynb
bsd-3-clause
import matplotlib.pyplot as plt """ Explanation: Matplotlib This notebook is (will be) as small crash course on the functionality of the Matplotlib Python module for creating graphs (and embedding it in notebooks). It is of course no substirute for the proper Matplotlib thorough documentation. First we need to import ...
dwhswenson/openpathsampling
examples/toy_model_mstis/toy_mstis_3_analysis.ipynb
mit
from __future__ import print_function # If our large test file is available, use it. Otherwise, use file generated # from toy_mstis_2_run.ipynb. This is so the notebook can be used in testing. import os test_file = "../toy_mstis_1k_OPS1.nc" filename = test_file if os.path.isfile(test_file) else "mstis.nc" print("Usin...
probml/pyprobml
notebooks/book2/28/gp_mauna_loa.ipynb
mit
try: import tinygp except ImportError: !pip install -q tinygp from jax.config import config config.update("jax_enable_x64", True) """ Explanation: <a href="https://colab.research.google.com/github/probml/probml-notebooks/blob/main/notebooks/gp_mauna_loa.ipynb" target="_parent"><img src="https://colab.researc...
justanr/notebooks
monads.ipynb
mit
x = y = ' Fred\n Thompson ' """ Explanation: I swore to myself up and down that I wouldn't write one of these. But then I went and hacked up Pynads. And then I wrote a post on Pynads. And then I posted explainations about Monads on reddit. So what the hell. I already fulfilled my "Write about decorators when I und...
eds-uga/csci1360e-su16
lectures/L7.ipynb
mit
import random """ Explanation: Lecture 7: Vectorized Programming CSCI 1360E: Foundations for Informatics and Analytics Overview and Objectives We've covered loops and lists, and how to use them to perform some basic arithmetic calculations. In this lecture, we'll see how we can use an external library to make these co...
ModestoCabrera/IS360_Project3
IS360project_3.ipynb
gpl-2.0
import pandas as pd import csv import matplotlib.pyplot as plt """ Explanation: IS-360 Project 3 End of explanation """ income_df = pd.read_csv('LifeExpectancyIncome.csv') income_df """ Explanation: Reading CSV File into Pandas DataFrame READING CSV: I want to read the csv using the Pandas '.read_csv' which return...
gschivley/Index-variability
Notebooks/Assign NERC region labels.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import os from os.path import join import pandas as pd from sklearn import neighbors, metrics from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split, GridSearchCV from collections import Counter from copy import deepcopy c...
gregcaporaso/short-read-tax-assignment
ipynb/runtime/analysis.ipynb
bsd-3-clause
from os.path import expandvars from tax_credit.plotting_functions import (lmplot_from_data_frame, calculate_linear_regress) import pandas as pd from os.path import join import seaborn.xkcd_rgb as colors """ Explanation: Evaluate computational runtimes The purpose of this notebook is to analyze and plot computational r...
CopernicusMarineInsitu/INSTACTraining
PythonNotebooks/PlatformPlots/plot_CMEMS_mooring_NorthWestShelf.ipynb
mit
%matplotlib inline import netCDF4 import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib import rcParams from matplotlib import colors from mpl_toolkits.basemap import Basemap """ Explanation: The objective of this notebook is to show how to read and plot data from a mooring (time ...
ColCarroll/ai_talk
talk_code/slides.ipynb
mit
import matplotlib %matplotlib inline from bokeh.plotting import figure, show, ColumnDataSource from bokeh.models import HoverTool from bokeh.io import output_notebook, save from clean_data import (get_models, predict, explain_model, LATEST_DATA as results_2016, get_df, get_features, regression_...
martinjrobins/hobo
examples/sampling/first-example.ipynb
bsd-3-clause
import pints """ Explanation: Sampling: First example This example shows you how to perform Bayesian inference on a time series, using Adaptive Covariance MCMC. It follows on from Optimisation: First example Like in the optimisation example, we start by importing pints: End of explanation """ import pints.toy as toy...
apache/beam
examples/notebooks/tour-of-beam/reading-and-writing-data.ipynb
apache-2.0
# Install apache-beam with pip. !pip install --quiet apache-beam # Create a directory for our data files. !mkdir -p data %%writefile data/my-text-file-1.txt This is just a plain text file, UTF-8 strings are allowed 🎉. Each line in the file is one element in the PCollection. %%writefile data/my-text-file-2.txt There...
davidgutierrez/HeartRatePatterns
Jupyter/MimicII/0a Fill Database WaveForm Headers.ipynb
gpl-3.0
import urllib.request import wfdb import psycopg2 from psycopg2.extensions import AsIs """ Explanation: Fill Database WaveForm Headers 1) Import de las librerias que utilizaremos End of explanation """ target_url = "https://physionet.org/physiobank/database/mimic2wdb/matched/RECORDS-waveforms" data = urllib.request....
SIMEXP/Projects
NSC2006/labo1/.ipynb_checkpoints/test1_plotly_local_install-checkpoint.ipynb
mit
import plotly.plotly as py from plotly.graph_objs import * trace0 = Scatter( x=[1, 2, 3, 4], y=[10, 15, 13, 17] ) trace1 = Scatter( x=[1, 2, 3, 4], y=[16, 5, 11, 9] ) data = Data([trace0, trace1]) py.iplot(data, filename = 'basic-line') """ Explanation: Creating an interactive graph inside an IPython...
Iolaum/ud370
assignments/2_fullyconnected.ipynb
gpl-3.0
# 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 numpy as np import tensorflow as tf from six.moves import cPickle as pickle from six.moves import range import os """ Explanation: Deep Learning Assignment 2 Previou...
waltervh/BornAgain-tutorial
old/python/notebooks/initial-setup.ipynb
gpl-3.0
print('hello, world!') """ Explanation: Anaconda and BornAgain setup If you do not already have a working Python 2.7 environment, download and install Anaconda at https://www.continuum.io/downloads. Be sure to get Python 2.7 version. You will need numpy and matplotlib. We recommend that you install ipython and jupyte...