repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
psiq/gdsfactory
notebooks/02_components.ipynb
mit
import pp c = pp.c.mzi() pp.qp(c) c.ports c = pp.c.ring_single_bus() pp.qp(c) """ Explanation: Components We store our component functions inside the pp.components module. Each function there returns a Component object You can use dir or help over the pp.c module to see the all available components. Some of which a...
phuongxuanpham/SelfDrivingCar
CarND-Camera-Calibration/camera_calibration.ipynb
gpl-3.0
import numpy as np import cv2 import glob import matplotlib.pyplot as plt %matplotlib qt # prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0) objp = np.zeros((6*8,3), np.float32) objp[:,:2] = np.mgrid[0:8, 0:6].T.reshape(-1,2) # Arrays to store object points and image points from all the images. objpo...
philmui/datascience2016fall
lecture04.data.wrangling/ch06.ipynb
mit
from __future__ import division from numpy.random import randn import numpy as np import os import sys import matplotlib.pyplot as plt np.random.seed(12345) plt.rc('figure', figsize=(10, 6)) from pandas import Series, DataFrame import pandas as pd np.set_printoptions(precision=4) %pwd """ Explanation: Data loading, s...
0x4a50/udacity-0x4a50-deep-learning-nanodegree
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...
mne-tools/mne-tools.github.io
0.23/_downloads/84d68dbced84793d122fec3a2cf0cde5/source_power_spectrum.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.datasets import sample from mne.minimum_norm import read_inverse_operator, compute_source_psd print(__doc__) """ Explanation: Compute source power spectral d...
ctroupin/OceanData_NoteBooks
PythonNotebooks/PlatformPlots/Read_drifter_data_3.ipynb
gpl-3.0
year = 2015 month = 7 %matplotlib inline import glob import os import netCDF4 import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap from matplotlib import colors """ Explanation: Now that we know how to read the data, we will add some processing to generate a gridded field.<br /...
siva82kb/siva82kb.github.io
.old/notebooks/2018-09-10-Least-Square-Estimation-of-AR-Models-And-Whitening-part-ii.ipynb
gpl-2.0
# AR parameters p = 4 a = 1.0 * np.random.rand(p) - 0.5 print "Original AR parameters:\n", a # Time series data N = 1000 n = np.arange(0, N) # Input white noise eparam = (0, 1.0) e = np.sqrt(eparam[1]) * np.random.randn(N) + eparam[0] # Generate AR time series. y = genARProcess(p, a, eparam, e) """ Explanation: Lea...
mas-dse-greina/neon
dicom/Sanity Check HDF5 DICOM.ipynb
apache-2.0
from neon.data import HDF5Iterator # Neon's HDF5 data loader from neon.backends import gen_backend be = gen_backend(backend='cpu', batch_size=1) outFilename = 'dicom_out.h5' # The name of our HDF5 data file train_set = HDF5Iterator(outFilename) train_set.get_description() train_set.ndata # Number of patients...
dimonaks/siman
tutorials/surface_MC.ipynb
gpl-2.0
from siman import header from siman.calc_manage import add, res, smart_structure_read from siman.geo import create_surface2, ortho_vec, create_supercell from siman.header import db from siman.analysis import suf_en from siman.classes import CalculationVasp from siman.set_functions import read_vasp_sets header.PATH2PO...
agushman/coursera
src/cours_2/week_4/bagging_and_rand_forest.ipynb
mit
from sklearn import datasets, tree, cross_validation, ensemble from sklearn.model_selection import cross_val_score from math import sqrt import numpy as np digits = datasets.load_digits() X = digits.data y = digits.target def write_answer(cross_val_score, file_name): with open(file_name, "w") as fout: ...
materialsvirtuallab/matgenb
notebooks/2017-09-03-Analyze and plot band structures.ipynb
bsd-3-clause
from pymatgen.ext.matproj import MPRester from pymatgen.electronic_structure.core import Spin #This initiliazes the Rest connection to the Materials Project db. Put your own API key if needed. a = MPRester() #load the band structure from mp-3748, CuAlO2 from the MP db bs = a.get_bandstructure_by_material_id("mp-3748") ...
tpin3694/tpin3694.github.io
machine-learning/find_nearest_neighbors.ipynb
mit
# Load libraries from sklearn.neighbors import NearestNeighbors from sklearn import datasets from sklearn.preprocessing import StandardScaler import numpy as np """ Explanation: Title: Find Nearest Neighbors Slug: find_nearest_neighbors Summary: Find a observation's nearest neighbors in scikit-learn. Date: 2017-09-19 ...
amueller/scipy-2017-sklearn
notebooks/23.Out-of-core_Learning_Large_Scale_Text_Classification.ipynb
cc0-1.0
from sklearn.feature_extraction.text import CountVectorizer vectorizer = CountVectorizer(min_df=1) vectorizer.fit([ "The cat sat on the mat.", ]) vectorizer.vocabulary_ """ Explanation: Out-of-core Learning - Large Scale Text Classification for Sentiment Analysis Scalability Issues The sklearn.feature_extraction...
root-mirror/training
SummerStudentCourse/2019/Exercises/ROOTBooks/FittingExample.ipynb
gpl-2.0
import ROOT """ Explanation: Fitting Example End of explanation """ %%cpp -d //Define functions for fitting // Quadratic background function double background(double *x, double *par) { return par[0] + par[1]*x[0] + par[2]*x[0]*x[0]; } // Lorenzian Peak function double lorentzianPeak(double *x, double *par) { r...
jasag/Phytoliths-recognition-system
code/notebooks/Prototypes/Classifiers_and_HoG/4_Test.ipynb
bsd-3-clause
#Imports %matplotlib inline import matplotlib.pyplot as plt from skimage.exposure import rescale_intensity from skimage import io, feature from skimage.transform import rescale from skimage.color import rgb2gray import windows """ Explanation: Probando con nuevas imágenes Realizamos los imports correspondientes End of...
evanmiltenburg/python-for-text-analysis
Assignments-colab/ASSIGNMENT_4b_BA.ipynb
apache-2.0
%%capture !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Data.zip !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/images.zip !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Extra_Material.zip !unzip Data.zip -d ../ !unzip images.zip -d ./ !unzip Ext...
mtat76/atm-py
examples/instruments_POPS_calibration.ipynb
mit
data = """130 1.73 140 1.85 150 1.99 173 2.28 200 2.53 233 2.77 270 2.96 315 3.04 365 3.165 420 3.213 490 3.355 570 3.56 660 3.72 770 3.795 890 3.86 1040 4.0 1200 4.05 1400 4.1 1600 4.18 1880 4.32 2180 4.44 2500 4.5""" cal = calibration.read_str(data) """ Explanation: How to use it Read and save Data This section sho...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_dics_beamformer.ipynb
bsd-3-clause
# Author: Roman Goj <roman.goj@gmail.com> # # License: BSD (3-clause) import mne import matplotlib.pyplot as plt import numpy as np from mne.datasets import sample from mne.time_frequency import csd_epochs from mne.beamformer import dics print(__doc__) data_path = sample.data_path() raw_fname = data_path + '/MEG/s...
dsacademybr/PythonFundamentos
Cap06/Notebooks/DSA-Python-Cap06-09-Mini-Projeto1.ipynb
gpl-3.0
# Versão da Linguagem Python from platform import python_version print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version()) """ Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 6</font> Download: http://github.com/dsacademybr Mini-Projeto 1 - Guia de Análise...
tensorflow/docs-l10n
site/ko/tutorials/distribute/input.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...
jakobkolb/MayaSim
Evaluation_Notebooks/X8_long_term_dynamics.ipynb
gpl-3.0
%pylab inline pylab.rcParams['figure.figsize'] = (14, 6) import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl d_start = 150 d_length = 20 testing = False location = '/home/jakob/Project_MayaSim/Python/output_data/X8_longterm_dynamics/results/trajectory' if testing: loc...
AaronCWong/phys202-2015-work
assignments/midterm/AlgorithmsEx03.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np from IPython.html.widgets import interact """ Explanation: Algorithms Exercise 3 Imports End of explanation """ def char_probs(s): l = len(s) dic = {l} for i in l: prob = i/l """Find the probabilitie...
min2bro/WebScraping
.ipynb_checkpoints/WebScrapingnDataAnalysis-checkpoint.ipynb
mit
%matplotlib inline from selenium import webdriver import time,re,json,numpy as np import pandas as pd from collections import defaultdict,Counter import matplotlib.pyplot as plt """ Explanation: Web Scraping & Data Analysis with Selenium and Python Vinay Babu Github: https://github.com/min2bro/WebScraping/blob/master...
Elixeus/NLP
deep_learning/word2vec.ipynb
mit
import numpy as np import tensorflow as tf """ Explanation: I followed along Aneesh Joshi's blog post on word2vec in this notebook. End of explanation """ # load data with open('darksouls_training.txt', 'r') as fh: training = [sent.replace('.','').replace('\n', '').lower() for sent in fh.readlines()] # with open...
linglaiyao1314/maths-with-python
02-programs.ipynb
mit
import math x = math.sin(1.2) """ Explanation: Programs Using the Python console to type in commands works fine, but has serious drawbacks. It doesn't save the work for the future. It doesn't allow the work to be re-used. It's frustrating to edit when you make a mistake, or want to make a small change. Instead, we wan...
JAmarel/QLab
ZeemanEffect/DataAnalysis.ipynb
mit
Currents = np.array([0, 0.49, 0.98, 1.5, 1.98, 2.48, 2.99, 3.61, 3.97, 4.48, 5.02, 5.49, 6.04, 6.44, 6.98, 7.46, 8.02]) #Amps Fields = np.array([0.3, 149, 302.3, 470.4, 623.2, 789, 949.2, 1143.5, 1245.8, 1408.2, 1571.5, 1679, 1802.8, 1879.4, 1963.5, 2028.2, 2096.2]) #Gauss """ Explanation: Determin...
tiagotaveiragomes/ode
Ordinary Differential Equations.ipynb
apache-2.0
def rungekutta(fn, y0, ti=0, tf=10, h=0.01): h = np.float(h) x = np.arange(ti, tf, h) Y = np.zeros((len(x), len(y0))) Y[0] = y0 for i in range(0, len(x)-1): yi = Y[i] xi = x[i] k1 = h * fn(xi, yi) k2 = h * fn(xi + 0.5 * h, yi + 0.5 * k1) ...
zchq88/MyUdacityDeepLearningProject
3/dlnd_tv_script_generation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper data_dir = './data/simpsons/moes_tavern_lines.txt' text = helper.load_data(data_dir) # Ignore notice, since we don't use it for analysing the data text = text[81:] """ Explanation: TV Script Generation In this project, you'll generate your own Simpsons TV scrip...
perwin/s4g_barfractions
s4gbars_main.ipynb
bsd-3-clause
import numpy as np import scipy import datautils as du import plotutils as pu import s4gutils # paths for locating data, saving plots, etc. dataDir = "./data/" simDir = dataDir fbarLitDir = dataDir + "f_bar_trends-from-literature/" # change the following if you want to save the figures somewhere convenient baseDir = ...
maartenbreddels/vaex
docs/source/example_graphql.ipynb
mit
import vaex.ml df = vaex.ml.datasets.load_titanic() df result = df.graphql.execute(""" { df { min { age fare } mean { age fare } max { age fare ...
dsager/research
projects/keyword-corpus/Keyword corpus for company names.ipynb
mit
import os from sqlalchemy import create_engine host = os.environ.get('KW_DB_HOST', 'localhost') user = os.environ.get('KW_DB_USER', 'me') password = os.environ.get('KW_DB_PASS', 'somepassword') engine = create_engine('postgresql://{}:{}@{}/neo_production'.format(user, password, host)) """ Explanation: Keyword corpus...
ES-DOC/esdoc-jupyterhub
notebooks/nerc/cmip6/models/ukesm1-0-ll/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nerc', 'ukesm1-0-ll', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: NERC Source ID: UKESM1-0-LL Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, ...
BrainIntensive/OnlineBrainIntensive
resources/matplotlib/AnatomyOfMatPlotLib/AnatomyOfMatplotlib-Part0-Intro2NumPy.ipynb
mit
import numpy as np """ Explanation: NumPy The NumPy package provides the "ndarray" object. The NumPy array is used to contain data of uniform type with an arbitrary number of dimensions. NumPy then provides basic mathematical and array methods to lay down the foundation for the entire SciPy ecosystem. The following im...
ML4DS/ML4all
TM3.Topic_Models_with_MLlib/ExB3_TopicModels/.ipynb_checkpoints/TM_Exam_Solution-checkpoint.ipynb
mit
%matplotlib inline import nltk import time import matplotlib.pyplot as plt import pylab # import nltk from nltk.tokenize import word_tokenize from nltk.stem import WordNetLemmatizer from nltk.corpus import stopwords #from test_helper import Test import collections from pyspark.mllib.clustering import LDA, LDAMode...
kidpixo/multibinner
examples/iris_multibinner.ipynb
mit
import matplotlib from matplotlib import pyplot as plt %matplotlib inline import numpy as np import pandas as pd import collections import multibinner as mb """ Explanation: Multibinner The problem I want to solve is: I have a huge pandas.DataFrame and I want to rebin some columns and get the oupt of custom function...
robertoalotufo/ia898
src/gshow.ipynb
mit
import numpy as np def gshow(f, X1=None, X2=None, X3=None, X4=None, X5=None, X6=None): if f.dtype == np.bool: f = np.where(f,255,0).astype('uint8') r = f g = f b = f if X1 is not None: # red 1 0 0 if (X1.dtype != np.bool): raise Exception('X1 must be bina...
musketeer191/job_analytics
preprocess.ipynb
gpl-3.0
import my_util as my_util; from my_util import * """ Explanation: Preparations Import libraries: End of explanation """ HOME_DIR = 'd:/larc_projects/job_analytics/' DATA_DIR = HOME_DIR + 'data/clean/' # job descriptions (JDs) init_posts = pd.read_csv(DATA_DIR + 'jd_df.csv') skill_df = pd.read_csv(DATA_DIR + 'skil...
igmhub/pyLyA
tutorials/QA_plots.ipynb
gpl-3.0
import os import glob import h5py import fitsio import healpy import matplotlib.pyplot as plt from matplotlib.pyplot import rcParams import scipy as sp import scipy.stats from scipy.interpolate import interp1d from picca import wedgize %matplotlib inline rcParams['figure.figsize'] = 10, 6 rcParams['lines.linewidth'] ...
ageron/ml-notebooks
07_ensemble_learning_and_random_forests.ipynb
apache-2.0
# To support both python 2 and python 3 from __future__ import division, print_function, unicode_literals # Common imports import numpy as np import os # to make this notebook's output stable across runs np.random.seed(42) # To plot pretty figures %matplotlib inline import matplotlib as mpl import matplotlib.pyplot ...
sytays/openanalysis
doc/Langauge/02-Formatting Output.ipynb
gpl-3.0
'8 = %d , 8.5 = %.1f, name = %s, 3 = %04d' % (8, 8.5, 'Ravi', 3) """ Explanation: Formatting Output In C Language, we had printf() function to display a formatted string to stdout. We also had format specifiers like %s for string, %d for integers and so on... In Python, there are many ways to format a string, We shall...
tuanavu/python-cookbook-3rd
notebooks/ch01/02_unpacking_elements_from_iterables_of_arbitrary_length.ipynb
mit
record = ('Dave', 'dave@example.com', '773-555-1212', '847-555-1212') name, email, *phone_numbers = record print (name) print (email) print (phone_numbers) """ Explanation: Unpacking Elements from Iterables of Arbitrary Length Problem You need to unpack N elements from an iterable, but the iterable may be longer tha...
mrcslws/nupic.research
projects/archive/dynamic_sparse/notebooks/ExperimentAnalysis-ReplicateHSD-8x.ipynb
agpl-3.0
%load_ext autoreload %autoreload 2 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import glob import tabulate import pprint import click import numpy as np import pandas as pd from ray.tune.commands import * from nupic.research.frameworks.dynamic...
yevheniyc/C
1t_DataAnalysisMLPython/1j_ML/DS_ML_Py_SBO/DataScience/1_Mean_Midean_Mode/MeanMedianMode.ipynb
mit
import numpy as np incomes = np.random.normal(27000, 15000, 10000) # (center around, stdev, population ) np.mean(incomes) # calculate mean """ Explanation: Mean, Median, Mode, and introducing NumPy Mean vs. Median Let's create some fake income data, centered around 27,000 with a normal distribution and standard devia...
davidzchen/tensorflow
tensorflow/lite/g3doc/performance/post_training_quant.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under...
ES-DOC/esdoc-jupyterhub
notebooks/cmcc/cmip6/models/sandbox-2/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cmcc', 'sandbox-2', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: CMCC Source ID: SANDBOX-2 Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, Radi...
GoogleCloudPlatform/data-analytics-golden-demo
notebooks/BigQuery-Demo-Notebook.ipynb
apache-2.0
from google.cloud import bigquery import pandas client = bigquery.Client() """ Explanation: Use Cases: - Data Scientists need access to data in your data warehouse. BigQuery makes this extremely easy. Description: - BigQuery provides a magic keyword ```%%bigquery``` used for executing queries to view the results or ...
madmax983/h2o-3
h2o-py/demos/turbofan_phm_gtkerror_NOPASS.ipynb
apache-2.0
import sys import h2o from h2o.estimators.glm import H2OGeneralizedLinearEstimator from h2o.estimators.gbm import H2OGradientBoostingEstimator from h2o.h2o import _locate import numpy as np import pandas as pd import seaborn as sns import pykalman as pyk sns.set() doGridSearch = True doKalmanSmoothing = False #unrel...
jvitria/DeepLearningBBVA2016
1. Basic Concepts I.ipynb
mit
import warnings warnings.filterwarnings('ignore') import numpy as np import seaborn as sns import bokeh.plotting as bp import matplotlib.pyplot as plt from sklearn.datasets.samples_generator import make_regression from scipy import stats from bokeh.models import WheelZoomTool, ResetTool, PanTool %matplotlib inline ...
sudhanshuptl/Machine-Learning
Kaggle/Titanic/Life_Predictor.ipynb
gpl-2.0
import pandas as pd import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score from sklearn.preprocessing import normalize import random test=pd.read_csv("test.csv") test.head() mData=pd.read_csv("train.csv") mData.head() mData = mData.drop(["PassengerId","Name"...
drericstrong/Blog
20161207_AbalonePart1.ipynb
agpl-3.0
import pandas as pd import numpy as np import seaborn as sns from scipy import stats import matplotlib.pyplot as plt from sklearn import linear_model from sklearn.metrics import r2_score, mean_absolute_error from sklearn.model_selection import train_test_split %matplotlib inline #Load the data from the CSV file abalone...
mdiaz236/DeepLearningFoundations
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...
whitead/numerical_stats
unit_11/hw_2018/Homework_11_Key.ipynb
gpl-3.0
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Homework 11 Key CHE 116: Numerical Methods and Statistics 4/12/2018 Homework Requirements: Write all equations in $\LaTeX$ Simplify all expressions Put comments in your Python code Explain or show your...
noammor/noammor.github.io
ipy/str-join-benchmark.ipynb
apache-2.0
from time import time import numpy as np import matplotlib.pyplot as plt from collections import deque import random %matplotlib inline def benchmark(counts): def times(f): def ret(): timings = [] for c in counts: start = time() f(c) t...
no-fire/line-follower
line-follower/src/v1_recurrent_postprocessing/LSTM Postprocessor v1.ipynb
mit
#Create references to important directories we will use over and over import os, sys DATA_HOME_DIR = '/home/nathan/olin/spring2017/line-follower/line-follower/data' #import modules import numpy as np from glob import glob from PIL import Image from tqdm import tqdm import bcolz from matplotlib import pyplot as plt im...
boffi/boffi.github.io
dati_2018/wt03/Continuous.ipynb
mit
from sympy import * init_printing(use_latex=True) from IPython.display import Latex %matplotlib inline """ Explanation: Continuous System Imports, stuff End of explanation """ x, w2 = symbols('x omega^2') L, m, EJ = symbols('L m EJ', positive = True) A, B, C, D, ld, LD = symbols('A B C D lambda Lambda') f, φ = symbo...
sripaladugu/sripaladugu.github.io
ipynb/OOP Concepts.ipynb
mit
class Employee: emp_count = 0 # Class Variable company = 'Google' # Class Variable def __init__(self, fname, lname): self.fname = fname self.lname = lname self.email = self.fname + '.' + self.lname + '@' + self.company + '.com' Employee.emp_count += 1 def get_fu...
statkraft/shyft-doc
notebooks/grid-pp/gridpp_simple.ipynb
lgpl-3.0
# first you should import the third-party python modules which you'll use later on # the first line enables that figures are shown inline, directly in the notebook %pylab inline import os from os import path import sys from matplotlib import pyplot as plt # once the shyft_path is set correctly, you should be able to i...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch6-Problem_6-04.ipynb
unlicense
%pylab notebook """ Explanation: Excercises Electric Machinery Fundamentals Chapter 6 Problem 6-4 End of explanation """ fse = 50.0 # [Hz] p = 2 Pout = 50e3 # [W] s = 5e-2 Pfw = 700.0 # [W] Pcore = 600.0 # [W] Pmisc = 0.0 # [W] """ Explanation: Description A 50-kW, 460-V, 50-Hz, two-pole induction ...
DB2-Samples/db2jupyter
Db2 Jupyter Macros.ipynb
apache-2.0
%run db2.ipynb """ Explanation: Db2 Macros The %sql command also allows the use of macros. Macros are used to substitute text into SQL commands that you execute. Macros substitution is done before any SQL is executed. This allows you to create macros that include commonly used SQL commands or parameters rather than ha...
lilleswing/deepchem
examples/tutorials/01_The_Basic_Tools_of_the_Deep_Life_Sciences.ipynb
mit
!curl -Lo conda_installer.py https://raw.githubusercontent.com/deepchem/deepchem/master/scripts/colab_install.py import conda_installer conda_installer.install() !/root/miniconda/bin/conda info -e !pip install --pre deepchem """ Explanation: Tutorial 1: The Basic Tools of the Deep Life Sciences Welcome to DeepChem's ...
phoebe-project/phoebe2-docs
development/tutorials/t0s.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.4,<2.5" """ Explanation: Various t0s Setup Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab). End of explanation """ import phoebe from phoebe import u # units import numpy as np import mat...
joetrollo/thinkful-library
linear-regression/workshop notes.ipynb
gpl-3.0
import numpy as np import pandas as pd import matplotlib from matplotlib import pyplot as plt %matplotlib inline """ Explanation: This workshop walks through the assignment for the accompanying course, Linear Regression and a Space Scam, focusing on the background behind linear regression and performing hypothesis tes...
PMEAL/OpenPNM
examples/reference/data_management/using_and_creating_labels.ipynb
mit
import openpnm as op %config InlineBackend.figure_formats = ['svg'] import numpy as np """ Explanation: Using and Creating Labels Labels are a way to 'bookmark' certain pores for easier lookup later, such as specifying boundary conditions. When networks are generated they include a set of relevent labels that have be...
mne-tools/mne-tools.github.io
0.20/_downloads/e1c688e612e75986f5dc98445428685b/plot_mne_inverse_coherence_epochs.ipynb
bsd-3-clause
# Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.minimum_norm import (apply_inverse, apply_inverse_epochs, read_inverse_operator) from mne.connectivity import seed_target_indices, spec...
SBRG/ssbio
docs/notebooks/GEM-PRO - Calculating Protein Properties.ipynb
mit
import sys import logging # Import the GEM-PRO class from ssbio.pipeline.gempro import GEMPRO # Printing multiple outputs per cell from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" """ Explanation: GEM-PRO - Calculating Protein Properties This notebook gives a...
TeamHG-Memex/eli5
notebooks/explain_text_prediction.ipynb
mit
show_html_expl(explain_prediction(clf, test['data'][2], vec, target_names=train['target_names']), force_weights=True) """ Explanation: dense_multitarget=True is supported for prediction explanations too, and shows just the top prediction highlighting. End of explanation """ show_html_expl(explain_pred...
nick-youngblut/SIPSim
ipynb/theory/standard_vs_our_conditions.ipynb
mit
import numpy as np %load_ext rpy2.ipython %%R library(ggplot2) library(dplyr) """ Explanation: Description Determining how differences in our isopycnic cfg conditions vary in meaningful ways from those of Clay et al., 2003. Eur Biophys J Needed to determine whether the Clay et al., 2003 function describing diffusio...
mne-tools/mne-tools.github.io
0.22/_downloads/3927e2933ae8d1b19effcbd5c5341bd0/plot_20_visualize_evoked.ipynb
bsd-3-clause
import os import numpy as np import mne """ Explanation: Visualizing Evoked data This tutorial shows the different visualization methods for ~mne.Evoked objects. :depth: 2 As usual we'll start by importing the modules we need: End of explanation """ sample_data_folder = mne.datasets.sample.data_path() sample_data...
balarsen/pymc_learning
2014_07_18b_pymc_nonlinear_model_example.ipynb
bsd-3-clause
# set random seed for reproducibility np.random.seed(12345) x = np.arange(5,400,10)*1e3 # Parameters for gaussian amp_true = 0.2 size_true = 1.8 ps_true = 0.1 # Gaussian function gauss = lambda x,amp,size,ps: amp*np.exp(-1*(np.pi**2/(3600.*180.)*size*x)**2/(4.*np.log(2.)))+ps f_true = gauss(x=x,amp=amp_true, size=si...
SunPower/pvfactors
docs/tutorials/Run_fast_simulations.ipynb
bsd-3-clause
# Import external libraries import os import numpy as np import matplotlib.pyplot as plt from datetime import datetime import pandas as pd import warnings # Settings %matplotlib inline np.set_printoptions(precision=3, linewidth=300) warnings.filterwarnings('ignore') # Paths LOCAL_DIR = os.getcwd() DATA_DIR = os.path.j...
google-research/google-research
dvrl/main_corrupted_sample_discovery.ipynb
apache-2.0
# Uses pip3 to install necessary package (lightgbm) !pip3 install lightgbm # Resets the IPython kernel to import the installed package. import IPython app = IPython.Application.instance() app.kernel.do_shutdown(True) import os from git import Repo # Current working directory repo_dir = os.getcwd() + '/repo' if no...
wittawatj/interpretable-test
ipynb/ume_test.ipynb
mit
%load_ext autoreload %autoreload 2 %matplotlib inline import autograd.numpy as np import matplotlib import matplotlib.pyplot as plt import freqopttest.util as util import freqopttest.data as data import freqopttest.kernel as kernel import freqopttest.tst as tst import freqopttest.glo as glo # font options font = { ...
tensorflow/federated
docs/tutorials/federated_select.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...
tensorflow/recommenders
docs/examples/dcn.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...
bryantbiggs/movie_torrents
Test_Analysis2.ipynb
mit
df = pd.read_csv('data/test_data2.csv', encoding='latin-1') print(len(df)) df.head() """ Explanation: Read in TRAIN data set and select pertinent columns End of explanation """ df['Released'] = pd.to_datetime(df['Released']) df['Year'] = pd.DatetimeIndex(df['Released']).year df['Month'] = pd.DatetimeIndex(df['Releas...
dwiel/deepfreq
backup.ipynb
mit
y.shape[0], 44100 * 60 """ Explanation: y is roughly 44100 samples/second * 60 seconds. I'm not sure why its off by 16 ... End of explanation """ # roughly matches 5169 above print D.shape print len(y)/2048. * 4. # windows are roughly 11ms long 1000/(5169/60.) # D has twice as many values as y float(D.shape[0] * ...
Upward-Spiral-Science/the-fat-boys
docs/Team Fatboys 5 Updates Fixed Report Part 2.ipynb
apache-2.0
import pickle raw_data = pickle.load(open('raw_data')) import statsmodels.api as sm synapsin1_raw = np.array(raw_data[1])[0:1119259] synapsin2_raw = np.array(raw_data[2])[0:1119259] sub_sample = np.random.permutation(len(synapsin2_raw))[1:1000] filter1 = synapsin1 > 15 synapsin1_raw_out = synapsin1_raw[filter1] densi...
Zsailer/PyCourses
notebooks/Lesson 1.ipynb
bsd-3-clause
from matplotlib.pyplot import * """ Explanation: Lesson 1: Let's load, plot, and analyze your data! Let me introduce you to Matplotlib, Python's most popular plotting package. If you have used or seen Matlab before, you'll notice it has a similar style. It produces high quality 2d plots (and 3D extensions), and can m...
soloman817/udacity-ml
notebooks/linear_regression.ipynb
mit
%matplotlib inline import random import numpy as np import matplotlib.pyplot as plt import pandas as pd from matplotlib import animation, rc from sklearn.linear_model import LinearRegression from IPython.display import HTML """ Explanation: Partial derivative equations A linear equation is defined as: $$ y(x_{0},x_{1}...
JKeun/lecture-statistics
.ipynb_checkpoints/ch14-correlation-analysis-and-regression-basic-checkpoint.ipynb
mit
import matplotlib.pylab as plt X = [10, 20, 30, 40, 50, 60, 70] y = [40, 45, 50, 65, 70, 70, 80] plt.figure(figsize=(4, 2)) plt.scatter(X, y) plt.xlabel("training time"); plt.ylabel("productivity") plt.show() """ Explanation: Ch14. 상관분석과 회귀분석의 기초 상관분석은 두 변수 간의 관계의 강도, 즉 얼마나 밀접하게 관려되어 있는지를 분석하는 것을 말한다. 그러나 때로는 관련성뿐만 ...
CivicKnowledge/metatab-packages
sandiego.gov/sandiego.gov-police_calls-2015e/notebooks/San Diego Police Calls For Service.ipynb
mit
%matplotlib inline import metapack as mp import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import geopandas as gpd """ Explanation: San Diego Police Calls For Service Eric Busboom, 7 Nov 2017 In preparation for the SCALE and Open San Diego Crime ANalysis Presentation, I downloaded the data pac...
google/earthengine-community
tutorials/intro-to-python-api/index.ipynb
apache-2.0
import ee # Trigger the authentication flow. ee.Authenticate() # Initialize the library. ee.Initialize() """ Explanation: An Intro to the Earth Engine Python API Author: guiattard Within the last decade, a large amount of geospatial data, such as satellite data (e.g. land surface temperature, vegetation) or the outp...
james-prior/cohpy
20150223-cohpy-memoization.ipynb
mit
from __future__ import print_function """ Explanation: This is based on the previous dojo-20150131-memoization notebook. End of explanation """ def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1) + fib(n-2) """ Explanation: We start with a function that ca...
nproctor/phys202-2015-work
assignments/assignment05/MatplotlibEx03.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 3 Imports End of explanation """ def well2d(x, y, nx, ny, L=1.0): sine1 = np.sin(nx*np.pi*x/L) sine2 = np.sin(ny*np.pi*y/L) eq = 2/L * sine1 * sine2 return(eq) psi = well2d(np.linspace(0,1,10),...
tommyod/KDEpy
docs/source/introduction.ipynb
gpl-3.0
import numpy as np from scipy.stats import norm import matplotlib.pyplot as plt from KDEpy import FFTKDE # Fastest 1D algorithm np.random.seed(123) # Seed generator for reproducible results distribution = norm() # Create normal distribution data = distribution.rvs(32) # Draw 32 random samples """ Explanation: In...
ES-DOC/esdoc-jupyterhub
notebooks/inm/cmip6/models/sandbox-1/landice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'inm', 'sandbox-1', 'landice') """ Explanation: ES-DOC CMIP6 Model Properties - Landice MIP Era: CMIP6 Institute: INM Source ID: SANDBOX-1 Topic: Landice Sub-Topics: Glaciers, Ice. Properties: 3...
nicoguaro/FEM_resources
variational/poly_ritz.ipynb
mit
%matplotlib notebook import numpy as np from scipy.linalg import eigh from sympy import (symbols, lambdify, init_printing, cos, sin, pi, expand, Matrix, diff, integrate, Poly) from sympy.plotting import plot3d from sympy.utilities.lambdify import lambdify import matplotlib.pyplot as plt from mpl_to...
srcole/qwm
misc/Slope change by low frequency aliasing.ipynb
mit
%config InlineBackend.figure_format = 'retina' %matplotlib inline import numpy as np import scipy as sp from scipy import signal import matplotlib.pyplot as plt import seaborn as sns sns.set_style('white') """ Explanation: Low frequency content biases spectral slope only for long windows Scott Based on Figure 1 of p...
boffi/boffi.github.io
dati_2019/05/2DOF.ipynb
mit
k0, m0 = 1.0, 1.0 # ideally, dimensional units... w20 = k0/m0 w0 = np.sqrt(w20) k1, k2 = 2*k0, 3*k0 m1, m2 = 2*m0, 4*m0 M = np.array(((m1, 0), ( 0, m2))) K = np.array(((k1+k2, -k2), (-k2, k2))) p = np.array(( 0.0, 1.0)); w = 2.0*w0 print_mat(M, pre='\\boldsymbol{M}=m\\,', fmt='%d') print_mat(K, pre='\\boldsymbol{K}...
tritemio/multispot_paper
out_notebooks/usALEX-5samples-PR-raw-dir_ex_aa-fit-out-AexAem-7d.ipynb
mit
ph_sel_name = "AexAem" data_id = "7d" # ph_sel_name = "all-ph" # data_id = "7d" """ Explanation: Executed: Mon Mar 27 11:37:51 2017 Duration: 8 seconds. usALEX-5samples - Template This notebook is executed through 8-spots paper analysis. For a direct execution, uncomment the cell below. End of explanation """ fro...
cliburn/sta-663-2017
notebook/13E_SparseMatrices.ipynb
mit
%matplotlib inline import numpy as np import pandas as pd from scipy import sparse import scipy.sparse.linalg as spla import matplotlib.pyplot as plt import seaborn as sns sns.set_context('notebook', font_scale=1.5) """ Explanation: Sparse Matrices End of explanation """ A = np.random.poisson(0.2, (5,15)) * np.rand...
machinelearningnanodegree/stanford-cs231
solutions/vijendra/assignment2/BatchNormalization.ipynb
mit
# As usual, a bit of setup 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.solver import Solver %matplotlib inline ...
machow/siuba
docs/backends.ipynb
mit
# pandas fast grouped implementation ---- from siuba.data import cars from siuba import _ from siuba.experimental.pd_groups import fast_mutate, fast_filter, fast_summarize fast_mutate( cars.groupby('cyl'), avg_mpg = _.mpg.mean(), # aggregation hp_per_mpg = _.hp / _.mpg, # elementwise ...
pligor/predicting-future-product-prices
02_preprocessing/exploration01-linear_regression.ipynb
agpl-3.0
def getModel(alpha): return Ridge(alpha=alpha, fit_intercept=True, normalize=False, copy_X=True, random_state=random_state) model = getModel(alpha=0.01) cvs = cross_val_score(estimator=model, X=XX, y=yy, cv=10) cvs cv_score = np.mean(cvs) cv_score def gpOptimization(n_jobs=n_jobs, cv=10, verbose=True): ...
zzsza/Datascience_School
16. 과최적화와 정규화/03. 정규화 선형 회귀.ipynb
mit
np.random.seed(0) n_samples = 30 X = np.sort(np.random.rand(n_samples)) y = np.cos(1.5 * np.pi * X) + np.random.randn(n_samples) * 0.1 dfX = pd.DataFrame(X, columns=["x"]) dfX = sm.add_constant(dfX) dfy = pd.DataFrame(y, columns=["y"]) df = pd.concat([dfX, dfy], axis=1) model = sm.OLS.from_formula("y ~ x + I(x**2) + ...
HNoorazar/PyOpinionGame
Two_Topics_Coupling_example.ipynb
gpl-3.0
import numpy as np import pandas as pd from pandas import Series, DataFrame import matplotlib.pyplot as plt import matplotlib.animation as animation import matplotlib.image as mpimg from matplotlib import rcParams import seaborn as sb """ Explanation: Opinion Game - Two Coupled Topics in the network These codes were ...
Kaggle/learntools
notebooks/data_viz_to_coder/raw/ex3.ipynb
apache-2.0
import pandas as pd pd.plotting.register_matplotlib_converters() import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns print("Setup Complete") """ Explanation: In this exercise, you will use your new knowledge to propose a solution to a real-world scenario. To succeed, you will need to import data ...
mit-crpg/openmc
examples/jupyter/hexagonal-lattice.ipynb
mit
%matplotlib inline import openmc fuel = openmc.Material(name='fuel') fuel.add_nuclide('U235', 1.0) fuel.set_density('g/cm3', 10.0) fuel2 = openmc.Material(name='fuel2') fuel2.add_nuclide('U238', 1.0) fuel2.set_density('g/cm3', 10.0) water = openmc.Material(name='water') water.add_nuclide('H1', 2.0) water.add_nuclide...
KhanSuleyman/tuthpc
mpi.ipynb
bsd-3-clause
%%file hellompi.py """ Parallel Hello World """ from mpi4py import MPI import sys size = MPI.COMM_WORLD.Get_size() rank = MPI.COMM_WORLD.Get_rank() name = MPI.Get_processor_name() sys.stdout.write( "Hello, World! I am process %d of %d on %s.\n" % (rank, size, name)) """ Explanation: MPI and cluster computi...
zakandrewking/cobrapy
documentation_builder/gapfilling.ipynb
lgpl-2.1
import cobra.test from cobra.flux_analysis import gapfill model = cobra.test.create_test_model("salmonella") """ Explanation: Gapfillling Model gap filling is the task of figuring out which reactions have to be added to a model to make it feasible. Several such algorithms have been reported e.g. Kumar et al. 2009 and ...