repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
neuro-data-science/neuro_data_science
python/modeling/connectivity.ipynb
gpl-3.0
import numpy as np import scipy.io as si import networkx as nx import matplotlib.pyplot as plt import bct import sys sys.path.append('../src/') import opencourse.bassett_funcs as bf plt.rcParams['image.cmap'] = 'viridis' plt.rcParams['image.interpolation'] = 'nearest' %matplotlib inline """ Explanation: This code i...
KEHANG/AutoFragmentModeling
ipython/1. frag_mech_generation/.ipynb_checkpoints/generate_fragment_mechanism-checkpoint.ipynb
mit
import os from tqdm import tqdm from rmgpy import settings from rmgpy.data.rmg import RMGDatabase from rmgpy.kinetics import KineticsData from rmgpy.rmg.model import getFamilyLibraryObject from rmgpy.data.kinetics.family import TemplateReaction from rmgpy.data.kinetics.depository import DepositoryReaction from rmgpy.d...
dtamayo/rebound
ipython_examples/TransitTimingVariations.ipynb
gpl-3.0
import rebound import numpy as np """ Explanation: Calculating Transit Timing Variations (TTV) with REBOUND The following code finds the transit times in a two planet system. The transit times of the inner planet are not exactly periodic, due to planet-planet interactions. First, let's import the REBOUND and numpy pac...
martinjrobins/hobo
examples/sampling/nested-rejection-sampling.ipynb
bsd-3-clause
import pints import pints.toy as toy import numpy as np import matplotlib.pyplot as plt # Load a forward model model = toy.LogisticModel() # Create some toy data r = 0.015 k = 500 real_parameters = [r, k] times = np.linspace(0, 1000, 100) signal_values = model.simulate(real_parameters, times) # Add independent Gauss...
jdnz/qml-rg
Tutorials/Python_Introduction.ipynb
gpl-3.0
from __future__ import print_function, division """ Explanation: 1. Introduction Perhaps instead of telling you how to write a loop or a conditional in Python, it might be a better option to put Python in context, tell a bit about how programming languages are designed, and why certain trade-offs are chosen. A program...
deculler/DataScienceTableDemos
Clicks.ipynb
bsd-2-clause
clicks = Table.read_table("http://stat.columbia.edu/~rachel/datasets/nyt1.csv") clicks """ Explanation: This workbook shows a example derived from the EDA exercise in Chapter 2 of Doing Data Science, by o'Neil abd Schutt End of explanation """ age_upper_bounds = [18, 25, 35, 45, 55, 65] def age_range(n): if n =...
SHDShim/pytheos
examples/6_p_scale_test_Dorogokupets2007_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...
DJCordhose/ai
notebooks/rl/berater-v4.ipynb
mit
# !pip install git+https://github.com/openai/baselines >/dev/null # !pip install gym >/dev/null import numpy import gym from gym.utils import seeding from gym import spaces def state_name_to_int(state): state_name_map = { 'S': 0, 'A': 1, 'B': 2, 'C': 3, } return state_name_...
tensorflow/docs-l10n
site/ja/guide/upgrade.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...
FRBs/FRB
docs/nb/DM_Halos and DM_IGM.ipynb
bsd-3-clause
# imports from importlib import reload import numpy as np from scipy.interpolate import InterpolatedUnivariateSpline as IUS from astropy import units as u from frb.halos.models import ModifiedNFW from frb.halos import models as frb_halos from frb.halos import hmf as frb_hmf from frb.dm import igm as frb_igm from frb....
supergis/git_notebook
geospatial/geojson/pygeojson.ipynb
gpl-3.0
from pprint import * """ Explanation: GeoJSON的python支持库。 openthings@163.com, 2016-04. IETF标准项目:https://github.com/geojson PyPi支持库: https://pypi.python.org/pypi/geojson * 其它的支持库包括:GeoPandas, Shaply, GDAL, GIScript End of explanation """ from geojson import Point Point((-115.81, 37.24)) # doctest: +ELLIPSIS """...
authman/DAT210x
Module5/Module5 - Lab9.ipynb
mit
import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D matplotlib.style.use('ggplot') # Look Pretty """ Explanation: DAT210x - Programming with Python for DS Module5- Lab9 End of explanation """ def drawLine(model, X_test, y_test, title, R2):...
gregcaporaso/sketchbook
2015.07.12-species-classifiers.ipynb
bsd-3-clause
%pylab inline from __future__ import division import numpy as np import pandas as pd import skbio import qiime_default_reference """ Explanation: In this recipe, we're going to build taxonomic classifiers for amplicon sequencing. We'll do this for 16S using some scikit-learn classifiers. End of explanation """ ### #...
tensorflow/docs-l10n
site/en-snapshot/lite/performance/quantization_debugger.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...
kubeflow/pipelines
components/google-cloud/google_cloud_pipeline_components/experimental/dataflow/python_job/DataflowPythonJobOp_sample.ipynb
apache-2.0
!pip3 install -U google-cloud-pipeline-components -q """ Explanation: Vertex Pipelines: Dataflow Python Job OP Overview This notebook shows how to use the DataflowPythonJobOp to create a Python Dataflow Job component. DataflowPythonJobOp creates a pipeline component that prepares data by submitting an Apache Beam job...
chinskiy/KDD-99
exploratory_analysis.ipynb
mit
%matplotlib inline #%matplotlib notebook import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches import constants data_10_percent = 'kddcup.data_10_percent' data_full = 'kddcup.data' data = pd.read_csv(data_10_percent, names=constants.names) # Remove Traffic featur...
jswoboda/SimISR
ExampleNotebooks/SingleBeamExample.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import os,inspect from SimISR import Path import scipy as sp from SimISR.utilFunctions import readconfigfile,makeconfigfile from SimISR.IonoContainer import IonoContainer,MakeTestIonoclass from SimISR.runsim import main as runsim from SimISR.analysisplots import analy...
rjenc29/numerical
tensorflow/5_word2vec.ipynb
mit
# These are all the modules we'll be using later. Make sure you can import them # before proceeding further. %matplotlib inline from __future__ import print_function import collections import math import numpy as np import os import random import tensorflow as tf import zipfile from matplotlib import pylab from six.mov...
empet/Math
Plotly-interactive-visualization-of-complex-valued-functions.ipynb
bsd-3-clause
import numpy as np import numpy.ma as ma from numpy import pi import matplotlib.pyplot as plt import matplotlib.colors def hsv_colorscale(S=1, V=1): if S < 0 or S > 1 or V < 0 or V > 1: raise ValueError('Parameters S (saturation), V (value, brightness) must be in [0,1]') argument = np.array([-pi, ...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/cmip6/models/nicam16-7s/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'nicam16-7s', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: MIROC Source ID: NICAM16-7S Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, ...
johnhw/summerschool2016
classifying_audio_streams/audio_1.ipynb
mit
import numpy as np import sklearn.datasets, sklearn.linear_model, sklearn.neighbors import matplotlib.pyplot as plt #import seaborn as sns import sys, os, time import scipy.io.wavfile, scipy.signal %matplotlib inline import matplotlib as mpl from IPython.core.display import HTML mpl.rcParams['figure.figsize'] = (18.0, ...
shengqiu/renthop
xgboost.ipynb
gpl-2.0
import os import sys import operator import numpy as np import pandas as pd from scipy import sparse import xgboost as xgb from sklearn import model_selection, preprocessing, ensemble from sklearn.metrics import log_loss from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer """ Explanation: It s...
NORCatUofC/rain
n-year/notebooks/N-Year Storms.ipynb
mit
from __future__ import absolute_import, division, print_function, unicode_literals import pandas as pd from datetime import datetime, timedelta import operator import matplotlib.pyplot as plt from collections import namedtuple %matplotlib notebook # The following code is adopted from Pat's Rolling Rain N-Year Thresho...
ericfourrier/pandas-patch
examples/Pandas Patch In Action.ipynb
mit
from pandas_patch import * %psource structure def get_test_df_complete(): """ get the full test dataset from Lending Club open source database, the purpose of this fuction is to be used in a demo ipython notebook """ import requests from zipfile import ZipFile from StringIO import StringIO zip...
csaladenes/aviation
code/.ipynb_checkpoints/airport_dest_parser-checkpoint.ipynb
mit
L=json.loads(file('../json/L.json','r').read()) M=json.loads(file('../json/M.json','r').read()) N=json.loads(file('../json/N.json','r').read()) import requests AP={} for c in M: if c not in AP:AP[c]={} for i in range(len(L[c])): AP[c][N[c][i]]=L[c][i] """ Explanation: Load airports of each country En...
do-mpc/do-mpc
documentation/source/mhe_example.ipynb
lgpl-3.0
import numpy as np from casadi import * # Add do_mpc to path. This is not necessary if it was installed via pip. import sys sys.path.append('../../') # Import do_mpc package: import do_mpc """ Explanation: Getting started: MHE Open an interactive online Jupyter Notebook with this content on Binder: In this Jupyter ...
mohanprasath/Course-Work
coursera/data_visualization_with_python/DV0101EN-3-4-1-Waffle-Charts-Word-Clouds-and-Regression-Plots-py-v2.0.ipynb
gpl-3.0
import numpy as np # useful for many scientific computing in Python import pandas as pd # primary data structure library from PIL import Image # converting images into arrays """ Explanation: <a href="https://cognitiveclass.ai"><img src = "https://ibm.box.com/shared/static/9gegpsmnsoo25ikkbl4qzlvlyjbgxs5x.png" width ...
gautam1858/tensorflow
tensorflow/lite/g3doc/performance/post_training_integer_quant_16x8.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...
pwer21c/pwer21c.github.io
python/pythoncodes/3_preview_while_ifelse_samedi.ipynb
mit
a=5 if a>3: print("a는 3보다 큽니다.") a=1 if a>3: print("a는 3보다 큽니다.") a=330 b=200 if b > a: print("b는 a보다 커요") elif b==a: print("b와 a는 같은 숫자에요") else: print("b는 a보다 작아요") while 문을 이용하여 1에서 10까지 출력하세요 i=2 while i<11: print(i) i=i+2 i=0 while i<11: if i!=0: print(i) i=i+...
ucsd-ccbb/visJS2jupyter
notebooks/multigraph_example/.ipynb_checkpoints/multigraph_example-checkpoint.ipynb
mit
import matplotlib as mpl import networkx as nx import pandas as pd import random import visJS2jupyter.visJS_module """ Explanation: Multigraph Network Styling for visJS2jupyter Authors: Brin Rosenthal (sbrosenthal@ucsd.edu), Mikayla Webster (m1webste@ucsd.edu), Julia Len (jlen@ucsd.edu) Import packages End of expl...
sorig/shogun
doc/ipython-notebooks/metric/LMNN.ipynb
bsd-3-clause
import numpy import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') x = numpy.array([[0,0],[-1,0.1],[0.3,-0.05],[0.7,0.3],[-0.2,-0.6],[-0.15,-0.63],[-0.25,0.55],[-0.28,0.67]]) y = numpy.array([0,0,0,0,1,1,2,2]) """ Explanation: Metric Learning with the Shogun Machine Learning Toolbox By Fernando J. I...
satishgoda/learning
web/jquery_slide.ipynb
mit
from IPython.display import HTML %%writefile jquery_slide_toggle.html <script> $(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideToggle("fast"); }); }); </script> """ Explanation: Sliding in jQuery https://www.w3schools.com/jquery/jquery_slide.asp https://www.w3schools.c...
sot/aca_stats
fit_acq_model-2018-11-dev/fit_acq_model-2018-11-binned-poly-binom.ipynb
bsd-3-clause
import sys import os from itertools import count from pathlib import Path sys.path.insert(0, str(Path(os.environ['HOME'], 'git', 'skanb', 'pea-test-set'))) import utils as asvt_utils import numpy as np import matplotlib.pyplot as plt from astropy.table import Table, vstack from astropy.time import Time import tables fr...
edwardd1/phys202-2015-work
midterm/InteractEx06.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np 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. End of explan...
karlnapf/shogun
doc/ipython-notebooks/multiclass/KNN.ipynb
bsd-3-clause
import numpy as np import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') from scipy.io import loadmat, savemat from numpy import random from os import path mat = loadmat(os.path.join(SHOGUN_DATA_DIR, 'multiclass/usps.mat')) Xall = mat['data'] Yall = np.array(mat['label'].squeeze(), dtype=n...
NeuroDataDesign/pan-synapse
pipeline_1/background/Precision_Recall_2.0.ipynb
apache-2.0
def generatePointSet(): center = (rand(0, 9), rand(0, 999), rand(0, 999)) toPopulate = [] for z in range(-3, 2): for y in range(-3, 2): for x in range(-3, 2): curPoint = (center[0]+z, center[1]+y, center[2]+x) #only populate valid points va...
random-forests/tensorflow-workshop
archive/extras/estimators-comparison.ipynb
apache-2.0
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import collections from sklearn.datasets import make_moons, make_circles, make_blobs from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split i...
samkennerly/TruckVotes
books/model.ipynb
bsd-2-clause
%load_ext autoreload %autoreload 2 %autosave 0 from truckvotes import * """ Explanation: choose a model End of explanation """ def show_error(predicted,actual): fTrueRed = (predicted > 0.5) & (actual > 0.5) fTrueBlue = (predicted < 0.5) & (actual < 0.5) fCorrect = fTrueRed | fTrueBlue fClose = (pre...
anhiga/poliastro
docs/source/examples/Propagation using Cowell's formulation.ipynb
mit
import numpy as np from astropy import units as u from matplotlib import ticker from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D plt.ion() from scipy.integrate import ode from poliastro.bodies import Earth from poliastro.twobody import Orbit from poliastro.examples import iss from polias...
TheMitchWorksPro/DataTech_Playground
PY_Basics/Walkthroughs/TMWP_Num_Seq_As_Num_Experiment.ipynb
mit
from __future__ import print_function # only need this line for Python 2.7 ... by importing print() we also get support for unpacking within print # * for unpacking is not recognized in this context in Python 2.7 normally # arguments on print and behavior of print in this example is also Python 3.x which "f...
hashiprobr/redes-sociais
encontro10.ipynb
gpl-3.0
import sys sys.path.append('..') import socnet as sn """ Explanation: Encontro 10: Lacunas Estruturais O enunciado da Escrita 4 continua ao longo deste notebook. Preste atenção nas partes em negrito. Importando a biblioteca: End of explanation """ sn.node_size = 10 sn.node_color = (0, 0, 0) sn.edge_width = 1 """ ...
bosscha/alma-calibrator
notebooks/selecting_source/alma_database_selection5.ipynb
gpl-2.0
file_listcal = "alma_sourcecat_searchresults_20180419.csv" q = databaseQuery() """ Explanation: New function to make a list and to select calibrator I add a function to retrieve all the flux from the ALMA Calibrator list with its frequency and observing date, and to retrieve redshift (z) from NED. End of explanation ...
Merinorus/adaisawesome
Homework/01 - Pandas and Data Wrangling/Intro to Pandas.ipynb
gpl-3.0
import pandas as pd import numpy as np pd.options.mode.chained_assignment = None # default='warn' """ Explanation: Table of Contents <p><div class="lev1"><a href="#Introduction-to-Pandas"><span class="toc-item-num">1&nbsp;&nbsp;</span>Introduction to Pandas</a></div><div class="lev2"><a href="#Pandas-Data-Structures"...
liupengyuan/python_tutorial
chapter3/python正则表达式.ipynb
mit
import re """ Explanation: python正则表达式快速基础教程 正则表达式,这个术语不太容易望文生义(没有去考证是如何被翻译为正则表达式的),其实其英文为Regular Expression,直接翻译就是:有规律的表达式。这个表达式其实就是一个字符序列,反映某种字符规律,用(字符串模式匹配)来处理字符串。很多高级语言均支持利用正则表达式对字符串进行处理的操作。 python提供的正则表达式文档可参见:https://docs.python.org/3/library/re.html End of explanation """ s = 'Blow low, follow in of which low...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/05_review/labs/5_train_bqml.ipynb
apache-2.0
PROJECT = 'cloud-training-demos' # Replace with your PROJECT BUCKET = 'cloud-training-bucket' # Replace with your BUCKET REGION = 'us-central1' # Choose an available region for Cloud MLE import os os.environ['BUCKET'] = BUCKET os.environ['PROJECT'] = PROJECT os.environ['REGION'] = REGION %%bash gcloud co...
oscarmore2/deep-learning-study
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...
ES-DOC/esdoc-jupyterhub
notebooks/ec-earth-consortium/cmip6/models/ec-earth3/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'ec-earth3', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: EC-EARTH-CONSORTIUM Source ID: EC-EARTH3 Topic: Atmos Sub-Topics: Dyn...
ghvn7777/ghvn7777.github.io
content/fluent_python/20_describe.ipynb
apache-2.0
class Quantity: # 描述符类 def __init__(self, storage_name): # storage_name 是托管实例中存储值的属性的名称 self.storage_name = storage_name # 设置托管属性赋值会调用 __set__方法 # 这里的 self 是描述符实例,即 LineItem.weight 或 LineItem.price # instance 是托管实例(LineItem 实例),value 是要设定的值 def __set__(self, instance, value): ...
ellisonbg/talk-2014
Visualization.ipynb
mit
from IPython.display import display, Image, HTML from talktools import website, nbviewer """ Explanation: Plotting and visualization End of explanation """ %matplotlib inline import matplotlib.pyplot as plt import matplotlib.mlab as mlab import numpy as np """ Explanation: One of the main usage cases for this displ...
ES-DOC/esdoc-jupyterhub
notebooks/mpi-m/cmip6/models/sandbox-1/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mpi-m', 'sandbox-1', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: MPI-M Source ID: SANDBOX-1 Topic: Atmos Sub-Topics: Dynamical Core, Radiation, Turb...
datastax-demos/Muvr-Analytics
ipython-analysis/exercise-cnn.ipynb
bsd-3-clause
%matplotlib inline import logging logging.basicConfig(level=10) logger = logging.getLogger() import shutil from os import remove import cPickle as pkl from os.path import expanduser, exists """ Explanation: CNN Experiments on muvr data First we need to setup the environment and import all the necessary stuff. End o...
batfish/pybatfish
docs/source/notebooks/routingProtocols.ipynb
apache-2.0
bf.set_network('generate_questions') bf.set_snapshot('generate_questions') """ Explanation: Routing Protocol Sessions and Policies This category of questions reveals information regarding which routing protocol sessions are compatibly configured and which ones are established. It also allows to you analyze BGP routi...
mne-tools/mne-tools.github.io
0.21/_downloads/f01121873dbae065a1740e6c0c20d1d5/plot_eeg_no_mri.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Joan Massich <mailsik@gmail.com> # # License: BSD Style. import os.path as op import mne from mne.datasets import eegbci from mne.datasets import fetch_fsaverage # Download fsaverage files fs_dir = fetch_fsaverage(verbose=True) subjects_dir = op....
danielwe/gridcell
example.ipynb
apache-2.0
%matplotlib inline """ Explanation: Example usage of the gridcell package End of explanation """ # Select data source datafile = '../../data/FlekkenBen/data.mat' # Load raw data from file from scipy import io raw_data = io.loadmat(datafile, squeeze_me=True) #print(raw_data) # Create sessions dict from the data fr...
ES-DOC/esdoc-jupyterhub
notebooks/nims-kma/cmip6/models/sandbox-1/atmoschem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nims-kma', 'sandbox-1', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: NIMS-KMA Source ID: SANDBOX-1 Topic: Atmoschem Sub-Topics: Transport, Em...
zzsza/Datascience_School
10. 기초 확률론3 - 확률 분포 모형/03. 이항 확률 분포 (파이썬 버전).ipynb
mit
N = 10 theta = 0.6 rv = sp.stats.binom(N, theta) rv """ Explanation: 이항 확률 분포 성공확률이 $\theta$ 인 베르누이 시도를 $N$번 하는 경우를 생각해 보자. 가장 운이 좋을 때에는 $N$번 모두 성공할 것이고 가장 운이 나쁜 경우에는 한 번도 성공하지 못할 겻이다. $N$번 중 성공한 횟수를 확률 변수 $X$ 라고 한다면 $X$의 값은 0 부터 $N$ 까지의 정수 중 하나가 될 것이다. 이러한 확률 변수를 이항 분포(binomial distribution)를 따르는 확률 변수라고 하며 다음과 같이 표...
cochoa0x1/integer-programming-with-python
05-routes-and-schedules/traveling_salesman2_vehicle_routing.ipynb
mit
from pulp import * import numpy as np import matplotlib.pyplot as plt %matplotlib inline import seaborn as sn """ Explanation: Multiple Traveling Salesman and the Problem of routing vehicles Imagine we have instead of one salesman traveling to all the sites, that instead the workload is shared among many salesman. Thi...
mumuwoyou/vnpy-master
sonnet/contrib/examples/CartPole_policy_gradient.ipynb
mit
import gym import numpy as np, pandas as pd import matplotlib.pyplot as plt %matplotlib inline env = gym.make("CartPole-v0") #gym compatibility: unwrap TimeLimit if hasattr(env,'env'): env=env.env env.reset() n_actions = env.action_space.n state_dim = env.observation_space.shape plt.imshow(env.render("rgb_array...
amcdawes/QMlabs
Lab 1 - Vectors and Matrices Solutions.ipynb
mit
from numpy import array, dot, outer, sqrt, matrix from numpy.linalg import eig, eigvals from matplotlib.pyplot import hist %matplotlib inline rv = array([1,2]) # a row vector rv cv = array([[3],[4]]) # a column vector cv """ Explanation: Lab 1 - Vectors and Matrices This notebook demonstrates the use of vectors a...
andreabduque/GAFE
GAFE tutorial.ipynb
mit
#Implements functional expansions from functions.FE import FE #Evaluates accuracy in a dataset for a particular classifier from fitness import Classifier #Implements gafe using DEAP toolbox import ga """ Explanation: Import modules from GAFE End of explanation """ from sklearn.preprocessing import MinMaxScaler impor...
blackjax-devs/blackjax
examples/SGLD.ipynb
apache-2.0
import jax import jax.nn as nn import jax.numpy as jnp import jax.scipy.stats as stats import numpy as np """ Explanation: MNIST digit recognition with a 3-layer Perceptron This example is inspired form this notebook in the SGMCMCJax repository. We try to use a 3-layer neural network to recognise the digits in the MNI...
james-prior/cohpy
20170424-cohpy-lbyl-v-eafp.ipynb
mit
numbers = (3, 1, 0, -1, -2) def foo(x): return 10 // x for x in numbers: y = foo(x) print(f'foo({x}) --> {y}') """ Explanation: LBYL versus EAFP In some other languages, one can not recover from an error, or it is difficult to recover from an error, so one tests input before doing something that could p...
phoebe-project/phoebe2-docs
2.3/tutorials/l3.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" """ Explanation: "Third" Light Setup Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab). End of explanation """ import phoebe from phoebe import u # units import numpy as np import m...
AllenDowney/ModSimPy
notebooks/oem.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.py module from modsim import * """ Explanation: Modeling and Simulati...
aschaffn/phys202-2015-work
assignments/assignment03/NumpyEx03.ipynb
mit
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import antipackage import github.ellisonbg.misc.vizarray as va """ Explanation: Numpy Exercise 3 Imports End of explanation """ def brownian(maxt, n): """Return one realization of a Brownian (Wiener) process with n steps...
DJCordhose/ai
notebooks/workshops/d2d/cnn-intro.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') import tensorflow as tf t...
KshitijT/fundamentals_of_interferometry
3_Positional_Astronomy/3_1_equatorial_coordinates.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt %matplotlib inline from IPython.display import HTML HTML('../style/course.css') #apply general CSS from IPython.display import HTML HTML('../style/code_toggle.html') import healpy as hp %pylab inline pylab.rcParams['figure.figsize'] = (15, 10) import matplotlib impor...
google/data-pills
pills/Google Ads/[DATA_PILL]_[Google_Ads]_Frequency_and_Audience_Analysis_(ADH).ipynb
apache-2.0
# The Developer Key is used to retrieve a discovery document containing the # non-public Full Circle Query v2 API. This is used to build the service used # in the samples to make API requests. Please see the README for instructions # on how to configure your Google Cloud Project for access to the Full Circle # Query v2...
chetan51/nupic.research
projects/dynamic_sparse/notebooks/ExperimentAnalysis-Neurips-debug-hebbianANDmagnitude.ipynb
gpl-3.0
%load_ext autoreload %autoreload 2 import sys sys.path.append("../../") from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import glob import tabulate import pprint import click import numpy as np import pandas as pd from ray.tune.commands import * ...
sofianehaddad/gosa
doc/example_gosa.ipynb
lgpl-3.0
import openturns as ot import numpy as np import pygosa %pylab inline """ Explanation: Example of using pygosa We illustrate hereafter the use of the pygosa module. End of explanation """ model = ot.SymbolicFunction(["x1","x2","x3"], ["sin(x1) + 7*sin(x2)^2 + 0.1*(x3^4)*sin(x1)"]) dist = ot.ComposedDistribution( 3 *...
bbalasub1/glmnet_python
docs/glmnet_vignette.ipynb
gpl-3.0
# Jupyter setup to expand cell display to 100% width on your screen (optional) from IPython.core.display import display, HTML display(HTML("<style>.container { width:100% !important; }</style>")) # Import relevant modules and setup for calling glmnet %reset -f %matplotlib inline import sys sys.path.append('../test') ...
JamesLuoau/deep-learning-getting-started
first-neural-network/Your_first_neural_network.ipynb
apache-2.0
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
rasbt/python-machine-learning-book
code/ch06/ch06.ipynb
mit
%load_ext watermark %watermark -a 'Sebastian Raschka' -u -d -v -p numpy,pandas,matplotlib,sklearn """ Explanation: Copyright (c) 2015 - 2017 Sebastian Raschka https://github.com/rasbt/python-machine-learning-book MIT License Python Machine Learning - Code Examples Chapter 6 - Learning Best Practices for Model Evaluati...
whitead/numerical_stats
unit_4/hw_2017/problem_set_2.ipynb
gpl-3.0
if 10**5 > 3**9: print('10^5 is greater') else: print('3^9 is greater') """ Explanation: Answer the following questions in Python. Do all calculations in Python. Your answers should have a pattern similar to this: python if 3 &lt; (5 * 2): print('3 is less than 5 times 2') else: print('3 is not less th...
chengjun/iching
iching.ipynb
mit
import random def sepSkyEarth(data): sky = random.randint(1, data-2) earth = data - sky earth -= 1 return sky , earth def getRemainder(num): rm = num % 4 if rm == 0: rm = 4 return rm def getChange(data): sky, earth = sepSkyEarth(data) skyRemainder = getRemainder(sky) ...
psychemedia/parlihacks
notebooks/Apache Drill - Hansard Demo.ipynb
mit
#Download data file !wget -P /Users/ajh59/Documents/parlidata/ https://zenodo.org/record/579712/files/senti_post_v2.csv #Install some dependencies !pip3 install pydrill !pip3 install pandas !pip3 install matplotlib #Import necessary packages import pandas as pd from pydrill.client import PyDrill #Set the notebooks u...
IST256/learn-python
content/lessons/09-Dictionaries/LAB-Dictionaries.ipynb
mit
stock = {} # empty dictionary stock['symbol'] = 'AAPL' stock['name'] = 'Apple Computer' print(stock) print(stock['symbol']) print(stock['name']) """ Explanation: In-Class Coding Lab: Dictionaries The goals of this lab are to help you understand: How to use Python Dictionaries Basic Dictionary methods Dealing with Key...
Patri-meteocat/Meteocat_ANL_collaboration
notebooks/Edges_dualPRF_example.ipynb
bsd-2-clause
import matplotlib.pyplot as plt import pylab as plb import matplotlib as mpl import pyart import numpy as np import scipy as sp import numpy.ma as ma from pylab import * from scipy import ndimage from matplotlib.backends.backend_pdf import PdfPages def local_valid(mask, dim, Nmin=None, **kwargs): if Nmin is ...
karlstroetmann/Formal-Languages
Ply/Mysterious-Conflicts.ipynb
gpl-2.0
import ply.lex as lex tokens = [ 'X' ] def t_X(t): r'x' return t literals = ['v', 'w', 'y', 'z'] t_ignore = ' \t' def t_newline(t): r'\n+' t.lexer.lineno += t.value.count('\n') def t_error(t): print(f"Illegal character '{t.value[0]}'") t.lexer.skip(1) __file__ = 'main' lexer = lex.lex()...
miky-kr5/Presentations
EVI - 2018/EVI 04/Modulo2.ipynb
cc0-1.0
import pandas as pd pd.Series? """ Explanation: Introducción a Pandas en los cuadernos de Jupyter La estructura de Datos Serie Arreglo unidimensional con etiquetas en los ejes (incluidas series de tiempo). Los parámetros de una Serie son: data (matriz, diccionario o escalar), index (arreglo de índices), dtype (numpy....
pastas/pasta
examples/notebooks/10_multiple_wells.ipynb
mit
import numpy as np import pandas as pd import pastas as ps import matplotlib.pyplot as plt ps.show_versions() """ Explanation: Adding Multiple Wells This notebook shows how a WellModel can be used to fit multiple wells with one response function. The influence of the individual wells is scaled by the distance to the ...
jhjungCode/pytorch-tutorial
06_MINIST_Save_and_Restore.ipynb
mit
%matplotlib inline """ Explanation: Save & Restore with a minist example Minist예제를 수행하면 알겠지만, Train에 생각보다는 꽤 많은 시간이 소요됩니다. 이 이유만이 아니라 평가시에는 trainnig후에 model의 parameter를 저장했다가 평가시에는 그 parameter를 불러들여서 사용하는 것이 일반적입니다. 여기에 사용되는 함수는 torch.save, torch.load와 model.state_dict(), model.load_state_dict()입니다. 사실 4장의 tutorial의 마...
fangohr/oommf-python
new/notebooks/standard_problem3.ipynb
bsd-2-clause
!rm -rf standard_problem3/ # Delete old result files (if any). """ Explanation: Micromagnetic standard problem 3 Author: Marijan Beg, Ryan Pepper Date: 11 May 2016 Problem specification This problem is to calculate the single domain limit of a cubic magnetic particle. This is the size $L$ of equal energy for the so-c...
NervanaSystems/coach
tutorials/0. Quick Start Guide.ipynb
apache-2.0
# Adding module path to sys path if not there, so rl_coach submodules can be imported import os import sys import tensorflow as tf module_path = os.path.abspath(os.path.join('..')) resources_path = os.path.abspath(os.path.join('Resources')) if module_path not in sys.path: sys.path.append(module_path) if resources_p...
henchc/Rediscovering-Text-as-Data
08-Classification/01-Classification.ipynb
mit
demo_tb = Table() demo_tb['Study_Hours'] = [2.0, 6.9, 1.6, 7.8, 3.1, 5.8, 3.4, 8.5, 6.7, 1.6, 8.6, 3.4, 9.4, 5.6, 9.6, 3.2, 3.5, 5.9, 9.7, 6.5] demo_tb['Grade'] = [67.0, 83.6, 35.4, 79.2, 42.4, 98.2, 67.6, 84.0, 93.8, 64.4, 100.0, 61.6, 100.0, 98.4, 98.4, 41.8, 72.0, 48.6, 90.8, 100.0] demo_tb['Pass'] = [0, 1, 0, 1, 0,...
JoseGuzman/myIPythonNotebooks
Stochastic_systems/Fit_real_histogram.ipynb
gpl-2.0
%pylab inline from scipy.stats import norm """ Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#-Fit-real-histogram" data-toc-modified-id="-Fit-real-histogram-1"><span class="toc-item-num">1&nbsp;&nbsp;</span> Fit real histogram</a></span><...
bhattacharjee/courses
CourseraDeepLearningSpecialization/1.NeuralNetworksAndDeepLearning/Week2/Exercises/.ipynb_checkpoints/Python+Basics+With+Numpy+v3-Copy1-checkpoint.ipynb
mit
### START CODE HERE ### (≈ 1 line of code) test = "Hello World" ### END CODE HERE ### print ("test: " + test) """ Explanation: Python Basics with Numpy (optional assignment) Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will help fami...
EdwardDixon/deeplearning
facepaint/main/Image modelling with H2O.ipynb
apache-2.0
data y = "b" x = ["x","y"] train, valid, test = data.split_frame([0.75, 0.15]) from h2o.estimators import H2ODeepLearningEstimator m = H2ODeepLearningEstimator(model_id="DL_defaults", hidden=[20,20,20,20,20,20,20,20,20,20], activation='tanh',epochs=10000) m.train(x,y,train) m """ Explanation: Our Data To use it wit...
jegibbs/phys202-2015-work
assignments/assignment08/InterpolationEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import numpy as np sns.set_style('white') from scipy.interpolate import griddata """ Explanation: Interpolation Exercise 2 End of explanation """ x=np.array(-5,5) x """ Explanation: Sparse 2d interpolation In this example the values of a scal...
vinitsamel/udacitydeeplearning
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...
aleph314/K2
EDA/EDA_MTA_Exercises.ipynb
gpl-3.0
import csv import os """ Explanation: Exploratory Data Analysis with Python We will explore the NYC MTA turnstile data set. These data files are from the New York Subway. It tracks the hourly entries and exits to turnstiles (UNIT) by day in the subway system. Here is an example of what you could do with the data. Jame...
karlstroetmann/Artificial-Intelligence
Python/7 Neural Networks/Neural-Network-Keras.ipynb
gpl-2.0
import gzip import pickle import numpy as np import keras import tensorflow as tf """ Explanation: Building a Neural Network with Keras End of explanation """ %env KMP_DUPLICATE_LIB_OK=TRUE """ Explanation: The following magic command is necessary to prevent the Python kernel to die because of linkage problems. En...
BorisPolonsky/LearningTensorFlow
RNN101/Customized RNN.ipynb
mit
import tensorflow as tf import numpy as np """ Explanation: Customized RNN Brief Learning to define operations in rnn cells under TensorFlow API r1.3. End of explanation """ class MyRnnCell(tf.nn.rnn_cell.RNNCell): def __init__(self, state_size, dtype): self._state_size = state_size self._dtype =...
charlesll/RamPy
examples/Mixing_spectra.ipynb
gpl-2.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import rampy as rp """ Explanation: Example of the mixing_sp() function Author: Charles Le Losq This function allows one to mix two endmembers spectra, $ref1$ and $ref2$, to an observed one $obs$: $obs = ref1 * F1 + ref2 * (1-F1)$ . The calculation ...
InsightSoftwareConsortium/SimpleITK-Notebooks
Python/64_Registration_Memory_Time_Tradeoff.ipynb
apache-2.0
import SimpleITK as sitk import numpy as np %matplotlib inline import matplotlib.pyplot as plt # utility method that either downloads data from the Girder repository or # if already downloaded returns the file name for reading from disk (cached data) %run update_path_to_download_script from downloaddata import fetch...
ggljzr/mi-ddw
Task 3 - Text Mining/task3.ipynb
mit
import nltk import numpy as np import wikipedia import re """ Explanation: Text mining In this task we will use nltk package to recognize named entities and classify in a given text (in this case article about American Revolution from Wikipedia). nltk.ne_chunk function can be used for both recognition and classificati...
saudijack/unfpyboot
TestInstall/BootCampTestInstall.ipynb
mit
success = True # We'll use this to keep track of the various tests failures = [] try: import numpy as np import scipy print "numpy and scipy imported -- success!" except: success = False msg = "* There was a problem importing numpy or scipy. You will definitely need these!" print msg failu...
dsevilla/jisbd17-nosql
talk.ipynb
mit
%load extra/utils/functions.py ds(1,2) ds(3) yoda(u"Una guerra SQL vs. NoSQL no debes empezar") """ Explanation: Tecnologías NoSQL -- Tutorial en JISBD 2017 Toda la información de este tutorial está disponible en https://github.com/dsevilla/jisbd17-nosql. Diego Sevilla Ruiz, dsevilla@um.es. End of explanation """ ...
smorton2/think-stats
code/chap11ex.ipynb
gpl-3.0
from __future__ import print_function, division %matplotlib inline import numpy as np import pandas as pd import random import thinkstats2 import thinkplot """ Explanation: Examples and Exercises from Think Stats, 2nd Edition http://thinkstats2.com Copyright 2016 Allen B. Downey MIT License: https://opensource.org...
ozak/CompEcon
notebooks/IntroPython.ipynb
gpl-3.0
1+1-2 3*2 3**2 -1**2 3*(3-2) 3*3-2 """ Explanation: Introduction to <img src="https://www.python.org/static/community_logos/python-logo-inkscape.svg" alt="Python" width=200/> and <img src="https://ipython.org/_static/IPy_header.png" alt="IPython" width=250/> using <img src="https://raw.githubusercontent.com/adeba...