repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
sserrot/lending_club_analysis
lending_club_notebook.ipynb
mit
df.drop('id', axis=1, inplace=True) df.drop('member_id', axis=1, inplace=True) df.drop('url', axis=1, inplace=True) df.describe() """ Explanation: My interest is in the loan status. I want to know if I can predict if a loan will be charged off or not. Thus there are multiple predictors that can be removed since the...
madhurilalitha/Python-Projects
AnomaliesTwitterText/anomalies_in_tweets.ipynb
mit
import nltk import pandas as pd import numpy as np data = pd.read_csv("original_train_data.csv", header = None,delimiter = "\t", quoting=3,names = ["Polarity","TextFeed"]) #Data Visualization data.head() """ Explanation: "Detection of anomalous tweets using supervising outlier techniques" Importing the Dependencies ...
mssalvador/WorkflowCleaning
notebooks/Semi_supervised_workflow.ipynb
apache-2.0
%run -i initilization.py from pyspark.sql import functions as F from pyspark.ml import clustering from pyspark.ml import feature from pyspark.sql import DataFrame from pyspark.sql import Window from pyspark.ml import Pipeline from pyspark.ml import classification from pyspark.ml.evaluation import BinaryClassification...
cmorgan/toyplot
docs/markers.ipynb
bsd-3-clause
import numpy import toyplot y = numpy.linspace(0, 1, 20) ** 2 toyplot.scatterplot(y, width=300); """ Explanation: .. _markers: Markers In Toyplot, markers are used to show the individual datums in scatterplots: End of explanation """ canvas = toyplot.Canvas(600, 300) canvas.axes(grid=(1, 2, 0)).plot(y) canvas.axes(...
bhargavvader/gensim
docs/notebooks/Corpora_and_Vector_Spaces.ipynb
lgpl-2.1
import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) import os import tempfile TEMP_FOLDER = tempfile.gettempdir() print('Folder "{}" will be used to save temporary dictionary and corpus.'.format(TEMP_FOLDER)) """ Explanation: Tutorial 1: Corpora and Vector Spaces...
AndreySheka/dl_ekb
hw10/Seminar10-RNN-homework-ru.ipynb
mit
#тут будет текст corpora = "" for fname in os.listdir("codex"): import sys if sys.version_info >= (3,0): with open("codex/"+fname, encoding='cp1251') as fin: text = fin.read() #If you are using your own corpora, make sure it's read correctly corpora += text else: ...
adriantorrie/adriantorrie.github.io
downloads/notebooks/udacity/deep_learning_foundations_nanodegree/project_1_notes_introduction_to_neural_networks.ipynb
mit
%run ../../../code/version_check.py """ Explanation: Summary Notes taken to help for the first project for the Deep Learning Foundations Nanodegree course dellivered by Udacity. My Github repo for this project can be found here: adriantorrie/udacity_dlfnd_project_1 Table of Contents Neural network Output Formula In...
datascience-practice/data-quest
python_introduction/beginner/.ipynb_checkpoints/booleans-and-if-statements-checkpoint.ipynb
mit
cat = True dog = False print(type(cat)) """ Explanation: 1: Booleans Instructions Assign the value True to the variable cat and the value False to the variable dog. Then use the print() function and the type() function to display the type for cat. Answer End of explanation """ from cities import cities print(citie...
tensorflow/examples
courses/udacity_intro_to_tensorflow_for_deep_learning/l09c01_nlp_turn_words_into_tokens.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...
t73liu/crypto-trading
quant/DailyGapFill.ipynb
mit
gap_fill_by_month = candles.groupby(["month", "gap_filled"]).size() gap_fill_by_month.groupby("month").apply(lambda g: g / g.sum() * 100) """ Explanation: Gap fill rates decrease as the gap size increases. End of explanation """ gap_fill_by_day_of_week = candles.groupby(["day_of_week", "gap_filled"]).size() gap_fill...
GoogleCloudPlatform/vertex-ai-samples
notebooks/official/migration/UJ8 Vertex SDK AutoML Text Sentiment Analysis.ipynb
apache-2.0
import os # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG """ Explanation: Vertex AI: Vertex AI Migration: AutoML Text Sentiment Analysis <table align="left"> <td> ...
empet/geom_modeling
FP-Bezier-Bspline.ipynb
bsd-2-clause
from IPython.display import Image Image(filename='Imag/Decast4p.png') """ Explanation: <center> Interactive generation of B&eacute;zier and B-spline curves.<br> Python functional programming implementation of the <br> de Casteljau and Cox-de Boor algorithms </center> The aim of this IPython notebook is two...
calroc/joypy
docs/Advent of Code 2017 December 1st.ipynb
gpl-3.0
from notebook_preamble import J, V, define """ Explanation: Advent of Code 2017 December 1st [Given] a sequence of digits (your puzzle input) and find the sum of all digits that match the next digit in the list. The list is circular, so the digit after the last digit is the first digit in the list. For example: 1122 ...
phoebe-project/phoebe2-docs
2.2/tutorials/pitch_yaw.ipynb
gpl-3.0
!pip install -I "phoebe>=2.2,<2.3" """ Explanation: Misalignment (Pitch & Yaw) Setup Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release). End of explanation """ %matplotlib i...
tylere/docker-tmpnb-ee
notebooks/1 - IPython Notebook Examples/IPython Project Examples/IPython Kernel/Capturing Output.ipynb
apache-2.0
from __future__ import print_function import sys """ Explanation: Capturing Output With <tt>%%capture</tt> IPython has a cell magic, %%capture, which captures the stdout/stderr of a cell. With this magic you can discard these streams or store them in a variable. End of explanation """ %%capture print('hi, stdout') p...
nathanielng/machine-learning
perceptron/digit-recognition.ipynb
apache-2.0
import numpy as np import matplotlib.pyplot as plt import pandas as pd from itertools import product from sklearn.svm import SVC from sklearn.model_selection import cross_val_score, cross_val_predict, ShuffleSplit, KFold from tqdm import tqdm from IPython.display import display, Math, Latex, HTML %matplotlib inline np....
rsterbentz/phys202-2015-work
assignments/assignment05/InteractEx04.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.display import display """ Explanation: Interact Exercise 4 Imports End of explanation """ def random_line(m, b, sigma, size=10): """Create a line y = m*x + b + N(0,si...
mne-tools/mne-tools.github.io
stable/_downloads/26b665b81df8d69d2764306260a9ffa9/cluster_stats_evoked.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD-3-Clause import matplotlib.pyplot as plt import mne from mne import io from mne.stats import permutation_cluster_test from mne.datasets import sample print(__doc__) """ Explanation: Permutation F-test on sensor data with 1D cluster level O...
AllenDowney/ThinkBayes2
notebooks/chap11.ipynb
mit
# If we're running on Colab, install empiricaldist # https://pypi.org/project/empiricaldist/ import sys IN_COLAB = 'google.colab' in sys.modules if IN_COLAB: !pip install empiricaldist # Get utils.py from os.path import basename, exists def download(url): filename = basename(url) if not exists(filename...
YAtOff/python0-reloaded
week4/Conditionals.ipynb
mit
a = 2 b = 1 if a > b: print('a is greater then b') a = 1 b = 2 if a < b: print('a is less than b') a = 1 b = 1 if a == b: print('a is equal to b') a = 1 b = 2 if a != b: print('a is not equal to b') """ Explanation: Условен оператор (if) Условният оператор променя поведението на програмата, на база...
boffi/boffi.github.io
dati_2018/03/Constant_Acceleration.ipynb
mit
m = 1.00 k = 4*pi*pi wn = 2*pi T = 1.0 z = 0.02 wd = wn*sqrt(1-z*z) c = 2*z*wn*m """ Explanation: Constant Acceleration Define the Dynamical System End of explanation """ NSTEPS = 200 # steps per second h = 1.0 / NSTEPS def load(t): return np.where(t<0, 0, np.where(t<5, sin(0.5*wn*t)**2, 0)) t = np.linspace(-1,...
IanHawke/Southampton-PV-NumericalMethods-2016
solutions/05-Partial-Differential-Equations.ipynb
mit
from __future__ import division import numpy from matplotlib import pyplot %matplotlib notebook dt = 1e-5 dx = 1e-2 x = numpy.arange(0,1+dx,dx) y = numpy.zeros_like(x) y = x * (1 - x) def update_heat(y, dt, dx): dydt = numpy.zeros_like(y) dydt[1:-1] = dt/dx**2 * (y[2:] + y[:-2] - 2*y[1:-1]) return dydt N...
marko911/deep-learning
intro-to-rnns/Anna_KaRNNa.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...
ES-DOC/esdoc-jupyterhub
notebooks/cccr-iitm/cmip6/models/sandbox-3/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-3', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: CCCR-IITM Source ID: SANDBOX-3 Sub-Topics: Radiative Forcings. Propertie...
akhilaananthram/nupic.research
sdr_paper/sdr_math_neuron_paper.ipynb
gpl-3.0
oxp = Symbol("Omega_x'") b = Symbol("b") n = Symbol("n") theta = Symbol("theta") w = Symbol("w") s = Symbol("s") a = Symbol("a") subsampledOmega = (binomial(s, b) * binomial(n - s, a - b)) / binomial(n, a) subsampledFpF = Sum(subsampledOmega, (b, theta, s)) subsampledOmegaSlow = (binomial(s, b) * binomial(n - s, a - b...
pybel/pybel
notebooks/Compiling a BEL Document.ipynb
mit
import os from urllib.request import urlretrieve import pybel import logging logging.getLogger('pybel').setLevel(logging.DEBUG) logging.basicConfig(level=logging.DEBUG) logging.getLogger('urllib3').setLevel(logging.WARNING) print(pybel.get_version()) DESKTOP_PATH = os.path.join(os.path.expanduser('~'), 'Desktop') ...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session09/Day5/BayesianBlocksDSFP_Problems.ipynb
mit
# execute this cell np.random.seed(0) x = np.concatenate([stats.cauchy(-5, 1.8).rvs(500), stats.cauchy(-4, 0.8).rvs(2000), stats.cauchy(-1, 0.3).rvs(500), stats.cauchy(2, 0.8).rvs(1000), stats.cauchy(4, 1.5).rvs(500)]) # truncate values to...
tuanavu/python-cookbook-3rd
notebooks/.ipynb_checkpoints/04_finding_the_largest_or_smallest_n_items-checkpoint.ipynb
mit
import heapq nums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2] print(heapq.nlargest(3, nums)) # Prints [42, 37, 23] print(heapq.nsmallest(3, nums)) # Prints [-4, 1, 2] """ Explanation: Keeping the Last N Items Problem You want to make a list of the largest or smallest N items in a collection. Solution The heapq modu...
amandersillinois/landlab
notebooks/tutorials/data_record/DataRecord_tutorial.ipynb
mit
import numpy as np from landlab import RasterModelGrid from landlab.data_record import DataRecord from landlab import imshow_grid import matplotlib.pyplot as plt from matplotlib.pyplot import plot, subplot, xlabel, ylabel, title, legend, figure %matplotlib inline """ Explanation: <a href="http://landlab.github.io"><i...
Olsthoorn/TransientGroundwaterFlow
exercises_notebooks/ReversibleStorage.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt import pdb """ Explanation: Reversible groundwater storage End of explanation """ dg = np.array([0.002, 0.063, 0.2, 0.630, 2.0 ]) * 1e-3 # mm """ Explanation: Introduction In the remainder of this syllabus, we will restrict ourselves to reversible groundwater stora...
davidthomas5412/PanglossNotebooks
GroupMeeting_11_16.ipynb
mit
%matplotlib inline from matplotlib import rc rc("font", family="serif", size=14) rc("text", usetex=True) import daft pgm = daft.PGM([7, 6], origin=[0, 0]) #background nodes pgm.add_plate(daft.Plate([0.5, 3.0, 5, 2], label=r"foreground galaxy $i$", shift=-0.1)) pgm.add_node(daft.Node("theta", r"$\theta$", 3.5, 5...
DavidQiuChao/CS231nHomeWorks
assignment2/BatchNormalization.ipynb
mit
# 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...
dougalsutherland/mmd
examples/mmd regression example.ipynb
bsd-3-clause
n = 500 mean = np.random.normal(0, 10, size=n) var = np.random.gamma(5, size=n) n_samp = np.random.randint(10, 500, size=n) samps = [np.random.normal(m, v, size=s)[:, np.newaxis] for m, v, s in zip(mean, var, n_samp)] # this gives us a progress bar for MMD computations from mmd.utils import show_progress show...
joferkington/tutorials
1506_Seismic_petrophysics_2/Seismic_petrophysics_2.ipynb
apache-2.0
def frm(vp1, vs1, rho1, rho_f1, k_f1, rho_f2, k_f2, k0, phi): vp1 = vp1 / 1000. vs1 = vs1 / 1000. mu1 = rho1 * vs1**2. k_s1 = rho1 * vp1**2 - (4./3.)*mu1 # The dry rock bulk modulus kdry = (k_s1 * ((phi*k0)/k_f1+1-phi)-k0) / ((phi*k0)/k_f1+(k_s1/k0)-1-phi) # Now we can apply Gassman...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/06_structured/3_keras_wd.ipynb
apache-2.0
# Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.1 # change these to try this notebook out BUCKET = 'cloud-training-demos-ml' PROJECT = 'cloud-training-demos' REGION = 'us-central1' import os os.environ['BUCKET'] = BUCKET os.environ['PROJECT'] = PROJECT os.environ['REGION'] = RE...
tensorflow/docs
site/en/guide/variable.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...
PyladiesMx/Empezando-con-Python
Pandas second part/Pandas segunda parte.ipynb
mit
#Cargamos los paquetes necesarios import pandas as pd import numpy as np import matplotlib.pyplot as plt #Creamos arreglos de datos por un arreglo de numpy arreglo = np.random.randn(7,4) columnas = list('ABCD') df = pd.DataFrame(arreglo, columns=columnas ) df #Creamos arreglo de datos por diccionario df2 = pd.Dat...
BrownDwarf/ApJdataFrames
notebooks/Luhman1999.ipynb
mit
import warnings warnings.filterwarnings("ignore") from astropy.io import ascii import pandas as pd """ Explanation: ApJdataFrames Luhman1999 Title: Low-Mass Star Formation and the Initial Mass Function in the ρ Ophiuchi Cloud Core Authors: K. L. Luhman and G.H. Rieke Data is from this paper: http://iopscience.iop.or...
Naereen/notebooks
Demo_of_RISE_for_slides_with_Jupyter_notebooks__Julia.ipynb
mit
from sys import version print(version) """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#Demo-of-RISE-for-slides-with-Jupyter-notebooks-(Python)" data-toc-modified-id="Demo-of-RISE-for-slides-with-Jupyter-notebooks-(Python)-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Demo of RISE for sli...
ProfessorKazarinoff/staticsite
content/code/matplotlib_plots/yy-plots.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: In this post, you will learn how to create y-y plots with Python and Matplotlib. y-y plots are a type of line plot where one line corresponds to one y-axis and another line on the same plot corresponds to a different y-axis. y-y pl...
KnHuq/Dynamic-Tensorflow-Tutorial
Vhanilla_RNN/RNN.ipynb
mit
import numpy as np import tensorflow as tf from sklearn.datasets import load_digits from sklearn.cross_validation import train_test_split import pylab as pl from IPython import display import sys %matplotlib inline """ Explanation: <span style="color:green"> VANILLA RNN ON 8*8 MNIST DATASET TO PREDICT TEN CLASS <span...
empet/Plotly-plots
Europe-Happiness.ipynb
gpl-3.0
import numpy as np import pandas as pd import matplotlib.cm as cm df = pd.read_excel('Data/Europe-Happiness.xlsx') df.head() N = len(df) score = df['Score'].values country = list(df.Country) country[13] = 'U Kingdom' country[14] = 'Czech Rep' country[38] = 'Bosn Herzeg' world_rk = list(df['World-Rank']) import plot...
nifannn/MachineLearningNotes
MathNotes/LinearAlgebra.ipynb
mit
import numpy as np """ Explanation: Linear Algebra Review Notes End of explanation """ A = np.array([[1,1,1], [3,1,2], [2,3,4]]) b = np.array([6, 11, 20]) A b x = np.linalg.solve(A, b) x """ Explanation: Gaussian Elimination one way to solve $ Ax = b $ For example: $ \begin{bmatrix}1 & 1 & 1 \ 3 & 1 & 2 \ 2...
jorgemauricio/INIFAP_Course
ejercicios/Seaborn/6_Color_Estilo.ipynb
mit
import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline tips = sns.load_dataset('tips') """ Explanation: Estilos y color En este ejercicio se demostrara como controlar la estetica de las graficas en seaborn: End of explanation """ sns.countplot(x='sex',data=tips) sns.set_style('white') sns.countplo...
zaqwes8811/micro-apps
self_driving/deps/Kalman_and_Bayesian_Filters_in_Python_master/00-Preface.ipynb
mit
from __future__ import division, print_function %matplotlib inline #format the book import book_format book_format.set_style() """ Explanation: Table of Contents Preface End of explanation """ import numpy as np x = np.array([1, 2, 3]) print(type(x)) x """ Explanation: Introductory textbook for Kalman filters and ...
guyk1971/deep-learning
face_generation/dlnd_face_generation_orig.ipynb
mit
data_dir = './data' # FloydHub - Use with data ID "R5KrjnANiKVhLWAkpXhNBe" #data_dir = '/input' """ DON'T MODIFY ANYTHING IN THIS CELL """ import helper helper.download_extract('mnist', data_dir) helper.download_extract('celeba', data_dir) """ Explanation: Face Generation In this project, you'll use generative adv...
mgalardini/2017_python_course
notebooks/1-Basic_python_and_native_python_data_structures.ipynb
gpl-2.0
import this """ Explanation: Basic Python and native data structures In a nutshell Scripting language Multi-platform (OsX, Linux, Windows) Battery-included Lots of third-party library (catching up with R for computational biology) Lots of help available online (e.g. stackoverflow) "Scripting language" means: no typ...
pklfz/fold
tensorflow_fold/g3doc/sentiment.ipynb
apache-2.0
# boilerplate import codecs import functools import os import tempfile import zipfile from nltk.tokenize import sexpr import numpy as np from six.moves import urllib import tensorflow as tf sess = tf.InteractiveSession() import tensorflow_fold as td """ Explanation: Sentiment Analysis with TreeLSTMs in TensorFlow Fol...
fastai/fastai
nbs/17_callback.tracker.ipynb
apache-2.0
#|export class TerminateOnNaNCallback(Callback): "A `Callback` that terminates training if loss is NaN." order=-9 def after_batch(self): "Test if `last_loss` is NaN and interrupts training." if torch.isinf(self.loss) or torch.isnan(self.loss): raise CancelFitException learn = synth_learner(...
google-aai/tf-serving-k8s-tutorial
jupyter/keras_training_to_serving.ipynb
apache-2.0
# Import Keras libraries import keras.applications.resnet50 as resnet50 from keras.preprocessing import image from keras import backend as K import numpy as np import os # Import TensorFlow saved model libraries import tensorflow as tf from tensorflow.python.saved_model import builder as saved_model_builder from tenso...
Kaggle/learntools
notebooks/feature_engineering_new/raw/ex3.ipynb
apache-2.0
# Setup feedback system from learntools.core import binder binder.bind(globals()) from learntools.feature_engineering_new.ex3 import * import numpy as np import pandas as pd from sklearn.model_selection import cross_val_score from xgboost import XGBRegressor def score_dataset(X, y, model=XGBRegressor()): # Label...
prk327/CoAca
3_Position_and_Label_Based_Indexing.ipynb
gpl-3.0
# loading libraries and reading the data import numpy as np import pandas as pd market_df = pd.read_csv("../global_sales_data/market_fact.csv") market_df.head() """ Explanation: Position and Label Based Indexing: df.iloc and df.loc You have seen some ways of selecting rows and columns from dataframes. Let's now see s...
ComputoCienciasUniandes/MetodosComputacionalesLaboratorio
2016-1/w04/.ipynb_checkpoints/sistemas_lineales-checkpoint.ipynb
mit
import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Sistemas de ecuaciones lineales En este notebook vamos a ver conceptos básicos para resolver sistemas de ecuaciones lineales. La estructura de esta presentación está basada en http://nbviewer.ipython.org/github/mbakker7/exploratory_...
janusnic/21v-python
unit_20/parallel_ml/notebooks/04 - Pandas and Heterogeneous Data Modeling.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd import warnings warnings.simplefilter('ignore', DeprecationWarning) """ Explanation: Predictive Modeling with heterogeneous data End of explanation """ #!curl -s https://dl.dropboxusercontent.com/u/5743203/data/titanic/titanic...
ContinualAI/avalanche
notebooks/from-zero-to-hero-tutorial/04_training.ipynb
mit
!pip install avalanche-lib=0.2.0 """ Explanation: description: Continual Learning Algorithms Prototyping Made Easy Training Welcome to the "Training" tutorial of the "From Zero to Hero" series. In this part we will present the functionalities offered by the training module. First, let's install Avalanche. You can skip...
mccormd1/LCandR
LC_python/LC_MLtrain.ipynb
gpl-3.0
import joblib features=joblib.load('clean_LCfeatures.p') labels=joblib.load('clean_LClabels.p') clabels=joblib.load('clean_LCclassifierlabel.p') import numpy as np import pandas as pd from time import time from IPython.display import display # Allows the use of display() for DataFrames # Import supplementary visualiz...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_read_events.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Chris Holdgraf <choldgraf@berkeley.edu> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() fname = data_path + '/MEG/sample/sample_audvi...
minesh1291/Learning-Python
TensorFlow_Beginner/try2-LR-TFB.ipynb
apache-2.0
import tensorflow as tf """ Explanation: https://www.youtube.com/watch?v=oxf3o8IbCk4 [23:33] http://ischlag.github.io/2016/06/04/how-to-use-tensorboard/ outdated https://www.tensorflow.org/programmers_guide/summaries_and_tensorboard Linear Regression Import End of explanation """ W = tf.Variable([0.3]) b = tf.Variab...
netodeolino/TCC
TCC 02/Resultados/Geral/Análise geral sobre os dados criminais.ipynb
mit
import plotly.plotly as py import plotly.graph_objs as go import pandas import matplotlib.pyplot as plt %matplotlib inline import numpy as np import matplotlib.ticker as ticker from scipy.stats import gaussian_kde import matplotlib.image as mpimg files = [ 'Cluster-Crime-Janeiro', 'Cluster-Crime-Fevereiro'...
johnpfay/environ859
07_DataWrangling/notebooks/03-Using-NumPy-With-Rasters.ipynb
gpl-3.0
# Import the modules import arcpy import numpy as np #Set the name of the file we'll import demFilename = '../Data/DEM.tif' #Import the DEM as a NumPy array, using only a 200 x 200 pixel subset of it demRaster = arcpy.RasterToNumPyArray(demFilename) #What is the shape of the raster (i.e. the # of rows and columns)? ...
dwhswenson/contact_map
examples/concurrences.ipynb
lgpl-2.1
from __future__ import print_function %matplotlib inline import matplotlib.pyplot as plt import numpy as np from contact_map import ContactFrequency, ResidueContactConcurrence, plot_concurrence import mdtraj as md traj = md.load("data/gsk3b_example.h5") print(traj) # to see number of frames; size of system """ Expla...
schiob/MusGen
Genetic_Chords.ipynb
mit
from IPython import display display.Image('img/simple.jpg', width=400) """ Explanation: Creating a chord progression with a genetic algorithm This work is the result of an experiment done some months ago. I used a simple genetic algorithm to find a solution to a classic exercise of harmony: given a certain voice (nor...
ES-DOC/esdoc-jupyterhub
notebooks/messy-consortium/cmip6/models/sandbox-3/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'messy-consortium', 'sandbox-3', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: MESSY-CONSORTIUM Source ID: SANDBOX-3 Topic: Ocean Sub-Topics: Timestepp...
HaoMood/cs231n
assignment3 (copy)/assignment3/ImageGradients.ipynb
gpl-3.0
# As usual, a bit of setup import time, os, json import numpy as np import skimage.io import matplotlib.pyplot as plt from cs231n.classifiers.pretrained_cnn import PretrainedCNN from cs231n.data_utils import load_tiny_imagenet from cs231n.image_utils import blur_image, deprocess_image %matplotlib inline plt.rcParams...
kerimlcr/ab2017-dpyo
ornek/osmnx/osmnx-0.3/examples/05-example-save-load-networks-shapes.ipynb
gpl-3.0
import osmnx as ox %matplotlib inline ox.config(log_file=True, log_console=True, use_cache=True) place = 'Piedmont, California, USA' """ Explanation: Use OSMnx to construct place boundaries and street networks, and save as various file formats for working with later Overview of OSMnx GitHub repo Examples, demos, tut...
rrbb014/data_science
fastcampus_dss/2016_05_24/0524_01__베르누이 확률 분포.ipynb
mit
theta = 0.6 rv = sp.stats.bernoulli(theta) rv """ Explanation: 베르누이 확률 분포 베르누이 시도 결과가 성공(Success) 혹은 실패(Fail) 두 가지 중 하나로만 나오는 것을 베르누이 시도(Bernoulli trial)라고 한다. 예를 들어 동전을 한 번 던져 앞면(H:Head)이 나오거나 뒷면(T:Tail)이 나오게 하는 것은 베르누이 시도의 일종이다. 베르누이 시도의 결과를 확률 변수(random variable) $X$ 로 나타낼 때는 보통 성공을 정수 1 ($X=1$), 실패를 정수 0 ($X=0$)으로...
Aniruddha-Tapas/Applied-Machine-Learning
Machine Learning using GraphLab/Analyzing Product Sentiment using GraphLab Create.ipynb
mit
import graphlab """ Explanation: Predicting sentiment from product reviews <hr> Import GraphLab Create End of explanation """ products = graphlab.SFrame('amazon_baby.gl/') """ Explanation: Read some product review data Loading reviews for a set of baby products. End of explanation """ products.head() """ Explan...
ioggstream/python-course
connexion-101/notebooks/02-openapi-3.ipynb
agpl-3.0
remote_yaml = 'https://raw.githubusercontent.com/teamdigitale/api-starter-kit/master/openapi/simple.yaml.src' render_markdown(f''' [Swagger Editor]({oas_editor_url(remote_yaml)}) is a simple webapp for editing OpenAPI 3 language specs. ''') """ Explanation: OpenAPI & Modeling OpenAPI is a specification language Ope...
catalyst-cooperative/pudl
test/validate/notebooks/validate_fuel_ferc1.ipynb
mit
%load_ext autoreload %autoreload 2 import sys import pandas as pd import sqlalchemy as sa import pudl import pudl.validate as pv import warnings import logging logger = logging.getLogger() logger.setLevel(logging.INFO) handler = logging.StreamHandler(stream=sys.stdout) formatter = logging.Formatter('%(message)s') han...
ecell/ecell4-notebooks
en/tests/MSD.ipynb
gpl-2.0
%matplotlib inline import matplotlib.pyplot as plt import numpy from ecell4.prelude import * """ Explanation: Mean Square Displacement (MSD) This is a validation for the E-Cell4 library. Here, we test a mean square displacement (MSD) for each simulation algorithms. End of explanation """ radius, D = 0.005, 1 m = Net...
probml/pyprobml
notebooks/book1/15/attention_torch.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import math from IPython import display try: import torch except ModuleNotFoundError: %pip install -qq torch import torch from torch import nn from torch.nn import functional as F from torch.utils import data import random import os import time np.random...
cdawei/flickr-photo
src/suburb-names.ipynb
gpl-2.0
from osgeo import ogr, osr import pandas as pd import numpy as np import collections """ Explanation: Assign Suburbs to POIs Use SA2 level from ABS to find suburbs. Uses file downloaded from ABS, which is the ZIP link called Statistical Area Level 2 (SA2) ASGS Ed 2011 Digital Boundaires in ESRI Shapefile Format. The f...
ES-DOC/esdoc-jupyterhub
notebooks/test-institute-1/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', 'test-institute-1', 'sandbox-3', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: TEST-INSTITUTE-1 Source ID: SANDBOX-3 Topic: Seaice Sub-Topics: Dynami...
konstantinstadler/pymrio
doc/source/notebooks/working_with_eora26.ipynb
gpl-3.0
import pymrio eora_storage = '/tmp/mrios/eora26' eora = pymrio.parse_eora26(year=2005, path=eora_storage) """ Explanation: Parsing the Eora26 EE MRIO database Getting Eora26 The Eora 26 database is available at http://www.worldmrio.com . You need to register there and can then download the files from http://www.wor...
shubham0704/ATR-FNN
MAMs discussion.ipynb
mit
# dependencies import matplotlib.pyplot as plt import pickle import numpy as np f = open('final_dataset.pickle','rb') dataset = pickle.load(f) sample_image = dataset['train_dataset'][0] sample_label = dataset['train_labels'][0] print(sample_label) plt.figure() plt.imshow(sample_image) plt.show() # lets make Wxx and ...
emiliom/stuff
pyoos_ndbc_demo.ipynb
cc0-1.0
import pandas as pd from pyoos.collectors.ndbc.ndbc_sos import NdbcSos import owslib.swe.sensor.sml as owslibsml fmt = '{:*^64}'.format """ Explanation: pyoos NDBC demo Demo the capabilities of the pyoos NdbcSos collector. Starting point was a notebook from Filipe, for the OOI Endurance Array, which has a spatial e...
vadim-ivlev/STUDY
handson-data-science-python/DataScience-Python3/ConditionalProbabilitySolution.ipynb
mit
from numpy import random random.seed(0) totals = {20:0, 30:0, 40:0, 50:0, 60:0, 70:0} purchases = {20:0, 30:0, 40:0, 50:0, 60:0, 70:0} totalPurchases = 0 for _ in range(100000): ageDecade = random.choice([20, 30, 40, 50, 60, 70]) purchaseProbability = 0.4 totals[ageDecade] += 1 if (random.random() < pu...
ereodeereigeo/dataTritiumWS22
numero_de_datos_perdidos_slide.ipynb
gpl-2.0
import pandas as pd """ Explanation: Número de datos obtenidos y perdidos Importamos las librerías necesarias End of explanation """ import ext_datos as ext import procesar as pro import time_plot as tplt """ Explanation: Importamos las librerías creadas para trabajar End of explanation """ dia1 = ext.extraer_da...
0u812/nteract
example-notebooks/download-stats.ipynb
bsd-3-clause
import IPython.display import pandas as pd import requests # Note: data = requests.get('https://api.github.com/repos/nteract/nteract/releases').json() print("{}:\n\t{}\n\t{}".format( data[0]['tag_name'], data[0]['assets'][0]['browser_download_url'], data[0]['assets'][0]['download_count'] )) """ Explanation:...
ljchang/psyc63
Notebooks/7_Introduction_to_Scraping.ipynb
mit
try: import requests except: !pip install requests try: from bs4 import BeautifulSoup except: !pip install bs4 """ Explanation: Introduction to Web Scraping Often we are interested in getting data from a website. Modern websites are often built using a REST framework that has an Application Programmin...
IBMDecisionOptimization/docplex-examples
examples/mp/jupyter/boxes.ipynb
apache-2.0
import sys try: import docplex.mp except: raise Exception('Please install docplex. See https://pypi.org/project/docplex/') """ Explanation: Objects in boxes This tutorial includes everything you need to set up IBM Decision Optimization CPLEX Modeling for Python (DOcplex), build a Mathematical Programming...
sanger-pathogens/Roary
contrib/roary_plots/roary_plots.ipynb
gpl-3.0
# Plotting imports %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns sns.set_style('white') # Other imports import os import pandas as pd import numpy as np from Bio import Phylo """ Explanation: Roary pangenome plots <h6><a href="javascript:toggle()" target="_self">Toggle source code</a></h6...
sdss/marvin
docs/sphinx/jupyter/whats_new_v21.ipynb
bsd-3-clause
import matplotlib %matplotlib inline # only necessary if you have a local DB from marvin import config config.forceDbOff() """ Explanation: What's New in Marvin 2.1 Marvin is Python 3.5+ compliant! End of explanation """ from marvin.tools.cube import Cube plateifu = '8485-1901' cube = Cube(plateifu=plateifu) print(...
lorgor/vulnmine
vulnmine/ipynb/170523-train-vendor-match.ipynb
gpl-3.0
# Initialize import pandas as pd import numpy as np import pip #needed to use the pip functions # Show versions of all installed software to help debug incompatibilities. for i in pip.get_installed_distributions(local_only=True): print(i) """ Explanation: Train vendor matching algorithm The ML classification al...
chebee7i/palettable
demo/Cubehelix Demo.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Cubehelix Color Maps in Palettable Cubehelix was designed by D.A. Green to provide a color mapping that would degrade gracefully to grayscale without losing information. This quality makes Cubehelix very useful for continuous colou...
frankbearzou/Data-analysis
Pixar Movies/Pixar Movies.ipynb
mit
pixar_movies['Domestic %'] = pixar_movies['Domestic %'].str.rstrip('%').astype('float') pixar_movies['International %'] = pixar_movies['International %'].str.rstrip('%').astype('float') """ Explanation: Data cleaning Because Domestic % and International % columns data end with %, and its data type are objects, it is ...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/launching_into_ml/solutions/rapid_prototyping_bqml_automl.ipynb
apache-2.0
import os # The Google Cloud Notebook product has specific requirements IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version") # Google Cloud Notebook requires dependencies to be installed with '--user' USER_FLAG = "" if IS_GOOGLE_CLOUD_NOTEBOOK: USER_FLAG = "--user" # Install Python...
edwardd1/phys202-2015-work
assignments/assignment04/MatplotlibEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 1 Imports End of explanation """ import os assert os.path.isfile('yearssn.dat') """ Explanation: Line plot of sunspot data Download the .txt data for the "Yearly mean total sunspot number [1700 - now]" from th...
ubcgif/gpgLabs
notebooks/em/FDEM_ThreeLoopModel.ipynb
mit
%matplotlib inline from geoscilabs.em.FDEM3loop import interactfem3loop from geoscilabs.em.FDEMpipe import interact_femPipe from matplotlib import rcParams rcParams['font.size'] = 14 """ Explanation: Electromagnetics: 3-loop model In the first part of this notebook, we consider a 3 loop system, consisting of a transm...
alexkeenan/jupyternotebookworkflow
bike_exercise_deeper_analysis.ipynb
mit
from sklearn.decomposition import PCA X=pivoted.fillna(0).T.values X2=PCA(2).fit_transform(X)# this tells it the number of components we want to reduce this to is 2 X2.shape import matplotlib.pyplot as plt plt.scatter(X2[:,0],X2[:,1]) """ Explanation: # First thing we're going to do is reduce the dimensionality ...
bigdata-i523/hid335
experiment/Python_SKLearn_RandomForestClassifier.ipynb
gpl-3.0
import sklearn import mglearn import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline from IPython.display import Image, display from sklearn.tree import DecisionTreeClassifier """ Explanation: Introduction to Machine Learning Andreas Muller and Sarah Guido Ch. 2 Supervised Learnin...
thomasantony/CarND-Projects
Exercises/Term1/TensorFlow-Tutorials/05_Ensemble_Learning.ipynb
mit
from IPython.display import Image Image('images/02_network_flowchart.png') """ Explanation: TensorFlow Tutorial #05 Ensemble Learning by Magnus Erik Hvass Pedersen / GitHub / Videos on YouTube Introduction This tutorial shows how to use a so-called ensemble of convolutional neural networks. Instead of using a single n...
mulhod/reviewer_experience_prediction
jupyter_notebooks/Exploring_Label_Distribution.ipynb
mit
import math import itertools from collections import Counter import numpy as np import scipy as sp from pymongo import collection import matplotlib.pyplot as plt %matplotlib inline from src import * from src.mongodb import * from src.datasets import * from src.experiments import * from data import APPID_DICT """ Exp...
arturops/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...
turbomanage/training-data-analyst
quests/serverlessml/04_keras/labs/keras_dnn.ipynb
apache-2.0
%%bash export PROJECT=$(gcloud config list project --format "value(core.project)") echo "Your current GCP Project Name is: "$PROJECT import os, json, math import numpy as np import shutil import tensorflow as tf print("TensorFlow version: ",tf.version.VERSION) PROJECT = "your-gcp-project-here" # REPLACE WITH YOUR PRO...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/quasibinomial.ipynb
bsd-3-clause
import statsmodels.api as sm import numpy as np import pandas as pd import matplotlib.pyplot as plt from io import StringIO """ Explanation: Quasi-binomial regression This notebook demonstrates using custom variance functions and non-binary data with the quasi-binomial GLM family to perform a regression analysis using...
mommermi/Introduction-to-Python-for-Scientists
notebooks/CodeOptimization_20161209.ipynb
mit
import time def square(x): return x**2 def quadrature(func, a, b, n=10000000): """ use the quadrature rule to determine the integral over the function from a to b""" # calculate individual elements integral_elements = [func(a)/2.] for k in range(1, n): integral_elements.append(func(a+k*fl...
Benedicto/ML-Learning
numpy-tutorial.ipynb
gpl-3.0
import numpy as np # importing this way allows us to refer to numpy as np """ Explanation: Numpy Tutorial Numpy is a computational library for Python that is optimized for operations on multi-dimensional arrays. In this notebook we will use numpy to work with 1-d arrays (often called vectors) and 2-d arrays (often cal...
brookthomas/GeneDive
preprocessing/Typeahead_ChemicalDisease.ipynb
mit
import sqlite3 import json DATABASE = "data.sqlite" conn = sqlite3.connect(DATABASE) cursor = conn.cursor() """ Explanation: Build Adjacency Matrix End of explanation """ # For getting the maximum row id QUERY_MAX_ID = "SELECT id FROM interactions ORDER BY id DESC LIMIT 1" # Get interaction data QUERY_INTERACTION...
hpparvi/PyTransit
notebooks/example_quadratic_model.ipynb
gpl-2.0
%pylab inline sys.path.append('..') from pytransit import QuadraticModel seed(0) times_sc = linspace(0.85, 1.15, 1000) # Short cadence time stamps times_lc = linspace(0.85, 1.15, 100) # Long cadence time stamps k, t0, p, a, i, e, w = 0.1, 1., 2.1, 3.2, 0.5*pi, 0.3, 0.4*pi pvp = tile([k, t0, p, a, i, e, w], (5...