repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
samkennerly/Fidelio | RSA.ipynb | gpl-3.0 | from fidelio_functions import *
"""
Explanation: RSA tutorial
Caution: Fidelio is an educational program. Do not use it as a serious encryption tool!
It has known weaknesses, including:
- The primes and packets are too small.
- Fidelio's padding scheme is <a href="https://en.wikipedia.org/wiki/Padding_(cryptography)#P... |
karlstroetmann/Formal-Languages | Python/Test-Regexp-2-NFA.ipynb | gpl-2.0 | %run Regexp-2-NFA.ipynb
%run RegExp-Parser.ipynb
"""
Explanation: This notebook contains a test for the function toNFA.
End of explanation
"""
r = parse('a*b*')
r
converter = RegExp2NFA({'a', 'b'})
"""
Explanation: If the regular expression r that is defined below is written in the style of the lecture notes, it r... |
mne-tools/mne-tools.github.io | 0.18/_downloads/c6fd8bd3dc3d461b7f23f0abafd06d22/plot_evoked_whitening.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis A. Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne import io
from mne.datasets import sample
from mne.cov import compute_covariance
print(__doc__)
"""
Explanation: Whitening evoked data with ... |
eugen/mlstudy | 1. Intro to Jupyter Notebooks - Python.ipynb | apache-2.0 | import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Make charts a bit prettier
plt.style.use('ggplot')
titanic = pd.read_csv('titanic.csv', sep = ',')
# What are the dimensions
titanic.shape
# What are the column names
titanic.columns
titanic['MySum'] = titanic["Survived"] + titanic[... |
ankitpandey2708/ml | recommender-system/ml-100k/model.ipynb | mit | import pandas as pd
import numpy as np
r_cols = ['user_id', 'movie_id', 'rating']
m_cols = ['movie_id', 'title']
ratings_df = pd.read_csv('u.data',sep='\t', names=r_cols, usecols = range(3), dtype = int)
movies_df = pd.read_csv('u.item', sep='|', names=m_cols, usecols=range(2))
movies_df['movie_id'] = movies_df['movi... |
ryan-leung/PHYS4650_Python_Tutorial | notebooks/Feb2017/CH2 Data Structures and Loops.ipynb | bsd-3-clause | (1, 'HKU', 3.0)
"""
Explanation: Ch2 Data Structures
In this part you will learn how to define data structure more than integer, tuples and boolean.
Tuple
Tuple in python is an 1D array that cannot change its content after declariation. The tuple can store differently type of elements. It is defined with parentheses.
... |
astroumd/GradMap | notebooks/Lectures2021/Lecture4/GradMap_L4_Student.ipynb | gpl-3.0 | # set exercise1 equal to your matrix
exercise1 = #your matrix goes here
"""
Explanation: Introduction to Image Processing
Image processing is a very useful tool for scientists in the lab, and for everyday uses as well. For, example, an astronomer may use image processing to help find and recognize stars, or a self dr... |
MachineLearningStudyGroup/Smart_Review_Summarization | ipynbs/Dynamic_Aspect_Extraction_Part_A.ipynb | mit | from srs.utilities import Product, AspectPattern
# load training data
product_name = 'Canon'
reviewTrainingFile = product_name + '.txt'
product = Product(name=product_name)
product.loadReviewsFromTrainingFile('../data/trainingFiles/Liu/' + reviewTrainingFile)
"""
Explanation: Dynamic Aspect Extraction for camera Revi... |
xmnlab/skdata | notebooks/SkData-SciPyLA2017-Propose.ipynb | mit | from skdata import SkData
"""
Explanation: # Table of Contents
<div class="toc" style="margin-top: 1em;"><ul class="toc-item" id="toc-level0"><li><span><a href="http://localhost:8888/notebooks/SkData-SciPyLA2017-Propose.ipynb#SkData" data-toc-modified-id="SkData-1"><span class="toc-item-num">1 </span>SkData... |
methylDragon/news-anaCrawler | firebasePush.ipynb | gpl-3.0 | import pyrebase
from urllib.parse import urlparse
config = {
"apiKey": "/////",
"authDomain": "fakenewsmustdie.firebaseapp.com",
"databaseURL": "https://fakenewsmustdie.firebaseio.com",
"storageBucket": "fakenewsmustdie.appspot.com"
}
"""
Explanation: firebasePush
This demonstrates how to write to Firebase us... |
ChileanVirtualObservatory/DISPLAY | src/DISPLAY - ASYDO.ipynb | gpl-3.0 | cube_params = {
'freq' : 604000,
'alpha' : 0,
'delta' : 0,
'spe_bw' : 4000,
'spe_res' : 1,
's_f' : 4,
's_a' : 0}
"""
Explanation: Testing Band 9
Creation of Data Cubes
Creation of the Synthetic Data Cubes ALMA-like using ASYDO Project.
Parameters:
isolist : subset of the list o... |
kubeflow/pipelines | components/gcp/dataproc/submit_spark_job/sample.ipynb | apache-2.0 | %%capture --no-stderr
!pip3 install kfp --upgrade
"""
Explanation: Name
Data preparation using Spark on YARN with Cloud Dataproc
Label
Cloud Dataproc, GCP, Cloud Storage, Spark, Kubeflow, pipelines, components, YARN
Summary
A Kubeflow Pipeline component to prepare data by submitting a Spark job on YARN to Cloud Datap... |
CalPolyPat/Python-Workshop | Python Workshop/Logic.ipynb | mit | if (True):
print("This will always print")
else:
print("This will never print")
if (False):
print("This will never print")
else:
print("This will always print")
a = 4
b = 5
if (a<b):
print("Wow, a was less than b, what a surprise!")
if (a>b):
print("I knew that a was greater than b!")
else... |
julianogalgaro/udacity | nd101/c2l8-sentiment-analysis/sentiment_network/Sentiment Classification - Mini Project 4.ipynb | mit | def pretty_print_review_and_label(i):
print(labels[i] + "\t:\t" + reviews[i][:80] + "...")
g = open('reviews.txt','r') # What we know!
reviews = list(map(lambda x:x[:-1],g.readlines()))
g.close()
g = open('labels.txt','r') # What we WANT to know!
labels = list(map(lambda x:x[:-1].upper(),g.readlines()))
g.close()... |
alepoydes/introduction-to-numerical-simulation | practice/Integrators.ipynb | mit | def EulerIntegrator(h,y0,f):
"""
Делает один шаг методом Эйлера.
y0 - начальное значение решения в момент времени t=0,
h - шаг по времения,
f(y) - правая часть дифференциального уравнения.
Возвращает приближенное значение y(h).
"""
return y0+h*f(y0)
def oneStepErrorPlot(f, y, integrator... |
Scoppio/League-of-Odds | Odds to win.ipynb | mit | %matplotlib inline
import numpy as np
import pandas as pd
"""
Explanation: Match Rating
Using numpy and panda to get the chance of victory of a team in a tournament
End of explanation
"""
dta = pd.read_csv('data/lol-2016/lcs-s-16.csv', parse_dates=[1])
dta
"""
Explanation: Loading up the data of the LCS SPRING 201... |
empirical-org/WikipediaSentences | notebooks/BERT-1.1 Experiments-QuillNLP.ipynb | agpl-3.0 | BERT_MODEL = 'bert-base-uncased'
BATCH_SIZE = 16 if "base" in BERT_MODEL else 2
GRADIENT_ACCUMULATION_STEPS = 1 if "base" in BERT_MODEL else 8
MAX_SEQ_LENGTH = 100
PREFIX = "junkfood_but"
"""
Explanation: First BERT Experiments
In this notebook we do some first experiments with BERT: we finetune a BERT model+classifie... |
csaladenes/csaladenes.github.io | present/bi/2020/jupyter/1_python_bevezeto.ipynb | mit | !pip install xlrd
"""
Explanation: Ha nincs meg minden bővítőcsomag, akkor feltesszük ezeket console-ból vagy ! a cella elejére.
End of explanation
"""
df=pd.read_excel('set-date-deschise-vtp2015.xlsx')
"""
Explanation: Pandasban az táblázatatok DataFrame-ek.
End of explanation
"""
df.index
"""
Explanation: Vízs... |
cosmoscalibur/herramientas_computacionales | Presentaciones/Notas/03_Linux_basico.ipynb | mit | %%bash
# Esto es un comentario y por tanto no ejecuta nada
echo "Esto no es un comentario" # pero esto si es un comentario
"""
Explanation: Linux
Podemos clasificar las utilidades por consola de linux acorde a su función, y analizarlas de forma sistematica. Aprovecharemos las capacidades de ejecución de notebooks de b... |
Kuni88/tutorial_python | text/Chapter3.ipynb | mit | import math
print(math.sqrt(2))
print(math.exp(2))
print(math.sin(2))
"""
Explanation: Chapter 3: 数学編
紹介するモジュール
math
numpy
scipy
モジュールの利用
モジュールを利用する場合,以下のように書く.
python
import module # moduleの利用
module.function() # module内にある関数functionを使う
毎回moduleと書くことはプログラムを長くする可能性があり不便だ.
そのため,以下のような書き方もできる.
python
from module impor... |
PepSalehi/tuthpc | Untitled4.ipynb | bsd-3-clause | %%file multihello.py
'''hello from another process
'''
from multiprocessing import Process
def f(name):
print 'hello', name
if __name__ == '__main__':
p = Process(target=f, args=('world',))
p.start()
p.join()
# EOF
!python2.7 multihello.py
"""
Explanation: Multiprocessing and multithreading
Pa... |
AcidLeroy/OpticalFlow | src/ipython_notebooks/plot_xcorr_benchmarks.ipynb | mit | from __future__ import print_function
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
"""
Explanation: Benchmarks of different version of Cross Correlations
Author: Cody W. Eilar
In this notebook, I explore speed comparisons of several different methods of implementing cross ... |
elfi-dev/notebooks | post-sampling_correction.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
import scipy.stats as ss
from functools import partial
import elfi
from elfi.examples import gauss
"""
Explanation: Post-sampling correction
Small values of the threshold parameter $\epsilon$ produce more accurate approximat... |
daniestevez/jupyter_notebooks | dslwp/DSLWP GMSK SSDV purple.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import scipy.signal
import matplotlib.pyplot as plt
"""
Explanation: Analysis of DSLWP-B 2018-08-12 SSDV transmission #3
This notebook analyzes SSDV transmissions made by DSLWP-B from the Moon.
End of explanation
"""
x = np.fromfile('/home/daniel/Descargas/DSLWP-B_PI9CAM_2018-0... |
the-deep-learners/nyc-ds-academy | notebooks/vggnet_in_keras.ipynb | mit | import numpy as np
np.random.seed(42)
"""
Explanation: VGGNet in Keras
In this notebook, we fit a model inspired by the "very deep" convolutional network VGGNet to classify flowers into the 17 categories of the Oxford Flowers data set. Derived from these two earlier notebooks.
Set seed for reproducibility
End of expl... |
desihub/desitarget | doc/nb/connecting-spectra-to-mocks.ipynb | bsd-3-clause | import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from desiutil.log import get_logger, DEBUG
log = get_logger()
import seaborn as sns
sns.set(style='white', font_scale=1.1, palette='Set2')
%matplotlib inline
"""
Explanation: Connecting Spectra to Mocks
The purpose of this notebook is to demons... |
amueller/strata_singapore_2015 | 03 - Cross-validation.ipynb | cc0-1.0 | from sklearn.datasets import load_iris
iris = load_iris()
X = iris.data
y = iris.target
from sklearn.cross_validation import cross_val_score
from sklearn.svm import LinearSVC
cross_val_score(LinearSVC(), X, y, cv=5)
cross_val_score(LinearSVC(), X, y, cv=5, scoring="f1_macro")
"""
Explanation: Cross-Validation
End ... |
ekostat/ekostat_calculator | notebooks/lv_notebook_watersexport_data.ipynb | mit | root_directory = 'D:/github/w_vattenstatus/ekostat_calculator'#"../" #os.getcwd()
workspace_directory = root_directory + '/workspaces'
resource_directory = root_directory + '/resources'
user_id = 'test_user'
# ## Initiate EventHandler
print(root_directory)
paths = {'user_id': user_id,
'workspace_directory': ... |
zegnus/self-driving-car-machine-learning | p02-traffic-sign-classifier/Traffic_Sign_Classifier-Cifar10 input.ipynb | mit | # Load pickled data
import pickle
from keras.datasets import cifar10
from sklearn.model_selection import train_test_split
# TODO: Fill this in based on where you saved the training and testing data
#training_file = "traffic-signs-data/train.p"
#validation_file = "traffic-signs-data/valid.p"
#testing_file = "traffic-... |
ICL-SML/Doubly-Stochastic-DGP | demos/demo_step_function.ipynb | apache-2.0 | import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
from gpflow.likelihoods import Gaussian
from gpflow.kernels import RBF, White
from gpflow.models.gpr import GPR
from gpflow.training import AdamOptimizer, ScipyOptimizer
from doubly_stochastic_dgp.dgp import DGP
np.random.... |
CivicTechTO/ttc_subway_times | delay-analysis/delay-analysis.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
df = pd.read_excel('data/delay.xlsx',sheetname='Sheet 1')
df.head()
df.info()
"""
Explanation: TTC delay data
Preliminary data cleaning + start of some EDA.
Notebook by Carol Zhang Nov 12 2017
End of exp... |
dcavar/python-tutorial-for-ipython | notebooks/WordNet and NLTK.ipynb | apache-2.0 | from nltk.corpus import wordnet
"""
Explanation: WordNet and NLTK
(C) 2016-2019 by Damir Cavar <dcavar@iu.edu>
Version: 1.1, November 2019
License: Creative Commons Attribution-ShareAlike 4.0 International License (CA BY-SA 4.0)
This is a brief introduction t... |
geopandas/geopandas | doc/source/gallery/geopandas_rasterio_sample.ipynb | bsd-3-clause | import geopandas
import rasterio
import matplotlib.pyplot as plt
from shapely.geometry import Point
"""
Explanation: Using GeoPandas with Rasterio to sample point data
This example shows how to use GeoPandas with Rasterio. Rasterio is a package for reading and writing raster data.
In this example a set of vector poin... |
aylward/ITKTubeTK | examples/archive/Merge_Adjacent_Images.ipynb | apache-2.0 | import os
import sys
import numpy
import itk
from itk import TubeTK as ttk
from itkwidgets import view
import matplotlib.pyplot as plt
from matplotlib import cm
%matplotlib inline
"""
Explanation: MergeAdjacentImages Notebook
This notebook contains a few examples of how to use the MergeAdjacentImages application fr... |
opensanca/trilha-python | 02-python-oo/aula-03/Aula 03.ipynb | mit | from exemplos.baralho import Baralho
baralho = Baralho()
"""
Explanation: [Py-OO] Aula 03
Modelo de dados do Python
O que você vai aprender nesta aula?
Após o término da aula você terá aprendido:
O que é o modelo de dados do Python
Para que servem e como funcionam métodos mágicos
Protocolos em Python
Sequência
Sob... |
jsharpna/DavisSML | lectures/lecture3/lecture3.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
import scipy as sc
"""
Explanation: Linear Regression and Subset Selection
StatML: Lecture 3
Prof. James Sharpnack
Reading: "The Elements of Statistical Learning," Hastie, Tibshirani, Friedman, Ch. 3 (ESL)
End of explanation
"""
def ... |
henchc/Rediscovering-Text-as-Data | 03-Close-Reading-I/01-Strings.ipynb | mit | first_name = "Franz"
last_name = "Kafka"
full_name = first_name + last_name
print(full_name)
"""
Explanation: Strings
We can do things with strings
We've already seen in Data 8 some operations that can be done with strings.
End of explanation
"""
full_name = first_name + " " + last_name
print(full_name)
"""
Explan... |
aliasvishnu/TensorFlow-Creative-Applications | Training a network with TensorFlow/.ipynb_checkpoints/Sine wave predictor-checkpoint.ipynb | gpl-3.0 | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Building a neural network with TensorFlow
In this module we are going to build a neural network for regression. Regression is the prediction of a real-valued number given some inputs.
End of explanation
"""
... |
otavio-r-filho/AIND-Deep_Learning_Notebooks | 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()
reviews[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural... |
Jesusomar97/Simulacion2017 | Modulo1/Clase7_ModeloAhorro.ipynb | mit | # Librería para cálculo numérico
import numpy as np
# Valores dados en el enunciado
C_0, meta, i = 10000, 11000, 0.008
# Despejamos k tal que C_k=meta
k = np.ceil((meta/C_0 - 1)/i) # Notar el uso de la función ceil (no se puede tener un número no entero de periodos)
k = k.astype(int) # Conversión a ent... |
greg-ashby/deep-learning-nanodegree | intro-to-tensorflow/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... |
google/physics-math-tutorials | colabs/Character Space Colab.ipynb | apache-2.0 | from collections import Counter
import math
def char2vec(word):
# Counts each of the the characters in word.
# We use a dictionary instead of a sparse matrix to describe the characters,
# however the concept is identical.
return Counter(word)
def support(v):
# The support of a vector over a basis is the sub... |
trsherborne/learn-python | lesson3.ipynb | mit | # Everyone should know how to create (or "declare") a string by now
var = 'This is a string'
alphabet = 'abcdefghijklmnopqrstuvwxyz'
"""
Explanation: LSESU Applicable Maths Python Lesson 3
1/11/16
Today we will be learning about
* Strings and string indexing
* Reading files
* Lists
* List comprehensions
Recap from we... |
w4zir/ml17s | lectures/.ipynb_checkpoints/lec04-linear-regression-example-checkpoint.ipynb | mit | %matplotlib inline
import pandas as pd
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt
# read data in pandas frame
dataframe = pd.read_csv('datasets/example1.csv', encoding='utf-8')
# assign x and y
X = np.array(dataframe[['x']])
y = np.array(dataframe[['y']])
m = y.size # number ... |
root-mirror/training | SoftwareCarpentry/07-rdataframe-collections.ipynb | gpl-2.0 | import ROOT
treename = "myDataset"
filename = "data/collections_dataset.root"
df = ROOT.RDataFrame(treename, filename)
print(f"Columns in the dataset: {df.GetColumnNames()}")
"""
Explanation: Working with collections and object selections
RDataFrame reads collections as the special type ROOT::RVec (e.g. a branch con... |
kubeflow/pipelines | samples/contrib/e2e-outlier-drift-explainer/seldon/seldon_e2e_cifar10.ipynb | apache-2.0 | import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from alibi.explai... |
google-research/OOD-failures | experiments.ipynb | apache-2.0 |
import tensorflow as tf
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import pprint
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
#import cvxpy as cp
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
from sklearn import preprocessing
import keras
from keras.models im... |
tritemio/multispot_paper | usALEX - Corrections - Gamma factor fit.ipynb | mit | from __future__ import division
import numpy as np
import pandas as pd
import lmfit
from scipy.stats import linregress
"""
Explanation: Fit Gamma factor
This notebook estimates the gamma factor from a set of 5 μs-ALEX smFRET measurements.
What this notebook does?
According to Lee 2005 (PDF, SI PDF), we estimate the ... |
ES-DOC/esdoc-jupyterhub | notebooks/cnrm-cerfacs/cmip6/models/cnrm-esm2-1-hr/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cnrm-cerfacs', 'cnrm-esm2-1-hr', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: CNRM-CERFACS
Source ID: CNRM-ESM2-1-HR
Topic: Ocnbgchem
Sub-Top... |
maxis42/ML-DA-Coursera-Yandex-MIPT | 5 Data analysis applications/Homework/2 project wage forecast for Russia/wage_forecast_solomkin/wage_forecast_solomkin.ipynb | mit | #загружаем необходимые модули
%pylab inline
import pandas as pd
from scipy import stats
import statsmodels.api as sm
import matplotlib.pyplot as plt
import warnings
from itertools import product
#обратное преобразование Бокса-Кокса
def invboxcox(y,lmbda):
if lmbda == 0:
return(np.exp(y))
else:
return... |
daviddesancho/PREFUR | examples/free_energy_model.ipynb | gpl-3.0 | from prefur import thermo
"""
Explanation: Thermodynamic definitions in the FES model
We start by importing the thermo module from the prefur package.
End of explanation
"""
FES = thermo.FES(65)
"""
Explanation: Next we produce an instance of the FES class, for which we only need the protein sequence length.
End of... |
csaladenes/aviation | code/airport_arrv_parser_old.ipynb | mit | L=json.loads(file('../json/L.json','r').read())
M=json.loads(file('../json/M.json','r').read())
N=json.loads(file('../json/N.json','r').read())
import requests
AP={}
for c in M:
if c not in AP:AP[c]={}
for i in range(len(L[c])):
AP[c][N[c][i]]=L[c][i]
sch={}
"""
Explanation: Load airports of each co... |
biothings/biothings_explorer | jupyter notebooks/How to use meta-kg.ipynb | apache-2.0 | !pip install git+https://github.com/biothings/biothings_explorer.git
from biothings_explorer.smartapi_kg import MetaKG
"""
Explanation: Install and import biothings_explorer
End of explanation
"""
kg = MetaKG()
kg.constructMetaKG(source="remote")
"""
Explanation: Construct Meta-KG from SmartAPI
End of explanation... |
pycomlink/pycomlink | notebooks/outdated_notebooks/Compare min-max data and instantaneous data.ipynb | bsd-3-clause | cml_list = pycml.io.examples.get_75_cmls()
cml_list_min_max = pycml.io.examples.get_75_cmls_min_max()
"""
Explanation: Read instantaneous and min_max data
The min-max data was derived from the instantaneous example data set
End of explanation
"""
cml_index = 0 # select a single cml
cml = cml_list[cml_index]
cml_min... |
mne-tools/mne-tools.github.io | 0.19/_downloads/17295dea468fcedae97ed8a6f9afc520/plot_decoding_csp_timefreq.ipynb | bsd-3-clause | # Authors: Laura Gwilliams <laura.gwilliams@nyu.edu>
# Jean-Remi King <jeanremi.king@gmail.com>
# Alex Barachant <alexandre.barachant@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
from mne import ... |
davewsmith/notebooks | temperature/MovingTheSensor.ipynb | mit | %matplotlib inline
import matplotlib
matplotlib.rcParams['figure.figsize'] = (12, 5)
import pandas as pd
df = pd.read_csv('movesensors.csv', header=None, names=['time', 'mac', 'f', 'h'], parse_dates=[0])
per_sensor_f = df.pivot(index='time', columns='mac', values='f')
downsampled_f = per_sensor_f.resample('2T').mean(... |
awjuliani/DeepRL-Agents | Model-Network.ipynb | mit | from __future__ import print_function
import numpy as np
try:
import cPickle as pickle
except ModuleNotFoundError:
import pickle
import tensorflow as tf
%matplotlib inline
import matplotlib.pyplot as plt
import math
import sys
if sys.version_info.major > 2:
xrange = range
del sys
import gym
env = gym.make... |
olgabot/cshl-singlecell-2017 | notebooks/in_progress/0.1_Downloading_public_data_Macosko2015.ipynb | mit | # Import libraries that are standard in Python first
import os
# Alphabetical order is standard
# We're doing "import superlongname as abbrev" for
# our laziness - this way we don't have to type out the whole thing each time.
# Python plotting library
import matplotlib.pyplot as plt
# Numerical python library (pron... |
emsi/ml-toolbox | random/catfish/1_notmnist.ipynb | agpl-3.0 | # These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.line... |
Neuroglycerin/neukrill-net-work | notebooks/Holdout testing for Pylearn2 Pickles.ipynb | mit | import pylearn2.utils
import pylearn2.config
import theano
import neukrill_net.dense_dataset
import neukrill_net.utils
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import holoviews as hl
%load_ext holoviews.ipython
"""
Explanation: After running your Pylearn2 models, it's probably not best to ... |
ES-DOC/esdoc-jupyterhub | notebooks/ec-earth-consortium/cmip6/models/ec-earth3-aerchem/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'ec-earth3-aerchem', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: EC-EARTH-CONSORTIUM
Source ID: EC-EARTH3-AERCHEM
Topic: A... |
lvrzhn/AstroHackWeek2015 | day3-machine-learning/09.2 - Support Vector Machines.ipynb | gpl-2.0 | from sklearn.datasets import load_digits
from sklearn.cross_validation import train_test_split
digits = load_digits()
X_train, X_test, y_train, y_test = train_test_split(digits.data / 16., digits.target % 2, random_state=2)
from sklearn.svm import LinearSVC, SVC
linear_svc = LinearSVC(loss="hinge").fit(X_train, y_tra... |
jplattel/notebooks | phone-usage.ipynb | mit | # Import libraries
import pandas as pd
%matplotlib inline
"""
Explanation: Playing with phone usage
Starting on the first day of this year, I started tracking how often I was using my phone, I've been tinkering with iPython Notebooks and Pineapple pro to explore this data. Here's my first try for analyzing the data... |
510908220/python-toolbox | books/files/traverse-directories.ipynb | mit | import os
os.listdir('traverse-directories')
"""
Explanation: 目录遍历
下面整理常见的目录遍历方式:
os.listdir
os.scandir
os.walk
os.listdir
glob.glob
pathlib.Path
目录结构为:
```
traverse-directories
sell.txt
fuit-shop\
orange.txt
apple.txt
car\
small-car\
奔驰.txt
big-car\
... |
crystalzhaizhai/cs207_yi_zhai | homeworks/HW4/HW4_final.ipynb | mit | with open("circles.txt","r") as f:
circles_text=f.read().split()
def mywave(radius):
return (float(radius)*float(radius)*3.14)
def myave(func, radii_list):
total_area=0
num_area=0
for radius in radii_list:
total_area+=func(radius)
num_area+=1
return (total_area/num_area)
prin... |
CommonClimate/teaching_notebooks | GEOL157L/GEOL157_Lab5_paleclimate_records.ipynb | mit | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Lab 5: Paleoclimate Data
In this lab you will analyze several famous paleoclimate datasets, and explore their implications for how climate changes.
1. Glacial-Interglacial cycles
Much inform... |
eriksalt/jupyter | Python Quick Reference/Base Language.ipynb | mit | # 'generic import' of math module
import math
math.sqrt(25)
# import a function
from math import sqrt
sqrt(25) # no longer have to reference the module
# import multiple functions at once
from math import cos, floor
# import all functions in a module (generally discouraged)
from csv import *
# define an alias
impo... |
ES-DOC/esdoc-jupyterhub | notebooks/messy-consortium/cmip6/models/emac-2-53-vol/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'messy-consortium', 'emac-2-53-vol', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: MESSY-CONSORTIUM
Source ID: EMAC-2-53-VOL
Topic: Atmoschem
S... |
marioberges/F16-12-752 | homeworks/homework1/exercise0_solution.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import sys
print('Python version:')
print(sys.version)
print('Numpy version:')
print(np.__version__)
import sklearn
print('Sklearn version:')
print(sklearn.__version__)
"""
Explanation: 12-752: Data-Driven Building Energy Management
Fall 2016, Car... |
saudijack/unfpyboot | Day_02/00_Scipy/02_scipy_Breakout-solutions.ipynb | mit | %pylab inline
matplotlib.rcParams['savefig.dpi'] = 2 * matplotlib.rcParams['savefig.dpi']
from scipy import misc
from scipy import ndimage
"""
Explanation: Scientific Programming I: Breakout Solutions
End of explanation
"""
img = plt.imread("MV_HFV_012.png")
fig = plt.figure()
ax = fig.add_subplot(111)
ax.imshow(im... |
tpin3694/tpin3694.github.io | machine-learning/create_baseline_regression_model.ipynb | mit | # Load libraries
from sklearn.datasets import load_boston
from sklearn.dummy import DummyRegressor
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
"""
Explanation: Title: Create Baseline Regression Model
Slug: create_baseline_regression_model
Summary: How to create... |
hetland/python4geosciences | materials/ST_unsupervised_machine_learning.ipynb | mit | from sklearn.datasets import make_blobs
X, y = make_blobs(random_state=42, centers=3)
X[:,1] += 0.25*X[:,0]**2
# print(X.shape)
# print(y)
# plt.scatter(X[:, 0], X[:, 1], 20, y, edgecolor='none')
plt.plot(X[:, 0], X[:, 1], 'ok')
from sklearn.cluster import KMeans, AffinityPropagation, SpectralClustering
# cluster = A... |
grigorisg9gr/menpo-notebooks | menpo3d/Rasterization Basics.ipynb | bsd-3-clause | import numpy as np
import menpo3d.io as mio
mesh = mio.import_builtin_asset('james.obj')
"""
Explanation: Offscreen Rasterization Basics
Menpo3D wraps a subproject called cyrasterize which allows for simple rasterization of 3D meshes. At the moment, only basic rendering is support, with no lighting. However, in the n... |
xiaodongpang23/anomaly_detection | anomaly_detection.ipynb | mit | batchlogfile = 'sample_dataset/batch_log.json'
df_batch = pd.read_json(batchlogfile, lines=True)
index_purchase = ['event_type','id','timestamp','amount']
index_friend = ['event_type','id1','id2','timestamp']
#df_batch.head()
#df_batch.describe()
# Read D and T
df_DT=df_batch[df_batch['D'].notnull()]
df_DT=df_DT[['... |
barronh/GCandPython | PNC_01Basics.ipynb | gpl-3.0 | # Prepare my slides
%pylab inline
%cd working
"""
Explanation: <style>
.answers {
visibility: hidden;
}
</style>
Python Analysis for GEOS-Chem
Author: Barron H. Henderson
Attendees will learn how to leverage Python to interact with air pollution-related model and observational data. Air research and application ... |
mne-tools/mne-tools.github.io | stable/_downloads/f398f296c84e53a14339d2c3c36e91a4/movement_detection.ipynb | bsd-3-clause | # Authors: Adonay Nunes <adonay.s.nunes@gmail.com>
# Luke Bloy <luke.bloy@gmail.com>
# License: BSD-3-Clause
import os.path as op
import mne
from mne.datasets.brainstorm import bst_auditory
from mne.io import read_raw_ctf
from mne.preprocessing import annotate_movement, compute_average_dev_head_t
# Load dat... |
google/starthinker | colabs/conversion_upload_from_biguery.ipynb | apache-2.0 | !pip install git+https://github.com/google/starthinker
"""
Explanation: 1. Install Dependencies
First install the libraries needed to execute recipes, this only needs to be done once, then click play.
End of explanation
"""
CLOUD_PROJECT = 'PASTE PROJECT ID HERE'
print("Cloud Project Set To: %s" % CLOUD_PROJECT)
... |
gunan/tensorflow | tensorflow/lite/g3doc/performance/post_training_quant.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... |
AbhilashReddyM/GeometricMultigrid | .ipynb_checkpoints/Making_a_Preconditioner-vectorized-checkpoint.ipynb | mit | import numpy as np
"""
Explanation: This is functionally similar to the the other notebook. All the operations here have been vectorized. This results in much much faster code, but is also much unreadable. The vectorization also necessitated the replacement of the Gauss-Seidel smoother with under-relaxed Jacobi. That ... |
btabibian/misc_notebooks | Nature-Cooperation.ipynb | mit | %%html
<div >
<iframe type="text/html" width="336" height="550" frameborder="0" allowfullscreen style="max-width:100%;float: left" src="https://lesen.amazon.de/kp/card?asin=B003UV8TC2&preview=inline&linkCode=kpe&ref_=cm_sw_r_kb_dp_MamPyb1NWT7A8" ></iframe>
</div>
<div >
<iframe type="text/html" width="336" height="550"... |
malooney/malooney.github.io | Optim_Class_Fall2020/DEMAPP09_Cournot_oligopolist_problem.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from compecon import BasisChebyshev, NLP, nodeunif
from compecon.demos import demo
"""
Explanation: Solving the Cournot Oligopoly Model by Collocation
DEMAPP09 Cournot Oligopolist Problem
<br>
This example is taken from section 6.8.1, page(s) 159... |
ckemere/RandomPythonScripts | Off Center Ring Simulation.ipynb | unlicense | #%%
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.collections import PatchCollection
"""
Explanation: Simulate binaural hearing when the stimulus is rotated around a ring of speakers.
End of explanation
"""
# MEASURE SOURCE ANGLE RELATIVE TO NOSE. POSITIVE... |
networks-lab/isilib | docs/examples/Making-Networks.ipynb | gpl-2.0 | import metaknowledge as mk
import networkx as nx
"""
Explanation: Making a network
For this class most of the types of network you will want to make can be produced by metaknowledge. The first three co-citation network, citation network and co-author network are specialized versions of the last three one-mode network,... |
EricChiquitoG/Simulacion2017 | Modulo2/Clase12_IntegracionMontecarlo.ipynb | mit | from IPython.display import YouTubeVideo
YouTubeVideo('Ti5zUD08w5s')
YouTubeVideo('jmsFC0mNayM')
"""
Explanation: Integración numérica Montecarlo
Referencia:
- https://ocw.mit.edu/courses/mechanical-engineering/2-086-numerical-computation-for-mechanical-engineers-fall-2014/nutshells-guis/MIT2_086F14_Monte_Carlo.pdf
-... |
tensorflow/docs-l10n | site/ja/hub/tutorials/boundless.ipynb | apache-2.0 | #@title Copyright 2020 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
alaindomissy/scbatch | members/fsclvm/f-scLVM.ipynb | bsd-3-clause | import os
import fscLVM
import pdb
from fscLVM import plotFactors, plotRelevance, plotLoadings, saveFA, dumpFA
%pylab inline
#specify where the hdf5 file is
data_dir = '../data/'
out_dir = './results'
"""
Explanation: fscLVM tutorial
In this notebook we illustrate how f-scLVM can be used to identify biological driver... |
rhlgupta122/Computer-Vision | notebook/Python/12. Boundary_filtering.ipynb | mit | import cv2
import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage as scp
"""
Explanation: *****Not Working*******
In this notebook, we will implement matlab imfilter method in python. Here we will implement four modes know as - (clip, wrap, copy, reflect) in old_matlab, (0, circular, replicate, symmet... |
brettavedisian/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."""
... |
ericmjl/bokeh | examples/howto/notebook_comms/Numba Image Example.ipynb | bsd-3-clause | from timeit import default_timer as timer
from bokeh.plotting import figure, show, output_notebook
from bokeh.models import GlyphRenderer, LinearColorMapper
from bokeh.io import push_notebook
from numba import jit, njit
from ipywidgets import interact
import numpy as np
import scipy.misc
output_notebook()
"""
Expla... |
RPGOne/Skynet | xgboost-master/demo/distributed-training/plot_model.ipynb | bsd-3-clause | import sys
import os
%matplotlib inline
"""
Explanation: XGBoost Model Analysis
This notebook can be used to load and analysis model learnt from all xgboost bindings, including distributed training.
End of explanation
"""
pkg_path = '../../python-package/'
model_file = 's3://my-bucket/xgb-demo/model/0002.model'
sys... |
sperez8/iLab-viz | log_visualization_maker.ipynb | gpl-3.0 | %load_ext autoreload
%autoreload 1
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
pd.options.display.max_rows = 1000
pd.options.display.max_columns = 60
#utils.py is where all our custom functions live is we set an autoreload on it.
%aimport utils
from... |
isb-cgc/examples-Python | notebooks/BRAF-V600 study using CCLE data.ipynb | apache-2.0 | !pip install --upgrade google-api-python-client==1.4.2
"""
Explanation: Working with BigQuery tables and the Genomics API
Case Study: BRAF V600 mutations in CCLE cell-lines
In this notebook we'll show you how you might combine information available in BigQuery tables with sequence-reads that have been imported into Go... |
stevetjoa/stanford-mir | zcr.ipynb | mit | x, sr = librosa.load('audio/simple_loop.wav')
"""
Explanation: ← Back to Index
Zero Crossing Rate
The zero crossing rate indicates the number of times that a signal crosses the horizontal axis.
Let's load a signal:
End of explanation
"""
ipd.Audio(x, rate=sr)
"""
Explanation: Listen to the signal:
End of expla... |
Yrthgze/prueba-sourcetree2 | BrambleXu/play5/play5.ipynb | mit | import os
import glob
from PIL import Image
def thumbnail_pic(path):
a = glob.glob(r'*.jpg')
for x in a:
name = os.path.join(path, x)
im = Image.open(name)
im.thumbnail((1136, 640))
print(im.format, im.size, im.mode)
im.save(name, 'JPEG')
print('Done!')
if __name__ ... |
griffinfoster/fundamentals_of_interferometry | 5_Imaging/5_3_gridding_and_degridding.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import HTML
from IPython.display import Image, display, clear_output
from ipywidgets import HBox, Label, FloatSlider, Layout
HTML('../style/course.css') #apply general CSS
"""
Explanation: Outline
Glossary
5. Imaging
Previous: ... |
mne-tools/mne-tools.github.io | dev/_downloads/99798f35196ac117a93fa936a5c48a93/20_visualize_evoked.ipynb | bsd-3-clause | import numpy as np
import mne
"""
Explanation: Visualizing Evoked data
This tutorial shows the different visualization methods for
:class:~mne.Evoked objects.
As usual we'll start by importing the modules we need:
End of explanation
"""
root = mne.datasets.sample.data_path() / 'MEG' / 'sample'
evk_file = root / 'sam... |
DfAC/MachineLearningFoundations | week01.ipynb | mit | data = gl.SFrame('people-example.csv')
data.tail()
"""
Explanation: Machine Learning Foundations: A Case Study Approach Week1
Lectures
A simple intro to ML discussing its origin from robots.
Old ML pipeline
Data -> ML Method -> My curve is better -> write a paper
New Machine learning pipeline
Data -> ML Method -> I... |
tensorflow/docs-l10n | site/ko/neural_structured_learning/tutorials/adversarial_keras_cnn_mnist.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 u... |
kfollette/ASTR200-Spring2017 | Labs/Lab8/.ipynb_checkpoints/Lab 8-checkpoint.ipynb | mit | from numpy import *
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: <small><i>This notebook is based on one put together by Mark Krumholz and has been modified to suit the purposes of this course, including expansion/modification of explanations and additional exercises. The original can be found a... |
ES-DOC/esdoc-jupyterhub | notebooks/miroc/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', 'miroc', 'sandbox-3', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: MIROC
Source ID: SANDBOX-3
Topic: Landice
Sub-Topics: Glaciers, Ice.
Propertie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.