repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
phobson/mpl-probscale
docs/tutorial/closer_look_at_viz.ipynb
bsd-3-clause
%matplotlib inline import warnings warnings.simplefilter('ignore') import numpy from matplotlib import pyplot import seaborn import probscale clear_bkgd = {'axes.facecolor':'none', 'figure.facecolor':'none'} seaborn.set(style='ticks', context='talk', color_codes=True, rc=clear_bkgd) # load up some example data from...
phoebe-project/phoebe2-docs
2.2/tutorials/apsidal_motion.ipynb
gpl-3.0
!pip install -I "phoebe>=2.2,<2.3" """ Explanation: Apsidal Motion 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 inline impor...
DataPilot/notebook-miner
summary_of_work/server_notebooks/bottom_up/Bottom Up Random Forest.ipynb
apache-2.0
import sys home_directory = '/dfs/scratch2/fcipollone' sys.path.append(home_directory) import numpy as np from nbminer.notebook_miner import NotebookMiner hw_filenames = np.load('../homework_names_jplag_combined_per_student.npy') hw_notebooks = [[NotebookMiner(filename) for filename in temp[:59]] for temp in hw_filena...
arasdar/DL
uri-dl/uri-dl-hw-2/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...
rueedlinger/python-snippets
rss/feedparser.ipynb
mit
import feedparser url = 'https://medium.com/feed/tag/machine-learning' resp = feedparser.parse(url) """ Explanation: Parse a RSS feed with feedparser In this Python snippet we use the feedparser package to parse a RSS feed from 'Medium'. - https://medium.com/feed/tag/machine-learning Let's get the RSS feed and pars...
paulcon/active_subspaces
tutorials/test_functions/piston/piston_example.ipynb
mit
import active_subspaces as ac import numpy as np %matplotlib inline # The piston_functions.py file contains two functions: the piston function (piston(xx)) # and its gradient (piston_grad(xx)). Each takes an Mx7 matrix (M is the number of data # points) with rows being normalized inputs; piston returns a column vector...
ealogar/curso-python
best-practices/1_Duck_Typing.ipynb
apache-2.0
# Compare def let_duck_swim_and_quack(d): if hasattr(d, "swim") and hasattr(d, "quack"): d.swim() d.quack() else: print "It does not look like a duck" raise AttributeError def let_duck_swim_and_quack(d): try: d.swim() d.quack() except AttributeError: ...
biosustain/marsi
notebooks/1.4 Converting Gene or Reaction Knockouts into Metabolite Knockouts.ipynb
apache-2.0
model = models.bigg.iJO1366 model.reactions.EX_o2_e.lower_bound = 0 """ Explanation: Design a D-lactate producing strain In this example we are going to create strain designs using OptGene. | Model | Medium | Aerobicity | Target | |------- |---------|-------------|-------------| | iJO1366| Glucose | Anaerobi...
hglanz/phys202-2015-work
assignments/assignment04/MatplotlibEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import math """ Explanation: Matplotlib Exercise 2 Imports End of explanation """ !head -n 30 open_exoplanet_catalogue.txt """ Explanation: Exoplanet properties Over the past few decades, astronomers have discovered thousands of extrasolar planet...
wittawatj/kernel-gof
ipynb/gof_mmd_test.ipynb
mit
%load_ext autoreload %autoreload 2 %matplotlib inline #%config InlineBackend.figure_format = 'svg' #%config InlineBackend.figure_format = 'pdf' import freqopttest.tst as tst import kgof import kgof.data as data import kgof.density as density import kgof.goftest as gof import kgof.mmd as mgof import kgof.kernel as ker ...
ecervera/ga-nb
nao/Crawling.ipynb
mit
import sys sys.path.append('c:\\udk\\naoqi-sdk-1.12.5-win32-vs2010\\lib') from Nao import Nao """ Explanation: Evolution of a Crawling Behavior for a Humanoid Robot Using Genetic Algorithms <img src="files/img/crawling.png" /> Controlling a biped robot with several degrees of freedom is a challenging task. For a human...
GoogleCloudPlatform/professional-services
examples/cloudml-support-routing/Notebooks/EDA.ipynb
apache-2.0
query = """ SELECT date_received, product, subproduct, issue, subissue, consumer_complaint_narrative, company_public_response, company_name, state FROM `bigquery-public-data.cfpb_complaints.complaint_database` """ query_job = client.query(...
ajfriend/stacklog
docs/tutorial.ipynb
isc
import stacklog import time def comp(t=.1): time.sleep(t) """ Explanation: stacklog Nested benchmarking and timing code. Stacklog uses a Logger object to capture timing output, so you can use multiple logging objects at once. The simplest interface is at the module level, and uses the 'default' Logger. End of exp...
ComputationalModeling/spring-2017-danielak
past-semesters/fall_2016/homework/HW5/Homework_5.ipynb
agpl-3.0
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import math def calc_accel(velocity, parachute_open=False, use_resistance=True): ''' This function calculates and returns the acceleration vector for a sky diver, given an input velocity. You can indicate whether the parachute is...
isendel/machine-learning
ml-regression/week1-2/numpy-tutorial.ipynb
apache-2.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...
wtbarnes/loops-workshop-2017-talk
notebooks/time_average_intensities.ipynb
mit
import os from scipy.interpolate import interp1d,splev,splrep import numpy as np import astropy.units as u import astropy.constants as const from synthesizAR.instruments import InstrumentHinodeEIS from synthesizAR.util import EISCube base1 = '/data/datadrive1/ar_forward_modeling/systematic_ar_study/noaa1109_tn{}' ba...
phoebe-project/phoebe2-docs
development/examples/diher_misaligned.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.4,<2.5" """ Explanation: DI Her: Misaligned Binary In this example, we'll reproduce Figure 8 in the misalignment release paper (Horvat et al. 2018). <img src="horvat+18_fig8.png" alt="Figure 8" width="400px"/> Setup Let's first make sure we have the latest version of PHOEBE 2.4 installed (u...
mne-tools/mne-tools.github.io
0.12/_downloads/plot_rereference_eeg.ipynb
bsd-3-clause
# Authors: Marijn van Vliet <w.m.vanvliet@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import mne from mne.datasets import sample from matplotlib import pyplot as plt print(__doc__) # Setup for reading the raw data data_path = sample.data_path() raw_f...
michaelneuder/image_quality_analysis
bin/calculations/human_data/old/human_data_sample.ipynb
mit
import matplotlib.pyplot as plt import pandas as pd import numpy as np import matplotlib.image as mpimg from PIL import Image import progressbar human_df = pd.read_csv('human_data.csv') human_df.head() """ Explanation: human judgement data examining some of the human judgement data End of explanation """ # data sa...
blua/deep-learning
gan_mnist/Intro_to_GANs_Exercises.ipynb.BASE.17033.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...
scikit-optimize/scikit-optimize.github.io
0.8/notebooks/auto_examples/plots/partial-dependence-plot.ipynb
bsd-3-clause
print(__doc__) import sys from skopt.plots import plot_objective from skopt import forest_minimize import numpy as np np.random.seed(123) import matplotlib.pyplot as plt """ Explanation: Partial Dependence Plots Sigurd Carlsen Feb 2019 Holger Nahrstaedt 2020 .. currentmodule:: skopt Plot objective now supports optiona...
temmeand/scikit-rf
doc/source/examples/vectorfitting/vectorfitting_ex2_190ghz_active.ipynb
bsd-3-clause
import skrf import numpy as np import matplotlib.pyplot as mplt """ Explanation: Ex2: Measured 190 GHz Active 2-Port The Vector Fitting feature is demonstrated using a 2-port S-matrix of an active circuit measured from 140 GHz to 220 GHz. Additional explanations and background information can be found in the Vector Fi...
RadoslawDryzner/LeRepoDuGuerrier
Homework04/Homework 4.ipynb
mit
def show_hist(data, title, xlabel, ylabel): plt.hist(data, range=[0, 40000]) plt.title(title) plt.xlabel(xlabel) plt.ylabel(ylabel) plt.show() def show_box_plot(data1, data2, legend1, legend2): plt.boxplot([data1, data2]) plt.xticks([1, 2], [legend1, legend2]) plt.show() def show_bar_p...
neto71/courses-1
deeplearning1/nbs/lesson3.ipynb
apache-2.0
from theano.sandbox import cuda %matplotlib inline import utils; reload(utils) from utils import * from __future__ import division, print_function #path = "data/dogscats/sample/" path = "data/dogscats/" model_path = path + 'models/' if not os.path.exists(model_path): os.mkdir(model_path) batch_size=64 """ Explanati...
K3D-tools/K3D-jupyter
examples/snapshots.ipynb
mit
plot = get_plot() plot.display() data = plot.get_binary_snapshot() with open('binary_snapshot.k3d', 'wb') as f: f.write(data) """ Explanation: Create and save to *.k3d file End of explanation """ plot2 = k3d.plot() with open('binary_snapshot.k3d', 'rb') as f: plot2.load_binary_snapshot(f.read()) plot2.displ...
nick-youngblut/SIPSim
ipynb/bac_genome/fullCyc/trimDataset/rep4_DBL-comm_bw_HR.ipynb
mit
import os import glob import re import nestly %load_ext rpy2.ipython %load_ext pushnote %%R library(ggplot2) library(dplyr) library(tidyr) library(gridExtra) library(phyloseq) """ Explanation: Goal Trying varying levels of bandwidth and DBL scaling with pre-fractionation abundances ('DBL-comm') Varying parameters b...
martinggww/lucasenlights
MachineLearning/DataScience-Python3/ConditionalProbabilitySolution.ipynb
cc0-1.0
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...
whitead/numerical_stats
unit_12/lectures/lecture_review.ipynb
gpl-3.0
plt.plot(pop_x, pop_y, 'o') plt.xlabel('Year') plt.ylabel('Population [Millions]') plt.show() """ Explanation: Unit 12, Review Numerical Methods and Statistics Prof. Andrew White, April 25 2017 We've seen the following types of regression: Ordinary least squares with 1 x dimension and 1 y dimension (OLS-1D). Solve w...
tarunchhabra26/fss16dst
code/8/WS4/tchhabr_performance.ipynb
apache-2.0
%matplotlib inline # All the imports from __future__ import print_function, division import pom3_ga, sys import pickle # TODO 1: Enter your unity ID here __author__ = "tchhabr" """ Explanation: Workshop 4 - Performance Metrics In this workshop we study 2 performance metrics(Spread and Inter-Generational Distance) on...
CELMA-project/CELMA
MES/singleOperators/1-DDXCylinder/calculations/exactSolutions.ipynb
lgpl-3.0
%matplotlib notebook from sympy import init_printing from sympy import S from sympy import sin, cos, tanh, exp, pi, sqrt from boutdata.mms import x, y, z, t from boutdata.mms import DDX import os, sys # If we add to sys.path, then it must be an absolute path common_dir = os.path.abspath('./../../../../common') # Sys...
regardscitoyens/consultation_an
exploitation/analyse_quanti_theme2.ipynb
agpl-3.0
def loadContributions(file, withsexe=False): contributions = pd.read_json(path_or_buf=file, orient="columns") rows = []; rindex = []; for i in range(0, contributions.shape[0]): row = {}; row['id'] = contributions['id'][i] rindex.append(contributions['id'][i]) if (withsexe...
martintb/pe_optimization_tutorial
03-numba.ipynb
mit
%load_ext memory_profiler %load_ext snakeviz %load_ext cython import holoviews as hv hv.extension('bokeh','matplotlib') from IPython.core import debugger ist = debugger.set_trace """ Explanation: Numba End of explanation """ import numpy as np pos = np.loadtxt('data/positions.dat') box = np.loadtxt('data/box.dat') ...
ML4DS/ML4all
R5.Bayesian_Regression/.ipynb_checkpoints/Bayesian_regression_student-checkpoint.ipynb
mit
# Import some libraries that will be necessary for working with data and displaying plots # To visualize plots in the notebook %matplotlib inline from IPython import display import matplotlib import matplotlib.pyplot as plt import numpy as np import scipy.io # To read matlab files import pylab import time """...
wikistat/Ateliers-Big-Data
Cdiscount/Part1-2-AIF-PythonNltkGensim-FeatureExtraction-Cdiscount.ipynb
mit
#Importation des librairies utilisées import time import pandas as pd import numpy as np import collections import itertools import os import warnings warnings.filterwarnings('ignore') from sklearn.cross_validation import train_test_split """ Explanation: Ateliers: Technologies de l'intelligence Artificielle <center...
tolaoniyangi/dmc
notebooks/week-5/01-CNN in keras for mnist.ipynb
apache-2.0
import numpy as np np.random.seed(1337) # for reproducibility from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Convolution2D, MaxPooling2D from keras.utils import np_utils from keras import backend as K from ker...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/end_to_end_ml/labs/prepare_data_babyweight.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst !pip install --user google-cloud-bigquery==1.25.0 """ Explanation: Prepare babyweight dataset. Learning Objectives Setup up the environment Preprocess natality dataset Augment natality dataset Create the train and eval tables in BigQuery Export data ...
yashdeeph709/Algorithms
PythonBootCamp/Complete-Python-Bootcamp-master/.ipynb_checkpoints/Errors and Exceptions Homework - Solution-checkpoint.ipynb
apache-2.0
try: for i in ['a','b','c']: print i**2 except: print "An error ocurred!" """ Explanation: Errors and Exceptions Homework - Solution Problem 1 Handle the exception thrown by the code below by using try and except blocks. End of explanation """ x = 5 y = 0 try: z = x/y except ZeroDivisionError: ...
GoogleCloudPlatform/training-data-analyst
blogs/babyweight/train_deploy.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst !pip install --user google-cloud-bigquery==1.25.0 """ Explanation: <h1> Structured data prediction using Cloud AI Platform </h1> This notebook illustrates: <ol> <li> Create a BigQuery Dataset and Google Cloud Storage Bucket <li> Export from BigQuery...
CalebBell/fluids
docs/Data/Sieve Sizes for Particle Size Distributions.ipynb
mit
from fluids.particle_size_distribution import ASTM_E11_sieves, ISO_3310_1_sieves, Sieve import pandas as pd pd.options.display.max_rows = 100000 """ Explanation: Sieve Sizes for Particle Size Distributions End of explanation """ # All units in SI, meters. dat = {} for name in Sieve.__slots__: vals = [] for s...
necromuralist/machine_learning_studies
machine_learning/udacity/project_1/boston_housing_exploration.ipynb
mit
# Importing a few necessary libraries # python standard library import warnings # third party import numpy as np import numpy import matplotlib.pyplot as pl from matplotlib import pylab import pandas import seaborn from sklearn import datasets from sklearn.tree import DecisionTreeRegressor # Make matplotlib show our ...
dtamayo/rebound
ipython_examples/Checkpoints.ipynb
gpl-3.0
import rebound sim = rebound.Simulation() sim.add(m=1.) sim.add(m=1e-6, a=1.) sim.add(a=2.) sim.integrator = "whfast" sim.save("checkpoint.bin") sim.status() """ Explanation: Checkpoints You can easily save and load a REBOUND simulation to a binary file. The binary file includes all information about the particles (ma...
nehal96/Deep-Learning-ND-Exercises
Deep Neural Networks/tf-deep-neural-networks.ipynb
mit
import tensorflow as tf # Hidden Layer with ReLU activation function hidden_layer = tf.add(tf.matmul(features, hidden_weights), hidden_biases) hidden_layer = tf.nn.relu(hidden_layer) output = tf.add(tf.matmul(hidden_layer, output_weights), output_biases) """ Explanation: Deep Neural Networks in TensorFlow Multilayer...
relopezbriega/mi-python-blog
content/notebooks/DataViz.ipynb
gpl-2.0
# <!-- collapse=True --> # importando modulos necesarios import numpy as np import pandas as pd from pydataset import data import re # librerías de visualizaciones import seaborn as sns import matplotlib.pyplot as plt from bokeh.io import output_notebook, show from bokeh.charts import Histogram, Scatter import folium...
csc-training/python-introduction
notebooks/answers/Advanced Object oriented programming.ipynb
mit
class Person(object): def __init__(self, name): self.name = name def say_hi(self): return "Hi, I'm " + self.name """ Explanation: Object-oriented programming Our first example is an example of composition. We create a Company that consists a list of Persons and an account balance. Then...
cubewise-code/TM1py-samples
Samples/time_series_forecasting.ipynb
mit
#import tm1 service module from TM1py.Services import TM1Service #import tm1 utils module from TM1py.Utils import Utils #import pandas import pandas as pd #import matplotlib import matplotlib.pyplot as plt #inline plotting for matplotlib %matplotlib inline #import statsmodels package from fbprophet import Prophet """ ...
QuantCrimAtLeeds/PredictCode
notebooks/sepp_2_testbed.ipynb
artistic-2.0
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: The EM algorithm for Hawkes processes Here we explore the optimisation algorithm for parameter estimation given in Mohler et al. "Randomized Controlled Field Trials of Predictive Policing". Journal of the American Statistical Assoc...
droud/courses
deeplearning1/nbs/lesson5.ipynb
apache-2.0
from keras.datasets import imdb idx = imdb.get_word_index() """ Explanation: Setup data We're going to look at the IMDB dataset, which contains movie reviews from IMDB, along with their sentiment. Keras comes with some helpers for this dataset. End of explanation """ idx_arr = sorted(idx, key=idx.get) idx_arr[:10] ...
feststelltaste/software-analytics
demos/20190319_JavaLand_Bruehl/DataScienceMeetsSoftwareData.ipynb
gpl-3.0
import pandas as pd log = pd.read_csv("../dataset/linux_blame_log.csv.gz") log.head() """ Explanation: Data Science meets Software Data <b>Markus Harrer</b>, Software Development Analyst @feststelltaste <small>JavaLand 2019, Phantasialand, Brühl, 19.03.2019</small> <img src="../resources/innoq_logo.jpg" width=20% hei...
andrzejkrawczyk/python-course
part_1/01.Wstęp.ipynb
apache-2.0
print("Hello world!") """ Explanation: Kurs Python Część 1 Zespół Learnetic Andrzej Krawczyk Python Język wysokiego poziomu Język skryptowy Język interpretowany Język dynamiczny Język szerokiego zastosowania Cechy Pythona Dynamiczne typowanie Automatyczne zarządzanie pamięcią Garbage Collector Obiektowo orientowany...
yw-fang/readingnotes
machine-learning/Hitchhiker-guide-2016/ch04.ipynb
apache-2.0
import this """ Explanation: Writing Great Code Y.-W. FANG at Kyoto University 这个章节对于 python 初学者真的是极其重要的。 This chapter focuses on writing the great code. You will see it is very useful to help you develop some good manners. Code style Pythonistas (vesteran Python developers)总是对 python 这一预言引以为豪的,因为即使不懂 python 的人,阅读一些简单...
lukechen526/deep-learning
image-classification/dlnd_image_classification.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE """ from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm import problem_unittests as tests import tarfile cifar10_dataset_folder_path = 'cifar-10-batches-py' class DLProgress(tqdm): last_block = 0 def hoo...
fabiansinz/pipeline
jupyter/tutorial/pipeline_vis.ipynb
lgpl-3.0
%pylab inline import datajoint as dj from pipeline.vis import * matplotlib.rcParams['figure.figsize'] = (10.0, 9.0) """ Explanation: Previous: pipeline_experiment | Next: pipeline_preprocess Schema vis Schema pipeline.vis is upstream from preprocess and it contains information about the visual stimulus entered by the ...
abevieiramota/data-science-cookbook
2016/decision-tree/DecisionTree.ipynb
mit
import os import subprocess import pandas as pd import math import numpy as np from sklearn.tree import DecisionTreeClassifier, export_graphviz headers = ["buying", "maint", "doors", "persons","lug_boot", "safety", "class"] data = pd.read_csv("carData.csv", header=None, names=headers) data = data.take(np.random.permu...
longyangking/ML
Notes/Ensemble/ID3 Decision Tree.ipynb
lgpl-3.0
from math import log def calcShannonEnt(dataSet): numEntries = len(dataSet) labelCounts = dict() for featVec in dataSet: currentLabel = featVec[-1] if currentLabel not in labelCounts.keys(): labelCounts[currentLabel] = 0 labelCounts[currentLabel] += 1 shannonEnt = 0.0...
mavillan/SciProg
04_jit/04_jit.ipynb
gpl-3.0
%matplotlib inline %load_ext memory_profiler import numpy as np import numexpr as ne import numba import math import random import matplotlib.pyplot as plt import scipy as sp import sys """ Explanation: <h1 align="center">Scientific Programming in Python</h1> <h2 align="center">Topic 4: Just in Time Compilation: Numb...
reubano/meza
examples/usage.ipynb
mit
# Create a csv file text = ( 'col1,col2,col3\n' 'hello,5/4/82,1\n' 'one,1/1/15,2\n' 'happy,7/4/92,3\n') f = StringIO(text) f.seek(0) # Load the file records = io.read_csv(f) # Records are an iterator over the rows row = next(records) row # Replace first row so as not to loose any data records = pr.p...
jlawman/jlawman.github.io
content/sklearn/Datasets - Generating Random Data.ipynb
mit
#Import pandas and plotting libraries to visualize data import seaborn as sns import matplotlib.pyplot as plt import pandas as pd %matplotlib inline """ Explanation: Scikit-learn has a number of methods to generate data in its datasets module. Below are some examples of the options available. End of explanation """ ...
PollyP/trend-friend-or-foe
notebooks/Looking at trend investing, part 1.ipynb
mit
%matplotlib inline from datetime import date import IPython.html.widgets as widgets import IPython.display as display import os import numpy as np import matplotlib.pyplot as plt import matplotlib.pylab as pylab import pandas as pd import pandas.io.data as web pd.set_option('display.float_format', lambda x: '%.4f' % ...
tensorflow/examples
courses/udacity_intro_to_tensorflow_for_deep_learning/l09c02_nlp_padding.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...
tpin3694/tpin3694.github.io
sql/drop_rows.ipynb
mit
# Ignore %load_ext sql %sql sqlite:// %config SqlMagic.feedback = False """ Explanation: Title: Drop Rows Slug: drop_rows Summary: Drop rows in SQL. Date: 2017-01-16 12:00 Category: SQL Tags: Basics Authors: Chris Albon Note: This tutorial was written using Catherine Devlin's SQL in Jupyter Notebooks library...
mjames-upc/python-awips
examples/notebooks/Watch_and_Warning_Polygons.ipynb
bsd-3-clause
from awips.dataaccess import DataAccessLayer from awips.tables import vtec from datetime import datetime import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cfeature from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER from cartopy.feature import ...
gaufung/Data_Analytics_Learning_Note
python-statatics-tutorial/basic-theme/python-language/Collections.ipynb
mit
from collections import * """ Explanation: Collections module End of explanation """ c1 = Counter() c2 = Counter('gaufung') c3 = Counter({'red':4,'blue':10}) c4 = Counter(cats=4,dogs=5) """ Explanation: 1 Counter A Counter is a dict subclass for counting hashable objects. It is an unordered collection where element...
pkreissl/espresso
doc/tutorials/polymers/polymers.ipynb
gpl-3.0
def solvent_langevin(system, kT, gamma): ''' Implicit solvation model based on Langevin dynamics (Rouse model). ''' system.thermostat.set_langevin(kT=kT, gamma=gamma, seed=42) def solvent_lbm(system, kT, gamma): ''' Lattice-based solvation model based on the LBM (Zimm model). ''' lbf =...
robertoalotufo/ia898
2S2018/05 Histograma da imagem.ipynb
mit
import numpy as np import matplotlib.image as mpimg f = mpimg.imread('../data/cameraman.tif') print(f.min(), f.max()) %matplotlib inline import matplotlib.pyplot as plt plt.imshow(f, cmap = 'gray') plt.colorbar() nbins = 20 h, bin_edges = np.histogram(f, nbins,(0,255)) print('h=\n',h) print('bins=\n',bin_edges) ...
mne-tools/mne-tools.github.io
0.24/_downloads/7ba58cd4e9bc2622d60527d21fc13577/decoding_spatio_temporal_source.ipynb
bsd-3-clause
# Author: Denis A. Engemann <denis.engemann@gmail.com> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # Jean-Remi King <jeanremi.king@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD-3-Clause import numpy as np import matplotlib.pyplot as plt from sklearn.pipeline import...
FaustineLi/Sta663-Project
examples/Autoencoder.ipynb
mit
import pickle, gzip import matplotlib.pyplot as plt import numpy as np %matplotlib inline np.random.seed(0) with gzip.open('../resources/data/mnist.pkl.gz', 'rb') as f: train, test, val = pickle.load(f, encoding='latin1') mnist = train[0] from vae import Network """ Explanation: Autoencoder Autoencoders ar...
YeoLab/single-cell-bioinformatics
notebooks/2.7_Apply_dimensionality_reduction_on_Shalek2013_Macaulay2016.ipynb
bsd-3-clause
# Alphabetical order is standard # We're doing "import superlongname as abbrev" for our laziness - this way we don't have to type out the whole thing each time. # Python plotting library import matplotlib.pyplot as plt # Numerical python library (pronounced "num-pie") import numpy as np # Dataframes in Python import...
santipuch590/deeplearning-tf
tensorflow_2_tutorials/text/word_embeddings.ipynb
mit
import tensorflow as tf import tensorflow_datasets as tfds tfds.disable_progress_bar() import matplotlib.pyplot as plt """ Explanation: Word embeddings Tutorial in TensorFlow 2.0 End of explanation """ embedding_layer = tf.keras.layers.Embedding(input_dim=1000, output_dim=5) """ Explanation: Embedding Layer Creat...
ntftrader/ntfdl
examples/notebooks/Multiple days of intraday data.ipynb
mit
%matplotlib inline %pylab inline --no-import-all pylab.rcParams['figure.figsize'] = (18, 10) from ntfdl import Multi from matplotlib.finance import candlestick_ohlc from datetime import datetime, timedelta # Instantiate multi with instrument FOE from Oslo exchange (OSS) foe = Multi('FOE', exchange='OSE') """ Explana...
rsignell-usgs/notebook
HOPS/.ipynb_checkpoints/hops_velocity3-checkpoint.ipynb
mit
from netCDF4 import Dataset #url = ('http://geoport.whoi.edu/thredds/dodsC/usgs/data2/rsignell/gdrive/' # 'nsf-alpha/Data/MIT_MSEAS/MSEAS_Tides_20160317/mseas_tides_2015071612_2015081612_01h.nc') url = ('/usgs/data2/rsignell/gdrive/' 'nsf-alpha/Data/MIT_MSEAS/MSEAS_Tides_20160317/mseas_tides_2015071612_20...
tensorflow/docs-l10n
site/ja/tutorials/images/cnn.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...
paulhoule/gastrodon
notebooks/remote/Collecting_Counts_From_Ontology2_DBpedia.ipynb
mit
%load_ext autotime import sys from os.path import expanduser from gastrodon import RemoteEndpoint,QName,ttl,URIRef,inline import pandas as pd import json pd.options.display.width=120 pd.options.display.max_colwidth=100 prefixes=inline(""" @prefix dbo: <http://dbpedia.org/ontology/> . @prefix summary: <http://r...
nwhidden/ND101-Deep-Learning
image-classification/dlnd_image_classification.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE """ from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm import problem_unittests as tests import tarfile cifar10_dataset_folder_path = 'cifar-10-batches-py' # Use Floyd's cifar-10 dataset if present floyd_cifar10...
grigorisg9gr/menpo-notebooks
menpo/Transforms/Generalized_Procrustes_Analysis.ipynb
bsd-3-clause
%matplotlib inline from pathlib import Path from menpo.transform import GeneralizedProcrustesAnalysis from menpo.shape import PointCloud import numpy as np import matplotlib.pyplot as plt """ Explanation: Generalized Procrustes Analysis Generalized Procrustes Analysis is an iterative technique for optimally rigidly ...
charlesll/RamPy
examples/Normalisation.ipynb
gpl-2.0
%matplotlib inline import sys sys.path.append("../") import numpy as np import scipy from matplotlib import pyplot as plt import rampy as rp from sklearn import preprocessing """ Explanation: Use of normalisation function In this example we normalise a spectrum to different values: area, maximum, or min-max. End of e...
pmgbergen/porepy
tutorials/contact_mechanics_with_AD.ipynb
gpl-3.0
import porepy as pp import numpy as np import inspect model = pp.ContactMechanics({}) print(inspect.getsource(model._assign_equations)) """ Explanation: Advanced AD application This notebook documents how the algorithmic (or automatic) differentiation framework may be applied to non-linear equations. For an introduc...
computational-class/cc2017
data/17.networkx.ipynb
mit
%matplotlib inline import networkx as nx import matplotlib.cm as cm import matplotlib.pyplot as plt import networkx as nx G=nx.Graph() # G = nx.DiGraph() # 有向网络 # 添加(孤立)节点 G.add_node("spam") # 添加节点和链接 G.add_edge(1,2) print(G.nodes()) print(G.edges()) # 绘制网络 nx.draw(G, with_labels = True) """ Explanation: 网络科学理论 ...
bjmorgan/vasppy
docs/source/examples/rdfs.ipynb
mit
# Create a pymatgen Structure for NaCl from pymatgen import Structure, Lattice # Create a pymatgen Structure for NaCl from pymatgen import Structure, Lattice a = 5.6402 # NaCl lattice parameter lattice = Lattice.from_parameters(a, a, a, 90.0, 90.0, 90.0) lattice structure = Structure.from_spacegroup(sg='Fm-3m', latt...
ziky5/F4500_Python_pro_fyziky
lekce_08/N2spec.ipynb
mit
#kod v teto bunce neni soucasti lekce, #presto ho ale netajime import massiveOES import matplotlib.pyplot as plt %matplotlib inline from matplotlib import colors as mcolors colors = dict(mcolors.BASE_COLORS, **mcolors.CSS4_COLORS) N2 = massiveOES.SpecDB('N2CB.db') spec_cold = N2.get_spectrum(Trot=300, Tvib=300, wmin...
sameersingh/uci-statnlp
tutorials/rnn_examples.ipynb
apache-2.0
!wget https://raw.githubusercontent.com/UniversalDependencies/UD_English/master/en-ud-dev.conllu !wget https://raw.githubusercontent.com/UniversalDependencies/UD_English/master/en-ud-test.conllu !wget https://raw.githubusercontent.com/UniversalDependencies/UD_English/master/en-ud-train.conllu """ Explanation: Example:...
MinnowBoard/fishbowl-notebooks
Slideshow.ipynb
mit
import time import sys import os from PIL import Image from pyDrivers.ada_lcd import * import pyDrivers.ILI9341 as TFT import Adafruit_GPIO as GPIO import Adafruit_GPIO.SPI as SPI """ Explanation: Slideshow Project This complicated project uses all the major components of the other projects to create a system that wil...
gregcaporaso/short-read-tax-assignment
ipynb/simulated-community/dataset-generation.ipynb
bsd-3-clause
from os.path import join, expandvars from tax_credit.simulated_communities import generate_simulated_communities # Project directory project_dir = expandvars("$HOME/Desktop/projects/tax-credit/") # Directory containing reference sequence databases reference_database_dir = join(project_dir, 'data', 'ref_dbs') # simula...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session12/Day3/NotebookIII_part1_intro_to_3d.ipynb
mit
import numpy as np import matplotlib.pyplot as plt """ Explanation: Data, in Python, with THREE Dimensions! Hi! My name's Matt. I'll be working through some things in python with you that I think are cool, and that relate to visualizing things in three dimensions. Libraries We'll Use We're going to use a handful of ...
WNoxchi/Kaukasos
quantum/qaoa_max_cut.ipynb
mit
%matplotlib inline %reload_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt import itertools import networkx as nx from grove.pyqaoa.qaoa import QAOA from grove.pyqaoa.maxcut_qaoa import maxcut_qaoa from pyquil.paulis import PauliSum, PauliTerm from pyquil.gates import H from pyquil.ap...
mne-tools/mne-tools.github.io
0.24/_downloads/0bf55d4c93021947144bdb72823131e5/read_neo_format.ipynb
bsd-3-clause
import neo import mne """ Explanation: How to use data in neural ensemble (NEO) format This example shows how to create an MNE-Python ~mne.io.Raw object from data in the neural ensemble &lt;http://neuralensemble.org/neo/&gt;__ format. For general information on creating MNE-Python's data objects from NumPy arrays, see...
jepegit/cellpy
dev_utils/view_file.ipynb
mit
import cellpy from cellpy.utils import plotutils """ Explanation: Have a look at the data Here are some examples how to get a peak at the data. If we need an interactive plot of the raw-data, we can use the plotutils.raw_plot function. If we would like to see some statistics for some of the cycles, the plotutils.cycle...
cwhanse/pvlib-python
docs/tutorials/solarposition.ipynb
bsd-3-clause
import datetime # scientific python add-ons import numpy as np import pandas as pd # plotting stuff # first line makes the plots appear in the notebook %matplotlib inline import matplotlib.pyplot as plt # finally, we import the pvlib library import pvlib import pvlib from pvlib.location import Location """ Explan...
Kaggle/learntools
notebooks/sql_advanced/raw/tut3.ipynb
apache-2.0
from google.cloud import bigquery # Create a "Client" object client = bigquery.Client() # Construct a reference to the "google_analytics_sample" dataset dataset_ref = client.dataset("google_analytics_sample", project="bigquery-public-data") # Construct a reference to the "ga_sessions_20170801" table table_ref = data...
dsquareindia/gensim
docs/notebooks/WordRank_wrapper_quickstart.ipynb
lgpl-2.1
from gensim.models.wrappers import Wordrank wr_path = 'wordrank' # path to Wordrank directory out_dir = 'model' # name of output directory to save data to data = '../../gensim/test/test_data/lee.cor' # sample corpus model = Wordrank.train(wr_path, data, out_dir, iter=11, dump_period=5) """ Explanation: WordRank wrap...
klavinslab/coral
docs/tutorial/introduction/modules.ipynb
mit
import coral as cor # alternative you can import each module by itself e.g. from coral import design dir(cor) # dir lists everything in a module/object. Ignore the double underscore items. """ Explanation: coral modules coral has 7 modules: analysis, constants, database, design, reaction, seqio, and sequence. The mo...
SSQ/Coursera-UW-Machine-Learning-Classification
Programming Assignment 2/Implementing logistic regression from scratch.ipynb
mit
products = pd.read_csv('amazon_baby_subset.csv') """ Explanation: Load review dataset End of explanation """ products['name'][:10] """ Explanation: 1. listing the name of the first 10 products in the dataset. End of explanation """ print (products['sentiment'] == 1).sum() print (products['sentiment'] == -1).sum()...
vlad17/vlad17.github.io
assets/2020-03-07-subset-isomorphism/subset-isomorphism.ipynb
apache-2.0
import numpy as np np.random.seed(1234) x = np.random.choice(10, replace=False, size=10) s = np.argsort(x) inverse = np.empty_like(s) inverse[s] = np.arange(len(s), dtype=int) np.all(x == inverse) """ Explanation: Numpy Gems, Part 3 Much of scientific computing revolves around the manipulation of indices. Most formula...
scikit-optimize/scikit-optimize.github.io
0.7/notebooks/auto_examples/plots/visualizing-results.ipynb
bsd-3-clause
print(__doc__) import numpy as np np.random.seed(123) import matplotlib.pyplot as plt """ Explanation: Visualizing optimization results Tim Head, August 2016. Reformatted by Holger Nahrstaedt 2020 .. currentmodule:: skopt Bayesian optimization or sequential model-based optimization uses a surrogate model to model the...
zunio/python-recipes
01-loading/.ipynb_checkpoints/[Optimization]Pandas Large Data Optimization-checkpoint.ipynb
apache-2.0
import os import pandas as pd import zipfile !ls with zipfile.ZipFile("..\data\game_logs.csv","r") as zip_ref: zip_ref.extractall("..\data") # Load Data gl = pd.read_csv('..\data\game_logs.csv') # Available also at https://data.world/dataquest/mlb-game-logs # Data Preview gl.head() """ Explanation: Abstract I...
chagaz/ma2823_2016
lab_notebooks/Lab 6 2016-11-04 Tree-based methods.ipynb
mit
import numpy as np %pylab inline # Load the data # TODO # Normalize the data from sklearn import preprocessing X = preprocessing.normalize(X) # Set up a stratified 10-fold cross-validation from sklearn import cross_validation folds = cross_validation.StratifiedKFold(y, 10, shuffle=True) def cross_validate(design_ma...
dynaryu/rmtk
rmtk/vulnerability/derivation_fragility/R_mu_T_no_dispersion/dolsek_fajfar/dolsek_fajfar.ipynb
agpl-3.0
from rmtk.vulnerability.derivation_fragility.R_mu_T_no_dispersion.dolsek_fajfar import DF2004 from rmtk.vulnerability.common import utils %matplotlib inline """ Explanation: Dolsek and Fajfar (2004) This methodology makes use of work by Dolsek and Fajfar (2004) to estimate the inelastic displacement of a SDOF system ...
pgmpy/pgmpy_notebook
notebooks/8. Sampling Algorithms.ipynb
mit
from pgmpy.sampling import HamiltonianMC as HMC """ Explanation: Sampling In Continuous Graphical Models As we know inference is asking conditional probability questions to the models, the exact solution of these problems quickly becomes intractable. Sampling algorithms can be used to get approximate inference results...
gsorianob/fiuba-python
Clase 05 - Manejo de strings y Archivos de texto .ipynb
apache-2.0
cadena_caracteres = "Hola mundo" print dir(cadena_caracteres) """ Explanation: <!-- 29/10 Archivos de texto. Operaciones con cadenas de caracteres. String formaters. CLASE DE LABORATORIO (Gonzalo) --> Manejo de strings Con los strings podemos hacer muchas operaciones: End of explanation """ print 'Hola mundo' pri...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/time_series_prediction/labs/3_modeling_bqml.ipynb
apache-2.0
PROJECT = "your-gcp-project-here" # REPLACE WITH YOUR PROJECT NAME REGION = "us-central1" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1 %env PROJECT = PROJECT REGION = REGION """ Explanation: Time Series Prediction with BQML and AutoML Objectives 1. Learn how to use BQML to create a classification time-series m...
cstrelioff/ARM-ipynb
Chapter3/chptr3.4.ipynb
mit
from __future__ import print_function, division %matplotlib inline import matplotlib import numpy as np import pandas as pd import matplotlib.pyplot as plt # use matplotlib style sheet plt.style.use('ggplot') # import statsmodels for R-style regression import statsmodels.formula.api as smf """ Explanation: 3.4 Stati...