repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
jorisvandenbossche/geopandas
doc/source/gallery/choro_legends.ipynb
bsd-3-clause
import geopandas from geopandas import read_file import mapclassify mapclassify.__version__ import libpysal libpysal.__version__ libpysal.examples.available() _ = libpysal.examples.load_example('South') pth = libpysal.examples.get_path('south.shp') df = read_file(pth) """ Explanation: Choro legends End of explana...
ethen8181/machine-learning
python/class.ipynb
mit
# code for loading the format for the notebook import os # path : store the current path to convert back to it later path = os.getcwd() os.chdir(os.path.join('..', 'notebook_format')) from formats import load_style load_style(plot_style=False) os.chdir(path) # 1. magic to print version # 2. magic so that the notebo...
ES-DOC/esdoc-jupyterhub
notebooks/csiro-bom/cmip6/models/sandbox-3/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'csiro-bom', 'sandbox-3', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: CSIRO-BOM Source ID: SANDBOX-3 Topic: Land Sub-Topics: Soil, Snow, Vegetation, En...
jurajmajor/ltl3tela
Experiments/Evaluation_FOSSACS19.ipynb
gpl-3.0
from ltlcross_runner import LtlcrossRunner from IPython.display import display import pandas as pd import spot import sys spot.setup(show_default='.a') pd.options.display.float_format = '{: .0f}'.format pd.options.display.latex.multicolumn_format = 'c' """ Explanation: Experiments for FOSSACS'19 Paper: LTL to Smaller...
Britefury/deep-learning-tutorial-pydata2016
INTRO ML 02 - gradient descent for machine learning.ipynb
mit
import numpy as np import pandas as pd """ Explanation: Gradient descent for machine learning - a quick introduction In this notebook we are going to use gradient descent to estimate the parameters of a model. In this case we are going to compute the parameters to convert temperatures fom Farenheit to Kelvin. Given th...
mspieg/dynamical-systems
.ipynb_checkpoints/Bifurcations-checkpoint.ipynb
cc0-1.0
%matplotlib inline import numpy import matplotlib.pyplot as plt """ Explanation: <table> <tr align=left><td><img align=left src="./images/CC-BY.png"> <td>Text provided under a Creative Commons Attribution license, CC-BY. All code is made available under the FSF-approved MIT license. (c) Marc Spiegelman</td> </table>...
cdawei/digbeta
dchen/tour/data_stats.ipynb
gpl-3.0
plt.figure(figsize=[15, 5]) ax = plt.subplot() ax.set_xlabel('#Trajectories') ax.set_ylabel('#Queries') ax.set_title('Histogram of #Trajectories') queries = sorted(dat_obj.TRAJID_GROUP_DICT.keys()) X = [len(dat_obj.TRAJID_GROUP_DICT[q]) for q in queries] pd.Series(X).hist(ax=ax, bins=20) """ Explanation: Plot the hist...
queirozfcom/python-sandbox
python3/notebooks/number-formatting-post/main.ipynb
mit
'{:.2f}'.format(8.499) """ Explanation: View the original blog post at http://queirozf.com/entries/python-number-formatting-examples round to 2 decimal places End of explanation """ '{:.2f}%'.format(10.12345) """ Explanation: format float as percentage End of explanation """ import re def truncate(num,decimal_pl...
t-vi/candlegp
notebooks/mcmc.ipynb
apache-2.0
import sys, os sys.path.append(os.path.join(os.getcwd(),'..')) import candlegp import candlegp.training.hmc import numpy import torch from torch.autograd import Variable from matplotlib import pyplot pyplot.style.use('ggplot') %matplotlib inline X = Variable(torch.linspace(-3,3,20,out=torch.DoubleTensor())) Y = Vari...
ALEXKIRNAS/DataScience
CS231n/assignment2/Dropout.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...
netodeolino/TCC
TCC 02/Resultados/Maio/Maio.ipynb
mit
all_crime_tipos.head(10) all_crime_tipos_top10 = all_crime_tipos.head(10) all_crime_tipos_top10.plot(kind='barh', figsize=(12,6), color='#3f3fff') plt.title('Top 10 crimes por tipo (Mai 2017)') plt.xlabel('Número de crimes') plt.ylabel('Crime') plt.tight_layout() ax = plt.gca() ax.xaxis.set_major_formatter(ticker.StrM...
dsolanno/BarcelonaRentsStatus
airbnb data exploration/host_until/calculate_host_until.ipynb
mit
df1 = pd.read_csv('listings/30042015/30042015.csv', sep = ";") df2 = pd.read_csv('listings/17072015/17072015.csv', sep = ";") df3 = pd.read_csv('listings/02102015/02102015.csv', sep = ";") df4 = pd.read_csv('listings/03012016/03012016.csv', sep = ";") df5 = pd.read_csv('listings/08122016/08122016.csv', sep = ";") df6 =...
samgoodgame/sf_crime
iterations/KK_scripts/W207_Final_Project_logisticRegressionOnly_updated_08_20_1230.ipynb
mit
# Additional Libraries %matplotlib inline import matplotlib.pyplot as plt # Import relevant libraries: import time import numpy as np import pandas as pd from sklearn.neighbors import KNeighborsClassifier from sklearn import preprocessing from sklearn.preprocessing import MinMaxScaler from sklearn.preprocessing import...
malogrisard/NTDScourse
algorithms/02_ex_clustering.ipynb
mit
# Load libraries # Math import numpy as np # Visualization %matplotlib notebook import matplotlib.pyplot as plt plt.rcParams.update({'figure.max_open_warning': 0}) from mpl_toolkits.axes_grid1 import make_axes_locatable from scipy import ndimage # Print output of LFR code import subprocess # Sparse matrix import ...
PWhiddy/kbmod
notebooks/kbmod_CNN.ipynb
bsd-2-clause
import numpy as np import matplotlib.pyplot as plt import keras from keras.utils import np_utils %matplotlib inline """ Explanation: Creating a CNN to identify real objects in kbmod data End of explanation """ data = np.genfromtxt('../data/postage_stamp_training.dat') """ Explanation: Training Set Here we are going...
hailing-li/hailing-li.github.io
HW4/Frequent Itemset.ipynb
mit
import sqlite3 import pandas as pd from pprint import pprint from pandas import DataFrame import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error import math import numpy as np conn = sqlite3.connect('bicycle.db') c=conn.cursor() c.execute('SELECT LoTemp, Pre...
hashiprobr/redes-sociais
encontro04.ipynb
gpl-3.0
import numpy as np import socnet as sn import easyplot as ep """ Explanation: Encontro 04: Suporte para Análise Espectral de Grafos Este guia foi escrito para ajudar você a atingir os seguintes objetivos: lembrar conceitos básicos de geometria analítica e álgebra linear; explicar conceitos básicos de matriz de adjacê...
uwbmrb/BMRB-API
documentation/notebooks/Vicinal Disulfides.ipynb
gpl-3.0
%%capture !pip install requests; import requests """ Explanation: Example notebook for using the PDB and BMRB APIs for structural biology data science applications Introduction This notebook is designed to walk through some sample queries of both the PDB and BMRB in order to correlate NMR parameters with structure. ...
Leguark/pynoddy
docs/notebooks/.ipynb_checkpoints/Feature-Sampling-checkpoint.ipynb
gpl-2.0
from IPython.core.display import HTML css_file = 'pynoddy.css' HTML(open(css_file, "r").read()) import sys, os import matplotlib.pyplot as plt # adjust some settings for matplotlib from matplotlib import rcParams # print rcParams rcParams['font.size'] = 15 # determine path of repository to set paths corretly below rep...
Upward-Spiral-Science/spect-team
Code/Assignment-9/Independent Analysis-3.ipynb
apache-2.0
# Standard import pandas as pd import numpy as np %matplotlib inline import matplotlib.pyplot as plt import statsmodels.api as sm # Dimensionality reduction and Clustering from sklearn.decomposition import PCA from sklearn.cluster import KMeans from sklearn.cluster import MeanShift, estimate_bandwidth from sklearn imp...
caromedellin/Python-notes
python-intro/Untitled1.ipynb
mit
import csv import requests """ Explanation: APIs There are a few cases when a data set isn't a good enough solution. An Application Program Interface API is an alternative, it allows you to dinamically query andretrive data End of explanation """ response = requests.get("http://api.open-notify.org/iss-now.json") res...
taesiri/noteobooks
old:misc/graph_analysis/check_planarity.ipynb
mit
# generate random graph G = nx.generators.fast_gnp_random_graph(10, 0.4) # check planarity and draw the graph print("The graph is {0} planar".format("" if planarity.is_planar(G) else "not")) if(planarity.is_planar(G)): planarity.draw(G) nx.draw(G) """ Explanation: Hello Networkx and Planarity NetworkX Homepage Pl...
maubarsom/biotico-tools
ipython_nb/blast_hits_visualization.ipynb
apache-2.0
blast_cols = ["query_id","subject_id","pct_id","ali_len","mism","gap_open","q_start","q_end","s_start","s_end","e_value","bitscore"] pax_hits = pd.read_csv("PAXhs_vs_Pw.tblastn.txt",sep="\t",header=None,names=blast_cols) print( "Size of dataframe: {}".format(pax_hits.shape )) pax_hits.head() """ Explanation: 1. Read T...
google-research/google-research
linear_identifiability/identifiability_of_GPT_2_models.ipynb
apache-2.0
import numpy as np import torch import matplotlib.pyplot as plt from tqdm import tqdm num_layers = 13 num_sentences = 2000 # Install and import Huggingface Transformer models !pip install transformers ftfy spacy from transformers import * def get_model(model_id): print('Loading model: ', model_id) models = { ...
abatula/MachineLearningIntro
Diabetes_DataSet.ipynb
gpl-2.0
# Print figures in the notebook %matplotlib inline import numpy as np import matplotlib.pyplot as plt from sklearn import datasets # Import datasets from scikit-learn import matplotlib.cm as cm from matplotlib.colors import Normalize """ Explanation: What is a dataset? A dataset is a collection of information (or da...
philiptromans/mapswipe-ml-dataset-generator
1 - Analysing InceptionV3 results.ipynb
apache-2.0
from mapswipe_analysis import * all_projects_solution = Solution( ground_truth_solutions_file_to_map('../experiment_1/all_projects_dataset/test/solutions.csv'), predictions_file_to_map('../experiment_1/inception_v3_all_layers.results') ) all_projects_solution.accuracy """ Explanation: Much of the world isn't ...
Britefury/deep-learning-tutorial-pydata2016
TUTORIAL 05 - Dogs vs cats with transfer learning and data augmentation.ipynb
mit
%matplotlib inline """ Explanation: Dogs vs Cats with Transfer Learning and Data Augmentation In this Notebook we're going to use transfer learning to attempt to crack the Dogs vs Cats Kaggle competition. We add data augmentation and assess its effectiveness. We are going to downsample the images to 64x64; that's pret...
mne-tools/mne-tools.github.io
0.18/_downloads/e79896208a72b920b6d32cefb5c9c4b8/plot_point_spread.ipynb
bsd-3-clause
import os.path as op import numpy as np from mayavi import mlab import mne from mne.datasets import sample from mne.minimum_norm import read_inverse_operator, apply_inverse from mne.simulation import simulate_stc, simulate_evoked """ Explanation: Corrupt known signal with point spread The aim of this tutorial is to...
GraysonR/titanic-data-analysis
2015-12-24-titanic-gender-grouping.ipynb
mit
# Import magic %matplotlib inline # More imports import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns #Set general plot properties sns.set_style("white") sns.set_context({"figure.figsize": (18, 8)}) # Load CSV data titanic_data = pd.read_csv('titanic_data.csv') survived = tit...
fdion/infographics_research
Figure1.6.ipynb
mit
!wget 'http://esa.un.org/unpd/wpp/DVD/Files/1_Indicators%20(Standard)/EXCEL_FILES/2_Fertility/WPP2015_FERT_F04_TOTAL_FERTILITY.XLS' """ Explanation: Reproducible visualization In "The Functional Art: An introduction to information graphics and visualization" by Alberto Cairo, on page 12 we are presented with a visuali...
rsignell-usgs/notebook
NEXRAD/.ipynb_checkpoints/THREDDS_Radar_Server-checkpoint.ipynb
mit
import matplotlib import warnings warnings.filterwarnings("ignore", category=matplotlib.cbook.MatplotlibDeprecationWarning) %matplotlib inline """ Explanation: Using Python to Access NCEI Archived NEXRAD Level 2 Data This notebook shows how to access the THREDDS Data Server (TDS) instance that is serving up archived N...
PyDataMadrid2016/Conference-Info
workshops_materials/20160408_1100_Pandas_for_beginners/tutorial/EN - Tutorial 04 - Selecting data.ipynb
mit
# first, the imports import os import datetime as dt import pandas as pd import numpy as np import matplotlib.pyplot as plt from IPython.display import display np.random.seed(19760812) %matplotlib inline # We read the data in the file 'mast.txt' ipath = os.path.join('Datos', 'mast.txt') def dateparse(date, time): ...
danielgoncalvesti/BIGDATA2017
Atividade03/Lab4a_regressao_linear.ipynb
gpl-3.0
sc = SparkContext.getOrCreate() # carregar base de dados from test_helper import Test import os.path baseDir = os.path.join('Data') inputPath = os.path.join('millionsong.txt') fileName = os.path.join(baseDir, inputPath) numPartitions = 2 rawData = sc.textFile(fileName, numPartitions) # EXERCICIO numPoints = rawData....
deadbeatfour/notebooks
SWE_square_well/swe_square_well.ipynb
mit
delta = 1 # The spacing between neighboring lattice points L = 1000 # The ends of the lattice length = 10 momentum = 1 lattice = arange(-L,L,delta) v = vectorize(potential) plot(v(lattice)) hamiltonian = np.zeros((lattice.shape[0],lattice.shape[0])) for row in range(lattice.shape[0]): for col in range(lattice.shap...
quantumlib/ReCirq
docs/qaoa/example_problems.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...
AaronCWong/phys202-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_sine1(a,b): plt.figure(figsize=(15,2)) x = np.linspace(0,4...
qutip/qutip-notebooks
examples/piqs_introduction.ipynb
lgpl-3.0
import matplotlib.pyplot as plt import matplotlib as mpl from matplotlib import cm from qutip import * from qutip.piqs import * from qutip.cy.piqs import j_min """ Explanation: Introducing the Permutational Invariant Quantum Solver (PIQS) Notebook Author: Nathan Shammah (nathan.shammah@gmail.com) PIQS code: Nathan ...
DTOcean/dtocean-core
notebooks/DTOcean Mooring and Foundations Example.ipynb
gpl-3.0
%matplotlib inline from IPython.display import display, HTML import matplotlib.pyplot as plt plt.rcParams['figure.figsize'] = (14.0, 8.0) import numpy as np from dtocean_core import start_logging from dtocean_core.core import Core from dtocean_core.menu import ModuleMenu, ProjectMenu from dtocean_core.pipeline impo...
sgrindy/Bayesian-estimation-of-relaxation-spectra
Double_Maxwell_Lognormal_prior.ipynb
mit
def H(tau): h1 = 1; tau1 = 0.03; sd1 = 0.5; h2 = 7; tau2 = 10; sd2 = 0.5; term1 = h1/np.sqrt(2*sd1**2*np.pi) * np.exp(-(np.log10(tau/tau1)**2)/(2*sd1**2)) term2 = h2/np.sqrt(2*sd2**2*np.pi) * np.exp(-(np.log10(tau/tau2)**2)/(2*sd2**2)) return term1 + term2 Nfreq = 50 Nmodes = 30 w = np.logspace(-4,...
julienchastang/unidata-python-workshop
notebooks/CF Conventions/NetCDF and CF - The Basics.ipynb
mit
# Import some useful Python tools from datetime import datetime, timedelta import numpy as np # Twelve hours of hourly output starting at 22Z today start = datetime.utcnow().replace(hour=22, minute=0, second=0, microsecond=0) times = np.array([start + timedelta(hours=h) for h in range(13)]) # 3km spacing in x and y ...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/cmip6/models/sandbox-1/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'sandbox-1', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: MIROC Source ID: SANDBOX-1 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Bal...
tensorflow/tfx
tfx/examples/airflow_workshop/notebooks/step3.ipynb
apache-2.0
from __future__ import print_function !pip install -q papermill !pip install -q matplotlib !pip install -q networkx import os import tfx_utils %matplotlib notebook def _make_default_sqlite_uri(pipeline_name): return os.path.join(os.environ['HOME'], 'airflow/tfx/metadata', pipeline_name, 'metadata.db') def get_m...
dennys-bd/Coursera-Machine-Learning-Specialization
Course 2 - ML, Regression/week-3-polynomial-regression-assignment-blank.ipynb
mit
import graphlab """ Explanation: Regression Week 3: Assessing Fit (polynomial regression) In this notebook you will compare different regression models in order to assess which model fits best. We will be using polynomial regression as a means to examine this topic. In particular you will: * Write a function to take a...
y2ee201/Deep-Learning-Nanodegree
autoencoder/Convolutional_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) img = mnist.train.images[2] plt.imshow(img.reshape((28, 28)), cmap='Greys_r') """ Explanation: C...
opesci/devito
examples/performance/00_overview.ipynb
mit
from examples.performance import unidiff_output, print_kernel """ Explanation: Performance optimization overview The purpose of this tutorial is twofold Illustrate the performance optimizations applied to the code generated by an Operator. Describe the options Devito provides to users to steer the optimization proces...
buruzaemon/svd
PCA.ipynb
bsd-3-clause
corr = X_zscaled.corr() tmp = pd.np.triu(corr) - np.eye(corr.shape[0]) tmp = tmp.flatten() tmp = tmp[np.nonzero(tmp)] tmp = pd.Series(np.abs(tmp)) print('Correlation matrix:\n\n{}\n\n'.format(corr.values)) print('Multicollinearity check using off-diagonal values:\n\n{}'.format(tmp.describe())) """ Explanation: Mul...
google/data-pills
pills/CM/[DATA_PILL]_[CM]_Campaign_Overlap_(ADH)_v1.ipynb
apache-2.0
# Install additional packages !pip install -q matplotlib-venn # Import all necessary libs import json import sys import argparse import pprint import random import datetime import pandas as pd from google_auth_oauthlib.flow import InstalledAppFlow from googleapiclient import discovery from oauthlib.oauth2.rfc6749.err...
tcstewar/testing_notebooks
Data extraction from Nengo.ipynb
gpl-2.0
model = nengo.Network() with model: def stim_a_func(t): return np.sin(t*2*np.pi) stim_a = nengo.Node(stim_a_func) a = nengo.Ensemble(n_neurons=50, dimensions=1) nengo.Connection(stim_a, a) def stim_b_func(t): return np.cos(t*np.pi) stim_b = nengo.Node(stim_b_func) b = ne...
GPflow/GPflowOpt
doc/source/notebooks/hyperopt.ipynb
apache-2.0
%matplotlib inline import matplotlib.pyplot as plt # Loading airline data import numpy as np data = np.load('airline.npz') X_train, Y_train = data['X_train'], data['Y_train'] D = Y_train.shape[1]; """ Explanation: Bayesian Optimization of Hyperparameters Vincent Dutordoir, Joachim van der Herten Introduction Th...
colonelzentor/occmodel
examples/OCCT_Bottle_Example.ipynb
gpl-2.0
height = 70. width = 50. thickness = 30. pnt1 = [-width/2., 0., 0.] pnt2 = [-width/2., -thickness/4., 0.] pnt3 = [0., -thickness/2., 0.] pnt4 = [width/2., -thickness/4., 0.] pnt5 = [width/2., 0., 0.] edge1 = Edge().createLine(start=pnt1, end=pnt2) edge2 = Edge().createArc3P(start=pnt2, ...
QInfer/qinfer-examples
scoremixin_example.ipynb
agpl-3.0
from __future__ import division, print_function %matplotlib inline from qinfer import ScoreMixin, SimplePrecessionModel, RandomizedBenchmarkingModel import numpy as np import matplotlib.pyplot as plt try: plt.style.use('ggplot') except: pass """ Explanation: Fisher Score Mixin Example This notebook demonstr...
hobgreenson/chicago_employees
ChicagoEmployeeGenderSalary.ipynb
mit
workers = pd.read_csv('Current_Employee_Names__Salaries__and_Position_Titles.csv') """ Explanation: Introduction I downloaded a CSV of City of Chicago employee salary data, which includes the names, titles, departments and salaries of Chicago employees. I was interested to see whether men and women earn similar salar...
ES-DOC/esdoc-jupyterhub
notebooks/ec-earth-consortium/cmip6/models/ec-earth3/toplevel.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', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: EC-EARTH-CONSORTIUM Source ID: EC-EARTH3 Sub-Topics: Radiative ...
mayank-johri/LearnSeleniumUsingPython
Section 3 - Machine Learning/ThirdParty-scikit-learn-videos-master/07_cross_validation.ipynb
gpl-3.0
from sklearn.datasets import load_iris from sklearn.cross_validation import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn import metrics # read in the iris data iris = load_iris() # create X (features) and y (response) X = iris.data y = iris.target # use train/test split with diffe...
luciansmith/sedml-test-suite
archives/sbml-test-suite/convert-to-combine-arch.ipynb
bsd-3-clause
import pprint, tellurium as te # level and version of SBML to use lv_string = 'l3v1' # run all supported test cases # cases = te.getSupportedTestCases() # run just a subset containing all supported cases between 1 and 10 cases = te.getSupportedTestCases(981) print('Using the following {} cases:'.format(len(cases))) # ...
stephank16/enes_graph_use_case
prov_templates/old/PROV-Templates-python-work.ipynb
gpl-3.0
# Define the variable parts in the template as dictionary keys # dictionary values are the prov template variable bindings in one case # and correspond to the variable instance settings in the other case import prov.model as prov template_dict = { 'var_author':'var:author', 'var_value':'var:value', 'var_nam...
shanghai-machine-learning-meetup/presentations
peek_into_keras_backend/Peek into Keras backend.ipynb
apache-2.0
import pandas as pd import numpy as np %matplotlib inline import matplotlib.pyplot as plt import tensorflow as tf from keras.layers.embeddings import Embedding from keras.layers.core import Dense, Dropout, Lambda from keras.layers import Input, GlobalAveragePooling1D from keras.layers.convolutional import Conv1D fro...
FordyceLab/AcqPack
notebooks/Test20170524.ipynb
mit
import time import numpy as np import matplotlib.pyplot as plt import pandas as pd %matplotlib inline """ Explanation: SETUP End of explanation """ # config directory must have "__init__.py" file # from the 'config' directory, import the following classes: from config import Motor, ASI_Controller, Autosipper from co...
kunaltyagi/SDES
notes/python/p_norvig/logic/Mean Misanthrope Density.ipynb
gpl-3.0
from statistics import mean def occ(n): "The expected occupancy for a row of n houses (under misanthrope rules)." return (0 if n == 0 else 1 if n == 1 else mean(occ(L) + 1 + occ(R) for (L, R) in runs(n))) def runs(n): """A list [(L, R), ...] where the i-th tuple co...
feststelltaste/software-analytics
notebooks/Developers' Habits (Linux Edition).ipynb
gpl-3.0
import pandas as pd raw = pd.read_csv( r'../../linux/git_timestamp_author_email.log', sep="\t", encoding="latin-1", header=None, names=['unix_timestamp', 'author', 'email']) # create separate columns for time data raw[['timestamp', 'timezone']] = raw['unix_timestamp'].str.split(" ", expand=True) #...
tensorflow/docs-l10n
site/en-snapshot/addons/tutorials/optimizers_conditionalgradient.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 # 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 License is d...
scotthuang1989/Python-3-Module-of-the-Week
developer_tools/Python2ToPython3.ipynb
apache-2.0
# %load example.py def greet(name): print "Hello, {0}!".format(name) print "What's your name?" name = raw_input() greet(name) # we can convert this file to python3-compliant !2to3 example.py """ Explanation: Automated Python 2 to 3 code translation 2to3 is a Python program that reads Python 2.x source code and a...
hanleilei/note
training/submit/PythonExercises3rdAnd4th.ipynb
cc0-1.0
import os class Dog(object): def __init__(self): self.name = "Dog" def bark(self): return "woof!" class Cat(object): def __init__(self): self.name = "Cat" def meow(self): return "meow!" class Human(object): def __init__(self): self.name = "Human" ...
mne-tools/mne-tools.github.io
0.21/_downloads/306dcf0b43a155a02804528d597e4e81/plot_roi_erpimage_by_rt.ipynb
bsd-3-clause
# Authors: Jona Sassenhagen <jona.sassenhagen@gmail.com> # # License: BSD (3-clause) import mne from mne.event import define_target_events from mne.channels import make_1020_channel_selections print(__doc__) """ Explanation: Plot single trial activity, grouped by ROI and sorted by RT This will produce what is someti...
autumn-lake/Facebook-V-Predicting-Check-Ins
timeIsMin.ipynb
mit
Now, to confirm, let us do a little bit of simple tests. import pandas as pd from matplotlib import pyplot as plt from matplotlib import cm as cm import numpy as np %matplotlib inline train=pd.read_csv('../train.csv') train.describe() # first take a look at the whole picture of time data: train['time'].plot(kind='h...
jrbourbeau/cr-composition
notebooks/legacy/lightheavy/parameter-tuning/RF-parameter-tuning.ipynb
mit
import sys sys.path.append('/home/jbourbeau/cr-composition') print('Added to PYTHONPATH') from __future__ import division, print_function from collections import defaultdict import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import seaborn.apionly as sns...
nproctor/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 """ data = np.random.randn(2, 100) plt.scatter(data[0], data[1]) plt.xlabel("Random Number 1", fontsize=12, color="#666666") plt.ylabel("Random Number 2", fontsize=12...
macks22/gensim
docs/notebooks/doc2vec-IMDB.ipynb
lgpl-2.1
import locale import glob import os.path import requests import tarfile import sys import codecs import smart_open dirname = 'aclImdb' filename = 'aclImdb_v1.tar.gz' locale.setlocale(locale.LC_ALL, 'C') if sys.version > '3': control_chars = [chr(0x85)] else: control_chars = [unichr(0x85)] # Convert text to l...
llclave/Springboard-Mini-Projects
data_wrangling_json/json_exercise.ipynb
mit
# Import required packages import pandas as pd import json from pandas.io.json import json_normalize # Read JSON file as Pandas DataFrame object world_bank_df = pd.read_json('data/world_bank_projects.json') world_bank_df # Check DataFrame info world_bank_df.info() # List top 10 countries with the most projects world...
dataDogma/Computer-Science
Courses/DAT-208x/DAT208x - Week 3 - Section 2 - Methods.ipynb
gpl-3.0
""" Instructions: + Use the upper() method on room and store the result in room_up. Use the dot notation. + Print out room and room_up. Did both change? + Print out the number of o's on the variable room by calling count() on room and passing the letter "o" as an input to the metho...
ES-DOC/esdoc-jupyterhub
notebooks/hammoz-consortium/cmip6/models/mpiesm-1-2-ham/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'hammoz-consortium', 'mpiesm-1-2-ham', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: HAMMOZ-CONSORTIUM Source ID: MPIESM-1-2-HAM Topic: Aerosol Sub...
cathalmccabe/PYNQ
boards/Pynq-Z1/base/notebooks/arduino/arduino_lcd18.ipynb
bsd-3-clause
from pynq.overlays.base import BaseOverlay base = BaseOverlay("base.bit") """ Explanation: Arduino LCD Example using AdaFruit 1.8" LCD Shield This notebook shows a demo on Adafruit 1.8" LCD shield. End of explanation """ from pynq.lib.arduino import Arduino_LCD18 lcd = Arduino_LCD18(base.ARDUINO) """ Explanation: ...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/n10_dyna_q_with_predictor_full_training.ipynb
mit
# Basic imports import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime as dt import scipy.optimize as spo import sys from time import time from sklearn.metrics import r2_score, median_absolute_error from multiprocessing import Pool import pickle %matplotlib inline %pylab inli...
tritemio/multispot_paper
usALEX - Corrections - Direct excitation fit.ipynb
mit
data_file = 'results/usALEX-5samples-PR-raw-dir_ex_aa-fit-AexAem.csv' """ Explanation: Direct ecitation coefficient fit This notebook estracts the direct excitation coefficient from the set of 5 us-ALEX smFRET measurements. What it does? This notebook performs a weighted average of direct excitation coefficient fitt...
NYUDataBootcamp/Projects
UG_S17/Zhou-Stock Pitch.ipynb
mit
import requests import sys # system module import pandas as pd # data package import pandas_datareader.data as web import datetime import matplotlib.pyplot as plt # graphics module import datetime as dt # date and time module import numpy as np ...
chris1610/pbpython
notebooks/Selecting_Columns_in_DataFrame.ipynb
bsd-3-clause
import pandas as pd import numpy as np df = pd.read_csv( 'https://data.cityofnewyork.us/api/views/vfnx-vebw/rows.csv?accessType=DOWNLOAD&bom=true&format=true' ) """ Explanation: Tips for Selecting Columns in a DataFrame Notebook to accompany this post. End of explanation """ col_mapping = [f"{c[0]}:{c[1]}" for ...
akutuzov/gensim
docs/notebooks/topic_coherence_tutorial.ipynb
lgpl-2.1
import numpy as np import logging try: import pyLDAvis.gensim except ImportError: ValueError("SKIP: please install pyLDAvis") import json import warnings warnings.filterwarnings('ignore') # To ignore all warnings that arise here to enhance clarity from gensim.models.coherencemodel import CoherenceModel f...
kazzz24/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...
peterdalle/mij
2 Web scraping and APIs/Web scraping and Exercise.ipynb
gpl-3.0
!pip install lxml !pip install BeautifulSoup4 import urllib.request from lxml import html from bs4 import BeautifulSoup """ Explanation: Web scraping We will scrape data from: Internet Movie Database Washington Post Wikipedia Ethics: Scraping can be done much faster than humans. Pause ~1 second before scraping the...
VandyAstroML/Vanderbilt_Computational_Bootcamp
notebooks/Week_05/05_Numpy_Matplotlib.ipynb
mit
import numpy as np """ Explanation: Week 5 - Numpy & Matplotlib Today's Agenda Numpy Matplotlib Numpy - Numerical Python From their website (http://www.numpy.org/): NumPy is the fundamental package for scientific computing with Python. * a powerful N-dimensional array object * sophisticated (broadcasting) function...
ML4DS/ML4all
P3.Python_datos/Intro3_Working_with_Data_student.ipynb
mit
# Let's import some libraries import numpy as np import matplotlib.pyplot as plt """ Explanation: Working with data in Python Notebook version: * 1.0 (Sep 3, 2018) - First TMDE version * 1.1 (Sep 14, 2018) - Minor fixes Authors: Vanessa Gómez Verdejo (vanessa@tsc.uc3m.es), Óscar García Hinde (oghinde@tsc.uc3m.es), ...
ledeprogram/algorithms
class7/donow/benzaquen_mercy_donow_7.ipynb
gpl-3.0
import pandas as pd %matplotlib inline import numpy as np from sklearn.linear_model import LogisticRegression """ Explanation: Apply logistic regression to categorize whether a county had high mortality rate due to contamination 1. Import the necessary packages to read in the data, plot, and create a logistic regressi...
Aggieyixin/cjc2016
code/04.PythonCrawler_beautifulsoup.ipynb
mit
import urllib2 from bs4 import BeautifulSoup """ Explanation: 数据抓取: Beautifulsoup简介 王成军 wangchengjun@nju.edu.cn 计算传播网 http://computational-communication.com 需要解决的问题 页面解析 获取Javascript隐藏源数据 自动翻页 自动登录 连接API接口 End of explanation """ url = 'file:///Users/chengjun/GitHub/cjc2016/data/test.html' content = urllib2.urlop...
StudyExchange/Udacity
MachineLearning(Advanced)/p5_image_classification/image_classification_ZH-CN.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE """ from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm import problem_unittests as tests import tarfile cifar10_dataset_folder_path = 'cifar-10-batches-py' class DLProgress(tqdm): last_block = 0 def hoo...
jbocharov-mids/W207-Machine-Learning
John_Bocharov_p2.ipynb
apache-2.0
# This tells matplotlib not to try opening a new window for each plot. %matplotlib inline # General libraries. import re import numpy as np import matplotlib.pyplot as plt # SK-learn libraries for learning. from sklearn.pipeline import Pipeline from sklearn.neighbors import KNeighborsClassifier from sklearn.linear_mo...
turbomanage/training-data-analyst
courses/machine_learning/tensorflow/c_batched.ipynb
apache-2.0
import tensorflow as tf import numpy as np import shutil print(tf.__version__) """ Explanation: <h1> 2c. Refactoring to add batching and feature-creation </h1> In this notebook, we continue reading the same small dataset, but refactor our ML pipeline in two small, but significant, ways: <ol> <li> Refactor the input t...
lao-tseu-is-alive/mynotebooks
cgSVGDisplay.ipynb
gpl-2.0
%config InlineBackend.figure_format = 'svg' url_svg = 'http://clipartist.net/social/clipartist.net/B/base_tux_g_v_linux.svg' from IPython.display import SVG, display, HTML # testing svg inside jupyter next one does not support width parameter at the time of writing #display(SVG(url=url_svg)) display(HTML('<img src="' +...
jhillairet/scikit-rf
doc/source/examples/metrology/NanoVNA_V2_4port-splitter.ipynb
bsd-3-clause
import skrf from skrf.calibration import TwoPortOnePath # load networks of the raw calibration standard measurements short_raw = skrf.Network('./data_MiniCircuits_splitter/cal_short_raw.s2p') open_raw = skrf.Network('./data_MiniCircuits_splitter/cal_open_raw.s2p') match_raw = skrf.Network('./data_MiniCircuits_splitter...
pmgbergen/porepy
tutorials/mpsa.ipynb
gpl-3.0
import numpy as np import porepy as pp # Create grid n = 5 g = pp.CartGrid([n,n]) g.compute_geometry() """ Explanation: Multi-point stress approximation (MPSA) Porepy supports mpsa discretization for linear elasticity problem: \begin{equation} \nabla\cdot \sigma = -\vec f,\quad \vec x \in \Omega \end{equation} where...
mabevillar/rmtk
rmtk/plotting/hazard_outputs/plot_hazard_curves.ipynb
agpl-3.0
%matplotlib inline import matplotlib.pyplot as plt from plot_hazard_outputs import HazardCurve, UniformHazardSpectra hazard_curve_file = "../sample_outputs/hazard/hazard_curve.xml" hazard_curves = HazardCurve(hazard_curve_file) """ Explanation: Hazard Curves and Uniform Hazard Spectra This IPython notebook allows the...
Diyago/Machine-Learning-scripts
time series regression/DL aproach for timeseries/Air Pressure MLP.ipynb
apache-2.0
from __future__ import print_function import os import sys import pandas as pd import numpy as np %matplotlib inline from matplotlib import pyplot as plt import seaborn as sns import datetime #set current working directory os.chdir('D:/Practical Time Series') #Read the dataset into a pandas.DataFrame df = pd.read_csv...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/tensorflow_extended/solutions/Vertex_AI_Training_and_Serving_with_TFX_and_Vertex_Pipelines.ipynb
apache-2.0
# Use the latest version of pip. !pip install --upgrade pip !pip install --upgrade "tfx[kfp]<2" """ Explanation: Training and Serving with TFX and Vertex Pipelines Learning objectives Prepare example data. Create a pipeline. Run the pipeline on Vertex Pipelines. Test with a prediction request. Introduction In this n...
CodyKochmann/battle_tested
tutorials/hardening_filters.ipynb
mit
def list_of_strings_v1(iterable): """ converts the iterable input into a list of strings """ # build the output out = [str(i) for i in iterable] # validate the output for i in out: assert type(i) == str # return return out """ Explanation: battle_tested was originally created to har...
celiasmith/syde556
SYDE 556 Lecture 5 Dynamics.ipynb
gpl-2.0
%pylab inline import nengo model = nengo.Network() with model: ensA = nengo.Ensemble(100, dimensions=1) def feedback(x): return x+1 conn = nengo.Connection(ensA, ensA, function=feedback, synapse = 0.1) ensA_p = nengo.Probe(ensA, synapse=.01) sim = nengo.Simulator(model) sim.ru...
amueller/scipy-2016-sklearn
notebooks/03 Data Representation for Machine Learning.ipynb
cc0-1.0
from sklearn.datasets import load_iris iris = load_iris() """ Explanation: The use of watermark (above) is optional, and we use it to keep track of the changes while developing the tutorial material. (You can install this IPython extension via "pip install watermark". For more information, please see: https://github.c...
itoledoc/python_coffee
.ipynb_checkpoints/itoledoc_coffee-checkpoint.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D %matplotlib inline """ Explanation: Python Coffee, November 5, 2015 Import required libraries End of explanation """ import plotly.tools as tls import plotly.plotly as py import cufflinks as cf import plot...
5agado/data-science-learning
deep learning/StyleGAN/StyleGAN - Explore Directions.ipynb
apache-2.0
is_stylegan_v1 = False from pathlib import Path import matplotlib.pyplot as plt import numpy as np import sys import os from datetime import datetime from tqdm import tqdm # ffmpeg installation location, for creating videos plt.rcParams['animation.ffmpeg_path'] = str('/usr/bin/ffmpeg') import ipywidgets as widgets fr...
Danghor/Formal-Languages
Python/Regexp-Tutorial.ipynb
gpl-2.0
import re """ Explanation: Regular Expressions in Python (A Short Tutorial) This is a tutorial showing how regular expressions are supported in Python. The assumption is that the reader already has a grasp of the concept of regular expressions as it is taught in lectures on formal languages, for example in Formal L...
fonnesbeck/scipy2015_tutorial
notebooks/1. Data Preparation.ipynb
cc0-1.0
counts = pd.Series([632, 1638, 569, 115]) counts """ Explanation: Data Preparation using pandas An initial step in statistical data analysis is the preparation of the data to be used in the analysis. In practice, ~~a little~~ ~~some~~ ~~much~~ the majority of the actual time spent on a statistical modeling project is ...
biosustain/cameo-notebooks
02-import-models.ipynb
apache-2.0
less data/e_coli_core.xml from cameo import load_model model = load_model('data/e_coli_core.xml') model """ Explanation: Import models Import models from files The function :class:~cameo.io.load_model accepts a number of different input formats. SBML (Systems Biology Markup Language). JSON Pickle (pickled models) M...