repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
Naereen/notebooks
Living_in_a_noisy_world_with_James_Powell_rwatch_module.ipynb
mit
import numpy as np np.random.seed(1234) np.random.normal() """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#&quot;Living-in-a-noisy-world...&quot;,-using-James-Powell's-(dutc)-rwatch-module" data-toc-modified-id="&quot;Living-in-a-noisy-world...&quot;,-using-James-Powell's-(dutc)-rwatch-modu...
bashalex/datapot
notebooks/TimestampAndNumericExample.ipynb
gpl-3.0
import datapot as dp datapot = dp.DataPot() from datapot.utils import csv_to_jsonlines csv_to_jsonlines('../data/transactions.csv', '../data/transactions.jsonlines') ftr = open('../data/transactions.jsonlines') """ Explanation: Dataset with timestamp features. Creating the DataPot object. End of explanation """ ...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/quantile_regression.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import statsmodels.formula.api as smf import matplotlib.pyplot as plt data = sm.datasets.engel.load_pandas().data data.head() """ Explanation: Quantile regression This example page shows how to use statsmodels' QuantReg class to r...
csiu/100daysofcode
lol/visualizing-higher-dimensions.ipynb
mit
# Load data dat = pd.read_csv("lol_base_stats.tsv", sep="\t") dat.head() """ Explanation: Load yesterday's data End of explanation """ from bs4 import BeautifulSoup import requests primary_role = [] for url in dat.href: html_data = requests.get(url).text soup = BeautifulSoup(html_data, "html5lib") ...
wuafeing/Python3-Tutorial
02 strings and text/02.15 interpolating variables in strings.ipynb
gpl-3.0
s = "{name} has {n} messages." s.format(name = "Guido", n = 37) """ Explanation: Previous 2.15 字符串中插入变量 问题 你想创建一个内嵌变量的字符串,变量被它的值所表示的字符串替换掉。 解决方案 Python 并没有对在字符串中简单替换变量值提供直接的支持。 但是通过使用字符串的 format() 方法来解决这个问题。比如: End of explanation """ name = "Guido" n = 37 s.format_map(vars()) """ Explanation: 或者,如果要被替换的变量能在变量域中找到, ...
GrachevArtem/dl_course
week_03/HW2_Fully_Connected_NN.ipynb
mit
import numpy as np import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray' def rel_error(x, y): """ returns relative error """ return np.max(np.abs(x - y) / ...
VandroiyLabs/platemate
examples/iGEM 2015 Interlab - BrasilUSP.ipynb
gpl-3.0
%matplotlib inline import pylab as pl from math import sqrt import sys # importing platemate sys.path.insert(0, '../src') import platemate """ Explanation: Interlab from iGEM 2015 End of explanation """ ColumnNames = { 'C' : "Dev1", 'D' : "Dev2", 'E' : "Dev3" } controlNames = { 'A' : "LB", ...
magnastrazh/NEUCOGAR
nest/serotonin/research/C/nest-2.10.0/doc/model_details/IAF_neurons_singularity.ipynb
gpl-2.0
import sympy as sp sp.init_printing(use_latex=True) from sympy.matrices import zeros tau_m, tau_s, C, h = sp.symbols('tau_m, tau_s, C, h') """ Explanation: IAF neurons singularity This notebook describes how NEST handles the singularities appearing in the ODE's of integrate-and-fire model neurons with alpha- or expone...
jdfekete/progressivis
doc/RunStepDecorators.ipynb
bsd-2-clause
import progressivis.core.decorators """ Explanation: How to decorate the run_step() method (and why) The use of decorators is optional and intended to structure and make the run_step()method clearer and more compact. In order to use the decorators you have to import them as follows: End of explanation """ from progr...
evangelistalab/forte
tutorials/Exercise_01.00_psi4_api.ipynb
lgpl-3.0
import psi4 """ Explanation: Forte Exercise 1.00: Running psi4 jobs in Jupyter notebooks Goal: find the symmetry of the triple ground state of linear water In this exercise you are going to use psi4's Python API to compute the restricted open-shell Hartree-Fock wave function of triplet linear water and will use the s...
muratcemkose/cy-rest-python
basic/CytoscapeJS_visualization.ipynb
mit
# Package to render networks in Cytoscape.js from py2cytoscape import cytoscapejs as cyjs # And standard JSON utility import json """ Explanation: Using Cytoscape.js in Jupyter Notebook by Keiichiro Ono Introduction If you use Jupyetr Notebook with cyREST, you can script your workflow. And in some cases, you may ...
jameszw/udacity-deep-learning
project4-language-translation/dlnd_language_translation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: Language Translation In this project, you’re going...
ledeprogram/algorithms
class3/homework/benzaquen_mercy_3_2.ipynb
gpl-3.0
import random #We can do this in two different ways. #I will do both and see the time difference. #With the ---linear search--- we can check ALL values in order until we find the one we want #With the ---binary search--- we check for the value in the middle of the list, eliminating the #half of the list that are smal...
jhillairet/ICRH
TWA/Master Fusion Hands-on/Master Fusion Hands-on TWA.ipynb
mit
%load_ext autoreload %autoreload 2 %pylab %matplotlib inline import skrf as rf rf.stylely() """ Explanation: Master Fusion Hands-on RF Directional Coupler and Travelling Wave Antenna End of explanation """ idx_ps = np.linspace(0, 180, 19) # indexes of the phase shifter, from 0 to 180 per 10 # creating a NetworkS...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/n08_simple_q_learner_1000_states_full_training_25_epochs.ipynb
mit
# Basic imports import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime as dt import scipy.optimize as spo import sys from time import time from sklearn.metrics import r2_score, median_absolute_error from multiprocessing import Pool %matplotlib inline %pylab inline pylab.rcPar...
davicsilva/dsintensive
notebooks/flightDelayPrepData_v2.ipynb
apache-2.0
from datetime import datetime # Pandas and NumPy import pandas as pd import numpy as np # Read the CSV with flights records (separation = ";") flights = pd.read_csv('data/arfsample-date.csv', sep = ';', dtype = str) flights.head() # Lambda function # 1 - Used to adjust date columns to ISO format # flights['column-w...
barjacks/foundations-homework
11/Homework_11_working_with_parking_data.ipynb
mit
import pandas as pd """ Explanation: Homework 11: PARKING TICKETS End of explanation """ #As the datatypes in all of the columns vary, I decided to to make all the values, except for the ones I specify #into str. This also takes care of questions 1. -> dtype=str """ Explanation: 1. I want to make sure my Plate ID i...
AllenDowney/HeriReligion
freshman/freshman_survey.ipynb
mit
%matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt from utils import decorate, savefig import statsmodels.formula.api as smf import warnings warnings.filterwarnings('error') """ Explanation: Changes in religious affiliation and attendance Analysis based on data from the CIRP ...
ES-DOC/esdoc-jupyterhub
notebooks/noaa-gfdl/cmip6/models/sandbox-3/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'sandbox-3', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: NOAA-GFDL Source ID: SANDBOX-3 Topic: Aerosol Sub-Topics: Transport, Emissi...
darioizzo/fast-approx-ML
fast-approx-ML-slide14.ipynb
mit
a = pk.load(open("slide14.pkl","rb"), encoding='latin1') print("DATA = ", a) print("ONE ROW = ", a[0]) """ Explanation: We load the data file obtained from the optimization (in low-thrust) of many legs (GTOC7) for the maximum initial mass: ast1, ast2, $t_1$, $t_2$, $\Delta V_L$, $m^$, $m^_L$, $m^*_D$ We want to study...
y2ee201/Deep-Learning-Nanodegree
sentiment_network/Sentiment Classification - How to Best Frame a Problem for a Neural Network (Project 1).ipynb
mit
def pretty_print_review_and_label(i): print(labels[i] + "\t:\t" + reviews[i][:80] + "...") g = open('reviews.txt','r') # What we know! reviews = list(map(lambda x:x[:-1],g.readlines())) g.close() g = open('labels.txt','r') # What we WANT to know! labels = list(map(lambda x:x[:-1].upper(),g.readlines())) g.close()...
Chipe1/aima-python
notebooks/chapter19/RNN.ipynb
mit
import warnings warnings.filterwarnings("ignore", category=FutureWarning) import os, sys sys.path = [os.path.abspath("../../")] + sys.path from deep_learning4e import * from notebook4e import * psource(SimpleRNNLearner) """ Explanation: RNN Overview When human is thinking, they are thinking based on the understanding...
tensorflow/docs-l10n
site/en-snapshot/guide/data_performance.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...
astro4dev/OAD-Data-Science-Toolkit
Teaching Materials/Programming/Python/Python3Espanol/1_Introduccion/03. Numeros y jerarquía de operaciones.ipynb
gpl-3.0
2.**5 2**5 3/2 3//2 2//3 21/3 21//3 21%3 """ Explanation: Números y jerarquía de operaciones Números enteros y flotantes Jerarquía de operaciones Asignación de variables Números enteros y flotantes Con los números se pueden realizar los siguientes tipos de operaciones: | Operación | Resultado | | ----...
4dsolutions/tetravolumes
Computing Volumes.ipynb
apache-2.0
import math xyz_volume = math.sqrt(2)**3 ivm_volume = 3 print("XYZ units:", xyz_volume) print("IVM units:", ivm_volume) print("Conversion constant:", ivm_volume/xyz_volume) """ Explanation: Philosophy for Physics Majors<br/>Oregon Curriculum Network <h3 align="center">Computing Volumes in XYZ and IVM units</h3> <h4 al...
menpo/menpofit-notebooks
notebooks/DeformableModels/SupervisedDescentMethod/SDMs Basics.ipynb
bsd-3-clause
%matplotlib inline from pathlib import Path path_to_lfpw = Path('/vol/atlas/databases/lfpw') path_to_lfpw = Path('/home/nontas/Dropbox/lfpw/') import menpo.io as mio training_images = [] # load landmarked images for i in mio.import_images(path_to_lfpw / 'trainset', verbose=True): # crop image i = i.crop_to_...
specdb/specdb
docs/nb/Query_Catalog.ipynb
gpl-3.0
# import from astropy import units as u from astropy.coordinates import SkyCoord import specdb from specdb.specdb import SpecDB from specdb import specdb as spdb_spdb from specdb.cat_utils import flags_to_groups """ Explanation: Querying a specdb source Catalog [v1.0] End of explanation """ db_file = specdb.__path_...
Xilinx/BNN-PYNQ
notebooks/LFC-QNN_MNIST.ipynb
bsd-3-clause
import bnn """ Explanation: QNN on Pynq This notebook covers how to use low quantized Neural Networks on Pynq for inference on MNIST dataset by using LFC network composed of 4 fully connected layers with 1024 neurons each. There are 2 networks using different precision: LFCW1A1 using 1 bit weights and 1 activation, ...
tpin3694/tpin3694.github.io
python/matplotlib_bar_plot.ipynb
mit
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt import numpy as np """ Explanation: Title: Bar Plot In MatPlotLib Slug: matplotlib_bar_plot Summary: Bar Plot In MatPlotLib Date: 2016-05-01 12:00 Category: Python Tags: Data Visualization Authors: Chris Albon Based on: Sebastian Raschka. Prelimi...
steinam/teacher
jup_notebooks/datenbanken/SubSelects.ipynb
mit
%load_ext sql %sql mysql://steinam:steinam@localhost/sommer_2015 """ Explanation: Subselects End of explanation """ %%sql select k.kd_id, k.kd_plz, (select count(a.Au_ID) from auftrag a where a.au_kd_id = k.kd_id ) as AnzahlAuftr, (select count(f.`f_id`) from fahrten f, auftrag a where f.f_au_id...
weleen/mxnet
example/notebooks/basic/advanced_img_io.ipynb
apache-2.0
%matplotlib inline from __future__ import print_function import os import time # set the number of threads you want to use before importing mxnet os.environ['MXNET_CPU_WORKER_NTHREADS'] = '4' import mxnet as mx import numpy as np import matplotlib.pyplot as plt import cv2 # download example images os.system('wget http...
Kaggle/learntools
notebooks/machine_learning/raw/ex7.ipynb
apache-2.0
# Set up code checking from learntools.core import binder binder.bind(globals()) from learntools.machine_learning.ex7 import * # Set up filepaths import os if not os.path.exists("../input/train.csv"): os.symlink("../input/home-data-for-ml-course/train.csv", "../input/train.csv") os.symlink("../input/home-dat...
YingzhiGou/AI-Meetup-Decision-Systems-Lab-UOW
tutorial/machine_learning_with_python/02_Classification.ipynb
apache-2.0
# fetch data set from sklearn.datasets import fetch_mldata mnist = fetch_mldata('MNIST original', data_home="data") # download data here, it may take some time depends on the network mnist # this will show the dataset object # now let's take a look at the data X, y = mnist["data"], mnist["target"] X.shape y.shape ...
rpmunoz/topicos_ingenieria_1
clase_1/01 - Introduccion a Python.ipynb
gpl-3.0
# primero inicializamos las variables a y b a = 2 b = 3.5 # verificamos los valores y aplicamos operaciones simples print("a = ",a) print("b = ",b) c = a + b print(c) print("suma de a + b = ",c) d = a * b print("multiplicación de a * b = ",d) e = a ** b # el signo "**" representa "elevar a" print("a elevado a b = ",e...
rashikaranpuria/Machine-Learning-Specialization
Regression/Assignmet_five/.ipynb_checkpoints/week-5-lasso-assignment-1-blank-checkpoint.ipynb
mit
import graphlab graphlab.product_key.set_product_key("C0C2-04B4-D94B-70F6-8771-86F9-C6E1-E122") """ Explanation: Regression Week 5: Feature Selection and LASSO (Interpretation) In this notebook, you will use LASSO to select features, building on a pre-implemented solver for LASSO (using GraphLab Create, though you can...
astro4dev/OAD-Data-Science-Toolkit
Teaching Materials/Programming/Python/Python3Espanol/1_Introduccion/07. Cadenas, tuplas y diccionarios.ipynb
gpl-3.0
fruta = "banano" dulce = 'bocadillo' """ Explanation: Cadenas o strings En Python las cadenas son definidas como listas de caracteres, por lo que es posible aplicarles rebanado y las demás operaciones que vimos en la sección anterior. Una cadena se puede formar usando comillas dobles o sencillas, de la siguiente mane...
MichaelMartinez/watson_play
Basic_Concept_Graph.ipynb
mit
py = ConceptModel(['Python']) py.concepts() """ Explanation: Lets Concept all the things!!! First we need to import the goodies. Then we will start with Python... End of explanation """ py.explode() len(py.concepts()) """ Explanation: Now I am going to explode the and see what it does... End of explanation """ py...
birdsarah/bokeh-miscellany
0.12.14 bugs - test in latest dev.ipynb
gpl-2.0
N = 10000 x = np.random.normal(0, np.pi, N) y = np.sin(x) + np.random.normal(0, 0.2, N) p = figure(output_backend="webgl") p.scatter(x, y, alpha=0.1) show(p) """ Explanation: WebGL problems Drag around canvas is shifted down, cut off at top spilling over bottom End of explanation """ !conda list | egrep "jupyter|n...
searchs/bigdatabox
Workshop_Data_Analysis_With_Pandas_Numpy.ipynb
mit
import numpy as np import pandas as pd test_scores = [70,65,95,88] type(test_scores) scores = np.array(test_scores) type(scores) scores.mean() print(scores.max(), scores.min()) #More Calculations income = np.array([75000, 55000, 88000, 125000, 64000, 97000]) print(income.mean()) print(income.max()) print(income.m...
DouglasLeeTucker/DECam_PGCM
notebooks/DESY6DeepFields_PhotomZPs_tied_to_refcat2.ipynb
gpl-3.0
import numpy as np import pandas as pd from scipy import interpolate import glob import math import os import subprocess import sys import gc import glob import pickle import easyaccess as ea #import AlasBabylon import fitsio from astropy.io import fits import astropy.coordinates as coord from astropy.coordinates i...
deeplook/notebooks
freemium/freemium.ipynb
mit
import random import urllib import utils app_id = utils.app_id app_code = utils.app_code berlin_lat_lon = [52.5, 13.4] here_berlin_addr = 'Invalidenstr. 116, 10115 Berlin, Germany' """ Explanation: Tour of Free(mium) HERE APIs A short "teaser" presentation rushing through a small subset of many free APIs made by...
lubegamark/ple2014
clean_data.ipynb
mit
""" Import different packages required """ import utils import settings import pandas as pd """ Explanation: Cleaning PLE DataSet Introduction In this section of the project we shall clean the data so that we can do analysis in other sections. Upon inspection of the Dataset, a few issues were encountered. - The files...
gee-community/gee_tools
notebooks/bitreader/BitReader.ipynb
mit
import ee ee.Initialize() from geetools import bitreader, cloud_mask options = { '0-1': {0:'clear', 1:'cloud', 2:'mix'}, # cloud state '2-2': {0: 'no_shadow', 1:'shadow'}, # cloud shadow (bit 0 is not needed) '6-7': {0:'climatology', 1:'low', 2:'average', 3:'high'} # land/water flag } reader = bitreader.BitRe...
flohorovicic/pynoddy
docs/notebooks/6-Reproducible-Experiments.ipynb
gpl-2.0
from IPython.core.display import HTML css_file = 'pynoddy.css' HTML(open(css_file, "r").read()) %matplotlib inline # here the usual imports. If any of the imports fails, # make sure that pynoddy is installed # properly, ideally with 'python setup.py develop' # or 'python setup.py install' import sys, os import matp...
ericmjl/nnet-HA
Prototype Neural Network for predicting HA host tropism.ipynb
mit
import pandas as pd import numpy as np from Bio import SeqIO from Bio import AlignIO from Bio.Align import MultipleSeqAlignment from collections import Counter from sklearn.preprocessing import LabelBinarizer from sklearn.cross_validation import train_test_split from sklearn.ensemble import RandomForestClassifier, Extr...
relopezbriega/mi-python-blog
content/notebooks/ecuaciones-diferenciales.ipynb
gpl-2.0
import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np import sympy from scipy import integrate # imprimir con notación matemática. sympy.init_printing(use_latex='mathjax') # importando modulos de fenics import dolfin import mshr %matplotlib inline dolfin.parameters["reorder_dofs_serial"] = F...
ES-DOC/esdoc-jupyterhub
notebooks/dwd/cmip6/models/mpi-esm-1-2-hr/ocnbgchem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'dwd', 'mpi-esm-1-2-hr', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: DWD Source ID: MPI-ESM-1-2-HR Topic: Ocnbgchem Sub-Topics: Tracers. Pro...
albahnsen/PracticalMachineLearningClass
notebooks/07-regularization.ipynb
mit
# read in the dataset import pandas as pd url = 'https://github.com/albahnsen/PracticalMachineLearningClass/raw/master/datasets/communities.data' crime = pd.read_csv(url, header=None, na_values=['?']) crime.head() # examine the response variable crime[127].describe() # remove categorical features crime.drop([0, 1, 2,...
tpin3694/tpin3694.github.io
machine-learning/selecting_best_alpha_value_in_ridge_regression.ipynb
mit
# Load libraries from sklearn.linear_model import RidgeCV from sklearn.datasets import load_boston from sklearn.preprocessing import StandardScaler """ Explanation: Title: Selecting The Best Alpha Value In Ridge Regression Slug: selecting_best_alpha_value_in_ridge_regression Summary: How to select the best alpha v...
besser82/shogun
doc/ipython-notebooks/multiclass/KNN.ipynb
bsd-3-clause
import numpy as np import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') from scipy.io import loadmat, savemat from numpy import random from os import path mat = loadmat(os.path.join(SHOGUN_DATA_DIR, 'multiclass/usps.mat')) Xall = mat['data'] Yall = np.array(mat['label'].squeeze(), dtype=n...
giotta/EUR8217
labo/labo-py.ipynb
mit
# jupyter magic %matplotlib inline # python scientific stack import numpy as np import pandas as pd import scipy.stats as scs import statsmodels import statsmodels.api as sm import statsmodels.formula.api as smf import statsmodels.stats as sms # fileformat from simpledbf import Dbf5 from sas7bdat import SAS7BDAT """...
InsightLab/data-science-cookbook
2020/02-python-bibliotecas-manipulacao-dados/Numpy.ipynb
mit
import numpy as np """ Explanation: NumPy Numpy é um pacote fundamental para programação científica com Python. Ele traz consigo uma variedade de operações matemáticas, principalmente referente à operações algébricas com dados N-dimensionais! End of explanation """ a = np.array([1, 2, 3]) print(repr(a), a.shape, end...
hparik11/Deep-Learning-Nanodegree-Foundation-Repository
transfer-learning/Transfer_Learning_Solution.ipynb
mit
from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm vgg_dir = 'tensorflow_vgg/' # Make sure vgg exists if not isdir(vgg_dir): raise Exception("VGG directory doesn't exist!") class DLProgress(tqdm): last_block = 0 def hook(self, block_num=1, block_size=1, total_s...
saksham/recommender-systems
Collaborative Filtering.ipynb
mit
import numpy as np; import pandas as pd; from pandas import Series, DataFrame """ Explanation: Collaborative Filtering in 9 Lines of Code I was looking for some sample code for getting my hands dirty with some recommender system code, particularly around collaborative filtering. I came across this blog post with the s...
atitus5/MiniPlaces
tensorflow-tutorial/basics.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import tensorflow as tf """ Explanation: TensorFlow TensorFlow is an open source library for numerical computation using data flow graphs. Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional dat...
skkandrach/foundations-homework
Homework_5_Soma.ipynb
mit
!pip3 install requests import requests response = requests.get('https://api.spotify.com/v1/search?query=Lil+&offset=0&limit=50&type=artist&market=US') data = response.json() data.keys() artist_data = data['artists']['items'] for artist in artist_data: print(artist['name'], artist['popularity'], artist['genres']) ...
massimo-nocentini/competitive-programming
tutorials/dynamic-programming.ipynb
mit
from functools import lru_cache import operator from itertools import count, zip_longest, chain from collections import OrderedDict from random import randint def memo_holder(optimizer): def f(*args, **kwds): return_memo_table = kwds.pop('memo_table', False) pair = optimized, memo_table = optimizer...
afronski/playground-notes
introduction-to-big-data-with-apache-spark/solutions/lab4_machine_learning_student.ipynb
mit
import sys import os from test_helper import Test baseDir = os.path.join('data') inputPath = os.path.join('cs100', 'lab4', 'small') ratingsFilename = os.path.join(baseDir, inputPath, 'ratings.dat.gz') moviesFilename = os.path.join(baseDir, inputPath, 'movies.dat') """ Explanation: version 1.0.1 + Introduction to M...
vnaidu/loan-status
notebooks/loan-status.ipynb
mit
from IPython.display import display from IPython.core.display import HTML import warnings warnings.filterwarnings('ignore') import os if os.getcwd().split('/')[-1] == 'notebooks': os.chdir('../') import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt import seaborn as sns impo...
chseifert/tutorials
data-science/Classical-Machine-Learning-for-Beginners (Iris dataset).ipynb
apache-2.0
# pythons scientific computing package and a random number generator import numpy as np import random # machine learning classifiers and metrics from sklearn.naive_bayes import MultinomialNB from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy_score from sklearn.metrics import confusion_...
ucsd-ccbb/jupyter-genomics
notebooks/dnaSeq/VAPr_Variant_Annotation_Prioritization/ VAPr_Variant_Annotation_Prioritization.ipynb
mit
os.getcwd() import os import re import sys import vcf import time import pysam import myvariant import collections import numpy as np import pandas as pd sys.path.append(os.getcwd().replace("notebooks/dnaSeq/VAPr_Variant_Annotation_Prioritization", "src/dnaSeq/VAPr")) #variantannotation functions from variantannotati...
wind-python/windpowerlib
example/turbine_cluster_modelchain_example.ipynb
mit
import pandas as pd import modelchain_example as mc_e from windpowerlib import TurbineClusterModelChain, WindTurbineCluster, WindFarm import logging logging.getLogger().setLevel(logging.DEBUG) # Get weather data weather = mc_e.get_weather_data('weather.csv') print(weather[['wind_speed', 'temperature', 'pressure']][0...
xdze2/thermique_appart
Comparaison_Text.ipynb
mit
coords_grenoble = (45.1973288, 5.7139923) #(45.1973288, 5.7103223) startday, lastday = pd.to_datetime('22/06/2017', format='%d/%m/%Y'), pd.to_datetime('now') # download the data: data = wf.buildmultidayDF(startday, lastday, coords_grenoble ) import emoncmsfeed as getfeeds dataframefreq = '10min' feeds = { 'T_ext'...
jtwhite79/pyemu
verification/henry/.ipynb_checkpoints/verify_unc_results-checkpoint.ipynb
bsd-3-clause
%matplotlib inline import os import numpy as np import matplotlib.pyplot as plt import pandas as pd import pyemu """ Explanation: verify pyEMU results with the henry problem End of explanation """ la = pyemu.Schur("pest.jco",verbose=False) la.drop_prior_information() jco_ord = la.jco.get(la.pst.obs_names,la.pst.par_...
MIT-LCP/mimic-code
mimic-iv-cxr/dcm/create-mimic-cxr-jpg-metadata.ipynb
mit
# load json with gzip.open('dicom-metadata.json.gz', 'r') as fp: tmp = json.load(fp) dcm_metadata = dict() # convert from length list of 1 item dicts to single dict for d in tmp: for k, v in d.items(): dcm_metadata[k] = v del tmp # figure out how many unique top level meta-data fields in the ...
laenderoliveira/exerclivropy
listagens-jupyter-notebook/empacotamento-desempacotamento-parametros.ipynb
mit
def soma(a, b): print(a+b) l = [2, 3] soma(*l) """ Explanation: 8.7 Empacotamento e desempacotamento de parâmetros Listagem 8.28 - Empacotamento de parâmetros em uma lista End of explanation """ def barra(n=10, c="*"): print(c*n) l = [[5,"-"], [10, "*"], [5], [6, "."]] for e in l: barra(*e) """ Explanat...
eshlykov/mipt-day-after-day
labs/term-6/lab-4-1.ipynb
unlicense
import numpy as np; import scipy as sps; import matplotlib.pyplot as plt; import pandas as pd %matplotlib inline """ Explanation: Изучение спектров атома водорода и молекулы йода End of explanation """ table_1 = pd.read_excel('lab-4-1.xlsx', '1'); table_1.iloc[:, :4] """ Explanation: Неон и ртуть End of explanation...
bspalding/research_public
lectures/drafts/Principal component analysis.ipynb
apache-2.0
import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA # Import the data we want to model start = '2014-01-01' end = '2015-01-01' r1 = get_pricing('MSFT', fields='price', start_date=start, end_date=end).pct_change()[1:] r2 = get_pricing('SPY', fields='price', start_date=start, end_dat...
Geosyntec/pycvc
examples/Data Summaries.ipynb
bsd-3-clause
%matplotlib inline import os import sys import datetime import warnings import numpy as np import matplotlib.pyplot as plt import pandas import seaborn seaborn.set(style='ticks', context='paper') import wqio import pybmpdb import pynsqd import pycvc min_precip = 1.9999 palette = seaborn.color_palette('deep', n_col...
Hyperparticle/deep-learning-foundation
lessons/intro-to-tflearn/TFLearn_Digit_Recognition_Solution.ipynb
mit
# Import Numpy, TensorFlow, TFLearn, and MNIST data import numpy as np import tensorflow as tf import tflearn import tflearn.datasets.mnist as mnist """ Explanation: Handwritten Number Recognition with TFLearn and MNIST In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9. This...
joshnsolomon/phys202-2015-work
assignments/assignment05/InteractEx02.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.display import display """ Explanation: Interact Exercise 2 Imports End of explanation """ # YOUR CODE HERE def plot_sine1(a, b): t = np.linspace(0,4*np.pi,400) ...
CLandauGWU/group_e
DG/lesson_08DG.ipynb
mit
! conda install geopandas -qy import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline import geopandas as gpd from shapely.geometry import Point, Polygon from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.model_select...
prasants/pyds
Case Study - Hunt a Serial Killer.ipynb
mit
import pandas as pd import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns plt.rcParams["figure.figsize"] = (20,5) # This can be the default, or else, you can also specify this every time you generate a graph import vincent vincent.core.initialize_notebook() """ Explanation: Tabl...
pycam/python-basic
python_basic_2_3.ipynb
unlicense
path = "data/datafile.txt" fileObj = open( path ) """ Explanation: An introduction to solving biological problems with Python Session 2.3: Files Using files Reading from files Exercises 2.3.1 Writing to files Exercises 2.3.2 Data input and output (I/O) So far, all that data we have been working with has been written...
krondor/dsxlunch
Survey Sentiment and Tonal Analysis.ipynb
gpl-3.0
from IPython.display import HTML HTML('''<script> code_show=true; function code_toggle() { if (code_show){ $('div.input').hide(); } else { $('div.input').show(); } code_show = !code_show } $( document ).ready(code_toggle); </script> <form action="javascript:code_toggle()"><input type="submit" value="Click here...
notnil/udacity-ml-capstone
project.ipynb
mit
import glob import subprocess import json import os import csv from tqdm import tnrange, tqdm_notebook from keras.preprocessing import image from keras.applications.inception_v3 import InceptionV3, preprocess_input from keras.models import Model, load_model from keras.layers import Input import numpy as np # Adapted f...
GoogleCloudPlatform/training-data-analyst
courses/ai-for-finance/practice/momentum_using_hurst.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 """ Explanation: Improve Momentum Trading strategies using Hurst In this notebook we'll implementing a strategy to trade on momentum. You'll be using the training wheels version of Auquan's toolbox to abstract out the details since the full version of toolbox is a bit comprehensive t...
metpy/MetPy
v0.8/_downloads/Gradient.ipynb
bsd-3-clause
import numpy as np import metpy.calc as mpcalc from metpy.units import units """ Explanation: Gradient Use metpy.calc.gradient. This example demonstrates the various ways that MetPy's gradient function can be utilized. End of explanation """ data = np.array([[23, 24, 23], [25, 26, 25], ...
tpin3694/tpin3694.github.io
python/pandas_sampling_dataframe.ipynb
mit
import pandas as pd import numpy as np """ Explanation: Title: Random Sampling Dataframe Slug: pandas_sampling_dataframe Summary: Random Sampling Dataframe Date: 2016-05-01 12:00 Category: Python Tags: Data Wrangling Authors: Chris Albon import modules End of explanation """ raw_data = {'first_name': ['Jason', 'Mo...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/image_classification/labs/2_mnist_models.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst # Here we'll show the currently installed version of TensorFlow import tensorflow as tf print(tf.__version__) from datetime import datetime import os PROJECT = "your-project-id-here" # REPLACE WITH YOUR PROJECT ID BUCKET = "your-bucket-id-here" # R...
ispamm/tensorflow-tutorial
1-Reti-neurali-feedforward.ipynb
gpl-3.0
from sklearn import datasets (X, y) = datasets.make_moons(n_samples=1000) (X_tst, y_tst) = datasets.make_moons(n_samples=1000) """ Explanation: Tutorial 1 - Reti neurali feedforward in TensorFlow Prerequisiti per il tutorial: * T0 - Concetti base di TensorFlow Contenuti del tutorial: 1. Reti neurali feedforward. 2. Im...
NikitaLoik/machineLearning_andrewNg
notebooks/1_linear_regression.ipynb
mit
file_path_1 = '../course_materials/ex1data1.txt' """ Explanation: 1 Univariate Linear Regression End of explanation """ df = pd.read_csv(file_path_1, header = None) n_samples, n_variables = df.shape print(f"\tsample # {n_samples}\n\tvariables # {n_variables}") df.head() Xs = df.iloc[:, :1] Ys = df.iloc[:, 1:2] plt....
AllenDowney/DataExploration
modeling.ipynb
mit
from __future__ import print_function, division import analytic import brfss import nsfg import thinkstats2 import thinkplot import pandas as pd import numpy as np import math %matplotlib inline """ Explanation: Modeling distributions Copyright 2015 Allen Downey License: Creative Commons Attribution 4.0 Internatio...
UIUC-iSchool-DataViz/spring2017
week05/examples_week05.ipynb
mit
%matplotlib inline import h5py import matplotlib.pyplot as plt import numpy as np import ipywidgets plt.rcParams["figure.figsize"] = (12, 10) """ Explanation: Image Plotting This week, we will do just a very short bit of image plotting. We'll be using a Koala scan. End of explanation """ f = h5py.File("/srv/nbgrad...
jinzishuai/learn2deeplearn
deeplearning.ai/C2.ImproveDeepNN/week3/tensorflow_assignment/Tensorflow+Tutorial.ipynb
gpl-3.0
import math import numpy as np import h5py import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.python.framework import ops from tf_utils import load_dataset, random_mini_batches, convert_to_one_hot, predict %matplotlib inline np.random.seed(1) """ Explanation: TensorFlow Tutorial Welcome to this w...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch3-Animation_ThreePhaseFluxes2and4poles.ipynb
unlicense
%pylab notebook """ Explanation: Electric Machinery Fundamentals 5th edition Chapter 3 Animation: Three-phase fluxes (based on Example 3-1) Calculate the net magetic field produced by a three-phase stator (adapted for 50Hz). Showing a 2-pole and a 4-pole machine side by side Import the PyLab namespace (provides set of...
GoogleCloudPlatform/bigquery-notebooks
notebooks/community/analytics-componetized-patterns/retail/ltv/bqml/notebooks/bqml_automl_ltv_activate_lookalike.ipynb
apache-2.0
# Install libraries. # The magic cells insures that those libraries can be part of a custom container # if moving the code somewhere else. %pip install -q googleads %pip install -q -U kfp matplotlib Faker --user # Automatically restart kernel after installs # import IPython # app = IPython.Application.instance() # app...
quole/gensim
docs/notebooks/atmodel_tutorial.ipynb
lgpl-2.1
!wget -O - 'http://www.cs.nyu.edu/~roweis/data/nips12raw_str602.tgz' > /tmp/nips12raw_str602.tgz import tarfile filename = '/tmp/nips12raw_str602.tgz' tar = tarfile.open(filename, 'r:gz') for item in tar: tar.extract(item, path='/tmp') """ Explanation: The author-topic model: LDA with metadata In this tutorial, ...
ghvn7777/ghvn7777.github.io
content/python3-note/2-type.ipynb
apache-2.0
x = 100 print(id(globals)) print(id(locals)) globals() def test(): x = "hello world" print(locals()) print(id(globals)) print(id(locals)) test() """ Explanation: 类型 基本环境 名字空间 Python 中,每个模块(源码文件)有一个全局名字空间,根据代码作用域,有当前名字(本地名字)空间,如果直接在模块级别执行,本地名字空间和全局名字空间没有区别,但在函数内,当前名字空间指函数作用域指的是函数作用域 End of explan...
synthicity/activitysim
activitysim/examples/example_estimation/notebooks/22_trip_dest.ipynb
agpl-3.0
import larch # !conda install larch #for estimation import pandas as pd import numpy as np import yaml import larch.util.excel import os """ Explanation: Estimating Trip Destination Choice This notebook illustrates how to re-estimate a single model component for ActivitySim. This process includes running ActivityS...
crowd-course/datascience
Ng's Machine Learning Exercise 6.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sb from scipy.io import loadmat %matplotlib inline raw_data = loadmat('ex6data1.mat') raw_data """ Explanation: Ng's Machine Learning Exercise 6 - Support Vector Machines This notebook is a Python-implementation solution for the ...
davofis/computational_seismology
08_finite_volumes/fv_advection_1d.ipynb
gpl-3.0
# Import all necessary libraries, this is a configuration step for the exercise. # Please run it before the simulation code! import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation # Show the plots in the Notebook. plt.switch_backend("nbagg") """ Explanation: <div style='background...
akshaybabloo/Car-ND
Term_1/advanced_lane_finding_10/undistort_10_2.ipynb
mit
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...
ajrichards/notebook
python/indexing_in_numpy.ipynb
bsd-3-clause
import numpy as np %matplotlib inline x = np.arange(5) print(np.where(x < 3)) print(x < 3) """ Explanation: Indexing in NumPy np.where vs masking np.where returns just the indices where the equivalent mask is true this is useful if you need the actual indices (maybe for counts) otherwise the shorthand notation (mask...
jo-tez/aima-python
search.ipynb
mit
from search import * from notebook import psource, heatmap, gaussian_kernel, show_map, final_path_colors, display_visual, plot_NQueens # Needed to hide warnings in the matplotlib sections import warnings warnings.filterwarnings("ignore") """ Explanation: Solving problems by Searching This notebook serves as supportin...
feelpp/book.feelpp.org
pyfeelpp_tests.ipynb
gpl-3.0
!echo "deb https://dl.bintray.com/feelpp/ubuntu bionic latest" | tee -a /etc/apt/sources.list !wget -qO - https://bintray.com/user/downloadSubjectPublicKey?username=bintray | apt-key add - !apt update !apt install feelpp-quickstart feelpp-data !apt install python3-mpi4py python3-feelpp ssh """ Explanation: <a href="h...
grfiv/MNIST
vw/VW_benchmark_kvsm.ipynb
mit
from __future__ import division import re import numpy as np from sklearn.metrics import confusion_matrix import matplotlib.pyplot as plt %matplotlib inline #%qtconsole """ Explanation: MNIST classification with Vowpal Wabbit End of explanation """ !rm train_kvsm.vw.cache !rm mnist_train_kvsm.model !vw -d data/...
nikbearbrown/Deep_Learning
NEU/Sai_Raghuram_Kothapalli_DL/Creditcard Fraud detection using Autoencoders.ipynb
mit
import pandas as pd import numpy as np import pickle import matplotlib.pyplot as plt from scipy import stats import tensorflow as tf import seaborn as sns from pylab import rcParams from sklearn.model_selection import train_test_split from keras.models import Model, load_model from keras.layers import Input, Dense from...
econchick/pyladies-data
Meetup Stats.ipynb
mit
from __future__ import print_function from collections import defaultdict import json import os import time import requests """ Explanation: PyLadies and local Python User Groups Last updated: August 4, 2015 I am not a statistician by trade; far from it. I did take a few stats & econometrics courses in college, but ...
MadsJensen/intro_to_scientific_computing
notebooks/07-Control_flow.ipynb
bsd-3-clause
1 % 2 """ Explanation: Control flow In a nutshell: Allow for a control over a computer program. Types of control If/else statements Loops Boolean statements Logical statements The anatomy of if/else statements Statement to be evaluated Statement of what will happen if (1) is true Statement of what will happen if ...