repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
JamesSample/icpw
toc_trends_oct_2018_part2.ipynb
mit
# User input # Specify projects of interest proj_list = ['ICPW_TOCTRENDS_2018',] # Specify results folder res_fold = (r'../../update_autumn_2018/results') """ Explanation: TOC trends - October 2018 (Part 2: Chemistry trend analysis) The previous notebook created a new dataset for the trends analysis spanning ther per...
mintcloud/deep-learning
gan_mnist/Intro_to_GANs_Exercises.ipynb
mit
%matplotlib inline 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 In this notebook, we'll be building a generativ...
waltervh/BornAgain-tutorial
talks/day_1/gui_basics_1_M/GUI_solutions.ipynb
gpl-3.0
width = 981 * 0.172 print("Width = ", width, " mm") height = 1043 * 0.172 print("Height = ", height, " mm") """ Explanation: Exercise 1: Set up GALAXI instrument Beam parameters Pay attention, that Wavelength must be given in nm. Thus, $\lambda = 0.134$ nm. Detector parameters Considering pixel size 0.172 mm, calcul...
smorton2/think-stats
code/chap06exmine.ipynb
gpl-3.0
from __future__ import print_function, division %matplotlib inline import numpy as np import brfss 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/licenses/MIT End of ...
fazzolini/fast_ai
deeplearning1/nbs/lesson1.ipynb
apache-2.0
from __future__ import division, print_function %matplotlib inline """ Explanation: Using Convolutional Neural Networks Welcome to the first week of the first deep learning certificate! We're going to use convolutional neural networks (CNNs) to allow our computer to see - something that is only possible thanks to dee...
yuyu2172/image-labelling-tool
Image labeller notebook.ipynb
mit
%matplotlib inline import math from matplotlib import pyplot as plt from IPython.display import display, Javascript from image_labelling_tool import labelling_tool, labelling_tool_jupyter """ Explanation: Image labeller with persistence (example) This notebook will demonstrate the follwing: using the image labell...
oditorium/blog
iPython/BayesVsFreq-PartI-Intro.ipynb
agpl-3.0
N = 20 P = 0.6 l = list(map (pf(P), np.random.uniform(size=N))) ls = ft.reduce(lambda acc, n: acc + str(n), l, "") K = sum(l) l2 = list(map (pf(P), np.random.uniform(size=N*10))) ls2 = ft.reduce(lambda acc, n: acc + str(n), l, "") K2 = sum(l2) print ("N = %i (%i)" % (N,10*N)) print ("P = %.2f" % P) print ("K = %i (%i)"...
SylvainCorlay/ipywidgets
docs/source/examples/Using Interact.ipynb
bsd-3-clause
from __future__ import print_function from ipywidgets import interact, interactive, fixed, interact_manual import ipywidgets as widgets """ Explanation: Using Interact The interact function (ipywidgets.interact) automatically creates user interface (UI) controls for exploring code and data interactively. It is the eas...
NAMD/corpushash
demos/benchmark.ipynb
lgpl-3.0
import os import sys import shutil import copy import numpy as np import matplotlib.pyplot as plt from timeit import default_timer as timer import nltk from nltk.corpus import words from nltk.corpus import reuters import corpushash as ch """ Explanation: benchmarking the corpushash library corpushash is a simple libra...
ES-DOC/esdoc-jupyterhub
notebooks/ec-earth-consortium/cmip6/models/ec-earth3-cc/ocean.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-cc', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: EC-EARTH-CONSORTIUM Source ID: EC-EARTH3-CC Topic: Ocean Sub-Topic...
espressomd/espresso
doc/tutorials/error_analysis/error_analysis_part1.ipynb
gpl-3.0
import numpy as np %matplotlib inline import matplotlib.pyplot as plt plt.rcParams.update({'font.size': 18}) import sys import logging logging.basicConfig(level=logging.INFO, stream=sys.stdout) np.random.seed(43) def ar_1_process(n_samples, c, phi, eps): ''' Generate a correlated random sequence with the AR(1...
hasecbinusr/pysal
pysal/network/Network_Usage.ipynb
bsd-3-clause
%pylab inline import pysal as ps """ Explanation: Basic Tutorial for pysal.network updated 07/2016 End of explanation """ ntw = ps.Network(ps.examples.get_path('streets.shp')) """ Explanation: Instantiate a network End of explanation """ # Crimes ntw.snapobservations(ps.examples.get_path('crimes.shp'), 'crimes', ...
4dsolutions/Python5
Vectors in Space.ipynb
mit
class Vector: "A point in space" pass """ Explanation: Oregon Curriculum Network <br /> Discovering Math with Python Chapter 6: VECTORS IN SPACE A point vector is simply an object that points, from the origin to a specific location. We usually represent such an object with an arrow, with its tail at (0,0) or w...
IanHawke/maths-with-python
05-classes-oop.ipynb
mit
p_normal = (12, -14, 0, 2) """ Explanation: Classes and Object Oriented Programming We have looked at functions which take input and return output (or do things to the input). However, sometimes it is useful to think about objects first rather than the actions applied to them. Think about a polynomial, such as the cub...
AtmaMani/pyChakras
stats_101/02_data_description.ipynb
mit
import pandas as pd import matplotlib.pyplot as plt %matplotlib inline sales_data = pd.read_csv('datasets_csv/CH03/ex3-14.txt') sales_data.columns = ['Year', 'Month', 'Sales'] #strip out the double quotes sales_data.head() """ Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul c...
jonathf/chaospy
docs/user_guide/fundamentals/probability_distributions.ipynb
mit
import chaospy normal = chaospy.Normal(mu=2, sigma=2) normal """ Explanation: Probability distributions Probability distribution is the backbone of uncertainty quantification. Creating a probability distribution in chaospy is done by as follows: End of explanation """ samples = normal.sample(4, seed=1234) samples ...
quantumlib/Cirq
docs/tutorials/educators/neutral_atom.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...
oyamad/game_theory_models
test_logitdyn.ipynb
bsd-3-clause
u = coo_payoffs beta = 1.0 P = np.zeros((2,2)) """ Explanation: test_simulate_LLN End of explanation """ P[0,0] = np.exp(u[0,0] * beta) / (np.exp(u[0,0] * beta) + np.exp(u[1,0] * beta)) P[0,0] P[1,0] = np.exp(u[1,0] * beta) / (np.exp(u[0,0] * beta) + np.exp(u[1,0] * beta)) P[1,0] P[0,1] = np.exp(u[0,1] * beta) / (...
EBIvariation/eva-cttv-pipeline
data-exploration/complex-events/notebooks/hgvs-follow-up.ipynb
apache-2.0
def try_to_vep(hgvs, long=False): """Attempts to get consequences from VEP for HGVS expression.""" safe_hgvs = urllib.parse.quote(hgvs) vep_url = f'https://rest.ensembl.org/vep/human/hgvs/{safe_hgvs}?content-type=application/json' resp = requests.get(vep_url).json() if 'error' in resp: print...
iagapov/ocelot
demos/ipython_tutorials/7_lattice_design.ipynb
gpl-3.0
# the output of plotting commands is displayed inline within # frontends, directly below the code cell that produced it. %matplotlib inline from time import time # this python library provides generic shallow (copy) # and deep copy (deepcopy) operations from copy import deepcopy # import from Ocelot main modules...
napsternxg/blog
content/Convex Optimization using CVXPY.ipynb
gpl-3.0
%matplotlib inline import cvxpy as cvx import numpy as np import matplotlib.pyplot as plt from matplotlib import cm import seaborn as sns sns.set_context("paper") sns.set_style("ticks") np.random.seed(1337) """ Explanation: $\DeclareMathOperator*{\argmin}{arg\,min}$ I got introduced to the concept of convex optimi...
aselle/tensorflow
tensorflow/contrib/eager/python/examples/generative_examples/text_generation.ipynb
apache-2.0
!pip install unidecode """ Explanation: Copyright 2018 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"). Text Generation using a RNN <table class="tfo-notebook-buttons" align="left"><td> <a target="_blank" href="https://colab.research.google.com/github/tensorflow/tensorflow/blob/...
rnder/data-science-from-scratch
notebook/ch24_mapreduce.ipynb
unlicense
from __future__ import division import math, random, re, datetime from collections import defaultdict, Counter from functools import partial from naive_bayes import tokenize def word_count_old(documents): """맵리듀스를 사용하지 않고 단어의 빈도 수를 세어 줌""" return Counter(word for document in documents for wor...
hyzhak/mle
mle.ipynb
mit
import numpy as np from scipy.stats import bernoulli np.random.seed(123456789) p_true = 1/2 # this is the value we will try to estimate from the observed data fp = bernoulli(p_true) def sample(n=10): """ simulate coin flipping """ return fp.rvs(n) # flip it n times xs = sample(100) # generate some ...
SteveDiamond/cvxpy
examples/notebooks/WWW/clock_mesh.ipynb
gpl-3.0
import cvxpy as cp import numpy as np import scipy as scipy import matplotlib.pyplot as plt # Show plots inline in ipython. %matplotlib inline # Plot properties. plt.rc('text', usetex=True) plt.rc('font', family='serif') font = {'weight' : 'normal', 'size' : 16} plt.rc('font', **font) """ Explanation: Sizi...
vicente-gonzalez-ruiz/YAPT
04-concurrency/sharing_a_variable.ipynb
cc0-1.0
import threading import time a = '' def task_1(): global a for i in range(10): print('o', end='', flush=True) a += 'o' print(a) time.sleep(1) # Blocking -> yield to other thread def task_2(): global a for i in range(20): print('O', end='', flush=True) ...
JJ/ciencia-reproducible
app/Investigadores-UGR.ipynb
mit
%matplotlib inline from BeautifulSoup import BeautifulSoup import urllib2 from IPython.display import ( display, HTML ) import matplotlib.pyplot as plt url = 'http://investigacion.ugr.es/ugrinvestiga/static/BuscadorRanking/*/buscar?tipo=&rama_c=&disciplina_c=TELE_D&especialidad_c=&indicador=&periodo=' response ...
vbsteja/code
Python/ML_DL/DL/Neural-Networks-Demystified-master/.ipynb_checkpoints/Part 7 Overfitting, Testing, and Regularization-checkpoint.ipynb
apache-2.0
from IPython.display import YouTubeVideo YouTubeVideo('S4ZUwgesjS8') """ Explanation: <h1 align = 'center'> Neural Networks Demystified </h1> <h2 align = 'center'> Part 7: Overfitting, Testing, and Regularization </h2> <h4 align = 'center' > @stephencwelch </h4> End of explanation """ %pylab inline from partSix imp...
david-abel/simple_rl
simple_rl/tasks/navigation/Usage_NavigationWorldMDP.ipynb
apache-2.0
# Other Imports. from simple_rl.tasks import NavigationWorldMDP from simple_rl.agents import QLearningAgent from simple_rl.planning import ValueIteration from simple_rl.tasks.grid_world.GridWorldStateClass import GridWorldState from simple_rl.tasks.navigation.NavigationStateClass import NavigationWorldState from simple...
chinapnr/python_study
Python 基础课程/Python Basic Lesson 13 - 完整的 for 语句结构和 pprint.ipynb
gpl-3.0
# for continue 举例 for l in 'Python': if l == 'h': continue print('letter:', l) # for continue 举例 # 去除输入的内容中的元音字母 list1 = input('Input:') list2 = [] for s in list1: if s in ['a','e','i','o','u']: continue list2.append(s) # 将列表转换为字符串 s2 = ''.join(list2) print('Output:', s2) # for br...
DOV-Vlaanderen/pydov
docs/notebooks/search_hydrogeologische_stratigrafie.ipynb
mit
%matplotlib inline import os, sys import inspect import pydov """ Explanation: Example of DOV search methods for hydrogeological interpretations Use cases: Select interpretations in a bbox Select interpretations in a bbox with selected properties Select interpretations in a municipality Get interpretations using in...
akchinSTC/systemml
samples/jupyter-notebooks/Deep_Learning_Image_Classification.ipynb
apache-2.0
!pip show systemml %matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn import datasets from sklearn.cross_validation import train_test_split # module deprecated in 0.18 #from sklearn.model_selection import train_test_split # use this module for >=0.18 from sklearn ...
fastai/fastai
nbs/45_collab.ipynb
apache-2.0
#|export class TabularCollab(TabularPandas): "Instance of `TabularPandas` suitable for collaborative filtering (with no continuous variable)" with_cont=False """ Explanation: Collaborative filtering Tools to quickly get the data and train models suitable for collaborative filtering This module contains all t...
gardenermike/finding-lane-lines
P1.ipynb
mit
#importing some useful packages import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 %matplotlib inline """ 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 lesson to ide...
TiKeil/Master-thesis-LOD
notebooks/TEST_VCLOD_Coefficient_1.ipynb
apache-2.0
import os import sys import numpy as np import scipy.sparse as sparse import random import csv %matplotlib notebook import matplotlib.pyplot as plt from visualize import drawCoefficient from data import * from gridlod import interp, coef, util, fem, world, linalg, femsolver import pg_rand, femsolverCoarse, buildcoef...
Hyperparticle/deep-learning-foundation
materials/keyboard-shortcuts.ipynb
mit
# mode practice """ Explanation: Keyboard shortcuts In this notebook, you'll get some practice using keyboard shortcuts. These are key to becoming proficient at using notebooks and will greatly increase your work speed. First up, switching between edit mode and command mode. Edit mode allows you to type into cells whi...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/04_advanced_preprocessing/taxicab_traffic/train.ipynb
apache-2.0
import tensorflow as tf import numpy as np import shutil print(tf.__version__) """ Explanation: Taxi Fare Prediction Using Realtime Traffic Data This will be the same as our previous taxi fare model, but with the addition of ‘trips_last_5min’ data as a feature. This is our proxy for traffic End of explanation """ !g...
PyPSA/PyPSA
examples/notebooks/ac-dc-lopf.ipynb
mit
import pypsa import numpy as np import pandas as pd import os import matplotlib.pyplot as plt import cartopy.crs as ccrs %matplotlib inline plt.rc("figure", figsize=(8, 8)) network = pypsa.examples.ac_dc_meshed(from_master=True) # get current type (AC or DC) of the lines from the buses lines_current_type = network.l...
LimeeZ/phys292-2015-work
assignments/assignment05/InteractEx02.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.display import display """ Explanation: Interact Exercise 2 Imports End of explanation """ def plot_sin1(a,b): x = np.arange(0,4*np.pi) plt.plot(x, np.sin(a*x...
cpcloud/ibis
docs/tutorial/08-Geospatial-Analysis.ipynb
apache-2.0
# Launch the postgis container. # This may take a bit of time if it needs to download the image. !docker run -d -p 5432:5432 --name postgis-db -e POSTGRES_PASSWORD=supersecret mdillon/postgis:9.6-alpine """ Explanation: Geospatial Analysis One of the most popular extensions to PostgreSQL is PostGIS, which adds support...
nwjs/chromium.src
third_party/tensorflow-text/src/docs/guide/tokenizers.ipynb
bsd-3-clause
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...
abhi1509/deep-learning
batch-norm/Batch_Normalization_Exercises.ipynb
mit
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False) """ Explanation: Batch Normalization – Practice Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a con...
CyberCRI/dataanalysis-herocoli-redmetrics
v1.52.2/Tests/2.2 Google form analysis tests with sessions.ipynb
cc0-1.0
%run "../Functions/2. Google form analysis.ipynb" """ Explanation: 1.2 Google form analysis tests with sessions End of explanation """ allGFormResponders = getAllResponders() """ Explanation: (userIdThatDidNotAnswer) (userId1AnswerEN) (userIdAnswersEN) (userId1ScoreEN) (userIdScoresEN) (userId1AnswerFR) (userIdAnsw...
tensorflow/docs-l10n
site/en-snapshot/guide/migrate/saved_model.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...
jokedurnez/neuropower_extended
peakdistribution/peakdistributions_with_threshold_applied_to_thresholdfree_peaks.ipynb
mit
% matplotlib inline import os import numpy as np import nibabel as nib from nipy.labs.utils.simul_multisubject_fmri_dataset import surrogate_3d_dataset import nipy.algorithms.statistics.rft as rft from __future__ import print_function, division import math import matplotlib.pyplot as plt import palettable.colorbrewer a...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_gamma_map_inverse.ipynb
bsd-3-clause
# Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.inverse_sparse import gamma_map, make_stc_from_dipoles from mne.viz import (plot_sparse_source_estimate...
ES-DOC/esdoc-jupyterhub
notebooks/ipsl/cmip6/models/ipsl-cm6a-lr/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ipsl', 'ipsl-cm6a-lr', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: IPSL Source ID: IPSL-CM6A-LR Sub-Topics: Radiative Forcings. Properties: 8...
sorgerlab/belpy
models/ras_pathway/CyJS_Assembler.ipynb
mit
from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str statement_path = 'ras_pathway.txt' txt = open(statement_path, 'rt').read() print(txt) """ Explanation: CyJS Assembler Assemble a network from text using existing INDRA functionality Translate this into a model supp...
tuanavu/coursera-university-of-washington
machine_learning/2_regression/assignment/week5/.ipynb_checkpoints/week-5-lasso-assignment-1-exercise-checkpoint.ipynb
mit
import sys sys.path.append('C:\Anaconda2\envs\dato-env\Lib\site-packages') import graphlab """ Explanation: Regression Week 5: Feature Selection and LASSO (Interpretation) In this notebook, you will use LASSO to select features, building on a pre-implemented solver for LASSO (using GraphLab Create, though you can use ...
yashdeeph709/Algorithms
PythonBootCamp/Complete-Python-Bootcamp-master/GUI/5 - Widget Styling.ipynb
apache-2.0
%%html <style> .example-container { background: #999999; padding: 2px; min-height: 100px; } .example-container.sm { min-height: 50px; } .example-box { background: #9999FF; width: 50px; height: 50px; text-align: center; vertical-align: middle; color: white; font-weight: bold; margin: 2px;} .example-box.med { width: 65px...
stevetjoa/stanford-mir
evaluation_chord.ipynb
mit
y, sr = librosa.load('audio/simple_piano.wav') # Estimate onsets. est_onsets = librosa.onset.onset_detect(y=y, sr=sr, units='time') est_onsets # Load the reference annotation. ref_onsets = numpy.array([0.1, 0.21, 0.3]) mir_eval.onset.evaluate(ref_onsets, est_onsets) """ Explanation: &larr; Back to Index Evaluation...
jermainewang/mxnet
example/adversary/adversary_generation.ipynb
apache-2.0
%matplotlib inline import mxnet as mx import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm import os import sys sys.path.append(os.path.join(os.getcwd(), "../../tests/python/common")) from get_data import MNISTIterator """ Explanation: Fast Sign Adversary Generation Example This notebook dem...
xdnian/pyml
assignments/solutions/ex05_ch0607_sample_solutions.ipynb
mit
# Added version check for recent scikit-learn 0.18 checks from distutils.version import LooseVersion as Version from sklearn import __version__ as sklearn_version """ Explanation: Assignment 5 This assignment has weighting $1.5$. Model tuning and evaluation End of explanation """ import pandas as pd wdbc_source = '...
ChadFulton/statsmodels
examples/notebooks/formulas.ipynb
bsd-3-clause
from __future__ import print_function import numpy as np import statsmodels.api as sm """ Explanation: Formulas: Fitting models using R-style formulas Since version 0.5.0, statsmodels allows users to fit statistical models using R-style formulas. Internally, statsmodels uses the patsy package to convert formulas and d...
ThierryMondeel/FBA_python_tutorial
FBA_tutorials/extra_generate_COBRA_model_geenen_2012.ipynb
mit
import cobra from cobra.solvers import get_solver_name from cobra import Model, Reaction, Metabolite from cobra.flux_analysis import parsimonious import pandas as pd """ Explanation: COBRA model for (Geenen, 2012) This notebook takes the original kinetic model in SBML format and saves a json model that allows for CBM ...
murphy214/berrl
example_jupyter/example.ipynb
apache-2.0
import berrl as bl import numpy as np import pandas as pd apikey='pk.eyJ1IjoibXVycGh5MjE0IiwiYSI6ImNpam5kb3puZzAwZ2l0aG01ZW1uMTRjbnoifQ.5Znb4MArp7v3Wwrn6WFE6A' data=pd.read_csv('wv_traffic_fatals.csv') #data=data[data.CNTYNAME=='Clay County'] a=bl.make_points(data,list=True) bl.parselist(a,'fatals.geojson') # return...
rescolo/estadistica
Jupyter_notebooks/Ising model simulations.ipynb
unlicense
import numpy as np SIZE=5 STEPS=10 #----------------------------------------------------------------------# # Check periodic boundary conditions #----------------------------------------------------------------------# def bc(i): return i%SIZE #--------------------------------------------------------------------...
ecervera/UJI_AMR
exercises/Distance.ipynb
mit
import packages.initialization import pioneer3dx as p3dx p3dx.init() """ Explanation: <img align="right" src="../img/exercise_distance_240.png" /> Exercise: Move the robot forward for a distance. You are going to program the robot for moving forward from the initial position at the start of the simulation, in the cent...
ehrlinger/MachineLearningSamples-PredictiveMaintenance
Code/4_operationalization.ipynb
mit
## setup our environment by importing required libraries import json import os import shutil import time from pyspark.ml import Pipeline from pyspark.ml.classification import RandomForestClassifier # for creating pipelines and model from pyspark.ml.feature import StringIndexer, VectorAssembler, VectorIndexer # setup...
bennylp/quant.id
Notebooks/100 - Portfolio Construction and Analysis/10012 - Return Distribution Analysis.ipynb
gpl-3.0
import matplotlib.pyplot as plt import numpy as np import pandas as pd from IPython.display import display, Markdown, HTML %matplotlib inline FIGSIZE=(8,4) returns = pd.read_csv('SmallLargeCapReturns.csv', index_col='date', parse_dates=True) returns.index = returns.index.to_period('M') returns.head() """ Explanation...
abulbasar/machine-learning
Telecomm Churn Analysis Using XGBoost.ipynb
apache-2.0
import xgboost as xgb import pandas as pd from sklearn import * import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Problem Statement In this example I will build a classifier for churn prediction using a dataset from telecomm industry. You can find the data set in github in the following links. https...
ericmjl/Network-Analysis-Made-Simple
notebooks/04-advanced/01-bipartite.ipynb
mit
from IPython.display import YouTubeVideo YouTubeVideo(id="BYOK12I9vgI", width="100%") """ Explanation: Introduction End of explanation """ from nams import load_data as cf G = cf.load_crime_network() for n, d in G.nodes(data=True): G.nodes[n]["degree"] = G.degree(n) """ Explanation: In this chapter, we will lo...
mne-tools/mne-tools.github.io
0.23/_downloads/0602f866d20bff8af56294e10dd6854d/10_preprocessing_overview.ipynb
bsd-3-clause
import os import numpy as np 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(0, 60).load_data() # just use a fr...
tgsmith61591/pyramid
benchmarks/Benchmarking Seasonality.ipynb
mit
import pandas as pd X = pd.read_csv('item_sales_daily.csv.gz') y = X['sales'].values X.head() import pmdarima as pm import time from functools import wraps def timed(func): """A decorator to time a result""" @wraps(func) def wrapper(*args, **kwargs): start = time.time() res = func(*args,...
dbouquin/AstroHackWeek2015
day3-machine-learning/02 - First Steps.ipynb
gpl-2.0
from sklearn.datasets import load_digits digits = load_digits() from sklearn.cross_validation import train_test_split X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target) """ Explanation: Get some data to play with End of explanation """ ...
bakanchevn/DBCourseMirea2017
Неделя 2/Задание в классе/Лабораторная 2-1.ipynb
gpl-3.0
%%sql SELECT t FROM tracks t INNER JOIN genres g ON t.genreid = g.genreid INNER JOIN media_types m ON m.mediatypeid = t.mediatypeid ORDER BY t.bytes desc limit 10 """ Explanation: Задание 1 Вывести 10 самых больших по размеру треков жанра ROCK и формата MPEG End of explanation """ %%sql SELECT ...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/autoregressive_distributed_lag.ipynb
bsd-3-clause
import numpy as np import pandas as pd import seaborn as sns sns.set_style("darkgrid") sns.mpl.rc("figure", figsize=(16, 6)) sns.mpl.rc("font", size=14) """ Explanation: Autoregressive Distributed Lag (ARDL) models ARDL Models Autoregressive Distributed Lag (ARDL) models extend Autoregressive models with lags of expl...
fsix/mnist
notebooks/Deskewing.ipynb
apache-2.0
plt.imshow(X_train[0].reshape(28,28)) # This is what the image looks like from scipy.ndimage import interpolation def moments(image): c0,c1 = np.mgrid[:image.shape[0],:image.shape[1]] # A trick in numPy to create a mesh grid totalImage = np.sum(image) #sum of pixels m0 = np.sum(c0*image)/totalImage #mu_x ...
simkovic/simkovic.github.io
_ipynb/The Missing Square.ipynb
mit
%pylab inline def fibo(n): return np.int32(((1 + 5**0.5)/2)**n/5**0.5+0.5) x=np.arange(20) print fibo(x) """ Explanation: You should be familiar with the following puzzle. There is very similar puzzle that has some mathematical background in Fibonacci numbers. Recall Fibonacci numbers are given by $F_n = F_{n-1}+F_{...
ewulczyn/readers
src/data_generation/QA match EL to Google Forms.ipynb
mit
response_table = 'log.QuickSurveysResponses_15266417' impression_table = 'log.QuickSurveyInitiation_15278946' host = 'analytics-store.eqiad.wmnet' """ Explanation: QuickSurveysResponses_15266417 QuickSurveyInitiation_15278946 Survey End of explanation """ query = """ SELECT COUNT(*) as n FROM log.QuickSurveyInit...
martadesimone/Protoplanetarydisks
ChamaleonI_Tab.ipynb
gpl-2.0
def Mdisk(F,d,r,k,Td,lam): #Eq 2 Andrews et al. 2013 #F is *mm* Flux in *Jy* #d is the distance in *pc* #r is the dust to mass ratio *adimensional* #k is the dust opacity in *cm^2/g* #lam is the wavelenght in *mm* c=2.99792458e10 # Light velocity *cm/s* h=6.6260755e-27 # Planck con...
hvillanua/deep-learning
intro-to-tensorflow/intro_to_tensorflow.ipynb
mit
import hashlib import os import pickle from urllib.request import urlretrieve import numpy as np from PIL import Image from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelBinarizer from sklearn.utils import resample from tqdm import tqdm from zipfile import ZipFile print('All m...
jrrembert/cybernetic-organism
dato/clustering/.ipynb_checkpoints/Document retrieval-checkpoint.ipynb
gpl-2.0
import graphlab """ Explanation: Document retrieval from wikipedia data Fire up GraphLab Create End of explanation """ people = graphlab.SFrame('people_wiki.gl/') """ Explanation: Load some text data - from wikipedia, pages on people End of explanation """ people.head() len(people) """ Explanation: Data contain...
mdietrichstein/vgg16-transfer-learning
vgg16_transfer_learning.ipynb
bsd-2-clause
#reset python environment %reset -f import time default_device = '/gpu:0' # default_device = '/cpu:0' num_hidden_neurons = 256 vgg_mean = [103.939, 116.779, 123.68] classes = [l.strip() for l in open('synset.txt').readlines()] training_dataset_dir = './datasets/dogs-vs-cats-redux-kernels-edition/train/' test_datas...
anilcs13m/MachineLearning_Mastering
songrecommender/.ipynb_checkpoints/Song recommender-checkpoint.ipynb
gpl-2.0
import graphlab """ Explanation: Building a song recommender Fire up GraphLab Create End of explanation """ song_data = graphlab.SFrame('song_data.gl/') """ Explanation: Load music data End of explanation """ song_data.head(5) """ Explanation: Explore data Music data shows how many times a user listened to a son...
GetsDrawn/getsdrawndotcom
GetsDrawnDotCom.ipynb
mit
import os import requests from bs4 import BeautifulSoup import re import json import time import praw import dominate from dominate.tags import * from time import gmtime, strftime #import nose #import unittest import numpy as np import pandas as pd from pandas import * from PIL import Image from pprint import pprint ...
SimonBiggs/planningbook
Testing on a patient beam.ipynb
agpl-3.0
from glob2 import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline from rtplanchecking.pull_mephisto import * from rtplanchecking.scatter_factors import * from scipy.interpolate import interp1d """ Explanation: An example of basic plan checking using mephisto data file...
opengeostat/pygslib
doc/source/Ipython_templates/bicalib_raw.ipynb
mit
#general imports import matplotlib.pyplot as plt import pygslib import numpy as np import pandas as pd #make the plots inline %matplotlib inline """ Explanation: PyGSLIB Bicalib The GSLIb equivalent parameter file is ``` Parameters for BICALIB **** START OF PARAMETERS: ...
antoniomezzacapo/qiskit-tutorial
community/algorithms/bernstein_vazirani.ipynb
apache-2.0
#initialization import matplotlib.pyplot as plt %matplotlib inline import numpy as np # importing Qiskit from qiskit import IBMQ, Aer from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit import available_backends, execute, register, get_backend from qiskit.wrapper.jupyter import * # impor...
neeasthana/ML-SQL
Clustering/Iris/Iris.ipynb
gpl-3.0
#Libraries and Imports import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.cluster import KMeans from sklearn import preprocessing """ Explanation: Iris dataset (Clustering) Authors Written by: Neeraj Asthana (under Professor Robert Brunner) University of Illinois ...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/introduction_to_tensorflow/labs/feat.cols_tf.data.ipynb
apache-2.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline import tensorflow as tf from tensorflow import feature_column from tensorflow.keras import layers from sklearn.model_selection import train_test_split print("TensorFlow version: ",tf.version.VERSION) """...
jorisvandenbossche/2015-EuroScipy-pandas-tutorial
03 - Indexing and selecting data.ipynb
bsd-2-clause
%matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt try: import seaborn except ImportError: pass # redefining the example objects # series population = pd.Series({'Germany': 81.3, 'Belgium': 11.3, 'France': 64.3, 'United Kingdom': 64.9, 'Netherla...
NYUDataBootcamp/Projects
MBA_S16/Gammal-MLB_Injuries.ipynb
mit
'''Data were imported from referenced sources and stored locally''' import sys # system module import pandas as pd # data package import matplotlib.pyplot as plt # graphics module import datetime as dt # date and time module import numpy as np ...
ecell/ecell4-notebooks
en/tutorials/tutorial01.ipynb
gpl-2.0
%matplotlib inline from ecell4.prelude import * """ Explanation: 1. Brief Tour of E-Cell4 Simulations First of all, you have to load the E-Cell4 library: End of explanation """ with reaction_rules(): A + B > C | 0.01 # equivalent to create_binding_reaction_rule C > A + B | 0.3 # equivalent to create_unbi...
phoebe-project/phoebe2-docs
2.0/tutorials/vgamma.ipynb
gpl-3.0
!pip install -I "phoebe>=2.0,<2.1" %matplotlib inline """ Explanation: Systemic Velocity 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 """ im...
GitYiheng/reinforcement_learning_test
test05_machine_learning/Code snippets.ipynb
mit
import pandas as pd from sklearn import tree X = [[0, 0], [1, 2]] y = [0, 1] clf = tree.DecisionTreeClassifier() clf = clf.fit(X, y) clf.predict([[2., 2.]]) clf.predict_proba([[2. , 2.]]) clf.predict([[0.4, 1.2]]) clf.predict_proba([[0.4, 1.2]]) clf.predict_proba([[0, 0.2]]) """ Explanation: Decision Tree CAR...
rigetticomputing/grove
examples/DeutschJosza.ipynb
apache-2.0
from itertools import product from mock import patch from grove.deutsch_jozsa.deutsch_jozsa import DeutschJosza """ Explanation: This notebook is a brief sketch of how to use the Deutsch-Jozsa algorithm. We start by declaring all necessary imports. End of explanation """ bit_value = '0' bit = ("0", "1") constant_b...
WilliamHPNielsen/broadbean
docs/Filter compensation.ipynb
mit
%matplotlib notebook import matplotlib.pyplot as plt import numpy as np import sys from broadbean.ripasso import applyRCFilter, applyInverseRCFilter, applyCustomTransferFunction def squarewave(npts, periods=5): periods = int(periods) array = np.zeros(npts) for n in range(periods): array[int(n*npt...
rnwatanabe/projectPR
ExampleNotebooks/AntidromicStimulationofMNandRC.ipynb
gpl-3.0
import sys sys.path.insert(0, '..') import time import matplotlib.pyplot as plt %matplotlib notebook plt.rcParams['figure.figsize']= 7,7 import numpy as np from Configuration import Configuration from MotorUnitPool import MotorUnitPool from InterneuronPool import InterneuronPool from SynapsesFactory import SynapsesFa...
KJE2001/seminars
03_planck_distribution.ipynb
mit
from scipy.constants import * print("The Planck constant h:", h) """ Explanation: <figure> <IMG SRC="gfx/Logo_norsk_pos.png" WIDTH=100 ALIGN="right"> </figure> The Planck distribution Roberto Di Remigio, Luca Frediani In this set of exercises we will work with the Planck distribution. The first exercise is numerica...
ES-DOC/esdoc-jupyterhub
notebooks/noaa-gfdl/cmip6/models/sandbox-3/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'sandbox-3', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: NOAA-GFDL Source ID: SANDBOX-3 Topic: Seaice Sub-Topics: Dynamics, Thermodyna...
dit/dit
examples/PID.ipynb
bsd-3-clause
import dit from dit.pid.helpers import compare_measures from dit.pid.distributions import bivariates, trivariates dit.ditParams['print.exact'] = dit.ditParams['repr.print'] = True dit.ditParams['text.font'] = 'linechar' """ Explanation: Partial Information Decomposition The partial information decomposition is a metho...
nicoguaro/FEM_resources
Analytic FEM.ipynb
mit
from sympy import * init_session() def const_model(E, nu, const="plane_stress"): if const == "plane_stress": fac = E/(1 - nu**2) C = fac*Matrix([ [1, nu, 0], [nu, 1, 0], [0, 0, (1 - nu)/2]]) elif const == "plane_strain": fac = E*(1 - nu)/((1 - 2*nu)*(...
ES-DOC/esdoc-jupyterhub
notebooks/csir-csiro/cmip6/models/sandbox-3/landice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'csir-csiro', 'sandbox-3', 'landice') """ Explanation: ES-DOC CMIP6 Model Properties - Landice MIP Era: CMIP6 Institute: CSIR-CSIRO Source ID: SANDBOX-3 Topic: Landice Sub-Topics: Glaciers, Ice. ...
michrawson/nyu_ml_lectures
notebooks/03.4 Methods - Text Feature Extraction.ipynb
cc0-1.0
X = ["Some say the world will end in fire,", "Some say in ice."] len(X) from sklearn.feature_extraction.text import CountVectorizer vectorizer = CountVectorizer() vectorizer.fit(X) vectorizer.vocabulary_ X_bag_of_words = vectorizer.transform(X) X_bag_of_words.shape X_bag_of_words X_bag_of_words.toarray() ...
dineshpackt/Fast-Data-Processing-with-Spark-2
extras/010-Linear-Regression.ipynb
mit
from pyspark.context import SparkContext print "Running Spark Version %s" % (sc.version) from pyspark.conf import SparkConf conf = SparkConf() print conf.toDebugString() import datetime from pytz import timezone print "Last run @%s" % (datetime.datetime.now(timezone('US/Pacific'))) df_cars = sqlContext.read.load('ca...
dbkinghorn/blog-jupyter-notebooks
ML-LR-part2.ipynb
gpl-3.0
import pandas as pd # data handeling import numpy as np # numeriacal computing import matplotlib.pyplot as plt # plotting core import seaborn as sns # higher level plotting tools %matplotlib inline pd.set_option('display.float_format', lambda x: '%.2f' % x) pd.set_option('display.max_columns', 21) pd.set_option(...
UWashington-Astro300/Astro300-W17
StyleGuide.ipynb
mit
# Good - Full credit mass_particle = 10.0 velocity_particle = 20.0 kinetic_energy = 0.5 * mass_particle * (velocity_particle ** 2) print(kinetic_energy) # Bad - Half credit at best x = 10.0 y = 20.0 print(0.5*x*y**2) # Really bad - no credit print(0.5*10*20**2) """ Explanation: The Astro 300 Python programming...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_compute_mne_inverse_raw_in_label.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.minimum_norm import apply_inverse_raw, read_inverse_operator print(__doc__) data_path = sample.data_path() fname_inv = data_path + '/...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/chi2_fitting.ipynb
bsd-3-clause
import numpy as np import pandas as pd import statsmodels.api as sm """ Explanation: Least squares fitting of models to data This is a quick introduction to statsmodels for physical scientists (e.g. physicists, astronomers) or engineers. Why is this needed? Because most of statsmodels was written by statisticians and ...