repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
sadahanu/Capstone | SCRAPE/.ipynb_checkpoints/review_gather-checkpoint.ipynb | mit | # create the category data frame
cat_id = [1,2,3,4,5]
category = ['Balls and Fetch Toys','Chew Toys','Plush Toys','Interactive Toys','Rope and Tug']
link = ['https://www.chewy.com/s?rh=c%3A288%2Cc%3A315%2Cc%3A317','https://www.chewy.com/s?rh=c%3A288%2Cc%3A315%2Cc%3A316',
'https://www.chewy.com/s?rh=c%3A288%2Cc%3... |
csaladenes/csaladenes.github.io | present/mcc2/sklearn_tutorial/03.1-Classification-SVMs.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
plt.style.use('seaborn')
"""
Explanation: Dénes Csala
MCC, 2022
Based on Elements of Data Science (Allen B. Downey, 2021) and Python Data Science Handbook (Jake VanderPlas, 2018)
License: MIT
Supervised Learning In-Depth: ... |
ocelot-collab/ocelot | demos/ipython_tutorials/2_tracking.ipynb | gpl-3.0 | # the output of plotting commands is displayed inline within frontends,
# directly below the code cell that produced it
%matplotlib inline
# this python library provides generic shallow (copy) and
# deep copy (deepcopy) operations
from copy import deepcopy
import time
# import from Ocelot main modules and functio... |
Benedicto/ML-Learning | Linear_Regression_3_polynomial_regression_assignment.ipynb | gpl-3.0 | import graphlab
"""
Explanation: Regression Week 3: Assessing Fit (polynomial regression)
In this notebook you will compare different regression models in order to assess which model fits best. We will be using polynomial regression as a means to examine this topic. In particular you will:
* Write a function to take a... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-2/cmip6/models/sandbox-3/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-2', 'sandbox-3', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: TEST-INSTITUTE-2
Source ID: SANDBOX-3
Topic: Atmoschem
Sub-Topic... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/sandbox-3/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'sandbox-3', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: NERC
Source ID: SANDBOX-3
Topic: Landice
Sub-Topics: Glaciers, Ice.
Properties:... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/vertex_endpoints/nvidia-triton/nvidia-triton-custom-container-prediction.ipynb | apache-2.0 | import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
"""
Explanation: Getting started: Serving Models with NVIDIA Triton Inference Server with a custom container
<hr... |
hglanz/phys202-2015-work | assignments/assignment06/InteractEx05.ipynb | mit | import numpy as np
from matplotlib import pyplot as plt
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display, SVG
#raise NotImplementedError()
"""
Explanation: Interact Exercise 5
Imports
Put the standard imports for Matplotlib, Numpy and the IPython widgets in the followin... |
mne-tools/mne-tools.github.io | 0.23/_downloads/78ad76ea5b03c29b4b851b8b64f74b68/linear_model_patterns.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Romain Trachel <trachelr@gmail.com>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne import io, EvokedArray
from mne.datasets import sample
from mne.decoding import Vectorizer, get_coef
from sklea... |
astroumd/GradMap | notebooks/Lectures2020/Lecture1/GradMap_L1_Instructor.ipynb | gpl-3.0 | ## You can use Python as a calculator:
5*7 #This is a comment and does not affect your code.
#You can have as many as you want.
#Comments help explain your code to others and yourself.
#No worries.
5+7
5-7
5/7
"""
Explanation: Introduction to "Doing Science" in Python for REAL Beginners
Python is one of many lan... |
nicoa/showcase | pydatabln2017_filter_and_overview.ipynb | mit | base_url = "https://pydata.org"
r = rq.get(base_url + "/berlin2017/schedule/")
bs = bs4.BeautifulSoup(r.text, "html.parser")
"""
Explanation: <h1 id="tocheading">Table of Contents</h1>
<div id="toc"></div>
Query Data
Grab schedule page:
End of explanation
"""
data = {}
for ahref in tqdm_notebook(bs.find_all("a")):
... |
arkottke/pysra | examples/example-07.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import pysra
%matplotlib inline
# Increased figure sizes
plt.rcParams["figure.dpi"] = 120
"""
Explanation: Example 3: RVT Peak Calculators
Use RVT input motion with:
1. Boore & Thompson (2012) -- based on Cartwright and Longuet-Higgins (56) peak factor with correct... |
rkburnside/python_development | bootcamp/5 problems in 1 hour.ipynb | gpl-2.0 | a = [1,2,3,4,5,6,7]
def adding(x):
total = 0
for i in x:
total += i
print(total)
total = 0
i = 0
while i < len(x):
total += x[i]
i += 1
print(total)
return
adding(a)
b = [1,2,3,4,5,6,7]
def recur(lst,counter,total):
if counter == len(lst):
... |
ananswam/bioscrape | examples/Create a bioscrape model - Tutorial.ipynb | mit | from bioscrape.types import Model
species = ['X']
reactions = [(['X'], [], 'massaction', {'k':'d1'}), ([], ['X'], 'massaction', {'k':'k1'})]
k1 = 10.0
d1 = .2
params = [('k1', k1), ('d1', d1)]
initial_condition = {'X':0}
M = Model(species = species, reactions = reactions, parameters = params,
initial_condit... |
UserAd/data_science | Twitter bots/Botnet search #2.ipynb | mit | print("We get %s friends" % len(friend_ids))
"""
Explanation: Now get info about all these users
End of explanation
"""
possible_bots = []
for group in chunks(friend_ids, 100):
for user in api.lookup_users(user_ids=list(group)):
possible_bots.append(user)
possible_bots_df = pd.DataFrame([{'name'... |
daviddesancho/MasterMSM | examples/mueller_potential/.ipynb_checkpoints/mueller_potential-checkpoint.ipynb | gpl-2.0 | %matplotlib inline
%load_ext autoreload
%autoreload 2
import time
import numpy as np
import scipy.stats
import matplotlib.pyplot as plt
from collections import OrderedDict
"""
Explanation: MSM of Brownian dynamics simulations of diffusion on a 2D mueller potential
The mueller potential was introduced by K. Muller and ... |
ES-DOC/esdoc-jupyterhub | notebooks/csiro-bom/cmip6/models/sandbox-2/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csiro-bom', 'sandbox-2', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: CSIRO-BOM
Source ID: SANDBOX-2
Topic: Atmos
Sub-Topics: Dynamical Core, Radiati... |
tknapen/eyetracking_course | notebooks/pupil/pupil_preprocess_python.ipynb | mit | import numpy as np
import scipy as sp
import scipy.signal as signal
import matplotlib
import matplotlib.pyplot as pl
%matplotlib inline
import seaborn as sn
sn.set(style="ticks")
# extra dependencies of this notebook, for data loading and fitting of kernels
import pandas as pd
from lmfit import minimize, Parameter... |
WendyMawanli/liupengyuan.github.io | chapter2/homework/localization/3-29/201611680168.ipynb | mit | def compute_multi(end):
i = 0
multi = 1
while i < end:
i = i + 1
multi = multi * i
return multi
n = int(input('请输入第1个整数,以回车结束。'))
m = int(input('请输入第2个整数,以回车结束。'))
k = int(input('请输入第3个整数,以回车结束。'))
print('最终的和是:', compute_multi(m) + compute_multi(n) + compute_multi(k))
"""
Explanati... |
Charleo85/ml_project | resource/GAN-Tutorial/Generative Adversarial Networks Tutorial.ipynb | mit | import tensorflow as tf
import random
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Getting Started
According to Yann LeCun, “adversarial training is the coolest thing since sliced bread”. I’m inclined to believe so because I don’t think sliced bread ever created this much buzz... |
quantopian/research_public | notebooks/lectures/Confidence_Intervals/notebook.ipynb | apache-2.0 | import numpy as np
import seaborn as sns
from scipy import stats
import matplotlib.pyplot as plt
# We'll set a seed here so our runs are consistent
np.random.seed(10)
# Let's define some 'true' population parameters, we'll pretend we don't know these.
POPULATION_MU = 64
POPULATION_SIGMA = 5
# Generate our sample by ... |
M-R-Houghton/euroscipy_2015 | scikit_image/lectures/solutions/adv0_chromosomes.ipynb | mit | import numpy as np
from matplotlib import cm, pyplot as plt
import skdemo
plt.rcParams['image.cmap'] = 'cubehelix'
plt.rcParams['image.interpolation'] = 'none'
from skimage import io
image = io.imread('images/chromosomes.tif')
skdemo.imshow_with_histogram(image)
"""
Explanation: Measuring chromatin fluorescence
Goal:... |
phoebe-project/phoebe2-docs | development/tutorials/requiv.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Equivalent Radius
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # units
import numpy as np
impo... |
eds-uga/csci1360-fa16 | lectures/L10.ipynb | mit | def func(x):
print(x)
x = 10
func(20)
print(x)
"""
Explanation: Lecture 10: Variable Scope
CSCI 1360: Foundations for Informatics and Analytics
Overview and Objectives
We've spoken a lot about data structures and orders of execution (loops, functions, and so on). But now that we're intimately familiar with di... |
anuragkapur/anuragkapur.github.io | blog/cheat-sheets/jupyter/Python - Data Visualisation Cheat Sheet.ipynb | cc0-1.0 | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
"""
Explanation: Data Visualisation
End of explanation
"""
plt.figure(figsize = [15, 5])
plt.title('My plot')
plt.xlabel('X values')
plt.ylabel('Count of values')
plt.xlim([0, 10])
plt.ylim([0, 5])
"""
Explanation: Chart A... |
machinelearningnanodegree/stanford-cs231 | solutions/kvn219/assignment1/two_layer_net.ipynb | mit | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from cs231n.classifiers.neural_net import TwoLayerNet
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.... |
ES-DOC/esdoc-jupyterhub | notebooks/cmcc/cmip6/models/cmcc-cm2-hr5/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'cmcc-cm2-hr5', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: CMCC
Source ID: CMCC-CM2-HR5
Topic: Ocean
Sub-Topics: Timestepping Framework, Adv... |
sgangi03/big-data-python-class | Lectures/Lecture5-MapReduce/MapReduce Intro.ipynb | mit | def cube(x): return x*x*x
map(cube,range(1,11))
"""
Explanation: Challenge of processing large amounts of data
<ul>
<li>How to process is quickly?
<li>So how do we go about making the problem map so that it can be distributed computation?
<li> Distributed/Parrallel Programming is hard
</ul>
Mapreduce addresses all t... |
georgetown-analytics/machine-learning | examples/bbengfort/clustering-lda-analysis.ipynb | mit | DATA = "data/ieee-xplore.csv"
def load_data(path=DATA):
with open(path, 'r') as f:
reader = csv.DictReader(f)
for row in reader:
row['Tokenized Abstract'] = tokenize(row['Abstract'])
yield row
def tokenize(text):
return [
list(nltk.wordpunct_tokenize(s... |
landmanbester/fundamentals_of_interferometry | 4_Visibility_Space/4_5_1_UV_Coverage_UV_Tracks.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import HTML
HTML('../style/course.css') #apply general CSS
"""
Explanation: <a id='beginning'></a> <!--\label{beginning}-->
* Outline
* Glossary
* 4. The Visibility Space
* Previous: 4.3 The Visibility Function
* Next: ... |
kazzz24/deep-learning | sentiment-rnn/.ipynb_checkpoints/Sentiment RNN Solution-checkpoint.ipynb | mit | import numpy as np
import tensorflow as tf
with open('reviews.txt', 'r') as f:
reviews = f.read()
with open('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 network that performs sentiment analysis.... |
wuafeing/Python3-Tutorial | 01 data structures and algorithms/01.02 unpack elements from iterables.ipynb | gpl-3.0 | record = ("Dave", "dave@example.com", "773-555-1212", "847-555-1212")
name, email, *phone_numbers = record
name
email
phone_numbers
"""
Explanation: Previous
1.2 解压可迭代对象赋值给多个变量
问题
如果一个可迭代对象的元素个数超过变量个数时,会抛出一个 ValueError 。 那么怎样才能从这个可迭代对象中解压出 N 个元素出来?
解决方案
Python 的星号表达式可以用来解决这个问题。比如,你在学习一门课程,在学期末的时候, 你想统计下家庭作业的平均成绩,但是... |
cosmicBboy/themis-ml | research/fatal-encounters.ipynb | mit | import numpy as np
import pandas as pd
import seaborn as sns
from IPython.display import Markdown, display
sns.set_style("white")
%matplotlib inline
data = pd.read_csv("data/fatal_encounters_dataset.csv")
# clean data column names
data.columns = (
data.columns
.str.replace("'", "")
.str.replace("[^a-zA-... |
rasbt/algorithms_in_ipython_notebooks | ipython_nbs/search/dijkstra-algorithm.ipynb | gpl-3.0 | graph = {'A': {'B': 14, 'C': 9, 'D': 7},
'B': {'A': 14, 'C': 2, 'F': 9},
'C': {'A': 9, 'B': 2, 'D': 7, 'E': 11},
'D': {'A': 7, 'C':10, 'E':15},
'E': {'C': 11, 'D':15, 'F': 6},
'F': {'B': 9, 'E': 6}
}
"""
Explanation: Dijkstra's Algorithm
Dijkstra's algorithm is a... |
jgarciab/wwd2017 | class5/class5_stats.ipynb | gpl-3.0 | Image(url="https://kanbanize.com/blog/wp-content/uploads/2014/07/Standard_deviation_diagram.png", width=500)
"""
Explanation: 1. Assumptions of most tests
1.1 Normality
End of explanation
"""
def qq_plot(x):
import scipy.stats
(osm, osr),(slope, intercept, r) = scipy.stats.probplot(x, dist='norm', plot=None... |
hdesmond/StatisticalMethods | examples/XrayImage/FirstLook.ipynb | gpl-2.0 | import astropy.io.fits as pyfits
import numpy as np
import os.path
import astropy.visualization as viz
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 10.0)
"""
Explanation: A First Look at an X-ray Image Dataset
Images are data. They can be 2D, from cameras, or 1D, from spe... |
ioos/notebooks_demos | notebooks/2020-10-10-GTS.ipynb | mit | from datetime import date
from erddapy import ERDDAP
server = "http://osmc.noaa.gov/erddap"
e = ERDDAP(server=server, protocol="tabledap")
e.dataset_id = "ioos_obs_counts"
e.variables = ["time", "locationID", "region", "sponsor", "met", "wave"]
e.constraints = {
"time>=": "2019-09",
"time<": "2020-11",
}
df... |
mtasende/Machine-Learning-Nanodegree-Capstone | notebooks/prod/.ipynb_checkpoints/n08_simple_q_learner_fast_learner_11_actions-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
from multiprocessing import Pool
%matplotlib inline
%pylab inline
pylab.rcPar... |
phoebe-project/phoebe2-docs | 2.2/examples/spot_transit.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
%matplotlib inline
"""
Explanation: Spot Transit
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
"""
import ... |
DarkEnergyScienceCollaboration/Twinkles | examples/notebooks/SkyBrightnessCalculator.ipynb | mit | %pylab inline
import astropy.units as u
"""
Explanation: Sky Brightness in LSST
End of explanation
"""
import sqlite3
import astropy.table
conn = sqlite3.connect('/Data/DESC/minion_1016_sqlite.db')
c = conn.cursor()
"""
Explanation: Read Opsim Cadence
See opsim db summary table docs.
End of explanation
"""
c.... |
sarahmid/programming-bootcamp-v2 | lab4_exercises.ipynb | mit | ages = [65, 34, 96, 47]
print len(ages)
"""
Explanation: Programming Bootcamp 2016
Lesson 4 Exercises
Earning points (optional)
Enter your name below.
Email your .ipynb file to me (sarahmid@mail.med.upenn.edu) before 9:00 am on 9/20.
You do not need to complete all the problems to get points.
I will give partia... |
phoebe-project/phoebe2-docs | 2.1/examples/legacy_contact_binary.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.1,<2.2"
"""
Explanation: Comparing Contacts Binaries in PHOEBE 2 vs PHOEBE Legacy
NOTE: PHOEBE 1.0 legacy is an alternate backend and is not installed with PHOEBE 2. In order to run this backend, you'll need to have PHOEBE 1.0 installed and manually install the python wrappers in the phoebe... |
letsgoexploring/teaching | winter2017/econ129/python/Econ129_Class_17.ipynb | mit | # 1. Input model parameters and print
# 2. Compute the steady state of the model directly
# 3. Define a function that evaluates the equilibrium conditions
def equilibrium_equations(variables_forward,variables_current,parameters):
# Parameters
p = parameters
# Variables
fwd = variables_for... |
jtwhite79/pyemu | examples/PST_to_pyemu_to_Schur_Overview.ipynb | bsd-3-clause | nam_file = "freyberg.nam"
org_model_ws = "freyberg_sfr_update"
new_model_ws = "pest_setup"
# load the model, change dir and run once to get a hydmod output file and list file
m = flopy.modflow.Modflow.load(nam_file,model_ws=org_model_ws,check=False)
m.change_model_ws("temp",reset_external=True)
m.name = nam_file.split... |
paris-saclay-cds/python-workshop | Day_1_Scientific_Python/scikit-learn/04.2-Clustering-KMeans.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
"""
Explanation: Clustering: K-Means In-Depth
Here we'll explore K Means Clustering, which is an unsupervised clustering technique.
We'll start with our standard set of initial imports
End of explanation
"""
from sklearn.da... |
antoinecarme/sklearn_explain | doc/sample_DecisionTree-custom-binning.ipynb | bsd-3-clause |
ds = datasets.load_breast_cancer();
from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier(min_samples_leaf=30, random_state = 1960)
NC = 12
X = ds.data[:,0:NC]
y = ds.target
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_siz... |
motasay/twitter-sentiment | src/notebook.ipynb | gpl-3.0 | %matplotlib inline
import codecs
import logging
import numpy as np
from word2vec.word2vecReader import Word2Vec
from preprocessing import preprocess_tweet
from nltk import word_tokenize
from sklearn.cross_validation import train_test_split
from sklearn.cross_validation import cross_val_score
from sklearn.metrics imp... |
Aditya8795/Python-Scripts | Peturn Normally to move Uniformly.ipynb | mit | import numpy as np
# returns a random d dimensional vector, a direction to peturb in
def direction(d,t):
# if type == uniform
if(t == 'u'):
return np.random.uniform(-2/np.sqrt(d), 2/np.sqrt(d), d)
elif(t == 'n'):
return np.random.normal(0, 1/np.sqrt(d), d)
elif(t == 's'):
# a p... |
wanderer2/pymc3 | docs/source/notebooks/LKJ.ipynb | apache-2.0 | %matplotlib inline
from matplotlib.patches import Ellipse
from matplotlib import pyplot as plt
import numpy as np
import pymc3 as pm
import scipy as sp
import seaborn as sns
from theano import tensor as tt
np.random.seed(3264602) # from random.org
N = 100
mu_actual = sp.stats.uniform.rvs(-5, 10, size=2)
cov_actual... |
ALEXKIRNAS/DataScience | Coursera/Machine-learning-data-analysis/Course 2/Week_01/Linear_regression.ipynb | mit | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Линейная регрессия и основные библиотеки Python для анализа данных и научных вычислений
Это задание посвящено линейной регрессии. На примере прогнозирования роста человека по его весу Вы уви... |
Juan-Mateos/coll_int_ai_case | notebooks/ml_topic_analysis_exploration.ipynb | mit | %matplotlib inline
#Some imports
import time
#import xml.etree.ElementTree as etree
from lxml import etree
import feedparser
#Imports
#Key imports are loaded from my profile (see standard_imports.py in src folder).
#Paths
#Paths
top = os.path.dirname(os.getcwd())
#External data (to download the GRID database)
ext_... |
tpin3694/tpin3694.github.io | python/.ipynb_checkpoints/matplotlib_scatterplot_from_pandas-checkpoint.ipynb | mit | %matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Title: Making A Matplotlib Scatterplot From A Pandas Dataframe
Slug: matplotlib_scatterplot_from_pandas
Summary: Making A Matplotlib Scatterplot From A Pandas Dataframe
Date: 2016-05-01 12:00
Category: Python
Tag... |
AllenDowney/ThinkBayes2 | soln/chap12.ipynb | mit | # If we're running on Colab, install empiricaldist
# https://pypi.org/project/empiricaldist/
import sys
IN_COLAB = 'google.colab' in sys.modules
if IN_COLAB:
!pip install empiricaldist
# Get utils.py
from os.path import basename, exists
def download(url):
filename = basename(url)
if not exists(filename... |
clan2000/data-science-from-scratch | notebook/ch04_linear_algebra.ipynb | unlicense | # Original book version
def vector_sum(vectors):
return reduce(vector_add, vectors)
vectors = [v,w,v,w,v,w]
vector_sum(vectors)
# Modified version by sc82.choi at Gachon - *은 여러개의 argument를 list로 전환해줌
def vector_sum_modified(vectors):
return [sum(value) for value in zip(*vectors)]
vectors = [v,w,v,w,v,w]
ve... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-2/cmip6/models/sandbox-1/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-2', 'sandbox-1', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: TEST-INSTITUTE-2
Source ID: SANDBOX-1
Topic: Seaice
Sub-Topics: Dynami... |
Upward-Spiral-Science/team1 | code/extended_new_Analysis_akash.ipynb | apache-2.0 | import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import urllib2
import scipy.stats as stats
url = ('https://raw.githubusercontent.com/Upward-Spiral-Science/data/master/syn-density/output.csv')
data = urllib2.urlopen(url)
csv = np.genfromtxt(data, delimiter=",")[1:] # Remove lable row
# Clip data... |
kylepjohnson/notebooks | public_talks/2016_10_26_harvard/2.2b Clustering (w doc reduction).ipynb | mit | import datetime as dt
import os
import sys
import time
from cltk.corpus.greek.tlg.parse_tlg_indices import get_epithet_index
from cltk.corpus.greek.tlg.parse_tlg_indices import get_epithets
from cltk.corpus.greek.tlg.parse_tlg_indices import select_authors_by_epithet
from cltk.corpus.greek.tlg.parse_tlg_indices import... |
keras-team/autokeras | docs/ipynb/multi.ipynb | apache-2.0 |
num_instances = 100
# Generate image data.
image_data = np.random.rand(num_instances, 32, 32, 3).astype(np.float32)
# Generate structured data.
structured_data = np.random.rand(num_instances, 20).astype(np.float32)
"""
Explanation: In this tutorial we are making use of the
AutoModel
API to show how to handle multi-... |
ResearchComputing/RMACC2015-Spark | pyspark-exercises/01_lustre_log_exploration.ipynb | gpl-2.0 | from pyspark import SparkConf, SparkContext
import re
"""
Explanation: Example 1: Parallel Log Parsing with Map and Filter
Step 1: Data ingest and parsing
End of explanation
"""
sc
partitions = 18
parlog = sc.textFile("/lustre/janus_scratch/dami9546/lustre_debug.out", partitions)
"""
Explanation: This dataset is a... |
FiryZeplin/deep-learning | batch-norm/Batch_Normalization_Exercises.ipynb | mit | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False)
"""
Explanation: Batch Normalization – Practice
Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a con... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/regression_diagnostics.ipynb | bsd-3-clause | %matplotlib inline
from statsmodels.compat import lzip
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
import statsmodels.stats.api as sms
import matplotlib.pyplot as plt
# Load data
url = "https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/HistData/Guerry.csv"
dat... |
timothydmorton/usrp-sciprog | day2/exercises/Exercises_Python.ipynb | mit | #The following line will only work if you create the make_sentence.py in the current directory
import make_sentence.py
"""
Explanation: Exercises
Rules:
Every variable/function/class name should be meaningful
Variable/function names should be lowercase, class names uppercase
Write a documentation string (even if mini... |
opensanca/trilha-python | 01-python-intro/aula-03/Aula 03.ipynb | mit | numeros = [1, 2, 3, 4]
numeros
"""
Explanation: [Py-Intro] Aula 03
Tipos básicos
O que você vai aprender nesta aula?
Após o término da aula você terá aprendido:
Como manipular listas e tuplas
Listas
Na aula passada vimos o básico de lista, o objetivo desta seção é se aprofundar um pouco mais nos usos de lista.
End o... |
justiceamoh/ENGS108 | vagrant/solutions/hw1.ipynb | apache-2.0 | import numpy as np
from scipy.stats import norm
from scipy.io import loadmat
"""
Explanation: HW #1
Imports and dependencies
End of explanation
"""
# Load the matrix into memory, assuming for now that it is stored in the home directory
A = loadmat("../dataset/hw1/A11F17108.mat")['A']
# Obtain x, where Ax[:,i] = A[... |
fangohr/mpimag | sandbox/image_bluring/timings/speedup-image-blurring-in-parallel.ipynb | bsd-2-clause | # load the data files using pandas
# small image
datafile = 'ngcm_halo_small.csv'
df = pd.read_csv(datafile, header=None, names=['Size','Iterations','Total','Ave'])
# large image
datafileL = 'ngcm_halo_large.csv'
dfL = pd.read_csv(datafileL, header=None, names=['Size','Iterations','Total','Ave'])
iterations = 10
iter... |
kain88-de/mda-tutorial | Alignment.ipynb | gpl-2.0 | from __future__ import print_function
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import MDAnalysis as mda
"""
Explanation: In this tutorial will write a alignment algorithm with MDAnalysis functions and later look into the documentation to find functions for the implementation of the algorit... |
HazyResearch/snorkel | tutorials/cdr/CDR_Tutorial_1.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
from snorkel import SnorkelSession
session = SnorkelSession()
"""
Explanation: Chemical-Disease Relation (CDR) Tutorial
In this example, we'll be writing an application to extract mentions of chemical-induced-disease relationships from Pubmed abstracts, as per the... |
shngli/Data-Mining-Python | Mining massive datasets/Dimensionality Reduction.ipynb | gpl-3.0 | import numpy as np
# Matrix containing raw movie ratings by users A, B and C
rawRating = np.array([[1,2,3,4,5],
[2,3,2,5,3],
[5,5,5,3,2]])
# Matrix containing average movie ratings by users A, B and C
userAvg = np.array([[3,3,3,3,3],
[3,3,3,3,3],
... |
bjshaw/phys202-2015-work | assignments/assignment05/InteractEx04.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 4
Imports
End of explanation
"""
import scipy.stats
"""
Explanation: Line with Gaussian noise
Write a function n... |
nerdcommander/scientific_computing_2017 | lesson24/Lesson24_team_improved.ipynb | mit | ## don't forget to
import numpy as np
"""
Explanation: Unit 3: Simulations
Lesson 24: Advanced Lists
Notebook Authors
(fill in your two names here)
Team Roles
Facilitator: (fill in name)
Spokesperson: (fill in name)
Process Analyst: (fill in name)
Quality Control: (fill in name)
If there are only three people in you... |
jhprinz/openpathsampling | examples/alanine_dipeptide_tps/AD_tps_4_advanced.ipynb | lgpl-2.1 | %%time
flexible = paths.AnalysisStorage("tps_nc_files/alanine_dipeptide_tps.nc")
%%time
fixed = paths.AnalysisStorage("tps_nc_files/alanine_dipeptide_fixed_tps.nc")
flex_scheme = flexible.schemes[0]
fixed_scheme = fixed.schemes[0]
# TODO: cache trajectories too?
# create the ensemble that identifies recrossings
alp... |
parklab/PaSDqc | examples/05_example_chromosome_classification/Chromosome_classification.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors
# import matplotlib.gridspec as gridspec
import seaborn as sns
import pathlib
import PaSDqc
%matplotlib inline
sns.set_context('poster')
sns.set_style("ticks", {'ytick.minor.size': 0.0, 'xtick.minor.size': 0.0})
"""
Expl... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160613월_14일차_정규화(Regularization), 로지스틱 회귀 분석(Logistic Regression)/4.최적 정규화.ipynb | mit | from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import Pipeline
from sklearn.cross_validation import cross_val_score
n_samples = 1000
np.random.seed(0)
X = np.sort(np.random.rand(n_samples))
y = np.cos(1.5 * np.pi * X) + np.random.randn(n_sam... |
RaRe-Technologies/gensim | docs/notebooks/ldaseqmodel.ipynb | lgpl-2.1 | # setting up our imports
from gensim.models import ldaseqmodel
from gensim.corpora import Dictionary, bleicorpus
import numpy
from gensim.matutils import hellinger
"""
Explanation: Dynamic Topic Models Tutorial
What is this tutorial about?
This tutorial will exaplin what Dynamic Topic Models are, and how to use them ... |
rasbt/pattern_classification | dimensionality_reduction/projection/principal_component_analysis.ipynb | gpl-3.0 | import pandas as pd
df = pd.read_csv(
filepath_or_buffer='https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data',
header=None,
sep=',')
df.columns=['sepal_len', 'sepal_wid', 'petal_len', 'petal_wid', 'class']
df.dropna(how="all", inplace=True) # drops the empty line at file-end
df.ta... |
vsporeddy/bigbang | examples/Walkers and Talkers.ipynb | gpl-2.0 | # Load the raw email and git data
url = "http://mail.scipy.org/pipermail/scipy-dev/"
arx = Archive(url,archive_dir="../archives")
mailInfo = arx.data
repo = repo_loader.get_repo("bigbang")
gitInfo = repo.commit_data;
"""
Explanation: Introduction
In group efforts, there is sometimes the impression that there are those... |
tzoiker/gensim | docs/notebooks/ldaseqmodel.ipynb | lgpl-2.1 | # setting up our imports
from gensim.models import ldaseqmodel
from gensim.corpora import Dictionary, bleicorpus
import numpy
from gensim.matutils import hellinger
"""
Explanation: Dynamic Topic Models Tutorial
What is this tutorial about?
This tutorial will exaplin what Dynamic Topic Models are, and how to use them ... |
ajhenrikson/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... |
ikegwukc/INFO597-DeepLearning-GameTheory | NPlayerGames/NPlayerGames.ipynb | mit | import gmaps, os # Used for interactive visualizations
from game_types import NPlayerGame
import tensorflow as tf
import pandas as pd
"""
Explanation: N Player Game
Iterated Peace War Game
I've created a version of the peace war game. The scenario for this game is members of lcdm own companies across the united stat... |
sorig/shogun | doc/ipython-notebooks/structure/multilabel_structured_prediction.ipynb | bsd-3-clause | import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
from __future__ import print_function
try:
from sklearn.datasets import make_classification
except ImportError:
import pip
pip.main(['install', '--user', 'scikit-learn'])
from sklearn.datasets import make_classification
import... |
sastels/Onboarding | 3 - Lists.ipynb | mit | colours = ['red', 'blue', 'green']
print colours[0]
print colours[2]
print len(colours)
"""
Explanation: Python Lists
Python has a great built-in list type named "list". List literals are written within square brackets [ ]. Lists work similarly to strings -- use the len() function and square brackets [ ] to access dat... |
param411singh/inf1340-2015-notebooks | Week 12.ipynb | mit | import random
# The Coin class simulates a coin that can be flipped
class Coin:
# The __init__ methods is the constructor
def __init__(self):
self.sideup = 'Heads'
def toss(self):
flip = random.randint(0, 1)
if flip == 0:
self.sideup = "Heads"
else:
... |
mdeff/ntds_2016 | algorithms/06_ass_recurrent_nn.ipynb | mit | # Import libraries
import tensorflow as tf
import numpy as np
import collections
import os
# Load text data
data = open(os.path.join('datasets', 'text_ass_6.txt'), 'r').read() # must be simple plain text file
print('Text data:',data)
chars = list(set(data))
print('\nSingle characters:',chars)
data_len, vocab_size = le... |
folivetti/PIPYTHON | Aula03.ipynb | mit | from math import log
def entropia(p):
return -p*log(p,2) - (1.0-p)*log(1.0-p,2)
print(entropia(1.0), entropia(0.0))
"""
Explanation: Introdução à Programação em Python
Condicionais
Nossa função para o cálculo de entropia ficou da seguinte maneira:
python
def entropia(p):
return -p*log(p,2) - (1.0-p)*log(1.0-... |
peakrisk/peakrisk | posts/latest-weather-pijessie.ipynb | gpl-3.0 | # Tell matplotlib to plot in line
%matplotlib inline
# import pandas
import pandas
# seaborn magically adds a layer of goodness on top of Matplotlib
# mostly this is just changing matplotlib defaults, but it does also
# provide some higher level plotting methods.
import seaborn
# Tell seaborn to set things up
seabor... |
bakanchevn/DataBases_MIREA_2017-2018 | Week1/Лабораторная-1.ipynb | apache-2.0 | print ("Hello world!")
"""
Explanation: Добро пожаловать в IPython Notebook
Данный notebook печатает классическое "Hello world!.
Для запуска блока команд, нажмите на него, и используйте SHIFT+ENTER
Также есть дополнительные keyboard hotkeys (описанные в меню Help)
End of explanation
"""
%load_ext sql
%sql sqlite:///... |
julianogalgaro/udacity | nd101/c3-tensor-flow-env/intro-to-tensorflow-lab/intro_to_tensorflow.ipynb | mit | import hashlib
import os
import pickle
from urllib.request import urlretrieve
import numpy as np
from PIL import Image
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils import resample
from tqdm import tqdm
from zipfile import ZipFile
print('All m... |
urgedata/pythondata | pyflux/.ipynb_checkpoints/Dynamic Linear Regression Models in Python-checkpoint.ipynb | mit | sales_df = pd.read_csv('../examples/retail_sales.csv', index_col='date', parse_dates=True)
sales_df.head()
"""
Explanation: Load the data
For this work, we're going to use the same retail sales data that we've used before. It can be found in the examples directory of this repository.
End of explanation
"""
sales_df... |
heroxbd/SHTOOLS | examples/notebooks/tutorial_2.ipynb | bsd-3-clause | %matplotlib inline
from __future__ import print_function # only necessary if using Python 2.x
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Localized Spectral Analysis on the Sphere
A localised spectral estimate can be seen as the spectrum of a global function multiplied with a window. In a 2D c... |
UDST/activitysim | activitysim/examples/example_estimation/notebooks/17_tour_mode_choice.ipynb | bsd-3-clause | import os
import larch # !conda install larch -c conda-forge # for estimation
import pandas as pd
"""
Explanation: Estimating Tour Mode Choice
This notebook illustrates how to re-estimate tour and subtour mode choice for ActivitySim. This process
includes running ActivitySim in estimation mode to read household tra... |
spacecowboy/article-annriskgroups-source | TestData.ipynb | gpl-3.0 | # import stuffs
%matplotlib inline
import numpy as np
import pandas as pd
from pyplotthemes import get_savefig, ClassicTheme
from lifelines.plotting import add_at_risk_counts
from lifelines.estimation import KaplanMeierFitter
from lifelines.estimation import median_survival_times
#plt.latex = True
# Set to PLOS One req... |
ctralie/TUMTopoTimeSeries2016 | LowerStar.ipynb | apache-2.0 | %matplotlib notebook
import numpy as np
from scipy import ndimage
from ripser import ripser
from persim import plot_diagrams as plot_dgms
import matplotlib.pyplot as plt
from scipy import sparse
import time
import PIL
from mpl_toolkits.mplot3d import Axes3D
import sys
import ipywidgets as widgets
from IPython.display... |
statsmodels/statsmodels.github.io | v0.13.0/examples/notebooks/generated/mixed_lm_example.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
from statsmodels.tools.sm_exceptions import ConvergenceWarning
"""
Explanation: Linear Mixed Effects Models
End of explanation
"""
data = sm.datasets.get_rdataset("dietox", "geepack").data
md... |
ResearchComputing/xsede_2015 | pyspark/01_lustre_log_exploration.ipynb | mit | from pyspark import SparkConf, SparkContext
import re
"""
Explanation: Example 1: Parallel Log Parsing with Map and Filter
Step 1: Data ingest and parsing
End of explanation
"""
sc
partitions = 64
parlog = sc.textFile("/user/milroy/lustre_debug.out", partitions)
"""
Explanation: This dataset is a debug dump from a... |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_source_power_spectrum.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets import sample
from mne.minimum_norm import read_inverse_operator, compute_source_psd
print(__doc__)
"""
Explanation: Compute power spect... |
astarostin/MachineLearningSpecializationCoursera | course2/week2/MetricsPA.ipynb | apache-2.0 | import numpy as np
from matplotlib import pyplot as plt
import seaborn
%matplotlib inline
"""
Explanation: Сравнение метрик качества бинарной классификации
Programming Assignment
В этом задании мы разберемся, в чем состоит разница между разными метриками качества. Мы остановимся на задаче бинарной классификации (с отк... |
streety/biof509 | Wk03-Numpy-model-package-survey.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
n = 20
x = np.random.random((n,1))
y = 5 + 6 * x ** 2 + np.random.normal(0,0.5, size=(n,1))
plt.plot(x, y, 'b.')
plt.show()
"""
Explanation: Week 8 - Implementing a model in numpy and a survey of machine learning packages for python
This week we... |
sz2472/foundations-homework | homework 9/homework 9.ipynb | mit | earthquake = {
'rms': '1.85',
'updated': '2014-06-11T05:22:21.596Z',
'type': 'earthquake',
'magType': 'mwp',
'longitude': '-136.6561',
'gap': '48',
'depth': '10',
'dmin': '0.811',
'mag': '5.7',
'time': '2014-06-04T11:58:58.200Z',
'latitude': '59.0001',
... |
harmsm/pythonic-science | chapters/03_dealing-with-files/00_interacting-with-files_key.ipynb | unlicense | import pandas as pd
pd.read_table("data/1stn.pdb")
"""
Explanation: Structures like these are encoded in "PDB" files
How can we parse a complicted file like this one?
End of explanation
"""
f = open("test-file.txt")
print(f.readlines())
f.close()
"""
Explanation: We can do better by manually parsing the file.
Our... |
ES-DOC/esdoc-jupyterhub | notebooks/noaa-gfdl/cmip6/models/gfdl-esm2m/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'noaa-gfdl', 'gfdl-esm2m', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: NOAA-GFDL
Source ID: GFDL-ESM2M
Topic: Atmoschem
Sub-Topics: Transport... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.