repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
rajuniit/udacity | image_classification/dlnd_image_classification.ipynb | mit | import tarfile
from tqdm import tqdm as progress_bar_lib
from urllib.request import urlretrieve
from os.path import isfile, isdir
import problem_unittests as tests
cifar10_dataset_folder_path = 'cifar-10-batches-py'
class DownloadImageData(progress_bar_lib):
last_batch = 0
def start(self, batch_num=1, batc... |
dereneaton/ipyrad | testdocs/analysis/cookbook-distance.ipynb | gpl-3.0 | # conda install ipyrad -c conda-forge -c bioconda
# conda install ipcoal -c conda-forge
import ipyrad.analysis as ipa
import ipcoal
import toyplot
import toytree
"""
Explanation: <h1><span style="color:gray">ipyrad-analysis toolkit:</span> distance</h1>
Genetic distance matrices are used in many contexts to study th... |
MTG/sms-tools | notebooks/E2-Sinusoids-and-DFT.ipynb | agpl-3.0 | import numpy as np
# E2 - 1.1: Complete function gen_sine()
def gen_sine(A, f, phi, fs, t):
"""Generate a real sinusoid given its amplitude, frequency, initial phase, sampling rate, and duration.
Args:
A (float): amplitude of the sinusoid
f (float): frequency of the sinusoid in Hz
... |
nproctor/phys202-2015-work | assignments/assignment03/NumpyEx04.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: Numpy Exercise 4
Imports
End of explanation
"""
import networkx as nx
K_5=nx.complete_graph(5)
nx.draw(K_5)
"""
Explanation: Complete graph Laplacian
In discrete mathematics a Graph is a set of vertices or n... |
AllenDowney/ThinkStats2 | workshop/sampling_soln.ipynb | gpl-3.0 | %matplotlib inline
import numpy
import scipy.stats
import matplotlib.pyplot as plt
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
# seed the random number generator so we all get the same results
numpy.random.seed(18)
"""
Explanation: Random Sampling
Copyright 2016 Allen Downey
Li... |
jasonkitbaby/udacity-homework | boston_housing/boston_housing.ipynb | apache-2.0 | # 载入此项目所需要的库
import numpy as np
import pandas as pd
import visuals as vs # Supplementary code
# 检查你的Python版本
from sys import version_info
if version_info.major != 2 and version_info.minor != 7:
raise Exception('请使用Python 2.7来完成此项目')
# 让结果在notebook中显示
%matplotlib inline
# 载入波士顿房屋的数据集
data = pd.read_csv('housi... |
dennisproppe/fp_python | fp_lesson_3_monads.ipynb | apache-2.0 | class Company():
def __init__(self, name, address=None):
self.address = address
self.name = name
def get_name(self):
return self.name
def get_address(self):
return self.address
"""
Explanation: Monads
Monads are the most feared concept of FP, so I reserve ... |
wutienyang/facebook_fanpage_analysis | Facebook粉絲頁分析三部曲-爬取篇(posts).ipynb | mit | # 載入python 套件
import requests
import datetime
import time
import pandas as pd
"""
Explanation: 如何爬取Facebook粉絲頁資料 (posts) ?
基本上是透過 Facebook Graph API 去取得粉絲頁的資料,但是使用 Facebook Graph API 還需要取得權限,有兩種方法 :
第一種是取得 Access Token
第二種是建立 Facebook App的應用程式,用該應用程式的帳號,密碼當作權限
兩者的差別在於第一種會有時效限制,必須每隔一段時間去更新Access Token,才能使用
Access Token... |
daniel-acuna/python_data_science_intro | notebooks/Introduction to Python and Notebook.ipynb | mit | import sklearn
"""
Explanation: Jypter notebook
Before starting, let's take a look at the Jupyter notebook.
Stopping and halting a kernel
Looking at which notebooks are running
Cells
Adding cells above and below
Changing type of cell from Markdown to Code
Adding math
Class and objects
To import a module, you use the... |
0u812/nteract | example-notebooks/omex-basics.ipynb | bsd-3-clause | // -- Begin Antimony block
model *myModel()
// Compartments and Species:
species S1, S2;
// Reactions:
_J0: S1 -> S2; k1*S1;
// Species initializations:
S1 = 10;
S2 = 0;
// Variable initializations:
k1 = 1;
// Other declarations:
const k1;
end
// -- End Antimony block
// -- Begin PhraSEDML bl... |
cliburn/sta-663-2017 | worksheet/Mock Midterms 2 Solutions.ipynb | mit | %matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%load_ext rpy2.ipython
"""
Explanation: Midterm exams
This is a "closed book" examination - in particular, you are not to use any resources outside of this notebook (except possibly pen and paper). You may ... |
openfisca/openfisca-france-indirect-taxation | openfisca_france_indirect_taxation/examples/notebooks/depenses_agregats_transports.ipynb | agpl-3.0 | import seaborn
seaborn.set_palette(seaborn.color_palette("Set2", 12))
%matplotlib inline
from ipp_macro_series_parser.agregats_transports.transports_cleaner import a3_a
from openfisca_france_indirect_taxation.examples.utils_example import graph_builder_line, graph_builder_line_percent
"""
Explanation: Ce script ré... |
dh7/ML-Tutorial-Notebooks | tf-char-RNN-explained.ipynb | bsd-2-clause | import numpy as np
import tensorflow as tf
"""
Explanation: A minimal Char RNN using TensorFlow
This Jupyter Notebook implement RNN at char level and is inspired by the Minimal character-level Vanilla RNN model written by Andrej Karpathy
Decoding is based on this code from Sherjil Ozair
I did some modifications to the... |
dipanjank/ml | data_analysis/haberman_uci.ipynb | gpl-3.0 | %pylab inline
pylab.style.use('ggplot')
import pandas as pd
import numpy as np
import seaborn as sns
url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/haberman/haberman.data'
data_df = pd.read_csv(url, header=None)
data_df.head()
data_df.columns = ['age', 'year_of_op', 'n_nodes', 'survival']
data_df.h... |
rasbt/algorithms_in_ipython_notebooks | ipython_nbs/essentials/greedy-algorithm-intro.ipynb | gpl-3.0 | def coinchanger(cents, denominations=[1, 5, 10, 20]):
coins = {d: 0 for d in denominations}
for c in sorted(coins.keys(), reverse=True):
coins[c] += cents // c
cents = cents % c
if not cents:
total_coins = sum([i for i in coins.values()])
return sorted(coins.item... |
smharper/openmc | examples/jupyter/search.ipynb | mit | # Initialize third-party libraries and the OpenMC Python API
import matplotlib.pyplot as plt
import numpy as np
import openmc
import openmc.model
%matplotlib inline
"""
Explanation: This Notebook illustrates the usage of the OpenMC Python API's generic eigenvalue search capability. In this Notebook, we will do a cr... |
minxuancao/shogun | doc/ipython-notebooks/classification/SupportVectorMachines.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
import matplotlib.patches as patches
#To import all shogun classes
import modshogun as sg
import numpy as np
#Generate some random data
X = 2 * np.random.randn(10,2)
traindata=np.r_[X + 3, X + 7].... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/feature_engineering/labs/5_tftransform_taxifare.ipynb | apache-2.0 | !pip install --user apache-beam[gcp]==2.16.0
!pip install --user tensorflow-transform==0.15.0
"""
Explanation: TfTransform
Learning Objectives
1. Preproccess data and engineer new features using TfTransform
1. Create and deploy Apache Beam pipeline
1. Use processed data to train taxifare model locally then serve a p... |
AllenDowney/ThinkBayes2 | examples/distribution.ipynb | mit | from __future__ import print_function, division
%matplotlib inline
%precision 6
import warnings
warnings.filterwarnings('ignore')
from thinkbayes2 import Pmf, Cdf
import thinkplot
import numpy as np
from numpy.fft import fft, ifft
from inspect import getsourcelines
def show_code(func):
lines, _ = getsourcelin... |
manchester9/intro-to-nltk | Text.ipynb | mit | import codecs
import requests
from urlparse import urljoin
from contextlib import closing
chunk_size = 10**6 # Download 1 MB at a time.
wpurl = "http://wpo.st/" # Washington Post provides short links
def fetch_webpage(url, path):
# Open up a stream request (to download large documents)
# Ensure that we wil... |
fastai/course-v3 | nbs/dl2/10c_fp16.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
#export
from exp.nb_10b import *
"""
Explanation: Training in mixed precision
End of explanation
"""
# export
import apex.fp16_utils as fp16
"""
Explanation: A little bit of theory
Jump_to lesson 12 video
Continuing the documentation on the fastai_v1 developm... |
kbennion/foundations-hw | 09/.ipynb_checkpoints/09 - Functions-checkpoint.ipynb | mit | len
"""
Explanation: Class 9: Functions
A painful analogy
What do you do when you wake up in the morning?
I don't know about you, but I get ready.
"Obviously," you say, a little too snidely for my liking. You're particular, very detail-oriented, and need more information out of me.
Fine, then. Since you're going to be... |
crawfordsm/crawfordsm.github.io | _posts/hof_voters_files/hof_voters.ipynb | mit | #read in the data
def read_votes(infile):
"""Read in the number of votes in each file"""
lines = open(infile).readlines()
hof_votes = {}
for l in lines:
player={}
l = l.split(',')
name = l[1].replace('X-', '').replace(' HOF', '').strip()
player['year'] = l[2]
play... |
lsst-dm-tutorial/lsst2017 | tutorial.ipynb | gpl-3.0 | %%script bash
export DATA_DIR=$HOME/DATA
export CI_HSC_DIR=$DATA_DIR/ci_hsc_small
mkdir -p $DATA_DIR
cd $DATA_DIR
if ! [ -d $CI_HSC_DIR ]; then
curl -O http://lsst-web.ncsa.illinois.edu/~krughoff/data/small_demo.tar.gz
tar zxvf small_demo.tar.gz
fi
export WORK_DIR=$HOME/WORK
mkdir -p $WORK_DIR
if ! [ -f $WORK_D... |
Gezort/YSDA_deeplearning17 | Seminar4/bonus/Bonus-advanced-theano.ipynb | mit | import numpy as np
def sum_squares(N):
return <student.Implement_me()>
%%time
sum_squares(10**8)
"""
Explanation: Theano, Lasagne
and why they matter
got no lasagne?
Install the bleeding edge version from here: http://lasagne.readthedocs.org/en/latest/user/installation.html
Warming up
Implement a function that c... |
SheffieldML/GPyOpt | manual/GPyOpt_scikitlearn.ipynb | bsd-3-clause | %pylab inline
import GPy
import GPyOpt
import numpy as np
from sklearn import svm
from numpy.random import seed
seed(12345)
"""
Explanation: GPyOpt: configuring Scikit-learn methods
Written by Javier Gonzalez and Zhenwen Dai, University of Sheffield.
Modified by Federico Tomasi, University of Genoa.
Last updated Thu... |
patrickmineault/xcorr-notebooks | notebooks/Expansion-Schmexpansion.ipynb | mit | %config InlineBackend.figure_format = 'retina'
import numpy as np
import matplotlib.pyplot as plt
def f(x):
r = np.exp(-1 / x ** 2)
r[x == 0] = 0
return r
rg = np.linspace(-10, 10, 401)
plt.plot(rg, f(rg))
"""
Explanation: Expansion shmexpansion
In calculus, we were taught that this function does not hav... |
jlawman/jlawman.github.io | content/sklearn/Metrics - Classification Report Breakdown (Precision, Recall, F1).ipynb | mit | import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.datasets import make_blobs
data, labels = make_blobs(n_samples=100, n_features=2, centers=2,cluster_std=4,random_state=2)
plt.scatter(data[:,0], data[:,1], c = labels, cmap='coolwarm');
"""
Explanation: Create Dummy Data for Clas... |
hglanz/phys202-2015-work | assignments/assignment07/AlgorithmsEx01.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
"""
Explanation: Algorithms Exercise 1
Imports
End of explanation
"""
def tokenize(s, stop_words=None, punctuation='`~!@#$%^&*()_-+={[}]|\:;"<,>.?/}\t'):
"""Split a string into a list of words, removing punctuation and stop words."""
... |
junhwanjang/DataSchool | Lecture/05. 기초 선형 대수 1 - 행렬의 정의와 연산/3) NumPy 연산.ipynb | mit | x = np.arange(1, 101)
x
y = np.arange(101, 201)
y
%%time
z = np.zeros_like(x)
for i, (xi, yi) in enumerate(zip(x, y)):
z[i] = xi + yi
z
"""
Explanation: NumPy 연산
벡터화 연산
NumPy는 코드를 간단하게 만들고 계산 속도를 빠르게 하기 위한 벡터화 연산(vectorized operation)을 지원한다. 벡터화 연산이란 반복문(loop)을 사용하지 않고 선형 대수의 벡터 혹은 행렬 연산과 유사한 코드를 사용하는 것을 말한다.
예... |
ercius/openNCEM | ncempy/notebooks/TitanX 4D-STEM Basic.ipynb | gpl-3.0 | dirName = r'C:\Users\Peter\Data\Te NP 4D-STEM'
fName = r'07_45x8 ss=5nm_spot11_CL=100 0p1s_alpha=4p63mrad_bin=4_300kV.dm4'
%matplotlib widget
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import ncempy.io as nio
import ncempy.algo as nalgo
import ipywidgets as wi... |
NeuroDataDesign/seelviz | albert/prob/Tensor+Model.ipynb | apache-2.0 | FA = np.clip(FA, 0, 1)
RGB = color_fa(FA, tenfit.evecs)
nib.save(nib.Nifti1Image(np.array(255 * RGB, 'uint8'), img.get_affine()), 'tensor_rgb.nii.gz')
print('Computing tensor ellipsoids in a part of the splenium of the CC')
from dipy.data import get_sphere
sphere = get_sphere('symmetric724')
from dipy.viz import fvt... |
LimeeZ/phys292-2015-work | days/day06/Matplotlib.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Visualization with Matplotlib
Learning Objectives: Learn how to make basic plots using Matplotlib's pylab API and how to use the Matplotlib documentation.
This notebook focuses only on the Matplotlib API, rather that the broader que... |
tensorflow/model-optimization | tensorflow_model_optimization/g3doc/guide/combine/pqat_example.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... |
GoogleCloudPlatform/training-data-analyst | blogs/gcp_forecasting/gcp_time_series_forecasting.ipynb | apache-2.0 | !pip3 install pandas-gbq
%%bash
git clone https://github.com/GoogleCloudPlatform/training-data-analyst.git \
--depth 1
cd training-data-analyst/blogs/gcp_forecasting
"""
Explanation: Overview
Time-series forecasting problems are ubiquitous throughout the business world and can be posed as a supervised machine lear... |
freininghaus/adventofcode | 2016/day05-python.ipynb | mit | with open("input/day5.txt", "r") as f:
inputLines = [line for line in f]
doorId = bytes(inputLines[0].strip(), "utf-8")
import hashlib
import itertools
"""
Explanation: Day 5: How About a Nice Game of Chess
End of explanation
"""
def interestingHashes(prefix):
for i in itertools.count():
m = hashli... |
mortcanty/SARDocker | mohammed.ipynb | mit | %matplotlib inline
"""
Explanation: Test for Mohammed
This container was started with
sudo docker run -d -p 433:8888 --name=sar -v /home/mort/imagery/mohammed/Data:/home/imagery mort/sardocker
End of explanation
"""
ls /home/imagery
"""
Explanation: Here are the RadarSat-2 quadpol coherency matrix image directories... |
MAKOSCAFEE/AllNotebooks | BasicMathReview.ipynb | mit | import numpy as np
y = np.array([1,2,3])
x = np.array([2,3,4])
"""
Explanation: 1. Linear Algebra
In the context of deep learning, linear algebra is a mathematical toolbox that offers helpful techniques for manipulating groups of numbers simultaneously. It provides structures like vectors and matrices (spreadsheets) ... |
lemieuxl/pyplink | demo/PyPlink Demo.ipynb | mit | from pyplink import PyPlink
"""
Explanation: PyPlink
PyPlink is a Python module to read and write binary Plink files. Here are small examples for PyPlink.
End of explanation
"""
import zipfile
try:
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve
# Downloading the de... |
wesleybeckner/salty | scripts/molecular_dynamics/therm_cond.ipynb | mit | from keras.layers import Dense, Dropout, Input
from keras.models import Model, Sequential
from keras.optimizers import Adam
import salty
from sklearn import preprocessing
from keras import regularizers
import matplotlib.pyplot as plt
import numpy as np
from keras.callbacks import EarlyStopping
from sklearn.metrics impo... |
akseshina/dl_course | seminar_3/AlexNet.ipynb | gpl-3.0 | import cifar10
"""
Explanation: Load Data
End of explanation
"""
cifar10.maybe_download_and_extract()
"""
Explanation: The CIFAR-10 data-set is about 163 MB and will be downloaded automatically if it is not located in the given path.
End of explanation
"""
class_names = cifar10.load_class_names()
class_names
"""... |
neoscreenager/JupyterNotebookWhirlwindTourOfPython | .ipynb_checkpoints/indic_nlp_examples-checkpoint.ipynb | gpl-3.0 | # The path to the local git repo for Indic NLP library
INDIC_NLP_LIB_HOME="/home/development/anoop/installs/indic_nlp_library"
# The path to the local git repo for Indic NLP Resources
INDIC_NLP_RESOURCES="/usr/local/bin/indicnlp/indic_nlp_resources"
"""
Explanation: Indic NLP Library
The goal of the Indic NLP Library... |
GustavoRP/IA369Z | dev/Apresentação JUPYTER/Apresentacao_JUPYTER.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pylab as plt
from ipywidgets import *
#Variância do ruído
var = 0.3
#Conjunto de treino
train_size = 10
x_train = np.linspace(0,1,train_size)
y_train = np.sin(2*np.pi*x_train) + np.random.normal(0,var,train_size) #sinal + ruido
#Conjunto de teste
test_size = 10... |
mne-tools/mne-tools.github.io | 0.22/_downloads/05c57a644672d33707fd1264df7f5617/plot_time_frequency_global_field_power.ipynb | bsd-3-clause | # Authors: Denis A. Engemann <denis.engemann@gmail.com>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import somato
from mne.baseline import rescale
from mne.stats import boots... |
sbailey/knltest | doc/redrock/scaling_plots_orig.ipynb | bsd-3-clause | %pylab inline
import numpy as np
import io
data = b'''
# cpu ncpu ntarg time
hsw 4 64 123
hsw 8 64 85
hsw 16 64 68
hsw 32 64 68
hsw 64 64 76
hsw 16 32 50
hsw 16 128 102
hsw 16 256 169
knl 16 64 380
knl 64 64 315
kn... |
sylvchev/coursMLpython | 2-AnalyseDuTitanic.ipynb | unlicense | import csv
import numpy as np
fichier_csv = csv.reader(open('train.csv', 'r'))
entetes = fichier_csv.__next__() # on récupère la première ligne qui contient les entetes
donnees = list() # on crée la liste qui va servir à récupérer les données
for ligne in fichier_csv: # pour chaque ligne lue dans le... |
nesterione/problem-solving-and-algorithms | problems/Calculus/mkr.ipynb | apache-2.0 | # Коэффициент теплопроводности
lam = 401
# Коэффициент удельной теплоемкости
c = 385
# Плотность материала
ro = 8900
# Вычисляем коэффициент задающий физические свойства материала
alpha = lam/(c*ro)
"""
Explanation: Метод конечных разностей
1. Подготовка
Вводим физические параметры материала
End of explanation
"""
... |
georgetown-analytics/classroom-occupancy | models/Sensor Data Ingestion & Cleaning_KM.ipynb | mit | %matplotlib inline
import os
import json
import time
import pickle
import requests
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.dates as md
import matplotlib.pyplot as plt
import matplotlib.ticker as tkr
import seaborn as sns
sns.set_palette('RdBu', 10)
"""
Explanation: Import & ... |
phoebe-project/phoebe2-docs | 2.2/tutorials/l3.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: "Third" Light
Setup
Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""
%matplotlib inline
import... |
jesseklein406/bikeshare | Bikeshare.ipynb | mit | from pandas import DataFrame, Series
import pandas as pd
import numpy as np
weather_data = pd.read_table('data/daily_weather.tsv')
season_mapping = {'Spring': 'Winter', 'Winter': 'Fall', 'Fall': 'Summer', 'Summer': 'Spring'}
def fix_seasons(x):
return season_mapping[x]
weather_data['season_desc'] = weather_da... |
telescopeuser/workshop_blog | wechat_tool/lesson_2.ipynb | mit | # Copyright 2016 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# !pip install --upgrade google-api-python-client
"""
Explanation: 如何使用和开发微信聊天机器人的系列教程
A workshop to develop & use an intelligent and interactive chat-bot in WeChat
WeChat is a popular social media app, which has more than ... |
ES-DOC/esdoc-jupyterhub | notebooks/nasa-giss/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', 'nasa-giss', 'sandbox-2', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: NASA-GISS
Source ID: SANDBOX-2
Topic: Seaice
Sub-Topics: Dynamics, Thermodyna... |
pkreissl/espresso | doc/tutorials/ferrofluid/ferrofluid_part1.ipynb | gpl-3.0 | import espressomd
import espressomd.magnetostatics
import espressomd.magnetostatic_extensions
import espressomd.cluster_analysis
import espressomd.pair_criteria
espressomd.assert_features('DIPOLES', 'LENNARD_JONES')
import numpy as np
"""
Explanation: Ferrofluid - Part 1
Table of Contents
Introduction
The Model
Str... |
KMFleischer/PyEarthScience | Visualization/miscellaneous/create_street_maps_from_geolocations.ipynb | mit | from geopy.geocoders import Nominatim
import folium
"""
Explanation: Retrieve geo-locations, create maps with markers and popups
Use OpenStreetMap data and the DKRZ logo.
<br>
geopy - Python client for several popular geocoding web services
folium - visualization tool for maps
<br>
End of explanation
"""
geolocator... |
AhmetHamzaEmra/Deep-Learning-Specialization-Coursera | Improving Deep Neural Networks/Regularization.ipynb | mit | # import packages
import numpy as np
import matplotlib.pyplot as plt
from reg_utils import sigmoid, relu, plot_decision_boundary, initialize_parameters, load_2D_dataset, predict_dec
from reg_utils import compute_cost, predict, forward_propagation, backward_propagation, update_parameters
import sklearn
import sklearn.da... |
feststelltaste/software-analytics | notebooks/Calculating the Structural Similarity of Test Cases.ipynb | gpl-3.0 | import pandas as pd
invocations = pd.read_csv("datasets/test_code_invocations.csv", sep=";")
invocations.head()
"""
Explanation: Introduction
This blog is a three-part series. See part 1 for retrieving the dataset and part 3 (upcoming) for visualization.
In big and old legacy systems, tests are often a mess. Especial... |
ReactiveX/RxPY | notebooks/reactivex.io/Part VIII - Hot & Cold.ipynb | mit | rst(O.publish)
def emit(obs):
log('.........EMITTING........')
sleep(0.1)
obs.on_next(rand())
obs.on_completed()
rst(title='Reminder: 2 subscribers on a cold stream:')
s = O.create(emit)
d = subs(s), subs(s.delay(100))
rst(title='Now 2 subscribers on a PUBLISHED (hot) stream', sleep=0.4)... |
ES-DOC/esdoc-jupyterhub | notebooks/thu/cmip6/models/sandbox-3/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'thu', 'sandbox-3', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: THU
Source ID: SANDBOX-3
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Balance... |
taiducvu/NudityDetection | VNG_NUDITY_DETECTION.ipynb | apache-2.0 | %matplotlib inline
%load_ext autoreload
%autoreload 2
from model.datasets.data import normalize_name_file
normalize_name_file('/home/cpu11757/workspace/Nudity_Detection/src/model/datasets/AdditionalDataset/Normal/4',0,'d_%d')
"""
Explanation: Stage 1: Preprocess VNG's data
In this stage, we will read raw data from a ... |
UWSEDS/LectureNotes | PreFall2018/Visualization-in-Python/Visualization in Python.ipynb | bsd-2-clause | import pandas as pd
import matplotlib.pyplot as plt
# The following ensures that the plots are in the notebook
%matplotlib inline
# We'll also use capabilities in numpy
import numpy as np
"""
Explanation: Visualization in Python
Background
Why visualize?
- Discovery
- Inference
- Communication
Terminology
- Representa... |
LimeeZ/phys292-2015-work | assignments/assignment06/ProjectEuler17.ipynb | mit | def ones(one,count):
if one == 1 or one == 2 or one == 6:
count += 3
if one == 4 or one == 5 or one == 9:
count += 4
if one == 3 or one == 7 or one == 8:
count += 5
return count
def teens(teen,count):
if teen == 10:
count += 3
if teen == 11 or teen =... |
OyamaZemi/MirandaFackler.notebooks | lqapprox/lqapprox_py.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import quantecon as qe
# matplotlib settings
plt.rcParams['axes.xmargin'] = 0
plt.rcParams['axes.ymargin'] = 0
"""
Explanation: LQ Approximation with QuantEcon.py
End of explanation
"""
def approx_lq(s_star, x_star, f_star, Df_star, DDf_star, g_star, Dg_star, disco... |
phungkh/phys202-2015-work | assignments/assignment09/IntegrationEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy import integrate
"""
Explanation: Integration Exercise 2
Imports
End of explanation
"""
def integrand(x, a):
return 1.0/(x**2 + a**2)
def integral_approx(a):
# Use the args keyword argument to feed extra a... |
ES-DOC/esdoc-jupyterhub | notebooks/ipsl/cmip6/models/ipsl-cm6a-lr/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ipsl', 'ipsl-cm6a-lr', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: IPSL
Source ID: IPSL-CM6A-LR
Topic: Ocnbgchem
Sub-Topics: Tracers.
Prope... |
ewulczyn/talk_page_abuse | src/data_generation/crowdflower_analysis/src/Crowdflower Analysis (Experiment on Comparison of Onion Layers).ipynb | apache-2.0 | %matplotlib inline
from __future__ import division
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from crowdflower_analysis import *
from krippendorf_alpha import *
pd.set_option('display.max_colwidth', 1000)
attack_columns = ['not_attack', 'other', 'quoting', 'recipient', 'third_party']
aggre... |
dchud/warehousing-course | lectures/week-03/sql-demo.ipynb | cc0-1.0 | %load_ext sql
"""
Explanation: Sqlite3 and MySQL demo
With the excellent ipython-sql jupyter extension installed, it becomes very easy to connect to SQL database backends. This notebook demonstrates how to do this.
Note that this is a Python 2 notebook.
First, we need to activate the extension:
End of explanation
"""... |
letsgoexploring/teaching | winter2017/econ129/python/Econ129_Class_02_Complete.ipynb | mit | # Print the first several digits of pi (3.14159...):
print(3.14159)
"""
Explanation: Class 2: Python basics
This is a quick introduction progamming with Python (Python 3 in particular). An excellent print resources is Python Programming for Beginners by Jason Cannon. Part 1: Programming in Python of Thomas J. Sargent ... |
ssunkara1/bqplot | examples/Marks/Object Model/Image.ipynb | apache-2.0 | import ipywidgets as widgets
import os
image_path = os.path.abspath('../../data_files/trees.jpg')
with open(image_path, 'rb') as f:
raw_image = f.read()
ipyimage = widgets.Image(value=raw_image, format='jpg')
ipyimage
"""
Explanation: The Image Mark
Image is a Mark object, used to visualize images in standard fo... |
mne-tools/mne-tools.github.io | 0.23/_downloads/5f078eabe74f0448d3e1662c12313289/source_space_time_frequency.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, source_band_induced_power
print(__doc__)
"""
Explanation: Compute induced power in... |
jseabold/statsmodels | examples/notebooks/markov_regression.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
# NBER recessions
from pandas_datareader.data import DataReader
from datetime import datetime
usrec = DataReader('USREC', 'fred', start=datetime(1947, 1, 1), end=datetime(2013, 4, 1))
"""
Explanatio... |
weikang9009/pysal | notebooks/explore/pointpats/pointpattern.ipynb | bsd-3-clause | import pysal.lib as ps
import numpy as np
from pysal.explore.pointpats import PointPattern
"""
Explanation: Planar Point Patterns in PySAL
Author: Serge Rey sjsrey@gmail.com and Wei Kang weikang900... |
bbglab/adventofcode | 2016/BBGÀgora 20161201.ipynb | mit | [n * 2 for n in range(10) if n % 2 == 1]
# Also a dict
{n: n * 2 for n in range(10) if n % 2 == 1}
# Or a set
{n * 2 for n in range(10) if n % 2 == 1}
"""
Explanation: BBGÀgora - Advent of code
Install conda
Add conda channels
Install jupyter notebook
Create a conda environment
Register to github
Clone a github rep... |
vravishankar/Jupyter-Books | List+Comprehensions.ipynb | mit | # Simple List Comprehension
list = [x for x in range(5)]
print(list)
"""
Explanation: List Comprehensions
List comprehensions are quick and concise way to create lists. List comprehensions comprises of an expression, followed by a for clause and then zero or more for or if clauses. The result of the list comprehension... |
open-hluttaw/notebooks | Open Hluttaw API Examples.ipynb | gpl-3.0 | #List all committees
query = 'classification:Committee'
r = requests.get('http://api.openhluttaw.org/en/search/organizations?q='+query)
pages = r.json()['num_pages']
committees = []
for page in range(1,pages+1):
r = requests.get('http://api.openhluttaw.org/en/search/organizations?q='+query+'&page='+str(page))
... |
ocean-color-ac-challenge/evaluate-pearson | evaluation.ipynb | apache-2.0 | w_412 = 0.56
w_443 = 0.73
w_490 = 0.71
w_510 = 0.36
w_560 = 0.01
"""
Explanation: E-CEO Challenge #3 Evaluation
Weights
Define the weight of each wavelength
End of explanation
"""
run_id = '0000021-150601000007545-oozie-oozi-W'
run_meta = 'http://sb-10-16-10-53.dev.terradue.int:50075/streamFile/ciop/run/participant-... |
gwu-libraries/notebooks | 20180511-pyspark-elasticsearch/PySpark-ElasticSearch.ipynb | mit | import os
import pyspark
# Add the elasticsearch-hadoop jar
os.environ['PYSPARK_SUBMIT_ARGS'] = '--jars /home/jovyan/elasticsearch-hadoop-6.2.2.jar pyspark-shell'
conf = pyspark.SparkConf()
# Point to the master.
conf.setMaster("spark://tweetsets.library.gwu.edu:7101")
conf.setAppName("pyspark-elasticsearch-demo")
co... |
xdnian/pyml | code/ch11/ch11.ipynb | mit | %load_ext watermark
%watermark -a '' -u -d -v -p numpy,pandas,matplotlib,scipy,sklearn
"""
Explanation: Copyright (c) 2015, 2016 Sebastian Raschka
<br>
2016 Li-Yi Wei
https://github.com/1iyiwei/pyml
MIT License
Python Machine Learning - Code Examples
Chapter 11 - Working with Unlabeled Data – Clustering Analysis
Super... |
postBG/DL_project | 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... |
mediagestalt/Concordance-Output | Concordances.ipynb | mit | # This is where the modules are imported
import nltk
import sys
import codecs
from os import listdir
from os.path import splitext
from os.path import basename
# These functions extract the filename
def remove_ext(filename):
"Removes the file extension, such as .txt"
name, extension = splitext(filename)
re... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session07/Day1/Code repositories.ipynb | mit | ! #complete
! #complete
"""
Explanation: Code Repositories
The notebook contains problems oriented around building a basic Python code repository and making it public via Github. Of course there are other places to put code repositories, with complexity ranging from services comparable to github to simple hosting a g... |
bjodah/chempy | examples/protein_binding_unfolding_4state_model.ipynb | bsd-2-clause | import logging; logger = logging.getLogger('matplotlib'); logger.setLevel(logging.INFO) # or notebook filled with logging
from collections import OrderedDict, defaultdict
import math
import re
import time
from IPython.display import Image, Latex, display
import matplotlib.pyplot as plt
import sympy
from pyodesys.symb... |
FESOM/pyfesom | notebooks/plot_simple_diagnostics.ipynb | mit | import sys
sys.path.append("../")
import pyfesom as pf
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.colors import LinearSegmentedColormap
import numpy as np
#%matplotlib notebook
%matplotlib inline
from matplotlib import cm
from netCDF4 import Dataset, MFDataset
"""
Explana... |
seniosh/StatisticalMethods | notes/LMreview4.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (8.0, 8.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's
x = mu_x + tau_x... |
analysiscenter/dataset | examples/experiments/freezeout/FreezeOut.ipynb | apache-2.0 | import os
import sys
import blosc
import tensorflow as tf
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from tqdm import tqdm_notebook as tqn
from collections import OrderedDict
%matplotlib inline
sys.path.append('../../..')
from batch import ResBatch, ax_draw
from batchflow import Dataset, D... |
davidthomas5412/PanglossNotebooks | MassLuminosityProject/SummerResearch/ValidatingBigmaliAtScale_20170626.ipynb | mit | %matplotlib inline
import corner
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from matplotlib import rc
from bigmali.hyperparameter import get
from scipy.stats import lognorm
rc('text', usetex=True)
orig = np.loadtxt('bigmaliorig.out', delimiter=' ')
prior = np.loadtxt('bigmaliprior.out', de... |
GoogleCloudPlatform/vertex-pipelines-end-to-end-samples | pipelines/tfma_metrics_visualisations.ipynb | apache-2.0 | !pip install tensorflow_model_analysis==0.37.0 pandas==1.3.5 google_cloud_storage==1.43.0
"""
Explanation: TFMA Model Evaluation Visualisations
This Notebook will guide the user as to how to obtain embedded HTML visualisations of TFMA model evaluation metrics used and created during training. This Notebook must be run... |
steinam/teacher | jup_notebooks/data-science-ipython-notebooks-master/scikit-learn/scikit-learn-pca.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import seaborn;
from sklearn import neighbors, datasets
import pylab as pl
seaborn.set()
iris = datasets.load_iris()
X, y = iris.data, iris.target
from sklearn.decomposition import PCA
pca = PCA(n_components=2)
pca.fit(X)
X_reduced = pca.transfo... |
theandygross/CancerData | Notebooks/get_all_MAFs.ipynb | mit | import NotebookImport
from Imports import *
from bs4 import BeautifulSoup
from urllib2 import HTTPError
"""
Explanation: <h1 class="alert alert-info">Download Data <small> <i class="icon-download"></i> Get All Available MAF Files from TCGA Data Portal</small></h1>
End of explanation
"""
PATH_TO_CACERT = '/cellar/... |
alexgorban/models | research/object_detection/object_detection_tutorial.ipynb | apache-2.0 | !pip install -U --pre tensorflow=="2.*"
"""
Explanation: Object Detection API Demo
<table align="left"><td>
<a target="_blank" href="https://colab.sandbox.google.com/github/tensorflow/models/blob/master/research/object_detection/object_detection_tutorial.ipynb">
<img src="https://www.tensorflow.org/images/colab... |
Nathx/think_stats | resolved/survival.ipynb | gpl-3.0 | from __future__ import print_function, division
import nsfg
import survival
import thinkstats2
import thinkplot
import pandas
import numpy
from lifelines import KaplanMeierFitter
from collections import defaultdict
import matplotlib.pyplot as pyplot
%matplotlib inline
"""
Explanation: This notebook contains examp... |
dwhswenson/openpathsampling | examples/misc/sshooting-example.ipynb | mit | # Set simulation details.
D = 1.0 # Diffusion constant.
beta = 4.0 # Beta.
dt = 0.001 # Timestep delta t [time units]
tau = 0.5 # One-way trajectory length tau [time units] (= maximum correlation function time).
n_corr_points = 501 # Number of correlatio... |
ioos/notebooks_demos | notebooks/2018-03-01-erddapy.ipynb | mit | server = "https://data.ioos.us/gliders/erddap"
protocol = "tabledap"
dataset_id = "whoi_406-20160902T1700"
response = "mat"
variables = [
"depth",
"latitude",
"longitude",
"salinity",
"temperature",
"time",
]
constraints = {
"time>=": "2016-07-10T00:00:00Z",
"time<=": "2017-02-10T00... |
computational-class/cjc2016 | code/09.04-Feature-Engineering.ipynb | mit | data = [
{'price': 850000, 'rooms': 4, 'neighborhood': 'Queen Anne'},
{'price': 700000, 'rooms': 3, 'neighborhood': 'Fremont'},
{'price': 650000, 'rooms': 3, 'neighborhood': 'Wallingford'},
{'price': 600000, 'rooms': 2, 'neighborhood': 'Fremont'}
]
"""
Explanation: Feature Engineering
<!--BOOK_INFORMAT... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/08_image/mnist_linear.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
import numpy as np
import shutil
import os
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
print(tf.__version__)
"""
Explanation: MNIST Image Classification with TensorFlow
This notebook demonstrates how to implement a simple linear image m... |
moranconnorj/code_guild | wk0/notebooks/challenges/primes/primes_challenge.ipynb | mit | from math import sqrt, floor
def list_primes(n):
"""
Returns a list of prime numbers
takes an int and returns the primes up to and including that int
Parameters
----------
Input:
n: int
output:
prime: list
a list of integers
"""
prime = []
for i i... |
bert9bert/statsmodels | examples/notebooks/markov_regression.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
# NBER recessions
from pandas_datareader.data import DataReader
from datetime import datetime
usrec = DataReader('USREC', 'fred', start=datetime(1947, 1, 1), end=datetime(2013, 4, 1))
"""
Explanatio... |
akinorihomma/Computer-Science-2 | ニューラルネット入門_補足資料.ipynb | unlicense | np.array?
"""
Explanation: Python 基礎
iPython (or jupyter) のヘルプテクニック
これを見ている人は jupyter notebook を使っていると思うが、次のコードを動かしてみてほしい。
End of explanation
"""
def hogehoge():
""" docstring here! """
return 0
hogehoge?
"""
Explanation: iPython では ? をつけて実行することで、 Docstring (各プログラムの説明文) を簡単に参照することができる。
もし「関数はしってるんだけど、引数が分か... |
moonbury/pythonanywhere | learn_scipy/7702OS_Chap_03_rev20141229.ipynb | gpl-3.0 | import numpy
vectorA = numpy.array([1,2,3,4,5,6,7])
vectorA
vectorB = vectorA[::-1].copy()
vectorB
vectorB[0]=123
vectorB
vectorA
vectorB = vectorA[::-1].copy()
vectorB
"""
Explanation: <center><font color=red>Learning SciPy for Numerical and Scientific Computing</font></center>
Content under Creative Co... |
OpenPIV/openpiv-python | synimage/Synthetic_Image_Generator_examples.ipynb | gpl-3.0 | import synimagegen
import matplotlib.pyplot as plt
import numpy as np
import os
%matplotlib inline
"""
Explanation: Synthetic Image Generation examples
In this Notebook a number of test cases using the PIV sythetic image generator will be presented.
The three examples shown are:
1. Using a fully synthetic flow field c... |
cmmorrow/sci-analysis | docs/sci_analysis_main.ipynb | mit | import warnings
warnings.filterwarnings("ignore")
import numpy as np
import scipy.stats as st
from sci_analysis import analyze
"""
Explanation: sci-analysis
An easy to use and powerful python-based data exploration and analysis tool
Current Version
2.2 --- Released January 5, 2019
What is sci-analysis?
sci-analysis is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.