repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
leimao/leimao.github.io | downloads/articles/2017-09-14-Google-DeepDream-Python/deepdream.ipynb | gpl-2.0 | # boilerplate code
from __future__ import print_function
import os
from io import BytesIO
import numpy as np
from functools import partial
import PIL.Image
from IPython.display import clear_output, Image, display, HTML
import tensorflow as tf
"""
Explanation: DeepDreaming with TensorFlow
Loading and displaying the m... |
tpin3694/tpin3694.github.io | machine-learning/harris_corner_detector.ipynb | mit | # Load image
import cv2
import numpy as np
from matplotlib import pyplot as plt
"""
Explanation: Title: Harris Corner Detector
Slug: harris_corner_detector
Summary: How to detect corners images using OpenCV in Python with the Harris Corner Detector.
Date: 2017-09-11 12:00
Category: Machine Learning
Tags: Preprocess... |
ethen8181/Business-Analytics | bandits/bandits.ipynb | mit | def generate_bernoulli_bandit_data( n_simulations, K ):
"""
generate simluate data, that represents success / trial data
Parameters
----------
n_simulations : int
the total number of turns in a simulation
K : int
the total number of arms
Returns
-------... |
southpaw94/MachineLearning | TextExamples/3547_03_Code.ipynb | gpl-2.0 | %load_ext watermark
%watermark -a 'Sebastian Raschka' -u -d -v -p numpy,pandas,matplotlib,scikit-learn
# to install watermark just uncomment the following line:
#%install_ext https://raw.githubusercontent.com/rasbt/watermark/master/watermark.py
"""
Explanation: Sebastian Raschka, 2015
Python Machine Learning Essentia... |
dryadb11781/machine-learning-python | Datasets/ipython_notebook/ex2_the_iris_dataset.ipynb | bsd-3-clause | #這行是在ipython notebook的介面裏專用,如果在其他介面則可以拿掉
%matplotlib inline
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn import datasets
from sklearn.decomposition import PCA
# import some data to play with
iris = datasets.load_iris()
X = iris.data[:, :2] # we only take the first two features... |
ledeprogram/algorithms | class7/homework/Skinner_Barnaby_7_1.ipynb | gpl-3.0 | import pandas as pd
%matplotlib inline
from sklearn import datasets
from pandas.tools.plotting import scatter_matrix
from sklearn import tree
from sklearn.cross_validation import train_test_split
from sklearn import metrics
import numpy as np
import matplotlib.pyplot as plt
iris = datasets.load_iris()
iris
iris['f... |
gaufung/Data_Analytics_Learning_Note | DesignPattern/InterpretPattern.ipynb | mit | class PlayContext():
play_text = None
class Expression():
def interpret(self, context):
if len(context.play_text) == 0:
return
else:
play_segs=context.play_text.split(" ")
for play_seg in play_segs:
pos=0
for ele in play_seg:
... |
ernestyalumni/servetheloop | NISTFund/NISTFund.ipynb | mit | import os, sys
import decimal
from decimal import Decimal
import pandas as pd
# get the current directory and files inside
print(os.getcwd()); print(os.listdir( os.getcwd() ));
from NISTFund import retrieve_file, scraping_allascii, init_FundConst, make_pd_alphabeticalconv_lst, make_pd_conv_lst
"""
Explanation: Nat... |
hglanz/phys202-2015-work | assignments/assignment04/MatplotlibExercises.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Visualization 1: Matplotlib Basics Exercises
End of explanation
"""
x = np.random.randn(100)
y = 2.4 * x + 1.3 + np.random.randn(100)
plt.scatter(x, y)
plt.xlabel("x")
plt.ylabel("y")
plt.title("y vs. x")
"""
Explanation: Scatter... |
jvbalen/cover_id | draft_notebooks/paired_data_draft.ipynb | mit | # ratio = (5, 15, 80)
ratio = (1, 9, 90)
clique_dict, cliques_by_uri = SHS_data.read_cliques()
train_cliques, test_cliques, val_cliques = util.split_train_test_validation(clique_dict, ratio=ratio)
"""
Explanation: Load some data
End of explanation
"""
pairs, non_pairs = paired_data.get_pairs(train_cliques)
assert l... |
VVard0g/ThreatHunter-Playbook | docs/notebooks/windows/08_lateral_movement/WIN-201009173318.ipynb | mit | from openhunt.mordorutils import *
spark = get_spark()
"""
Explanation: Remote WMI Wbemcomn DLL Hijack
Metadata
| Metadata | Value |
|:------------------|:---|
| collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] |
| creation date | 2020/10/09 |
| modification date | 2020/10/09 |
| playbook related |... |
AbnerZheng/Titanic_Kaggle | scikit-learn/09_classification_metrics.ipynb | mit | # read the data into a Pandas DataFrame
import pandas as pd
url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data'
col_names = ['pregnant', 'glucose', 'bp', 'skin', 'insulin', 'bmi', 'pedigree', 'age', 'label']
pima = pd.read_csv(url, header=None, names=col_na... |
gfeiden/Notebook | Daily/20150811_young_model_bcs.ipynb | mit | def loadPreMS(filename):
trk = np.genfromtxt(filename)
bools = [(5.0e5 < age < 1.0e9) for age in trk[:,0]]
return np.compress(bools, trk, axis=0)
"""
Explanation: Young Stellar Evolution Model Boundary Condition Sensitivity
Exploration of how various boundary conditions affects stellar evolution model resu... |
ky822/Data_Bootcamp | Code/IPython/Bootcamp_1_Examples.ipynb | mit | x = [7, 3, 5]
x.pop?
"""
Explanation: Data Bootcamp 1: Examples
Python applied to economic and financial data
This is an introduction to Data Bootcamp, a (prospective) course at NYU designed to give students some familiarity with (i) Python and (ii) economic and financial data. A more complete collection of materia... |
snegirigens/DLND | sentiment-rnn/Sentiment_RNN.ipynb | mit | import numpy as np
import tensorflow as tf
with open('../sentiment-network/reviews.txt', 'r') as f:
reviews = f.read()
with open('../sentiment-network/labels.txt', 'r') as f:
labels = f.read()
print (len(reviews))
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll impleme... |
google/prog-edu-assistant | exercises/functional-master.ipynb | apache-2.0 | # A program that calculates the final grade for each student.
# Scores for Assignment 1, Assignment 2, and Final Exam.
sam_scores = [90, 80, 90]
yuko_scores = [90, 100, 80]
sam_weighted_score = 0.2 * sam_scores[0] + 0.2 * sam_scores[1] + 0.6 * sam_scores[2]
sam_grade = 'PASS' if sam_weighted_score > 60 else 'FAIL'
pr... |
varnion/sabesPy | rascunho.ipynb | bsd-3-clause | from IPython.display import display, Image
## eis a imagem da notícia
infograficoG1 = Image('reservatorios1403.jpg')
display(infograficoG1)
"""
Explanation: Acho que esse gráfico do G1 tá errado
G1 São Paulo
Nível de água do Cantareira vai a 14,5%; todos reservatórios sobem
link da notícia
<!---
import matplotlib.pyplot as plt
"""
Explanation: Part 2: Visual Overview of Plotting Functions
We've talked a lot about laying things out, etc, but we haven't talked about ... |
deepchem/deepchem | examples/tutorials/Going_Deeper_on_Molecular_Featurizations.ipynb | mit | !pip install --pre deepchem
import deepchem
deepchem.__version__
"""
Explanation: Going Deeper On Molecular Featurizations
One of the most important steps of doing machine learning on molecular data is transforming the data into a form amenable to the application of learning algorithms. This process is broadly called ... |
amkatrutsa/MIPT-Opt | Spring2017-2019/12-NumMethods/Seminar12.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
USE_COLAB = False
if not USE_COLAB:
plt.rc("text", usetex=True)
import numpy as np
C = 10
alpha = -0.5
q = 0.9
num_iter = 7
sublinear = np.array([C * k**alpha for k in range(1, num_iter + 1)])
linear = np.array([C * q**k for k in range(1, num_iter + 1)])
superlin... |
rice-solar-physics/hot_plasma_single_nanoflares | notebooks/read_hydrad_results.ipynb | bsd-2-clause | import os
import pickle
import numpy as np
"""
Explanation: Read HYDRAD Results
In our paper, we make various comparisons between EBTEL and the field-aligned code HYDRAD. However, runs of HYDRAD are computationally expensive and it is not feasible to do these on the fly. We are in the process of making HYDRAD availab... |
gentnerlab/ephys-analysis | notebooks/quick_viz.ipynb | bsd-3-clause | import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import os
import sys
from ephys import core, events, rasters
from importlib import reload
"""
Explanation: Initial visualizations of your data
This notebook is meant to let you quickly look at your post-manually sorted data
End of explanation
"""
... |
gaufung/Data_Analytics_Learning_Note | python-statatics-tutorial/advance-theme/Singleton.ipynb | mit | class Singleton(object):
def __new__(cls, *args, **kwargs):
if not hasattr(cls, '_instance'):
cls._instance = super(Singleton, cls).__new__(cls, *args, **kwargs)
return cls._instance
class MyClass(object):
pass
single1 = Singleton()
single2 = Singleton()
myclass1 = MyClass()... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/tsa_arma_0.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
from scipy import stats
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.tsa.arima.model import ARIMA
from statsmodels.graphics.api import qqplot
"""
Explanation: Autoregressive Moving Average (ARMA): Sunspots data
End of explana... |
ioggstream/python-course | python-for-sysadmin/notebooks/03_parsing_benchmarks.ipynb | agpl-3.0 | import re
import nose
# %timeit
"""
Explanation: Parsing
Goals:
- Plan a parsing strategy
- Use basic regular expressions: match, search, sub
- Benchmarking a parser
- Running nosetests
- Write a simple parser
Modules:
End of explanation
"""
from __future__ import print_function
# Before writing the parser, collect... |
UV-CDAT/tutorials | graphics/Basic_VCS_demo.ipynb | bsd-2-clause | import vcs
import cdms2
# MAke sure sample data is here
vcs.download_sample_data_files()
f=cdms2.open(vcs.sample_data+"/clt.nc")
# LOAS SAMPLE DATA
s=f("clt")
# Create vcs canvas (basically X window to draw in)
x=vcs.init()
# plot data as is
#because we are in jupyter using bg=True to plot thing in background (no... |
adieuadieu/educathingamajigs | udacity/carnd/p1-lane-lines/P1.ipynb | unlicense | #importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
%matplotlib inline
#reading in an image
image = mpimg.imread('test_images/solidWhiteRight.jpg')
#printing out some stats and plotting
print('This image is:', type(image), 'with dimesions:', im... |
google/fedjax | docs/notebooks/dataset_tutorial.ipynb | apache-2.0 | # Uncomment these to install fedjax.
# !pip install fedjax
# !pip install --upgrade git+https://github.com/google/fedjax.git
# !pip install tensorflow_datasets
import functools
import itertools
import fedjax
import numpy as np
"""
Explanation: Federated datasets
This tutorial introduces datasets in FedJAX and how to... |
mne-tools/mne-tools.github.io | 0.22/_downloads/638c39682b0791ce4e430e4d2fcc4c45/plot_tf_dics.ipynb | bsd-3-clause | # Author: Roman Goj <roman.goj@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne.event import make_fixed_length_events
from mne.datasets import sample
from mne.time_frequency import csd_fourier
from mne.beamformer import tf_dics
from mne.viz import plot_source_spectrogram
print(__doc__)
data_path = sample.d... |
DB2-Samples/db2odata | Notebooks/DB2 Jupyter Extensions Tutorial.ipynb | apache-2.0 | %run db2.ipynb
"""
Explanation: DB2 Jupyter Notebook Extensions Tutorial
The SQL code tutorials for DB2 rely on a Jupyter notebook extension, commonly refer to as a "magic" command. The beginning of all of the notebooks begin with the following command which will load the extension and allow the remainder of the noteb... |
pyemma/deeplearning | assignment1/features.ipynb | gpl-3.0 | import random
import numpy as np
from cs231n.data_utils import load_CIFAR10
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'
# for auto-reloading extenrnal modu... |
udacity/deep-learning | student-admissions-keras/StudentAdmissionsKeras.ipynb | mit | # Importing pandas and numpy
import pandas as pd
import numpy as np
# Reading the csv file into a pandas DataFrame
data = pd.read_csv('student_data.csv')
# Printing out the first 10 rows of our data
data[:10]
"""
Explanation: Predicting Student Admissions with Neural Networks in Keras
In this notebook, we predict st... |
isendel/machine-learning | ml-regression/week3-4/week-4-ridge-regression-assignment-2.ipynb | apache-2.0 | import numpy as np
import pandas as pd
import sys
from sklearn import linear_model
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Regression Week 4: Ridge Regression (gradient descent)
In this notebook, you will implement ridge regression via gradient descent. You will:
* Convert an SFrame into a ... |
SaintlyVi/DLR_DB | DLR CPDs.ipynb | mit | import os, glob
import pandas as pd
import numpy as np
from support import data_dir
fileimport = glob.glob(os.path.join(data_dir, 'BN','*.txt'))
data = {}
names = [(f.rpartition('/')[2]).partition('.')[0] for f in fileimport]
for n, f in zip(names, fileimport):
print(n)
data[n] = pd.read_table(f, index_col=0)
... |
bbfamily/abu | abupy_lecture/12-机器学习与比特币示例(ABU量化使用文档).ipynb | gpl-3.0 | # 基础库导入
from __future__ import print_function
from __future__ import division
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import os
import sys
# 使用insert 0即只使用github,避免交叉使用了pip安装的abupy,导致的版本不一致问题
sys.path.insert(0, os.path.abspath('../'))
import abupy
# 使用沙盒数据,目的是和书中一样的... |
d-k-b/udacity-deep-learning | autoencoder/Convolutional_Autoencoder_Solution.ipynb | mit | %matplotlib inline
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', validation_size=0)
img = mnist.train.images[2]
plt.imshow(img.reshape((28, 28)), cmap='Greys_r')
"""
Explanation: C... |
sujitpal/polydlot | src/pytorch/10-cumsum-prediction.ipynb | apache-2.0 | from __future__ import division, print_function
from sklearn.metrics import accuracy_score, confusion_matrix
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
import os
import shutil
%matplotlib inline
DATA_DIR = ".... |
quantextive/qtx | examples/QuantextiveAEX.ipynb | mit | api = "market-data-eod"
"""
Explanation: Select your API Endpoint
End of explanation
"""
api_key = '*****************'
"""
Explanation: Enter your API Token
You can request your trial key at https://quantextive.com/request_aex/ or via the AEX portal (https://quantextive.com/dashboard)
End of explanation
"""
param... |
KaiJin11/KaiJin11.github.io | script+precipitation+data.ipynb | cc0-1.0 | for i in range(9):
print county_name[i]
zipcode=[93210,93263,93202,93638,93620,95641,95242,95326,93201]
ZipcodeList=[{ "County_N":county_name[i], "zipcode":zipcode[i] } for i in range(len(zipcode))]
COUNTYZIP=pd.DataFrame(ZipcodeList, columns=["County_N", "zipcode"])
COUNTYZIP
"""
Explanation: Lets extract the z... |
kit-cel/wt | sigNT/systems/mp_ap.ipynb | gpl-2.0 | # importing
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
import matplotlib
# showing figures inline
%matplotlib inline
# plotting options
font = {'size' : 20}
plt.rc('font', **font)
plt.rc('text', usetex=True)
matplotlib.rc('figure', figsize=(18, 10) )
"""
Explanation: Content an... |
desihub/desisim | doc/nb/star-templates.ipynb | bsd-3-clause | import os
import numpy as np
import matplotlib.pyplot as plt
import speclite
from desisim.io import read_basis_templates
import matplotlib
import seaborn as sns
%matplotlib inline
sns.set(style='white', font_scale=1.8, font='sans-serif')
colors = sns.color_palette('Set2', n_colors=8, desat=0.75)
#colors = iter([_col... |
harmsm/pythonic-science | chapters/00_inductive-python/key/06_numpy-arrays_key.ipynb | unlicense | x = []
for i in range(1,11):
if i > 2:
x.append(i**2)
print(x[3])
"""
Explanation: Warm up
What will the following code spit out? (Don't just type it -- pencil and paper it).
End of explanation
"""
some_list = [1,2,3]
a_list_copy = some_list
some_list[1] = 273
"""
Explanation: How would you fix the fo... |
n-kostadinov/sentiment-analysis | SentimentAnalysis.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
with open('data/reviews.txt','r') as file_handler:
reviews = np.array(list(map(lambda x:x[:-1], file_handler.readlines())))
with open('data/labels.txt','r') as file_handler:
labels = np.array(list(map(lambda x:x[:-1].upper(), file_handler.r... |
DSSG2017/florence | dev/notebooks/Distributions_MM.ipynb | mit | import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
"""
Explanation: Plotting distributions
First, import relevant libraries:
End of explanation
"""
# Load data
uda = pd.read_csv("./aws-data/user_dist.txt", sep="\t") # User dist... |
fonnesbeck/PyMC3_Oslo | notebooks/b. Multilevel Modeling.ipynb | cc0-1.0 | %matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns; sns.set_context('notebook')
# Import radon data
srrs2 = pd.read_csv('../data/srrs2.dat')
srrs2.columns = srrs2.columns.map(str.strip)
srrs_mn = srrs2[srrs2.state=='MN']
"""
Explanation: A Primer on Bayesia... |
tensorflow/examples | courses/udacity_intro_to_tensorflow_for_deep_learning/l05c03_exercise_flowers_with_data_augmentation.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
tensorflow/docs-l10n | site/ko/io/tutorials/bigquery.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... |
ThyrixYang/LearningNotes | MOOC/stanford_cnn_cs231n/assignment1/.ipynb_checkpoints/knn-checkpoint.ipynb | gpl-3.0 | # Run some setup code for this notebook.
import random
import numpy as np
from cs231n.data_utils import load_CIFAR10
import matplotlib.pyplot as plt
from __future__ import print_function
# This is a bit of magic to make matplotlib figures appear inline in the notebook
# rather than in a new window.
%matplotlib inlin... |
mne-tools/mne-tools.github.io | 0.22/_downloads/581c1c0ba541022ae5f26cefb5b0685e/plot_stats_cluster_spatio_temporal.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
import os.path as op
import numpy as np
from numpy.random import randn
from scipy import stats as stats
import mne
from mne.epochs import equalize_epoch_counts
from mne.stats import ... |
particle-physics-playground/playground | activities/physicsbkg_Lifetimes.ipynb | mit | particles = ["B+/-","D+/-","J/Psi"]
lifetimes = [1.64e-12,1.4e-12,7e-21]
c = 3e8 # m/s
v = c
for p,l in zip(particles,lifetimes):
distance = v*l
print "%-5s lifetime=%4.2e s distance traveled=%4.2e m" % (p,l,distance)
"""
Explanation: Lifetimes
<h3>Learning goals</h3>
<ul>
<li>Relativistic kinemat... |
malogrisard/NTDScourse | toolkit/00_introduction.ipynb | mit | %%script sh
cat ../requirements.txt
# Windows
# !type ..\requirements.txt
"""
Explanation: A Python Tour of Data Science: Introduction
Michaël Defferrard, PhD student, EPFL LTS2
This short primer is an introduction to the scientific Python stack for Data Science. It is designed as a tour around the major Python packa... |
Silmathoron/NNGT | doc/examples/nngt_tutorial.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib
#matplotlib.use('Qt4Agg')
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (15, 6)
import numpy as np
import nngt
from nngt import generation as ng
from nngt import analysis as na
from nngt import plot as nplt
nngt.seed(0)
"""
Explanation: NNGT example notebook
T... |
NYUDataBootcamp/Projects | MBA_S17/Love-Serunjogi-CitiBikeRiderData.ipynb | mit | import sys # system module
import pandas as pd # data package
import matplotlib as mpl # graphics package
import matplotlib.pyplot as plt # graphics module
import datetime as dt # date and time module
import numpy as np ... |
kit-cel/wt | nt1/vorlesung/1_quellencodierung/LZ77.ipynb | gpl-2.0 | # importing
import numpy as np
from collections import Counter
"""
Explanation: Content and Objectives
Lempel-Ziv-77 encoding of a string
Huffmann encoding of the resulting 3-tuples
Application of this function to several examples
Import
End of explanation
"""
def LZ77_encode ( input_sequence, window_length = 10 ... |
QuantStack/quantstack-talks | pylondinium/notebooks/wealth-of-nations.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
import os
from bqplot import (
LogScale, LinearScale, OrdinalColorScale, ColorAxis,
Axis, Scatter, Lines, CATEGORY10, Label, Figure, Tooltip
)
from ipywidgets import HBox, VBox, IntSlider, Play, jslink
initial_year = 1800
"""
Explanation: This is a bqplot recreation of... |
harmsm/pythonic-science | chapters/01_simulation/00_random-sampling_key.ipynb | unlicense | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from scipy import stats
replicates = range(2,50)
p_values = []
for i in replicates:
measure_one = np.random.normal(10,2,i)
measure_two = np.random.normal(12,2,i)
p_values.append(stats.ttest_ind(measure_one,measure_two)[1])
pl... |
unapiedra/BBChop | analysis/Visualise Results.ipynb | gpl-2.0 | %matplotlib inline
import json
import pandas as pd
import seaborn as sn
with open('results.json') as f: d = json.load(f)
df = pd.DataFrame.from_dict(d)
df.head()
"""
Explanation: Bayesian Search for Debugging: An Evaluation of BBChop
<!--
Typical Components
Title Page
Abstract
Introduction
Methods and Materials (o... |
wei-Z/Python-Machine-Learning | code/bonus/nested_cross_validation.ipynb | mit | %load_ext watermark
%watermark -a 'Sebastian Raschka' -u -d -v -p numpy,pandas,matplotlib,scikit-learn
"""
Explanation: Sebastian Raschka, 2015
https://github.com/rasbt/python-machine-learning-book
Python Machine Learning - Code Examples
Bonus Material - An Extended Nested Cross-Validation Example
For an explanation o... |
jesford/cluster-lensing | demo.ipynb | mit | from __future__ import print_function
import numpy as np
from astropy import units
from matplotlib import pyplot as plt
%matplotlib inline
from clusterlensing import ClusterEnsemble
"""
Explanation: ClusterEnsemble demonstration
Some example usage of how to build up a dataframe of galaxy cluster properties, includi... |
JKeun/lecture-statistics | .ipynb_checkpoints/ch09-statistical-estimation-checkpoint.ipynb | mit | import numpy as np
import scipy.stats as sp
import matplotlib.pylab as plt
from matplotlib.patches import Polygon
mu = 140; std = 30;
rv = sp.norm(mu, std)
xx = np.linspace(50, 230, 100)
fig = plt.figure()
ax = fig.add_subplot(111)
plt.plot(xx, rv.pdf(xx), 'r', linewidth=2)
ix = np.linspace(mu-2*std, mu+2*std)
iy ... |
ctn-waterloo/best-practices | Parameter exploration - psyrun.ipynb | mit | from __future__ import print_function
from pprint import pprint
"""
Explanation: Parameter exploration
Purpose: Run the simulation with varying parameters and characterize the effects of those parameters
Parameter exploration can either be done as grid search where a multidimensional "regular" grid of parameter values... |
ChadFulton/statsmodels | examples/notebooks/statespace_varmax.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
dta = sm.datasets.webuse('lutkepohl2', 'https://www.stata-press.com/data/r12/')
dta.index = dta.qtr
endog = dta.loc['1960-04-01':'1978-10-01', ['dln_inv', 'dln_inc', 'dln_consump']]
"""
Explanation:... |
StefanoAllesina/ISC | python/solutions/Jiang2013_solution.ipynb | gpl-2.0 | import csv
with open('../data/Jiang2013_data.csv') as csvfile:
reader = csv.DictReader(csvfile, delimiter = '\t')
taxa = []
r_values = []
for row in reader:
taxa.append(row['Taxon'])
r_values.append(float(row['r']))
"""
Explanation: Solution of Jiang et al. 2013
Write a function that t... |
jinntrance/MOOC | coursera/deep-neural-network/quiz and assignments/Week 4/Building+your+Deep+Neural+Network+-+Step+by+Step+v5.ipynb | cc0-1.0 | import numpy as np
import h5py
import matplotlib.pyplot as plt
from testCases_v2 import *
from dnn_utils_v2 import sigmoid, sigmoid_backward, relu, relu_backward
%matplotlib inline
plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['imag... |
molgor/spystats | notebooks/Sandboxes/[Testing] simulations_with_spatial_autocr.ipynb | bsd-2-clause | # Load Biospytial modules and etc.
%matplotlib inline
import sys
sys.path.append('/apps')
sys.path.append('..')
sys.path.append('../../spystats')
import django
django.setup()
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
## Use the ggplot style
plt.style.use('ggplot')
import tools
import loggi... |
SBRG/ssbio | docs/notebooks/GEM-PRO - List of Gene IDs.ipynb | mit | import sys
import logging
# Import the GEM-PRO class
from ssbio.pipeline.gempro import GEMPRO
# Printing multiple outputs per cell
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
"""
Explanation: GEM-PRO - List of Gene IDs
This notebook gives an example of h... |
FRESNA/atlite | examples/landuse-availability.ipynb | gpl-3.0 | import atlite
import xarray as xr
import geopandas as gpd
import matplotlib.pyplot as plt
from rasterio.plot import show
from atlite.gis import shape_availability, ExclusionContainer
plt.rcParams['figure.figsize'] = [7, 7]
"""
Explanation: Calculate Landuse Availabilities
This example shows how atlite can deal with l... |
qingshuimonk/STA663 | docs/vae_unit.ipynb | mit | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Variational Autoencoder
This scripts contains module for implementing variational autoencoder, the... |
mtasende/Machine-Learning-Nanodegree-Capstone | notebooks/dev/.ipynb_checkpoints/n08_market_simulator_b-checkpoint.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
%matplotlib inline
%pylab inline
pylab.rcParams['figure.figsize'] = (20.0, 10... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/ml_ops/stage2/get_started_vertex_training_r_using_r_kernel.ipynb | apache-2.0 | library(glue)
library(IRdisplay)
sh <- function(cmd, args = c(), intern = FALSE) {
if (is.null(args)) {
cmd <- glue(cmd)
s <- strsplit(cmd, " ")[[1]]
cmd <- s[1]
args <- s[2:length(s)]
}
ret <- system2(cmd, args, stdout = TRUE, stderr = TRUE)
if ("errmsg" %in% attributes... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/migration/UJ3 Custom Training Custom Container TF Keras.ipynb | apache-2.0 | ! pip3 install -U google-cloud-aiplatform --user
"""
Explanation: Vertex SDK: Train & deploy a TensorFlow model with custom container (aka pre-built containers)
Installation
Install the latest (preview) version of Vertex SDK.
End of explanation
"""
! pip3 install google-cloud-storage
"""
Explanation: Install the Go... |
maestrotf/pymepps | docs/examples/example_plot_thredds.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
import pymepps
"""
Explanation: Load a thredds dataset
In the following example we will load a thredds dataset from the
norwegian met.no thredds server.
End of explanation
"""
metno_path = 'http://thredds.met.no/thredds/dodsC/meps25files/' \
'meps_det_pp_2_5km_... |
pramitchoudhary/Experiments | notebook_gallery/jupyter/deep_learning/image_classification_dog_vs_cat.ipynb | unlicense | # import the necessary packages
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers import Activation
from keras.optimizers import SGD
from keras.layers import Dense
from keras.utils import np_utils
from imutils import... |
mne-tools/mne-tools.github.io | 0.17/_downloads/1b26761ba88c6441bd13afd5730965a4/plot_stats_spatio_temporal_cluster_sensors.ipynb | bsd-3-clause | # Authors: Denis Engemann <denis.engemann@gmail.com>
# Jona Sassenhagen <jona.sassenhagen@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mne.viz import plot_topomap
import mne
from mne.stats import spatio_... |
bosscha/alma-calibrator | notebooks/selecting_source/alma_database_selection7.ipynb | gpl-2.0 | file_listcal = "alma_sourcecat_searchresults_20180419.csv"
q = databaseQuery()
"""
Explanation: New function to make a list and to select calibrator
I add a function to retrieve all the flux from the ALMA Calibrator list with its frequency and observing date, and to retrieve redshift (z) from NED.
End of explanation
... |
dalonlobo/GL-Mini-Projects | TweetAnalysis/Final/Q2/Dalon_4_RTD_MiniPro_Tweepy_Q2.ipynb | mit | import logging # python logging module
# basic format for logging
logFormat = "%(asctime)s - [%(levelname)s] (%(funcName)s:%(lineno)d) %(message)s"
# logs will be stored in tweepy.log
logging.basicConfig(filename='tweepytrends.log', level=logging.INFO,
format=logFormat, datefmt="%Y-%m-%d %H:%M:%S"... |
AhmetHamzaEmra/Deep-Learning-Specialization-Coursera | Convolutional Neural Networks/Convolution+model+-+Application+-+v1.ipynb | mit | import math
import numpy as np
import h5py
import matplotlib.pyplot as plt
import scipy
from PIL import Image
from scipy import ndimage
import tensorflow as tf
from tensorflow.python.framework import ops
from cnn_utils import *
%matplotlib inline
np.random.seed(1)
"""
Explanation: Convolutional Neural Networks: Appli... |
ReactiveX/RxPY | notebooks/Getting Started.ipynb | mit | %%bash
pip install reactivex
"""
Explanation: Getting Started with RxPY
ReactiveX, or Rx for short, is an API for programming with observable event streams. RxPY is a port of ReactiveX to Python. Learning Rx with Python is particularly interesting since Python removes much of the clutter that comes with statically typ... |
sthuggins/phys202-2015-work | assignments/assignment06/DisplayEx01.ipynb | mit | from IPython.display import Image
from IPython.display import display
assert True # leave this to grade the import statements
"""
Explanation: Display Exercise 1
Imports
Put any needed imports needed to display rich output the following cell:
End of explanation
"""
u = 'http://static1.squarespace.com/static/5201ab1... |
dandtaylor/MetroShare | metro_stations_import.ipynb | mit | import http.client, urllib.request, urllib.parse, urllib.error, base64
import urllib
import json
import pickle
"""
Explanation: Use the WMATA api to get station locations for each line
LineCode string
Two-letter line code abbreviation:
RD - Red
YL - Yellow
GR - Green
BL - Blue
OR - Orange
SV - Silver
End of explanati... |
DBWangGroupUNSW/COMP9318 | L2 - BUC.ipynb | mit | import sys
import pandas as pd
import numpy as np
ALL = -1
# DEBUG = True
DEBUG = False
##============================================================
# Data file format:
# * tab-delimited input file
# * 1st line: dimension names and the last dimension is assumed to be the measure
# * rest of the lines: data valu... |
mne-tools/mne-tools.github.io | 0.20/_downloads/ea5d011661d60a36b1834dbd1af606a4/plot_decoding_spatio_temporal_source.ipynb | bsd-3-clause | # Author: Denis A. Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Jean-Remi King <jeanremi.king@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from sklearn.pipeline impo... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session11/Day4/CoadditionAndSubtractionSolutions.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import MultipleLocator
from scipy.stats import norm
def pixel_plot(pix, counts, fig=None, ax=None):
'''Make a pixelated 1D plot'''
if fig is None and ax is None:
fig, ax = plt.subplots()
ax.step(pix, counts,
... |
PyDataMallorca/WS_Introduction_to_data_science | Titanic.ipynb | gpl-3.0 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
def plot_correlation_map( df ):
corr = data.corr()
_ , ax = plt.subplots( figsize =( 12 , 10 ) )
cmap = sns.diverging_palette( 220 , 10 , as_cmap = True )
_ = sns.heatmap(
corr,
cmap = cmap,
... |
cloudera/ibis | docs/source/tutorial/06-Advanced-Topics-ComplexFiltering.ipynb | apache-2.0 | import os
import ibis
ibis.options.interactive = True
connection = ibis.sqlite.connect(os.path.join('data', 'geography.db'))
"""
Explanation: Advanced Topics: Additional Filtering
The filtering examples we've shown to this point have been pretty simple, either comparisons between columns or fixed values, or set filt... |
ethen8181/machine-learning | trees/monotonic.ipynb | mit | # code for loading the format for the notebook
import os
# path : store the current path to convert back to it later
path = os.getcwd()
os.chdir(os.path.join('..', 'notebook_format'))
from formats import load_style
load_style(css_style='custom2.css', plot_style=False)
os.chdir(path)
# 1. magic for inline plot
# 2. ... |
ebenolson/Recipes | examples/imagecaption/COCO Preprocessing.ipynb | mit | import sklearn
import numpy as np
import lasagne
import skimage.transform
from lasagne.utils import floatX
import theano
import theano.tensor as T
import matplotlib.pyplot as plt
%matplotlib inline
import json
import pickle
"""
Explanation: Image Captioning with LSTM
This is a partial implementation of "Show and T... |
ajgpitch/qutip-notebooks | examples/piqs-steadystate-superradiance.ipynb | lgpl-3.0 | import matplotlib.pyplot as plt
from qutip import *
from qutip.piqs import *
import numpy as np
from scipy import constants
"""
Explanation: Steady-state superradiance, lasing and cooperative resonance fluorescence
Notebook author: Nathan Shammah (nathan.shammah at gmail.com)
We consider a system of $N$ two-level syst... |
jepegit/cellpy | dev_utils/batch_notebooks/cellpy_batch_processing_DEV.ipynb | mit | %load_ext autoreload
%autoreload 2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import cellpy
from cellpy import prms
from cellpy import prmreader
from cellpy.utils import batch
import holoviews as hv
%matplotlib inline
hv.extension("bokeh")
prmreader.info()
##############################... |
snegirigens/DLND | sentiment-rnn/Sentiment_RNN_Solution.ipynb | mit | import numpy as np
import tensorflow as tf
with open('../sentiment-network/reviews.txt', 'r') as f:
reviews = f.read()
with open('../sentiment-network/labels.txt', 'r') as f:
labels = f.read()
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural... |
oroszgy/oroszgy.github.io | content/handouts/concurrency-exercise.ipynb | mit | def fun():
max(range(1000))
"""
Explanation: Benchmarking your code
End of explanation
"""
%%timeit
fun()
%%time
fun()
"""
Explanation: Using magic functions of Jupyter and timeit
https://docs.python.org/3.5/library/timeit.html
https://ipython.org/ipython-doc/3/interactive/magics.html#magic-time
End of explan... |
robyn28/Kaggle_GrupoBimbo | 04-model-and-evaluation.ipynb | mit | import numpy as np
import pandas as pd
from sklearn import cross_validation
from sklearn import metrics
from sklearn import linear_model
from sklearn import ensemble
#QUESTION - what is diff bw random forest classifier and rf regressor?
#import seaborn as sns
import matplotlib.pyplot as plt
#sns.set(style="whitegrid",... |
Katsuya-Ishiyama/image_style_transfer | image_style_transfer_using_cnn.ipynb | mit | import numpy as np
import pandas as pd
import tensorflow as tf
CONTENT_FILE = '/home/ishiyama/image_style_transfer/image/input/test_input_01.JPG'
STYLE_FILE = '/home/ishiyama/image_style_transfer/image/style/test_style_01.jpg'
class Image(np.ndarray):
"""画像を扱うためのnumpy.ndarray
XXX: 実装が大変なので一旦保留
... |
mlperf/training_results_v0.5 | v0.5.0/google/cloud_v3.8/resnet-tpuv3-8/code/resnet/model/models/samples/outreach/blogs/housing_prices.ipynb | apache-2.0 | import os
import subprocess
import tempfile
import tensorflow as tf
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
assert tf.VERSION.split('.') >= ['1','4']
%matplotlib inline
mpl.rcParams['figure.figsize'] = 12, 6
mpl.rcParams['image.cmap'] = 'viridis'
logdir = tempfile.mkdtemp()
logd... |
vpoggi/catalogue_toolkit | notebooks/ISC Download Example.ipynb | agpl-3.0 | %matplotlib inline
import eqcat.isc_downloader as isc
"""
Explanation: The ISC Bulletin Download Utility
The isc_downloader package provides a set of APIs to download a customized ISC catalogue from the ISC website (http://www.isc.ac.uk/iscbulletin/) using the Python command line.
End of explanation
"""
Cat1 = isc.I... |
ES-DOC/esdoc-jupyterhub | notebooks/csir-csiro/cmip6/models/sandbox-2/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csir-csiro', 'sandbox-2', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CSIR-CSIRO
Source ID: SANDBOX-2
Topic: Aerosol
Sub-Topics: Transport, Emis... |
dpalmisano/snippets | uk-schools-cluster-analysis/notebooks/explore.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing
from sklearn.cluster import KMeans, AgglomerativeClustering
from mpl_toolkits.mplot3d import Axes3D
%matplotlib inline
"""
Explanation: UK schools cluster analysis
This notebook explores some potential correl... |
ES-DOC/esdoc-jupyterhub | notebooks/cccr-iitm/cmip6/models/sandbox-2/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-2', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: SANDBOX-2
Sub-Topics: Radiative Forcings.
Propertie... |
IST256/learn-python | content/lessons/13-Visualization/SmallGroup-Visualization.ipynb | mit | import requests
import geocoder
import matplotlib
import matplotlib.pyplot as plt
import chart_studio as plotly
import chart_studio.plotly as py
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
import folium
from IPython.display import display
# SET YOUR KEYS AND CREDENTIALS
plotly.too... |
abulbasar/machine-learning | Scikit - 28 Clustering - Online Retail Sales Data.ipynb | apache-2.0 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing, metrics, cluster
%matplotlib inline
"""
Explanation: Clustering Online Retail Sales Data
Dataset: https://archive.ics.uci.edu/ml/datasets/online+retail
End of explanation
"""
df = pd.read_excel("/data/Online Re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.