repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
atreyv/atom-phys
patterns - ipython example tutorial.ipynb
gpl-3.0
%matplotlib inline from libpatternsworkflow import * from __future__ import division mpl.rc('font', size=14) mpl.rcParams['figure.figsize'] = (16.0, 8.0) """ Explanation: Import all necessary libraries. Libpatterns imports libphys as well End of explanation """ dsave = '/home/pedro/Dropbox/PhD at Strathclyde/Thesis/...
Zhenxingzhang/AnalyticsVidhya
Articles/Ridge_Lasso_Regression/Ridge_Lasso_Regression.ipynb
apache-2.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline from matplotlib.pylab import rcParams rcParams['figure.figsize'] = 12, 10 import random """ Explanation: Ridge & Lasso Regression Tutorial Ridge and Lasso regression are techniques used for preventing overfitting. Before going i...
peterwittek/open_science_tutorial
Symbolic calculations and functional programming.ipynb
gpl-3.0
%quickref """ Explanation: The notebook interface The IPython -- being rebranded as Jupyter -- notebook interface is becoming a standard for a number of languages other than Python: Julia, Scala, R, Haskell, bash are all getting their kernels in IPython. Since Python allows you to call MATLAB anyway, you can also use ...
BerryAI/Acai
examples/tutorial.ipynb
mit
try: import OpenMRS as om except: # At this point, you probably haven't installed OpenMRS. You can install it by: # sudo pip install git+https://github.com/BerryAI/Acai # Now we are going to import OpenMRS from the source. # Note: This assumes you are currently in the 'examples/' folder running th...
jpwhite3/python-analytics-demo
Part_1.ipynb
cc0-1.0
from __future__ import division, unicode_literals import pandas as pd import numpy as np import glob import warnings import calendar warnings.filterwarnings("ignore") """ Explanation: 1.) Import the modules we will need End of explanation """ glob.glob('./input/sales-*.xlsx') """ Explanation: 2.) Take a look at the...
PWhiddy/kbmod
notebooks/kbmod_demo-Copy1.ipynb
bsd-2-clause
import numpy as np import matplotlib.pyplot as plt import subprocess %matplotlib inline %load_ext autoreload %autoreload 2 """ Explanation: KBMOD Demo The purpose of this demo is to showcase how KBMOD can be used to search through images for moving objects. The images used here are from the Subaru telescope and were p...
ComputationalModeling/spring-2017-danielak
past-semesters/spring_2016/day-by-day/day16-analyzing-tweets-with-string-processing/In-Class-Strings-SOLUTION.ipynb
agpl-3.0
%matplotlib inline import matplotlib.pyplot as plt from string import punctuation """ Explanation: Day 16 In-class assignment: Data analysis and Modeling in Social Sciences Part 3 The first part of this notebook is a copy of a blog post tutorial written by Dr. Neal Caren (University of North Carolina, Chapel Hill). Th...
xpmethod/middlemarch-critical-histories
old/e1/e1b-analysis.ipynb
gpl-3.0
import pandas as pd %matplotlib inline from ast import literal_eval import numpy as np import re import json from nltk.corpus import names from collections import Counter from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [16, 6] plt.style.use('ggplot') with open('../middlemarch.txt') as f: mm ...
michigraber/neuralyzer
notebooks/doc/DataHandlingUtilities.ipynb
mit
%%bash build_tiff_stack.py --help """ Explanation: Data Handling Utilities tiff file directory to tiff stack conversion A utility script that can be executed from the command line to convert tif files in a directory into a tif stack: End of explanation """ %%bash extract_channels_from_raw.py --help """ Explanation:...
emjotde/UMZ
Cwiczenia/01/Uczenie Maszynowe - Ćwiczenia 1.3 - NumPy, algebra liniowa.ipynb
cc0-1.0
import numpy as np x = np.array([[1,2,3]]).T xt = x.T x.shape xt.shape """ Explanation: 1.3 NumPy - Algebra liniowa NumPy jest pakietem szczególnie przydatnym do obliczeń w dziedzinie algebry liniowej. W uczeniu maszynowym algebra liniowa będzie miała duże znaczenie. Wektor o wymiarach $1 \times N$ $$ X = \...
alexandonian/lightning
Basic-Usage.ipynb
apache-2.0
imcontroller = ImageController(demo.image_info) demo.image_info.items() """ Explanation: Let's see the ImageController in action: Since we don't have a database up and running, we will pass the ImageController the information it needs manually. As soon as the database is set up, the Provider will make queries to the d...
kjlawlor/intro-numerical-methods
1_intro_to_python.ipynb
mit
2 + 2 32 - (4 + 2)**2 1 / 2 """ Explanation: Discussion 1: Introduction to Python So you want to code in Python? We will do some basic manipulations and demonstrate some of the basics of the notebook interface that we will be using extensively throughout the course. Topics: - Math - Variables - Lists - Control...
jeffzhengye/pylearn
google_cloud/.ipynb_checkpoints/google_cloud-checkpoint.ipynb
unlicense
# check firewall !rm index.html* !wget www.google.com import uuid from google.cloud import dialogflow # session format: 'projects/*/locations/*/agent/environments/*/users/*/sessions/*'. def get_session(project_id, session_id, env=None): """ Using the same `session_id` between requests allows continuation ...
wuafeing/Python3-Tutorial
02 strings and text/02.02 match text at start end.ipynb
gpl-3.0
filename = "spam.txt" filename.endswith(".txt") filename.startswith("file:") url = "http://www.python.org" url.startswith("http:") """ Explanation: Previous 2.2 字符串开头或结尾匹配 问题 你需要通过指定的文本模式去检查字符串的开头或者结尾,比如文件名后缀,URL Scheme 等等。 解决方案 检查字符串开头或结尾的一个简单方法是使用 str.startswith() 或者是 str.endswith() 方法。比如: End of explanation """ ...
turbomanage/training-data-analyst
courses/machine_learning/deepdive2/time_series_prediction/solutions/4_modeling_keras.ipynb
apache-2.0
import os import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import tensorflow as tf from google.cloud import bigquery from tensorflow.keras.utils import to_categorical from tensorflow.keras.models import Sequential from tensorflow.keras.layers import (Dense, DenseFeatures...
materials-commons/materials-commons.github.io
materials-commons-cli/html/examples/MaterialsCommons-Project-Shell-Example.ipynb
mit
import os import pathlib import shutil parent_path = pathlib.Path.home() / "mc_projects" os.makedirs(parent_path, exist_ok=True) # Project name name = "ExampleProjectFromJupyter" project_path = parent_path / name # Projct summary - short description to show in tables summary = "Example project created via Jupyter no...
amkatrutsa/MIPT-Opt
Spring2021/newton_quasi.ipynb
mit
import numpy as np import liboptpy.unconstr_solvers as methods import liboptpy.step_size as ss import jax import jax.numpy as jnp from jax.config import config config.update("jax_enable_x64", True) import sklearn.datasets as skldata n = 300 m = 2000 X, y = skldata.make_classification(n_classes=2, n_features=n, n_sa...
techforspace/sentinel
SNAP_Python_Tutorial_3/SNAP-Python_Tutorial_3.ipynb
mit
from snappy import ProductIO from snappy import jpy from snappy import GPF file_path = 'C:\Program Files\snap\S2A_MSIL1C_20170202T090201_N0204_R007_T35SNA_20170202T090155.SAFE\MTD_MSIL1C.xml' product = ProductIO.readProduct(file_path) HashMap = jpy.get_type('java.util.HashMap') parameters = HashMap() parameters.put...
liufuyang/coursera-Applied-Machine-Learning-in-Python
Assignment 2.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split np.random.seed(0) n = 15 x = np.linspace(0,10,n) + np.random.randn(n)/5 y = np.sin(x)+x/6 + np.random.randn(n)/10 X_train, X_test, y_train, y_test = train_test_split(x, y, random_state=0) # Y...
CUBoulder-ASTR2600/lectures
lecture_17_monte_carlo.ipynb
isc
from IPython.display import Image Image(url='http://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/The_Sun_by_the_Atmospheric_Imaging_Assembly_of_NASA%27s_Solar_Dynamics_Observatory_-_20100819.jpg/251px-The_Sun_by_the_Atmospheric_Imaging_Assembly_of_NASA%27s_Solar_Dynamics_Observatory_-_20100819.jpg') """ Explanat...
SylvainCorlay/bqplot
examples/Scales/Color Scales.ipynb
apache-2.0
import numpy as np import bqplot.pyplot as plt from bqplot import ColorScale, DateColorScale, OrdinalColorScale, ColorAxis # setup data for plotting np.random.seed(0) n = 100 x_data = range(n) y_data = np.cumsum(np.random.randn(n) * 100.0) def create_fig(color_scale, color_data, fig_margin=None): # allow some ma...
feststelltaste/software-analytics
demos/20190425_JUGH_Kassel/DatenanalysenProblemeEntwicklung.ipynb
gpl-3.0
import pandas as pd log = pd.read_csv("../dataset/linux_blame_log.csv.gz") log.head() """ Explanation: Mit Datenanalysen Probleme in der Entwicklung aufzeigen <small>Java User Group Hessen, Kassel, 25.04.2019</small> <b>Markus Harrer</b>, Software Development Analyst Twitter: @feststelltaste Blog: feststelltaste.de <i...
jni/useful-histories
hydronic-heat-pump-payback-period.ipynb
bsd-3-clause
import pint u = pint.UnitRegistry() u.define('dollar = [currency]') u.define('cent = 0.01 * dollar') gas_price = 1.78 * u('cent / MJ') # based on current prices 2022-05-23 elec_price = 20.35 * u('cent / kWh') # based on current prices """ Explanation: Payback period of electric heat pumps Hydronic heating works by ...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_gamma_map_inverse.ipynb
bsd-3-clause
# Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.inverse_sparse import gamma_map, make_stc_from_dipoles from mne.viz import (plot_sparse_source_estimate...
jaidevd/inmantec_fdp
notebooks/day1/02_fourier_analysis.ipynb
mit
Fs = 32768 duration = 0.25 t = np.linspace(0, duration, duration * Fs) f1, f2 = 697, 1336 y1 = np.sin(2 * np.pi * f1 * t); y2 = np.sin(2 * np.pi * f2 * t); y = (y1 + y2) / 2 plt.plot(t, y) from IPython.display import Audio Audio(y, rate=44100) """ Explanation: DTMF: Linear combination of two sinusoids End of explanat...
tiagoft/curso_audio
estatisticas_de_timbre.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt # Demonstrando propriedades de vetores # Ideia: coloque mais dimensoes nos vetores e veja o que acontece! x = np.array([4, 3]) y = np.array([3, 4]) print x print y print x + y # Soma de vetores print 10 * x # Multiplicacao por escalar print np.lina...
ShinjiKatoA16/UCSY-sw-eng
NumberOfDivisor.ipynb
mit
# Simple but not efficient answer def num_div0(n): ''' n: Integer (bigger than 0) output: Number of Divisor (Including 1 and n) ''' count_div = 0 for div in range(1, n+1): # 1 - n if n % div == 0: count_div += 1 return count_div print (5, num_div0(5)...
dasnah/TitanicDataSet
Project 2 Titanic Data Final.ipynb
unlicense
##import everything import numpy as np import pandas as pd import scipy as sp import matplotlib.pyplot as plt import seaborn as sea %matplotlib inline sea.set(style="whitegrid") titanic_ds = pd.read_csv('titanic-data.csv') """ Explanation: Questions: 1: What sex has a higher probability of surviving? 2: What was the...
gwtsa/gwtsa
examples/notebooks/11_WellModel.ipynb
mit
import numpy as np import pandas as pd import pastas as ps from pastas.stressmodels import WellModel """ Explanation: WellModel (many wells with one response function) This notebook shows how a WellModel can be used to fit multiple wells with one response function. The influence of the individual wells is scaled by th...
calebmadrigal/radio-hacking-scripts
fsk_modem_research.ipynb
mit
samp_rate = 1000 len_in_sec = 1 t = np.linspace(0, 1, samp_rate * len_in_sec) hz_4 = 1*np.sin(4 * 2 * np.pi * t) hz_8 = hz_4 * (2 * np.cos(4 * 2 * np.pi * t)) plt.plot(t, hz_4) plt.show() plt.plot(t, hz_8) plt.show() """ Explanation: FSK Modulation Now that we've got some ideas for demodulating fsk, let's do some frea...
jjehl/poppy_education
poppy-4dof-arm-mini/poppy-4dof-arm-mini_couple_vertical.ipynb
gpl-2.0
from poppy.creatures import Poppy4dofArmMini mini_dof = Poppy4dofArmMini(simulator='vrep') import time %pylab inline """ Explanation: Corriger une position en fonction du couple mesuré sur un moteur Compétences visées par cette activité : Mettre en place un asservissement PID lié au couple mesuré sur un moteur. En ...
JamesSample/icpw
toc_trends_oct_2018_part3.ipynb
mit
# Read station data stn_path = r'../../update_autumn_2018/toc_trends_oct18_stations.xlsx' stn_df = pd.read_excel(stn_path, sheet_name='Data') ## Update stations table #with eng.begin() as conn: # for idx, row in stn_df.iterrows(): # # Add new vals to dict # var_dict = {'elev':row['elevation'], # ...
sspickle/sci-comp-notebooks
P03-TaylorSeries.ipynb
mit
import sympy as sp sp.init_printing() Um,x,x0,alpha=sp.symbols('Um x x_0 alpha', real=True) """ Explanation: Taylor Series Suppose you have some function that may be expensive or difficult to evaluate and so you’d like to find an easy approximation for that function in some limited domain. One particularly nice way t...
phenology/infrastructure
applications/notebooks/stable/plot_kmeans_clusters.ipynb
apache-2.0
import sys sys.path.append("/usr/lib/spark/python") sys.path.append("/usr/lib/spark/python/lib/py4j-0.10.4-src.zip") sys.path.append("/usr/lib/python3/dist-packages") import os os.environ["HADOOP_CONF_DIR"] = "/etc/hadoop/conf" import os os.environ["PYSPARK_PYTHON"] = "python3" os.environ["PYSPARK_DRIVER_PYTHON"] = "...
mttaggart/codeforteachers
drag-race/drag-race.ipynb
mit
class Car: """Our Car class""" def __init__(self, year, make, model, top_speed, acceleration ): """Car Constructor function""" self.year = year self.make = make self.model = mode...
TariqAHassan/BioVida
tutorials/2_cancer_imaging_archive.ipynb
bsd-3-clause
from biovida.images import CancerImageInterface """ Explanation: BioVida: The Cancer Imaging Archive The Cancer Imaging Archive is a large repository of medical images of various forms of cancer. Programmatic web access is granted through a RESTful web API. However, this service requires an API-key to use, which you ...
GoogleCloudPlatform/ai-platform-samples
notebooks/samples/tables/result_slicing/slicing_eval_results.ipynb
apache-2.0
! pip install --upgrade --quiet --user sklearn ! pip install --upgrade --quiet --user witwidget ! pip install --upgrade --quiet --user tensorflow==1.15 ! pip install --upgrade --quiet --user tensorflow_model_analysis ! pip install --upgrade --quiet --user pandas-gbq """ Explanation: Slicing AutoML Tables Evaluation Re...
jbliss1234/ML
t81_558_class1_intro_python.ipynb
apache-2.0
# What version of Python do you have? import sys import tensorflow as tf import sklearn as sk import pandas as pd print("Python {}".format(sys.version)) print('TensorFlow {}'.format(tf.__version__)) print('Pandas {}'.format(pd.__version__)) print('Scikit-Learn {}'.format(sk.__version__)) """ Explanation: T81-558: Ap...
julienchastang/unidata-python-workshop
notebooks/Skew_T/SkewT_and_Hodograph.ipynb
mit
# Create a datetime for our request - notice the times are from laregest (year) to smallest (hour) from datetime import datetime request_time = datetime(1999, 5, 3, 12) # Store the station name in a variable for flexibility and clarity station = 'OUN' # Import the Wyoming simple web service and request the data # Don...
pandas-dev/pandas
doc/source/user_guide/style.ipynb
bsd-3-clause
import matplotlib.pyplot # We have this here to trigger matplotlib's font cache stuff. # This cell is hidden from the output import pandas as pd import numpy as np import matplotlib as mpl df = pd.DataFrame([[38.0, 2.0, 18.0, 22.0, 21, np.nan],[19, 439, 6, 452, 226,232]], index=pd.Index(['Tumour (P...
nick-youngblut/SIPSim
ipynb/bac_genome/fullCyc/Day1_fullDataset/xRich.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) ## BD for G+C of 0 or 100 BD.GCp0 = 0 * 0.098 + 1.66 BD.GCp100 = 1 * 0.098 + 1.66 """ Explanation: Goal Simulating fullCyc Day1 control grad...
DBWangGroupUNSW/COMP9318
L8 - Hierarchical Clustering.ipynb
mit
from matplotlib import pyplot as plt from scipy.cluster.hierarchy import dendrogram, linkage, fcluster import numpy as np %matplotlib inline np.set_printoptions(precision=5, suppress=True) """ Explanation: Clustering-2: Hierarchical Clustering import Modules End of explanation """ np.random.seed(42) a = np.random.m...
statsmodels/statsmodels.github.io
v0.13.2/examples/notebooks/generated/glm.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import statsmodels.api as sm from scipy import stats from matplotlib import pyplot as plt plt.rc("figure", figsize=(16,8)) plt.rc("font", size=14) """ Explanation: Generalized Linear Models End of explanation """ print(sm.datasets.star98.NOTE) """ Explanation: GLM: Binomial r...
LeviBarnes/PythonSecrets
SecretCodes.ipynb
mit
print ("Hello my name is Levi.") """ Explanation: Sending Secret Messages with Python This notebook will teach you how to send secret messages to your friends using a computer language called "Python." Python is used by thousands of programmers around the world to create websites and video games, to do science and mat...
mraty/applied-data-science
course-2_applied_plotting/Assignment2.ipynb
mit
import matplotlib.pyplot as plt import mplleaflet import pandas as pd import numpy as np def leaflet_plot_stations(binsize, hashid): df = pd.read_csv('BinSize_d{}.csv'.format(binsize)) station_locations_by_hash = df[df['hash'] == hashid] lons = station_locations_by_hash['LONGITUDE'].tolist() lats = ...
chrlttv/Teaching
Session1/2.Perceptron.ipynb
mit
import random, numpy as np, matplotlib.pyplot as plt, time %matplotlib inline # Training data for the first question training_data = [ (np.array([0,0,1]), 0), (np.array([0,1,1]), 1), (np.array([1,0,1]), 1), (np.array([1,1,1]), 1), ] def unit_step(value): if value < 0: return 0 else: ...
muratcemkose/cy-rest-python
basic/CytoscapeREST_Basic1.ipynb
mit
import sys print ('My Python Version = ' + sys.version) """ Explanation: Basic Workflow 1: Introduction to cyREST API by Keiichiro Ono Introduction This is an introduction to cyREST and its API. You will learn how to access Cytoscape via RESTful API. Prerequisites Basic knowledge of RESTful API This is a good intr...
jhconning/Dev-II
notebooks/Beta_Delta.ipynb
bsd-3-clause
%reload_ext watermark %watermark -u -n -t """ Explanation: Breakable Commitments... Code to generate figures Karna Basu and Jonathan Conning Department of Economics, Hunter College and The Graduate Center, City University of New York End of explanation """ %matplotlib inline import numpy as np import matplotlib.pyp...
telescopeuser/uat_shl
rnd03/shl_sm_NoOCR_v012 2017-09.ipynb
mit
import pandas as pd """ Explanation: SHL Project simulation module: shl_sm shl_sm required data feeds: live bidding price, per second, time series prediction module parameters/csv parm_si.csv (seasonality index per second) parm_month.csv (parameter like alpha, beta, gamma, etc. per month) SHL Simulation Modu...
myinxd/agn-ae
code-sdss/SDSS_Analysis-KS-Chi2-tests.ipynb
mit
lumo_fr1_typical = lumo[idx2_same] * 10**-22 lumo_fr2_typical = lumo[idx3_same] * 10**-22 mag_fr1_typical = mag_abs[idx2_same] mag_fr2_typical = mag_abs[idx3_same] lumo_fr1_like = lumo[idx_fr1] * 10**-22 lumo_fr2_like = lumo[idx_fr2] * 10**-22 mag_fr1_like = mag_abs[idx_fr1] mag_fr2_like = mag_abs[idx_fr2] mag_fr1 ...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/noresm2-hh/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-hh', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: NCC Source ID: NORESM2-HH Topic: Atmos Sub-Topics: Dynamical Core, Radiation, Turbul...
jstac/quantecon_nyu_2016
lecture14/pre_RuixueGong.ipynb
bsd-3-clause
from IPython.display import Image Image(filename='scikit-learn-flow-chart.jpg') #source: web """ Explanation: Statsmodels v.s. Scikit-learn Ruixue Gong, NYU This notebook helps economists better understand the differences and similarities between machine learning package Scikit-learn and traditional statistical pack...
graphistry/pygraphistry
demos/data/benchmarking/SparseDatasets.ipynb
bsd-3-clause
import random import graphistry as g import pandas as pd """ Explanation: Sparse Datasets This notebook is used for benchmarking and debugging sparse datasets Import the necessary libaries End of explanation """ g.__version__ # To specify Graphistry account & server, use: # graphistry.register(api=3, username='.....
datactive/bigbang
examples/name-and-gender/Analyze Senders - Name and Gender.ipynb
mit
%matplotlib inline """ Explanation: Experimenting with estimating the gender of mailing list participants. End of explanation """ import bigbang.ingress.mailman as mailman import bigbang.analysis.graph as graph import bigbang.analysis.process as process from bigbang.parse import get_date from bigbang.archive import ...
weixuanfu/tpot
tutorials/Portuguese Bank Marketing/Portuguese Bank Marketing Strategy.ipynb
lgpl-3.0
# Import required libraries from tpot import TPOTClassifier from sklearn.model_selection import train_test_split import pandas as pd import numpy as np #Load the data Marketing=pd.read_csv('Data_FinalProject.csv') Marketing.head(5) """ Explanation: Portuguese Bank Marketing Strategy- TPOT Tutorial The data is relate...
tensorflow/hub
examples/colab/bert_experts.ipynb
apache-2.0
#@title Copyright 2020 The TensorFlow Hub Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
dongwooc/StatisticalMethods
notes/InferenceSandbox.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt import scipy.stats %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 5.0) # the model parameters a = np.pi b = 1.6818 # my arbitrary constants mu_x = np.exp(1.0) # see definitions above tau_x = 1.0 s = 1.0 N = 50 # number of data points # get some x's and y...
Yu-Group/scikit-learn-sandbox
jupyter/backup_deprecated_nbs/11_Create_Binary_Tree.ipynb
mit
# Step by Step version def search(aList, target): for v in aList: if target == v: return True return False # Recursive approach def searchRecursive(aList, target): if len(aList) == 0: return False if aList[0] == target: return True return searchRecursive(aList[1:...
dnc1994/MachineLearning-UW
ml-regression/blank/week-2-multiple-regression-assignment-2-blank.ipynb
mit
import graphlab """ Explanation: Regression Week 2: Multiple Regression (gradient descent) In the first notebook we explored multiple regression using graphlab create. Now we will use graphlab along with numpy to solve for the regression weights with gradient descent. In this notebook we will cover estimating multiple...
shikhar413/openmc
examples/jupyter/pincell_depletion.ipynb
mit
%matplotlib inline import math import openmc """ Explanation: Pincell Depletion This notebook is intended to introduce the reader to the depletion interface contained in OpenMC. It is recommended that you are moderately familiar with building models using the OpenMC Python API. The earlier examples are excellent start...
jrmontag/Data-Science-45min-Intros
pandas-201/functional_ish_pandas.ipynb
unlicense
import os import zipfile import requests import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt """ Explanation: This will lean heavily on Tom Augspurger's excellent series on Modern Pandas. Quote: Method chaining, where you call methods on an object one after another, is in vogu...
cfcdavidchan/Deep-Learning-Foundation-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...
Bismarrck/deep-learning
batch-norm/Batch_Normalization_Exercises.ipynb
mit
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False) """ Explanation: Batch Normalization – Practice Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a con...
grokkaine/biopycourse
day2/scicomp_scipy.ipynb
cc0-1.0
from sklearn.datasets import load_iris iris = load_iris() print(iris.feature_names, iris.target_names) print(iris.data.shape) #print(iris.DESCR) from scipy import linalg # perform SVD A = iris.data U, s, V = linalg.svd(A) print("U.shape, V.shape, s.shape: ", U.shape, V.shape, s.shape) print("Singular values:", s) #c...
M-R-Houghton/euroscipy_2015
scikit_image/lectures/solutions/3_morphological_operations.ipynb
mit
import numpy as np from matplotlib import pyplot as plt, cm import skdemo plt.rcParams['image.cmap'] = 'cubehelix' plt.rcParams['image.interpolation'] = 'none' image = np.array([[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0,...
mcc-petrinets/formulas
spot/tests/python/decompose.ipynb
mit
aut = spot.translate('(Ga -> Gb) W c') aut """ Explanation: This notebook demonstrates how to use the decompose_scc() function to split an automaton in up to three automata capturing different behaviors. This is based on the paper Strength-based decomposition of the property Büchi automaton for faster model checking...
AllenDowney/ModSim
python/soln/chap12.ipynb
gpl-2.0
# install Pint if necessary try: import pint except ImportError: !pip install pint # download modsim.py if necessary from os.path import exists filename = 'modsim.py' if not exists(filename): from urllib.request import urlretrieve url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/' ...
basp/aya
noise.ipynb
mit
img = np.random.ranf((128,128)) plt.imshow(img, cmap=plt.cm.ocean) """ Explanation: plotting images We can easily plot images by using the imshow function. Conveniently, an image can just be a 2-dimensional numpy array of floats in the range of 0 to 1. We can easily create such an array with the ranf function. Below w...
moranconnorj/code_guild
wk0/notebooks/challenges/primes/.ipynb_checkpoints/primes_challenge-checkpoint.ipynb
mit
def list_primes(n): primes = [] for i in range(0, n + 1): for j in range(0, i): if i % j == 0: break else: primes.append(i) return primes """ Explanation: <small><i>This notebook was prepared by Thunder Shiviah. Source and license info is on GitHub....
nimagh/MachineLearning
BayesianOptimization/BayesianOptimization.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt from scipy.optimize import minimize from scipy.linalg import det from scipy.linalg import pinv2 as inv #pinv uses linalg.lstsq algorithm while pinv2 uses SVD from scipy.stats import norm %matplotlib inline %load_ext autoreload %autoreload 2 %autosave 0 """ Explana...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_read_epochs.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Matti Hamalainen <msh@nmr.mgh.harvard.edu> # # License: BSD (3-clause) import mne from mne import io from mne.datasets import sample print(__doc__) data_path = sample.data_path() """ Explanation: Reading epochs from a raw FIF file Th...
mne-tools/mne-tools.github.io
dev/_downloads/686e03eb7a01e30e026e3dd11e64df18/30_filtering_resampling.ipynb
bsd-3-clause
import os import numpy as np import matplotlib.pyplot as plt import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file) # use just 6...
mne-tools/mne-tools.github.io
0.18/_downloads/3c22b754d3ee35b041302de37d5f9515/plot_decoding_spatio_temporal_source.ipynb
bsd-3-clause
# sphinx_gallery_thumbnail_number = 2 # Author: Denis A. Engemann <denis.engemann@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Jean-Remi King <jeanremi.king@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import numpy as np import m...
pikepdf/pikepdf
docs/_notebooks/pages.ipynb
mpl-2.0
from pikepdf import Pdf pdf = Pdf.open('../../tests/resources/fourpages.pdf') """ Explanation: Manipulating pages pikepdf presents the pages in a PDF through the Pdf.pages property, which follows the list protocol. As such page numbers begin at 0. Let's look at a simple PDF that contains four pages. End of explanation...
axant/notebooks
notebooks/MongoDB.ipynb
mit
from pymongo import MongoClient client = MongoClient('mongodb://localhost:27017/') db = client.phonebook print db.collection_names() """ Explanation: MongoDB Schema Free Document Based Supports Indexing Not Transactional Does not support relations (no JOIN) Supports Autosharding Automatic Replication and Failover Re...
simonvh/gimmemotifs
docs/api_examples.ipynb
mit
with open("MA0099.3.jaspar") as f: motifs = read_motifs(f, fmt="jaspar") print(motifs[0]) """ Explanation: Read motifs from files in other formats. End of explanation """ with open("example.pfm") as f: motifs = read_motifs(f) # pwm print(motifs[0].to_pwm()) # pfm print(motifs[0].to_pfm()) # consensus sequ...
GoogleCloudPlatform/asl-ml-immersion
notebooks/end-to-end-structured/solutions/5a_train_keras_ai_platform_babyweight.ipynb
apache-2.0
import os """ Explanation: LAB 5a: Training Keras model on Cloud AI Platform. Learning Objectives Setup up the environment Create trainer module's task.py to hold hyperparameter argparsing code Create trainer module's model.py to hold Keras model code Run trainer module package locally Submit training job to Cloud A...
KIPAC/StatisticalMethods
tutorials/probability_essentials.ipynb
gpl-2.0
exec(open('tbc.py').read()) # define TBC and TBC_above import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Tutorial: Probability Essentials Analytic and numerical manipulations of probability distributions In this notebook we will work throug...
jamesfolberth/jupyterhub_AWS_deployment
notebooks/data8_notebooks/lab02/lab02.ipynb
bsd-3-clause
from datascience import * from client.api.assignment import load_assignment tests = load_assignment('lab02.ok') """ Explanation: Lab 2: Data Types Welcome to lab 2! Last time, we had our first look at Python and Jupyter notebooks. So far, we've only used Python to manipulate numbers. There's a lot more to life tha...
smeingast/PNICER
notebooks/pnicer.ipynb
gpl-3.0
import sys from pnicer import ApparentMagnitudes from pnicer.utils.auxiliary import get_resource_path %matplotlib inline """ Explanation: <h1 align="center">PNICER demonstration notebook</h1> Preparations The main dependencies of PNICER are astropy, numpy, scipy, matplotlib, and scikit-learn. Here we only import th...
aimalz/qp
docs/notebooks/kld.ipynb
mit
import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt %matplotlib inline import qp import numpy as np import scipy.stats as sps P = qp.PDF(funcform=sps.norm(loc=0.0, scale=1.0)) x, sigma = 2.0, 1.0 Q = qp.PDF(funcform=sps.norm(loc=x, scale=sigma)) infinity = 100.0 D = qp.metrics.calculate_kld(P...
sastels/Onboarding
1 - Introduction.ipynb
mit
a = 6 ## set a variable in this interpreter session a ## entering an expression prints its value a + 2 a = 'hi' ## 'a' can hold a string just as well a len(a) ## call the len() function on a string a + len(a) ## try something that doesn't work a + str(len(a)) ## probably what you really w...
DfAC/MiningMassiveDatasets
week02.ipynb
gpl-2.0
from itertools import combinations as Combinations #https://github.com/ztane/python-Levenshtein from Levenshtein import distance as EditDistance from Levenshtein import editops as EditOps from collections import Counter inputWords = ['he', 'she', 'his', 'hers'] distanceGroups = [] for wordA,wordB in list(Combinations...
openfisca/senegal
notebooks/Fake-data-Senegal.ipynb
agpl-3.0
import matplotlib.pyplot as plt # For graphics %matplotlib inline import numpy as np # linear algebra and math import pandas as pd # data frames from openfisca_core.model_api import * from openfisca_senegal import SenegalTaxBenefitSystem # The Senegalese tax-benefits system from openfisca_senegal.survey_scenario...
lzctony/data-512-a1
hcds-a1-data-curation.ipynb
mit
def get_data(url, access, file_name): """ This function takes an url, parameter for the key 'access'/'access-site' depends on getting pageviews or pagecounts dataset. Then save the data as json file with the name as given file_name to your directory. Args: param1 (str): an url for ...
HNoorazar/PyOpinionGame
One_Topic_Driver_Example.ipynb
gpl-3.0
import numpy as np from numpy.random import randn 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 - One Topic in the net...
quantopian/research_public
notebooks/data/quandl.cboe_rvx/notebook.ipynb
apache-2.0
# For use in Quantopian Research, exploring interactively from quantopian.interactive.data.quandl import cboe_rvx as dataset # import data operations from odo import odo # import other libraries we will use import pandas as pd # Let's use blaze to understand the data a bit using Blaze dshape() dataset.dshape # And h...
bronesto/firstNeuralNetwork
Your_first_neural_network (1).ipynb
agpl-3.0
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
j-coll/opencga
opencga-client/src/main/python/notebooks/pyopencga_basic_notebook_001.ipynb
apache-2.0
# Initialize PYTHONPATH for pyopencga import sys import os from pprint import pprint """ Explanation: pyOpenCGA Basic User Usage [NOTE] The server methods used by pyopencga client are defined in the following swagger URL: - http://bioinfo.hpc.cam.ac.uk/opencga-demo/webservices For tutorials and more info about acces...
blua/deep-learning
tv-script-generation/olds_ipnbs/old1_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...
napsternxg/gensim
docs/notebooks/topic_coherence-movies.ipynb
gpl-3.0
from __future__ import print_function import re import os from scipy.stats import pearsonr from datetime import datetime from gensim.models import CoherenceModel from gensim.corpora.dictionary import Dictionary from smart_open import smart_open """ Explanation: Benchmark testing of coherence pipeline on Movies data...
Olsthoorn/TransientGroundwaterFlow
Assignment/.ipynb_checkpoints/Inclass020200129-checkpoint.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt import pandas as pd from scipy.special import exp1 as W """ Explanation: Assingment in class, Jan 29, 2004 The questions and explanation of the assignement goes here. I expect you to return the assignment notebook, well documented by yourself. I don't want to read my ...
phoebe-project/phoebe2-docs
2.3/tutorials/plotting_advanced.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" """ Explanation: Advanced: Plotting Options For basic plotting usage, see the plotting tutorial PHOEBE 2.3 uses autofig 1.1 as an intermediate layer for highend functionality to matplotlib. Setup Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment thi...
dssg/diogenes
doc/notebooks/grid_search.ipynb
mit
%matplotlib inline import diogenes import numpy as np data = diogenes.read.open_csv_url( 'http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv', delimiter=';') labels = data['quality'] labels = labels < np.average(labels) M = diogenes.modify.remove_cols(data, 'quality') "...
deehzee/cs231n
assignment2/KerasNeonFullyConnected.ipynb
mit
input_dim = 3 * 32 * 32 hidden_dim = 50 #std = np.sqrt(2.0 / num_train) #std = np.sqrt(2.0 / input_dim) std = 0.01 num_iters = 1000 batch_size = 200 lr = 0.00179573608347 #decay = 0.960001695353 decay = 1 reg = 0.316227766017 net = TwoLayerNet(input_dim, hidden_dim, num_classes, std) stats = net.train(X_train, y_trai...
stevenydc/2015lab1
Lab1-pythonpandas_original.ipynb
mit
# The %... is an iPython thing, and is not part of the Python language. # In this case we're just telling the plotting library to draw things on # the notebook, instead of on a separate window. %matplotlib inline #this line above prepares IPython notebook for working with matplotlib # See all the "as ..." contructs? ...
daniel-severo/dask-ml
docs/source/examples/xgboost.ipynb
bsd-3-clause
%matplotlib inline """ Explanation: Dask and XGBoost <img src="http://dask.readthedocs.io/en/latest/_images/dask_horizontal.svg" align="left" width="30%" alt="Dask logo"> <img src="https://raw.githubusercontent.com/dmlc/dmlc.github.io/master/img/logo-m/xgboost.png" align="left" width="25%" alt="Dask logo"> End of expl...
davicsilva/dsintensive
notebooks/miniprojects/data_wrangling_json/.ipynb_checkpoints/sliderule_dsi_xml_exercise-checkpoint.ipynb
apache-2.0
from xml.etree import ElementTree as ET """ Explanation: XML example and exercise study examples of accessing nodes in XML tree structure work on exercise to be completed and submitted reference: https://docs.python.org/2.7/library/xml.etree.elementtree.html data source: http://www.dbis.informatik.uni-goettinge...
tatjanus/cianparser
cian_ml.ipynb
bsd-2-clause
data.drop(['Bal_na', 'Distr_N', 'Brick_na'], axis = 1, inplace = True) """ Explanation: Готовим данные к линейной модели. Уберем n-ные столбцы после one-hot encoding, чтоб не образовывалась линейная зависимость End of explanation """ data_sq = data.copy() squared_columns = ['Distance', 'Kitsp', 'Livsp', 'Totsp', 'M...
shirtsgroup/physical-validation
doc/examples/openmm_replica_exchange.ipynb
lgpl-2.1
# enable plotting in notebook %matplotlib notebook """ Explanation: Check ensemble of OpenMM temperature replica exchange simulations Note: This notebook can be run locally by cloning the Github repository. The notebook is located in doc/examples/openmm_replica_exchange.ipynb. The input and output files of the simulat...