repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
ramezquitao/pyoptools
doc/notebooks/basic/SimpleComponents.ipynb
gpl-3.0
from pyoptools.all import * from numpy import pi,sqrt """ Explanation: Creating components with pyOpTools To be able to simulate an optical system, the first step is to use the predefined surfaces to create components. In this notebook it will be shown how to create some simple components. End of explanation """ S0=...
WilliamHPNielsen/broadbean
docs/Subsequences.ipynb
mit
%matplotlib notebook import broadbean as bb from broadbean.plotting import plotter sine = bb.PulseAtoms.sine ramp = bb.PulseAtoms.ramp """ Explanation: Subsequences This notebook describes the use of subsequences. Subsequences can be useful in a wide range of settings. End of explanation """ # Uncompressed SR = 1...
gregunz/ada2017
exam/data_cluedo/2-icecream.ipynb
mit
# Run the following to import necessary packages and import dataset. Do not use any additional plotting libraries. import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt matplotlib.style.use('ggplot') datafile = "dataset/icecream.csv" df = pd.read_csv(datafile) df """ Explanation: <h1...
bataeves/kaggle
sber/Model-0.31434.ipynb
unlicense
# train_raw = pd.read_csv("data/train.csv") train_raw = pd.read_csv("data/train_without_noise.csv") test = pd.read_csv("data/test.csv") macro = pd.read_csv("data/macro.csv") train_raw.head() def preprocess_anomaly(df): df["full_sq"] = map(lambda x: x if x > 10 else float("NaN"), df["full_sq"]) df["life_sq"] = ...
mne-tools/mne-tools.github.io
0.14/_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 + '/...
anhaidgroup/py_entitymatching
notebooks/guides/step_wise_em_guides/Performing Blocking Using Built-In Blockers (Overlap Blocker).ipynb
bsd-3-clause
# Import py_entitymatching package import py_entitymatching as em import os import pandas as pd """ Explanation: Introduction This IPython notebook illustrates how to perform blocking using Overlap blocker. First, we need to import py_entitymatching package and other libraries as follows: End of explanation """ # Ge...
ComputationalModeling/spring-2017-danielak
past-semesters/spring_2016/day-by-day/day23-Econophysics/STUDENT-Notebook-for-Econophysics.ipynb
agpl-3.0
# Use Python to make a filled-in plot # from the data that got reported out """ Explanation: Econophysics Names of group members // put your names here! Goals of this assignment Witness what we call "emergent behavior"; large patterns manifesting from the simple interactions of tiny agents Develop a graphical way t...
fggp/ctcsound
cookbook/03-threading.ipynb
lgpl-2.1
import ctcsound cs = ctcsound.Csound() csd = ''' <CsoundSynthesizer> <CsOptions> -d -o dac -m0 </CsOptions> <CsInstruments> sr = 48000 ksmps = 100 nchnls = 2 0dbfs = 1 instr 1 idur = p3 iamp = p4 icps = cpspch(p5) irise = p6 idec = p7...
zzsza/TIL
python/crawling-google-play.ipynb
mit
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import json import re from bs4 import BeautifulSoup import warnings from konlpy.tag import Twitter from sklearn.feature_extraction.text import CountVectorizer warnings.filterwarnings('ignore') %matplotlib inline %config InlineBackend.figure_fo...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/cmip6/models/miroc-es2h/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'miroc-es2h', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: MIROC Source ID: MIROC-ES2H Topic: Ocean Sub-Topics: Timestepping Framework, Advec...
quantopian/research_public
notebooks/lectures/Spearman_Rank_Correlation/answers/notebook.ipynb
apache-2.0
import numpy as np import pandas as pd import scipy.stats as stats import matplotlib.pyplot as plt import math """ Explanation: Exercises: Spearman Rank Correlation Lecture Link This exercise notebook refers to this lecture. Please use the lecture for explanations and sample code. https://www.quantopian.com/lectures#S...
seblabbe/MATH2010-Logiciels-mathematiques
Devoirs/devoir2-solutions.ipynb
gpl-3.0
def somme(A, B): C = [] for i in range(4): Ai = A[i] Bi = B[i] row = [Ai[j]+Bi[j] for j in range(4)] C.append(row) return C X = [[56, 39, 3, 41], [23, 78, 11, 62], [61, 26, 65, 51], [80, 98, 9, 68]] Y = [[51, 52, 53, 15], [ 1, 71, 46, 31], [99, 7,...
amitkaps/weed
4-Model.ipynb
mit
# Load the libraries import numpy as np import pandas as pd from scipy import stats from sklearn import linear_model # Load the data again! df = pd.read_csv("data/Weed_Price.csv", parse_dates=[-1]) df.sort(columns=['State','date'], inplace=True) df1 = df[df.State=="California"].copy() df1.set_index("date", inplace=Tru...
jakobrunge/tigramite
tutorials/tigramite_tutorial_basics.ipynb
gpl-3.0
# Imports import numpy as np import matplotlib from matplotlib import pyplot as plt %matplotlib inline ## use `%matplotlib notebook` for interactive figures # plt.style.use('ggplot') import sklearn import tigramite from tigramite import data_processing as pp from tigramite.toymodels import structural_causal_proce...
phoebe-project/phoebe2-docs
2.1/tutorials/20_21_meshes.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" """ Explanation: 2.0 - 2.1 Migration: Meshes Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release). End of explanation """ import phoebe b = ...
cdalzell/ds-for-wall-street
ds-for-ws-student.ipynb
apache-2.0
%matplotlib inline import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.dates as mdates import seaborn as sns """ Explanation: Loading and Cleaning the Data Turn on inline matplotlib plotting and import plotting dependencies. End of explanation """ import numpy as np import pandas as pd import...
keras-team/keras-io
guides/ipynb/keras_cv/coco_metrics.ipynb
apache-2.0
import keras_cv # import all modules we will need in this example import tensorflow as tf from tensorflow import keras # only consider boxes with areas less than a 32x32 square. metric = keras_cv.metrics.COCORecall(class_ids=[1, 2, 3], area_range=(0, 32**2)) """ Explanation: Using KerasCV COCO Metrics Author: lukewo...
phobson/statsmodels
examples/notebooks/tsa_filters.ipynb
bsd-3-clause
%matplotlib inline from __future__ import print_function import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm dta = sm.datasets.macrodata.load_pandas().data index = pd.Index(sm.tsa.datetools.dates_from_range('1959Q1', '2009Q3')) print(index) dta.index = index del dta['year'] del dta['qu...
M0nica/python-foundations-hw
05/NYT_graded.ipynb
mit
import config import requests #imports key from config file nyt_articles_api = config.nyt_articles_api nyt_books_api = config.nyt_books_api nyt_movie_api = config.nyt_movie_api response = requests.get('https://api.nytimes.com/svc/search/v2/articlesearch.json?api-key=' + nyt_articles_api) data = response.json() # pr...
liganega/Gongsu-DataSci
previous/y2017/W08-numpy-hypothesis_test/.ipynb_checkpoints/GongSu19-Statistical_Hypothesis_Test-checkpoint.ipynb
gpl-3.0
import numpy as np from __future__ import print_function, division """ Explanation: 자료 안내: 여기서 다루는 내용은 아래 사이트의 내용을 참고하여 생성되었음. https://github.com/rouseguy/intro2stats 가설검정 End of explanation """ import sympy as sp sp.factorial(5) """ Explanation: 오늘의 주요 예제: 동전던지기 동전을 30번 던져서 앞면(Head)이 24번 나왔을 때, 정상적인 동전이라 할 수 있을까?...
ozorich/phys202-2015-work
assignments/assignment04/MatplotlibExercises.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Visualization 1: Matplotlib Basics Exercises End of explanation """ y=np.random.randn(30) x=np.random.randn(30) plt.scatter(x,y, color="r",s=50, marker='x',alpha=.9) plt.xlabel('Random Values for X') plt.ylabel('Randome Values fo...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/04_advanced_preprocessing/labs/taxicab_traffic/deploy.ipynb
apache-2.0
!gsutil cp -r $MODEL_PATH/* gs://$BUCKET/taxifare/model/ """ Explanation: Deploy for Online Prediction To get our predictions, in addition to the features provided by the client, we also need to fetch the latest traffic information from BigQuery. We then combine these and invoke our tensorflow model. This is visualize...
ES-DOC/esdoc-jupyterhub
notebooks/nasa-giss/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', 'nasa-giss', 'sandbox-3', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: NASA-GISS Source ID: SANDBOX-3 Topic: Seaice Sub-Topics: Dynamics, Thermodyna...
lenovor/notes-on-dirichlet-processes
2015-09-02-fitting-a-mixture-model.ipynb
mit
%matplotlib inline import pandas as pd import numpy as np import random import matplotlib.pyplot as plt from scipy import stats from collections import namedtuple, Counter """ Explanation: Fitting a Mixture Model with Gibbs Sampling End of explanation """ data = pd.Series.from_csv("clusters.csv") _=data.hist(bins=2...
espressomd/espresso
doc/tutorials/ferrofluid/ferrofluid_part2.ipynb
gpl-3.0
import espressomd import espressomd.magnetostatics espressomd.assert_features(['DIPOLES', 'DP3M', 'LENNARD_JONES']) %matplotlib inline import matplotlib.pyplot as plt plt.rcParams.update({'font.size': 18}) import numpy as np import tqdm """ Explanation: Ferrofluid - Part 2 Table of Contents Applying an external mag...
tritemio/pybroom
doc/notebooks/pybroom-example-multi-datasets.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format='retina' # for hi-dpi displays import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from lmfit import Model import lmfit print('lmfit: %s' % lmfit.__version__) sns.set_style('whitegrid') import pybroom as br """ Explanati...
statsmodels/statsmodels.github.io
v0.13.2/examples/notebooks/generated/tsa_arma_0.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd import statsmodels.api as sm from scipy import stats from statsmodels.tsa.arima.model import ARIMA from statsmodels.graphics.api import qqplot """ Explanation: Autoregressive Moving Average (ARMA): Sunspots data End of explanat...
Heroes-Academy/OOP_Spring_2016
notebooks/giordani/Python_3_OOP_Part_3__Delegation__composition_and_inheritance.ipynb
mit
class Door: colour = 'brown' def __init__(self, number, status): self.number = number self.status = status @classmethod def knock(cls): print("Knock!") @classmethod def paint(cls, colour): cls.colour = colour def open(self): self.status = 'open' ...
Hebali/learning_machines
tensorflow_tutorials/Tutorial_01_GraphsAndSessions.ipynb
mit
# Create input constants: X = 2.0 Y = 3.0 # Perform addition: Z = X + Y # Print output: print Z """ Explanation: Learning Machines Taught by Patrick Hebron at NYU/ITP, Fall 2017 TensorFlow Basics: "Graphs and Sessions" Let's look at a simple arithmetic procedure in pure Python: End of explanation """ # Import Ten...
mne-tools/mne-tools.github.io
0.23/_downloads/b99fcf919e5d2f612fcfee22adcfc330/40_autogenerate_metadata.ipynb
bsd-3-clause
from pathlib import Path import matplotlib.pyplot as plt import mne data_dir = Path(mne.datasets.erp_core.data_path()) infile = data_dir / 'ERP-CORE_Subject-001_Task-Flankers_eeg.fif' raw = mne.io.read_raw(infile, preload=True) raw.filter(l_freq=0.1, h_freq=40) raw.plot(start=60) # extract events all_events, all_ev...
markdewing/qmc_algorithms
Variational/Variational_Hydrogen.ipynb
mit
beta = Symbol('beta') R_T = exp(-r - beta*r*r) R_T """ Explanation: Energy of the Hydrogen Atom The variational principle states a trial wavefunction will have an energy greater than or equal to the ground state energy. $$\frac{\int \psi H \psi}{ \int \psi^2} \ge E_0$$ First consider the hydogen atom. Let us use a tr...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_define_target_events.ipynb
bsd-3-clause
# Authors: Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import mne from mne import io from mne.event import define_target_events from mne.datasets import sample import matplotlib.pyplot as plt print(__doc__) data_path = sample.data_path() """ Explanation: ===================================...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/02_generalization/labs/create_datasets.ipynb
apache-2.0
from google.cloud import bigquery import seaborn as sns import pandas as pd import numpy as np import shutil """ Explanation: <h1> Explore and create ML datasets </h1> In this notebook, we will explore data corresponding to taxi rides in New York City to build a Machine Learning model in support of a fare-estimation ...
km-Poonacha/python4phd
Session 2/ipython/.ipynb_checkpoints/Lesson 5- Crawl and scrape-Worksheet-checkpoint.ipynb
gpl-3.0
<h1 id="HEADING" property="name" class="heading_name "> <div class="heading_height"></div> " Le Jardin Napolitain " </h1> """ Explanation: Lesson 5 - Crawl and Scrape Making the request Using 'requests' module Use the requests module to make a HTTP request to http://www.tripadvisor.com - Check the...
james-prior/euler
euler-204-generalised-hamming-numbers.ipynb
mit
MAX_PRIME = 100 MAX_SMOOTH = 10**9 def is_prime(x): return all(x % divisor != 0 for divisor in range(2, x)) primes = tuple(x for x in range(2, MAX_PRIME+1) if is_prime(x)) def n_smooth_numbers(n, x, primes, max_smooth): if not primes: return n while True: n = n_smooth_numbers(n, x, primes...
geoneill12/phys202-2015-work
assignments/assignment10/ODEsEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import seaborn as sns from scipy.integrate import odeint from IPython.html.widgets import interact, fixed """ Explanation: Ordinary Differential Equations Exercise 1 Imports End of explanation """ def solve_euler(derivs, y0, x): """Solve a 1d ...
google-research/google-research
gfsa/notebooks/demo_learning_static_analyses.ipynb
apache-2.0
# 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 the L...
3upperm2n/notes-deeplearning
tensorboard/tensorboard/Anna KaRNNa Name Scoped.ipynb
mit
import time from collections import namedtuple import numpy as np import tensorflow as tf """ Explanation: Anna KaRNNa In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book. This network is base...
ContinualAI/avalanche
notebooks/how-tos/dataloading_buffers_replay.ipynb
mit
!pip install avalanche-lib """ Explanation: description: How to implement replay and data loading Dataloading, Memory Buffers, and Replay Avalanche provides several components that help you to balance data loading and implement rehearsal strategies. Dataloaders are used to provide balancing between groups (e.g. tasks/...
timothydmorton/usrp-sciprog
day2/exercises/Solutions/Python_answers.ipynb
mit
#I don't think this is the code golf winner. Try to beat me. for i in range(100): print('FizzBuzz'*(not (i+1)%5)*(not (i+1)%3) or 'Fizz'*(not (i+1)%5) or 'Buzz'*(not (i+1)%3) or str(i+1)) """ Explanation: Exercises Rules: Every variable/function/class name should be meaningful Variable/function names should be lo...
DJCordhose/big-data-visualization
code/notebooks/analysis-dask.ipynb
mit
# http://dask.pydata.org/en/latest/dataframe-overview.html %time lazy_df = dd.read_csv('../../data/raw/2001.csv', encoding='iso-8859-1') %time len(lazy_df) # http://dask.pydata.org/en/latest/dataframe-api.html#dask.dataframe.DataFrame.sample s = 10000 # desired sample size n = 5967780 fraction = s / n df = lazy_df.s...
AllenDowney/ModSim
soln/chap12.ipynb
gpl-2.0
# install Pint if necessary try: import pint except ImportError: !pip install pint # download modsim.py if necessary from os.path import exists filename = 'modsim.py' if not exists(filename): from urllib.request import urlretrieve url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/' ...
readywater/caltrain-predict
.ipynb_checkpoints/01sepEvents-checkpoint.ipynb
mit
# Import necessary libraries import matplotlib.pyplot as plt import numpy as np import pandas as pd import sys import re import random import operator from func import * # inline plot %matplotlib inline #%%javascript #IPython.OutputArea.auto_scroll_threshold = 9999; #%load 'data/raw-twt2016-01-26-14/21/09.csv' df = ...
theideasmith/theideasmith.github.io
_notebooks/.ipynb_checkpoints/Asymptotic Convergence of Gradient Descent for Linear Regression Least Squares Optimization-checkpoint.ipynb
mit
from pylab import * from numpy import random as random random.seed(1) N=1000. w = array([14., 30.]); x = zeros((2, int(N))).astype(float32) x[0,:] = arange(N).astype(float32) x[1,:] = 1 y = w.dot(x) + random.normal(size=int(N), scale=100.) """ Explanation: Supplementary Materials This code accompanies the paper Asymp...
TuKo/brainiak
examples/reprsimil/group_brsa_example.ipynb
apache-2.0
%matplotlib inline import scipy.stats import scipy.spatial.distance as spdist import numpy as np from brainiak.reprsimil.brsa import GBRSA import brainiak.utils.utils as utils import matplotlib.pyplot as plt import matplotlib as mpl import logging np.random.seed(10) import copy """ Explanation: This demo shows how to ...
AAbercrombie0492/gdelt_distributed_architecture
notebooks/GDELT_Architecture.ipynb
mit
from IPython.display import YouTubeVideo, HTML HTML('<iframe width="560" height="315" src="https://www.youtube.com/embed/GpCarC_I3Ao?list=PLlRVXVT7h9_gCGCOl_bNYHA7FXbSOIVbs" frameborder="0" allowfullscreen></iframe>') """ Explanation: Data Engineering Final Project: GDELT Global Data on Events, Location, and Tone "Th...
celiasmith/syde556
SYDE 556 Lecture 9 Action Selection.ipynb
gpl-2.0
%pylab inline import nengo model = nengo.Network('Selection') with model: stim = nengo.Node(lambda t: [np.sin(t), np.cos(t)]) s = nengo.Ensemble(200, dimensions=2) Q_A = nengo.Ensemble(50, dimensions=1) Q_B = nengo.Ensemble(50, dimensions=1) Q_C = nengo.Ensemble(50, dimensions=1) Q_D ...
mortonjt/yummy-octo-duck
ipynb/UniFrac benchmarking.ipynb
bsd-3-clause
import numpy.testing as npt ids, otu_ids, otu_data, t = get_random_samples(10, tree, True) fu_mat = make_and_run_pw_distances(unifrac, otu_data, otu_ids=otu_ids, tree=t) u_mat = pw_distances(unweighted_unifrac, otu_data, otu_ids=otu_ids, tree=t) fwu_mat = make_and_run_pw_distances(w_unifrac, otu_data, otu_ids=otu_ids...
gaufung/Data_Analytics_Learning_Note
python-statatics-tutorial/basic-theme/python-language/Function.ipynb
mit
bigx = 10 def double_times(x = bigx): return x * 2 bigx = 1000 double_times() """ Explanation: 函数 1 默认参数 函数的参数中如果有默认参数,那么函数在定义的时候将被计算而不是等到函数被调用的时候 End of explanation """ def foo(values, x=[]): for value in values: x.append(value) return x foo([0,1,2]) foo([4,5]) def foo_fix(values, x=[]): i...
ES-DOC/esdoc-jupyterhub
notebooks/bnu/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', 'bnu', 'sandbox-1', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: BNU Source ID: SANDBOX-1 Topic: Atmos Sub-Topics: Dynamical Core, Radiation, Turbulen...
laurajchang/NPTFit
examples/Example7_Galactic_Center_nonPoissonian.ipynb
mit
# Import relevant modules %matplotlib inline %load_ext autoreload %autoreload 2 import numpy as np from NPTFit import nptfit # module for performing scan from NPTFit import create_mask as cm # module for creating the mask from NPTFit import dnds_analysis # module for analysing the output from NPTFit import psf_corre...
2php/CodeToolKit
9.caffe-ssd/examples/inceptionv3.ipynb
mit
# set up Python environment: numpy for numerical routines, and matplotlib for plotting import numpy as np import matplotlib.pyplot as plt # display plots in this notebook %matplotlib inline # set display defaults plt.rcParams['figure.figsize'] = (10, 10) # large images plt.rcParams['image.interpolation'] = 'nea...
spectralDNS/shenfun
docs/source/fasttransforms.ipynb
bsd-2-clause
from shenfun import * from mpi4py_fft import fftw """ Explanation: <!-- File automatically generated using DocOnce (https://github.com/doconce/doconce/): doconce format ipynb fasttransforms.do.txt --> Demo - Some fast transforms Mikael Mortensen (email: mikaem@math.uio.no), Department of Mathematics, University of O...
the-deep-learners/TensorFlow-LiveLessons
notebooks/transfer_learning_in_keras.ipynb
mit
import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "1" """ Explanation: Transfer Learning in Keras In this notebook, we'll cover how to load a pre-trained model (in this case, VGGNet19) and finetune it for a new task: detecting hot dogs. End of explanation """ from keras.ap...
kikocorreoso/brythonmagic
notebooks/Highcharts (python) tutorial.ipynb
mit
%load_ext brythonmagic """ Explanation: First step In this tutorial we will use Brython, an implementation of Python written in javascript and Python, to access the Highcharts javascript library and to manage the data to be used in the maps. To integrate Brython in the IPython notebook we are using an extension for th...
jakejhansen/minesweeper_solver
Minesweeper_results.ipynb
mit
# Initialization goes here import numpy as np import matplotlib.pyplot as plt import pickle import os import pandas as pd import math from matplotlib import rc plt.rc('text', usetex=True) plt.rc('font', family='serif') def smooth(y,factor): if type(y)!=list: y = list(y) return pd.Series(y).rolling(wind...
JJINDAHOUSE/deep-learning
sentiment-rnn/Sentiment_RNN.ipynb
mit
import numpy as np import tensorflow as tf with open('../sentiment-network/reviews.txt', 'r') as f: reviews = f.read() with open('../sentiment-network/labels.txt', 'r') as f: labels = f.read() reviews[:2000] """ Explanation: Sentiment Analysis with an RNN In this notebook, you'll implement a recurrent neural...
gabyx/ApproxMVBB
tests/python/PlotTestResults.ipynb
mpl-2.0
import sys,os,imp,re import math import numpy as np import matplotlib as mpl import matplotlib.cm as cm import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cmx from mpl_toolkits.mplot3d import Axes3D mpl.rcParams['figure.figsize']=(6.0,4.0) #(6.0,4.0) mpl.rcParams['font.siz...
jbocharov-mids/W207-Machine-Learning
John_Bocharov_p1.ipynb
apache-2.0
# This tells matplotlib not to try opening a new window for each plot. %matplotlib inline # Import a bunch of libraries. import time import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator from sklearn.pipeline import Pipeline from sklearn.datasets import fetch_mldata from skle...
georgetown-analytics/machine-learning
archive/notebook/nist_clustering.ipynb
mit
from lxml import html import requests from __future__ import print_function from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.cluster import KMeans, MiniBatchKMeans from time import time """ Explanation: Clustering NIST headlines and descriptions adapted from https://github.com/star-is-here/open...
skaae/Recipes
examples/ImageNet Pretrained Network (VGG_S).ipynb
mit
!wget https://s3.amazonaws.com/lasagne/recipes/pretrained/imagenet/vgg_cnn_s.pkl """ Explanation: Introduction This example demonstrates using a network pretrained on ImageNet for classification. The model used was converted from the VGG_CNN_S model (http://arxiv.org/abs/1405.3531) in Caffe's Model Zoo. For details o...
phoebe-project/phoebe2-docs
2.1/examples/single_spots.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" """ Explanation: Single Star with Spots Setup IMPORTANT NOTE: if using spots on contact systems or single stars, make sure to use 2.1.15 or later as the 2.1.15 release fixed a bug affecting spots in these systems. Let's first make sure we have the latest version of PHOEBE 2.1 install...
Upward-Spiral-Science/claritycontrol
code/Advanced Texture Based Clarity Visualization.ipynb
apache-2.0
import os PATH="/Users/albertlee/claritycontrol/code/scripts" os.chdir(PATH) import clearity as cl # I wrote this module for easier operations on data import matplotlib.pyplot as plt import jgraph as ig import clearity.resources as rs import csv,gc # garbage memory collection :) import matplotlib #import matplotlib....
sujitpal/polydlot
src/pytorch/06-echo-sequence-prediction.ipynb
apache-2.0
from __future__ import division, print_function from sklearn.metrics import accuracy_score, confusion_matrix from sklearn.model_selection import train_test_split from sklearn.preprocessing import OneHotEncoder import torch import torch.nn as nn from torch.autograd import Variable import numpy as np import matplotlib.py...
jochym/abinitio-workshop
notebooks/FononyDFT.ipynb
cc0-1.0
# przygotowanie rysunku t=ase.io.read('FIGs/MnAs_phM06.traj',index=':') v=view(t,viewer='nglview') v.custom_colors({'Mn':'green','As':'blue'}) v.view._remote_call("setSize", target="Widget", args=["500px", "500px"]) #v.view.center_view() v.view.background='#ffc' v.view.parameters=dict(clipDist=-200) # wyświetlenie ry...
Kaggle/learntools
notebooks/game_ai/raw/tut3.ipynb
apache-2.0
#$HIDE_INPUT$ import random import numpy as np # Gets board at next step if agent drops piece in selected column def drop_piece(grid, col, mark, config): next_grid = grid.copy() for row in range(config.rows-1, -1, -1): if next_grid[row][col] == 0: break next_grid[row][col] = mark re...
ogoann/StatisticalMethods
notes/InferenceSandbox.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt import scipy.stats %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 5.0) # the model parameters a = np.pi b = 1.6818 # my arbitrary constants mu_x = np.exp(1.0) # see definitions above tau_x = 1.0 s = 1.0 N = 50 # number of data points # get some x's and y...
glouppe/scikit-optimize
examples/bayesian-optimization.ipynb
bsd-3-clause
import numpy as np np.random.seed(777) %matplotlib inline import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (10, 6) """ Explanation: Bayesian optimization with skopt Gilles Louppe, Manoj Kumar July 2016. End of explanation """ noise_level = 0.1 def f(x, noise_level=noise_level): return np.sin(5 ...
jmschrei/pomegranate
tutorials/old/Tutorial_6_Markov_Chain.ipynb
mit
from pomegranate import * %pylab inline d1 = DiscreteDistribution({'A': 0.10, 'C': 0.40, 'G': 0.40, 'T': 0.10}) d2 = ConditionalProbabilityTable([['A', 'A', 0.10], ['A', 'C', 0.50], ['A', 'G', 0.30], ['A', 'T', 0.10], ...
turbomanage/training-data-analyst
courses/machine_learning/deepdive2/feature_engineering/solutions/4_keras_adv_feat_eng.ipynb
apache-2.0
import datetime import logging import os import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tensorflow import feature_column as fc from tensorflow.keras import layers from tensorflow.keras import models # set TF error log verbosity logging.getLogger("tensorflow").setLevel(logging.ERROR) ...
rasbt/python-machine-learning-book
code/ch05/ch05.ipynb
mit
%load_ext watermark %watermark -a 'Sebastian Raschka' -u -d -p numpy,scipy,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 5 - Compressing Data via Dimensionality Reduction No...
mdeff/ntds_2017
projects/reports/stackoverflow_network/StackOverflowNetworkAnalysis.ipynb
mit
%matplotlib inline import os import networkx as nx import numpy as np import matplotlib.pyplot as plt from scipy import sparse # Own modules import DataProcessing as proc import DataCleaning as clean import NetworkAnalysis as analysis import Classification as classification import NetworkEvolution as evol """ Explan...
XinyiGong/pymks
notebooks/filter.ipynb
mit
%matplotlib inline %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt """ Explanation: Filter Example This example demonstrates the connection between MKS and signal processing for a 1D filter. It shows that the filter is in fact the same as the influence coefficients and, thus, ap...
planetlabs/notebooks
jupyter-notebooks/ship-detector/01_ship_detector.ipynb
apache-2.0
sample_data_file_name = 'data/1056417_2017-03-08_RE3_3A_Visual_clip.tif' """ Explanation: Detect ships in Planet data This notebook demonstrates how to detect and count objects in satellite imagery using algorithms from Python's scikit-image library. In this example, we'll look for ships in a small area in the San Fr...
nipy/brainx
brainx/notebooks/detect_partition_degeneracy.ipynb
bsd-3-clause
%matplotlib inline import os import numpy as np import networkx as nx from glob import glob from matplotlib import pyplot as plt from brainx.util import threshold_adjacency_matrix """ Explanation: Evaluating Partitions for Degeneracy <br> This notebook is designed to allow BrainX users to evaluate degeneracies in t...
google/trax
trax/models/research/examples/hourglass_downsampled_imagenet.ipynb
apache-2.0
# 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 the Lice...
edosedgar/xs-pkg
deep_learning/hw1/homework_modules.ipynb
gpl-2.0
class Module(object): """ Basically, you can think of a module as of a something (black box) which can process `input` data and produce `ouput` data. This is like applying a function which is called `forward`: output = module.forward(input) The module should be able to perfor...
maxvogel/NetworKit-mirror2
Doc/Notebooks/NetworKit_UserGuide.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt """ Explanation: NetworKit User Guide About NetworKit NetworKit is an open-source toolkit for high-performance network analysis. Its aim is to provide tools for the analysis of large networks in the size range from thousands to billions of edges. For this purpose, it ...
radhikapc/foundation-homework
homework06/Homework06-Dark Sky Forecast API-Radhika.ipynb
mit
#https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE,TIME response = requests.get('https://api.forecast.io/forecast/4da699cf85f9706ce50848a7e59591b7/12.971599,77.594563') data = response.json() #print(data) #print(data.keys()) print("Bangalore is in", data['timezone'], "timezone") timezone_find = data.keys() #fi...
yedivanseven/bestPy
examples/05_Recommender.ipynb
gpl-3.0
import sys sys.path.append('../..') """ Explanation: CHAPTER 5 The Recommender Now that we got to know bestPy's powerful algorithms, we cant't wait to use them, right? In trying to do so, however, we might realize that they are pretty bare-bone and inconvenient to handle. For example, we need to know the internally us...
aldian/tensorflow
tensorflow/lite/g3doc/performance/post_training_float16_quant.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...
halimacc/CS231n-assignments
assignment2/BatchNormalization.ipynb
unlicense
# As usual, a bit of setup from __future__ import print_function import time import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.fc_net import * from cs231n.data_utils import get_CIFAR10_data from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array from cs231n.solv...
tensorflow/docs-l10n
site/ja/lite/performance/post_training_integer_quant.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...
AllenDowney/ThinkBayes2
examples/hockey.ipynb
mit
# If we're running on Colab, install PyMC and ArviZ import sys IN_COLAB = 'google.colab' in sys.modules if IN_COLAB: !pip install pymc3 !pip install arviz # PyMC generates a FutureWarning we don't need to deal with yet import warnings warnings.filterwarnings("ignore", category=FutureWarning) import seaborn ...
spulido99/NetworksAnalysis
alejogm0520/Repaso_Estadistico.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import scipy.stats as stas %matplotlib inline x = np.arange(0.01, 1, 0.01) values = [(0.5, 0.5),(5, 1),(1, 3),(2, 2),(2, 5)] for i, j in values: y = stas.beta.pdf(x,i,j) plt.plot(x,y) plt.show() """ Explanation: Analisis de Redes: Repaso Estadistico Ejercici...
tensorflow/graphics
tensorflow_graphics/notebooks/6dof_alignment.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...
openmrslab/suspect
docs/notebooks/tut05_hsvd.ipynb
mit
import suspect import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: 5. Water suppression with HSVD In this tutorial we will take a look at water suppression. Water is present in the body at concentrations thousands of times higher than any of the metabolites we are interested in, so a...
d00d/quantNotebooks
Notebooks/quantopian_research_public/notebooks/lectures/Futures_Trading_Considerations/notebook.ipynb
unlicense
import numpy as np import pandas as pd import matplotlib.pyplot as plt from quantopian.research.experimental import continuous_future, history """ Explanation: Futures Trading Considerations by Maxwell Margenot and Delaney Mackenzie Part of the Quantopian Lecture Series: www.quantopian.com/lectures github.com/quantop...
moonbury/pythonanywhere
github/MasteringMatplotlib/mmpl-preview.ipynb
gpl-3.0
import matplotlib matplotlib.use('nbagg') %matplotlib inline """ Explanation: A Preview A quick look at some examples indicating the sorts of things that will be examined in later notebooks. Each notebook will take advantage of the NbAgg backend, and we set that up first: End of explanation """ import matplotlib.pyp...
fgnt/nara_wpe
examples/WPE_Tensorflow_online.ipynb
mit
channels = 8 sampling_rate = 16000 delay = 3 alpha=0.99 taps = 10 frequency_bins = stft_options['size'] // 2 + 1 """ Explanation: Example with real audio recordings The iterations are dropped in contrast to the offline version. To use past observations the correlation matrix and the correlation vector are calculated r...
Bastien-Brd/pi-tuner
pitch_detection_from_microphone.ipynb
mit
import sounddevice as sd import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Tutorial for recording a guitar string stroke and detecting its pitch I use the python library called sounddevice which allows to easily record audio and represent the result as a numpy ...
julienchastang/unidata-python-workshop
notebooks/AWIPS/Model_Sounding_Data.ipynb
mit
from awips.dataaccess import DataAccessLayer import matplotlib.tri as mtri import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes from math import exp, log import numpy as np from metpy.calc import get_wind_components, lcl, dry_lapse, parcel_profile, dewpoint from metpy.calc import...
zephirefaith/AI_Fall15_Assignments
A1/player_notebook.ipynb
mit
from random import randint class RandomPlayer(): """Player that chooses a move randomly.""" def move(self, game, legal_moves, time_left): if not legal_moves: return (-1,-1) return legal_moves[randint(0,len(legal_moves)-1)] """ Explanation: This is the ipython notebook you should use as a templ...
DawesLab/LabNotebooks
Beam Splitter Leonhart.ipynb
mit
from qutip import * from numpy import sqrt, pi, cos, sin, exp, array, real, imag, linspace from numpy import math factorial = math.factorial import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Beam Splitter QM AMCDawes Based on paper (and book) by Ulf Leonhardt arXiv:quant-ph/0305007v2 4 Jul 2003 Some ...
otavio-r-filho/AIND-Deep_Learning_Notebooks
autoencoder/Simple_Autoencoder_Solution.ipynb
mit
%matplotlib inline 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', validation_size=0) """ Explanation: A Simple Autoencoder We'll start off by building a simple autoencoder to compres...
yashdeeph709/Algorithms
PythonBootCamp/Complete-Python-Bootcamp-master/Milestone Project 1 - Advanced Solution.ipynb
apache-2.0
# Specifically for the iPython Notebook environment for clearing output. from IPython.display import clear_output # Global variables board = [' '] * 10 game_state = True announce = '' """ Explanation: Tic Tac Toe This is the solution for the Milestone Project! A two player game made within a Jupyter Notebook. Feel fr...
rashikaranpuria/Machine-Learning-Specialization
Machine Learning Foundations: A Case Study Approach/Assignment_three/Document retrieval.ipynb
mit
import graphlab """ Explanation: Document retrieval from wikipedia data Fire up GraphLab Create End of explanation """ people = graphlab.SFrame('people_wiki.gl/people_wiki.gl') """ Explanation: Load some text data - from wikipedia, pages on people End of explanation """ people.head() len(people) """ Explanatio...
balarsen/pymc_learning
updating_info/Updating Info.ipynb
bsd-3-clause
# pymc3.distributions.DensityDist? import matplotlib.pyplot as plt import matplotlib as mpl from pymc3 import Model, Normal, Slice from pymc3 import sample from pymc3 import traceplot from pymc3.distributions import Interpolated from theano import as_op import theano.tensor as tt import numpy as np from scipy import ...
JKeun/project-02-watcha
01_crawling/02_api_crawling(raw_df1).ipynb
mit
import requests import json import pandas as pd """ Explanation: api(json)을 통한 feature 크롤링 y : 'owner_action' key안에 있는 ['rating': 내가준 별점] X : ['title':영화제목, 'eval_count':평가자수, 'watcha_rating':평균별점, 'filmrate':관람가, 'main_genre':장르, 'nation':국가, 'running_time':상영시간, 'year':제작년도] $\hat y$ : predicted_rating 추가로 뽑아야...
santanche/java2learn
notebooks/pt/c04components/s03message-bus/3.iot-dashboard-python.ipynb
gpl-2.0
from resources.iot.device import IoT_sensor_consumer from IPython.core.display import display import ipywidgets as widgets from resources.iot.device import IoT_mqtt_publisher, IoT_sensor """ Explanation: Exemplos de Componentes Visuais para iPython End of explanation """ widgets.FloatProgress(value=30.0, min=0, max=...