repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
Aryan-Barbarian/bigbang | examples/Corr between centrality and community 0.1.ipynb | gpl-2.0 | %matplotlib inline
from bigbang.archive import Archive
import bigbang.parse as parse
import bigbang.graph as graph
import bigbang.mailman as mailman
import bigbang.process as process
import networkx as nx
import matplotlib.pyplot as plt
import pandas as pd
from pprint import pprint as pp
import pytz
import numpy as np... |
aimalz/qp | docs/desc-0000-qp-photo-z_approximation/research/data_exploration.ipynb | mit | %load_ext autoreload
%autoreload 2
from __future__ import print_function
import hickle
import numpy as np
from pathos.multiprocessing import ProcessingPool as Pool
import random
import cProfile
import pstats
import StringIO
import timeit
import psutil
import sys
import os
import timeit
import pandas as pd
pd.set... |
superbobry/pymc3 | pymc3/examples/rolling_regression.ipynb | apache-2.0 | %matplotlib inline
import pandas as pd
from pandas_datareader import data
import numpy as np
import pymc3 as pm
import matplotlib.pyplot as plt
"""
Explanation: Bayesian Rolling Regression in PyMC3
Author: Thomas Wiecki
Pairs trading is a famous technique in algorithmic trading that plays two stocks against each othe... |
noammor/coursera-machinelearning-python | ex6/ml-ex6.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import scipy.io
import sklearn.svm
%matplotlib inline
"""
Explanation: Exercise 6 | Support Vector Machines
End of explanation
"""
ex6data1 = scipy.io.loadmat('ex6data1.mat')
X = ex6data1['X']
y = ex6data1['y'][:, 0]
def plot_data(X, y, ax=None):
if ax == None... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/ukesm1-0-ll/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'ukesm1-0-ll', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: NERC
Source ID: UKESM1-0-LL
Topic: Atmoschem
Sub-Topics: Transport, Emissi... |
ES-DOC/esdoc-jupyterhub | notebooks/cas/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', 'cas', 'sandbox-2', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CAS
Source ID: SANDBOX-2
Sub-Topics: Radiative Forcings.
Properties: 85 (42 re... |
ES-DOC/esdoc-jupyterhub | notebooks/pcmdi/cmip6/models/sandbox-2/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'pcmdi', 'sandbox-2', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: PCMDI
Source ID: SANDBOX-2
Topic: Ocnbgchem
Sub-Topics: Tracers.
Propertie... |
tensorflow/decision-forests | documentation/tutorials/intermediate_colab.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... |
imatge-upc/activitynet-2016-cvprw | notebooks/16 Visualization of Results.ipynb | mit | import random
import os
import numpy as np
from work.dataset.activitynet import ActivityNetDataset
dataset = ActivityNetDataset(
videos_path='../dataset/videos.json',
labels_path='../dataset/labels.txt'
)
videos = dataset.get_subset_videos('validation')
videos = random.sample(videos, 8)
examples = []
for v in... |
jbmuir/SeismoTeaching | task_1.ipynb | mit | #A fdsn client allow us to connect with web services for obtaining data
from obspy.clients.fdsn import Client
#The UTCDateTime module specifies times in a consistent fashion - useful for specifying dates precisely
from obspy import UTCDateTime
"""
we can add a "keyword argument" like "timeout" below to certain functio... |
param411singh/inf1340-2015-notebooks | Week 11.ipynb | mit | import json
list1 = ["Monday", 6, "pumpkin", 3.1415]
dict1 = {
"latitude_degree": 43.6617,
"latitude_direction": "N",
"longitude_degree": 79.3950,
"longitude_direction": "W"
}
json_encoded = json.dumps(dict1)
print json_encoded
"""
Explanation: Overview
Hour ... |
csiu/datasci | text/2015-07-26_document-classification_nb-2cat.ipynb | mit | import glob
import pandas as pd
samples = {
'train':{},
'test':{}
}
files = glob.glob('20news-bydate-*/rec.sport*/*')
for s in samples.keys():
for c in ['baseball', 'hockey']:
samples[s][c] = samples[s].get(c, len(filter(lambda x: s in x and c in x, files)))
print 'Number of training documents:\t... |
jinntrance/MOOC | coursera/ml-classification/assignments/module-10-online-learning-assignment-blank.ipynb | cc0-1.0 | from __future__ import division
import graphlab
"""
Explanation: Training Logistic Regression via Stochastic Gradient Ascent
The goal of this notebook is to implement a logistic regression classifier using stochastic gradient ascent. You will:
Extract features from Amazon product reviews.
Convert an SFrame into a Num... |
usc-isi-i2/etk | examples/excel_extractor/excel extractor.ipynb | mit | import pprint
from etk.extractors.excel_extractor import ExcelExtractor
ee = ExcelExtractor()
variables = {
'value': '$col,$row'
}
raw_extractions = ee.extract('alabama.xls', '16tbl08al', ['C,7', 'M,33'], variables)
pprint.pprint(raw_extractions[:10]) # print first 10
"""
Explanation: Excel Extractor
ETK's Excel ... |
barjacks/foundations-homework | 14_Analyzing_Text/14 - TF-IDF Homework.ipynb | mit | # If you'd like to download it through the command line...
!curl -O http://www.cs.cornell.edu/home/llee/data/convote/convote_v1.1.tar.gz
# And then extract it through the command line...
!tar -zxf convote_v1.1.tar.gz
"""
Explanation: Homework 14 (or so): TF-IDF text analysis and clustering
Hooray, we kind of figured ... |
tensorflow/docs-l10n | site/zh-cn/datasets/overview.ipynb | apache-2.0 | !pip install -q tfds-nightly tensorflow matplotlib
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import tensorflow_datasets as tfds
"""
Explanation: TensorFlow Datasets
TFDS provides a collection of ready-to-use datasets for use with TensorFlow, Jax, and other Machine Learning frameworks... |
nansencenter/nansat | docs/source/notebooks/nansat-introduction.ipynb | gpl-3.0 | import os
import shutil
import nansat
idir = os.path.join(os.path.dirname(nansat.__file__), 'tests', 'data/')
"""
Explanation: Nansat: First Steps
Overview
The NANSAT package contains several classes:
Nansat - open and read satellite data
Domain - define grid for the region of interest
Figure - create raster... |
martinjrobins/hobo | examples/plotting/residuals-autocorrelation-diagnostics.ipynb | bsd-3-clause | import pints
import pints.toy as toy
import pints.plot
import numpy as np
import matplotlib.pyplot as plt
# Use the toy logistic model
model = toy.LogisticModel()
real_parameters = [0.015, 500]
times = np.linspace(0, 1000, 100)
org_values = model.simulate(real_parameters, times)
# Add independent Gaussian noise
nois... |
prashantas/MyDataScience | DeepNetwork/Keras/MnistKerasModelsGood.ipynb | bsd-2-clause | from keras.datasets import mnist # subroutines for fetching the MNIST dataset
from keras.models import Model # basic class for specifying and training a neural network
from keras.layers import Input, Dense # the two types of neural network layer we will be using
from keras.utils import np_utils # utilities for one-hot ... |
AndreySheka/dl_ekb | hw9/music_binder/music_dnn_task.ipynb | mit | plt.figure(figsize=(20,4))
pylab.plot(np.arange(len(y)) * 1.0 /sr, y, 'k')
pylab.xlim([0, 10])
pylab.show()
"""
Explanation: Sound as 1D-Signal
End of explanation
"""
S = librosa.feature.melspectrogram(y, sr=sr, n_mels=128)
log_S = librosa.logamplitude(S, ref_power=np.max)
plt.figure(figsize=(20,4))
librosa.display... |
najeeb97khan/Random_Acts_Of_Pizza | Quality Of Features.ipynb | mit | %pylab inline
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import re
from nltk.corpus import stopwords
from collections import Counter
from nltk.corpus import wordnet as wn
nouns = {x.name().split('.', 1)[0] for x in wn.all_synsets('n')}
import warnings
warnings.filterw... |
psychemedia/parlihacks | notebooks/Apache Drill - JSON Written Questions.ipynb | mit | import pandas as pd
from pydrill.client import PyDrill
%matplotlib inline
#Get a connection to the Apache Drill server
drill = PyDrill(host='localhost', port=8047)
"""
Explanation: Using Apache Drill to Query Parliament Written Questions Data
A bit of a play to try to get to grips with Apache Drill, querying over JS... |
MadsJensen/intro_to_scientific_computing | notebooks/23-Single-logfile-parser.ipynb | bsd-3-clause | import string
"""
Explanation: Parsing a single log file
parse: to examine in a minute way
In this notebook we'll extract the information on reaction time and accuracy from a single log file, and generalise our code to apply to any log file (written with the same structure).
It is considered good practice to import al... |
hadim/public_notebooks | Analysis/Fit_Ellipse/notebook.ipynb | mit | # Do some import
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from tifffile import TiffFile
# Load the image
tf = TiffFile("binary_cell.tif")
# Get the numpy array
a = tf.asarray()
# Replace all 255 to 1 so the image is now made of "0" and "1"
a[a == 255] = 1
print(np.unique(a))
_ = plt.ims... |
JorisBolsens/PYNQ | Pynq-Z1/notebooks/examples/pmod_grove_tmp.ipynb | bsd-3-clause | from pynq.pl import Overlay
Overlay("base.bit").download()
"""
Explanation: Grove Temperature Sensor 1.2
This example shows how to use the Grove Temperature Sensor v1.2 on the Pynq-Z1 board. You will also see how to plot a graph using matplotlib. The Grove Temperature sensor produces an analog signal, and requires an ... |
Hvass-Labs/TensorFlow-Tutorials | 12_Adversarial_Noise_MNIST.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
from sklearn.metrics import confusion_matrix
import time
from datetime import timedelta
import math
"""
Explanation: TensorFlow Tutorial #12
Adversarial Noise for MNIST
by Magnus Erik Hvass Pedersen
/ GitHub / Videos on YouTu... |
petermchale/yeast_bioinformatics | analysis.ipynb | mit | import sys, os
sys.path.append(os.getcwd() + '/source')
from extract import createEnergyMatrix
energy_matrix = createEnergyMatrix('data/Gal4_affinity.in')
"""
Explanation: Yeast bioinformatic analysis
This Notebook lives at Github.
Here is a rendered version of this notebook.
Research Question
The eukaryotic genome... |
juanshishido/experiments-guide | 02-randomization.ipynb | mit | import numpy as np
n, p = 10, 0.5
np.random.binomial(n, p)
"""
Explanation: Randomization
In the previous chapter, we saw how randomization eliminates selection bias. Let's explain what we mean by randomization, describe several ways we might want to randomly assign treatments, and discuss the components other than t... |
SKA-ScienceDataProcessor/crocodile | examples/notebooks/wstacking.ipynb | apache-2.0 | %matplotlib inline
import sys
sys.path.append('../..')
from matplotlib import pylab
pylab.rcParams['figure.figsize'] = 16, 10
import functools
import numpy
import scipy
import scipy.special
import time
from crocodile.clean import *
from crocodile.synthesis import *
from crocodile.simulate import *
from util.visual... |
andreyf/machine-learning-examples | numpy_and_pandas/part0_numpy.ipynb | gpl-3.0 | # Python 2 and 3 compatibility
from __future__ import (absolute_import, division,
print_function, unicode_literals)
# отключим предупреждения Anaconda
import warnings
warnings.simplefilter('ignore')
import numpy as np
a = np.array([0, 1, 2, 3])
a
"""
Explanation: <center>
<img src="../img/ods_... |
tensorflow/docs-l10n | site/en-snapshot/agents/tutorials/5_replay_buffers_tutorial.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... |
poldrack/fmri-analysis-vm | analysis/statistics/LinearAlgebraStats.ipynb | mit | import numpy,pandas
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats
import statsmodels.api as sm
import statsmodels
from statsmodels.formula.api import ols,glsar
from statsmodels.tsa.arima_process import arma_generate_sample
from scipy.linalg import toeplitz
from IPython.display import display,... |
AdityaSoni19031997/Machine-Learning | kaggle/microsoft_malware_competition/neural-network-malware-0-67.ipynb | mit | # IMPORT LIBRARIES
import pandas as pd, numpy as np, os, gc
# LOAD AND FREQUENCY-ENCODE
FE = ['EngineVersion','AppVersion','AvSigVersion','Census_OSVersion']
# LOAD AND ONE-HOT-ENCODE
OHE = [ 'RtpStateBitfield','IsSxsPassiveMode','DefaultBrowsersIdentifier',
'AVProductStatesIdentifier','AVProductsInstalled', '... |
CLandauGWU/group_e | Model_Select.ipynb | mit | #Shift and shape vars
shiftmonths = 6
shapef = 'anc'
#Assign the split for holdout data.
holdout_date = 2015.5
#Get data
filestring = './data/'+shapef+'_out.csv'
df = pd.read_csv(filestring)
df = df.sort_values(['month', 'NAME'])# , 'ANC'])
df = df.reset_index(drop=True)
len(df.NAME.unique())
"""
Explanation: To start... |
ARM-software/lisa | ipynb/deprecated/examples/trappy/custom_events_example.ipynb | apache-2.0 | import logging
from conf import LisaLogging
LisaLogging.setup()
# Generate plots inline
%matplotlib inline
import copy
import json
import os
import time
import math
import logging
# Support to access the remote target
import devlib
from env import TestEnv
# Support to configure and run RTApp based workloads
from wl... |
mne-tools/mne-tools.github.io | 0.18/_downloads/9794ea6d3b7fc21947e9529fb55249c9/plot_read_proj.ipynb | bsd-3-clause | # Author: Joan Massich <mailsik@gmail.com>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne import read_proj
from mne.io import read_raw_fif
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
subjects_dir = data_path + '/subjects'
fname = data_path + '/MEG... |
Kappa-Dev/ReGraph | examples/Tutorial_NetworkX_backend/Part2_hierarchies.ipynb | mit | from regraph import NXGraph, NXHierarchy, Rule
from regraph import plot_graph, plot_instance, plot_rule
%matplotlib inline
"""
Explanation: ReGraph tutorial (NetworkX backend)
Part 2: Rewriting hierarchies of graph
ReGraph allows to create a hierarchies of graphs related by means of homomorphisms (or typing). In the ... |
msampathkumar/data_science_sessions | QuickBasics/Introduction_to_LinkedList.ipynb | mit | class Node:
def __init__(self, value: int):
# print('push elem', value)
self.value = value
self.next = None
def __repr__(self):
is_next = False
if self.next:
is_next = True
# return '<Node val(%s) know(%s)>' % (self.value, id(self.next))
... |
evanmiltenburg/python-for-text-analysis | Chapters-colab/Chapter_04_Boolean_Expressions_and_Conditions.ipynb | apache-2.0 | %%capture
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Data.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/images.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Extra_Material.zip
!unzip Data.zip -d ../
!unzip images.zip -d ./
!unzip Ext... |
julianogalgaro/udacity | nd101/c2l8-sentiment-analysis/sentiment_network/Sentiment Classification - Mini Project 2.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()... |
metpy/MetPy | v0.10/_downloads/d02fda82caa4290e31f980126221b2a4/Wind_SLP_Interpolation.ipynb | bsd-3-clause | import cartopy.crs as ccrs
import cartopy.feature as cfeature
from matplotlib.colors import BoundaryNorm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from metpy.calc import wind_components
from metpy.cbook import get_test_data
from metpy.interpolate import interpolate_to_grid, remove_nan_obse... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/production_ml/labs/multi_worker_with_keras.ipynb | apache-2.0 | import json
import os
import sys
"""
Explanation: Multi-worker training with Keras
Learning Objectives
Multi-worker Configuration
Choose the right strategy
Train the model
Multi worker training in depth
Introduction
This notebook demonstrates multi-worker distributed training with Keras model using tf.distribute.Str... |
grfiv/titanic | May2015/vowpal_wabbit.ipynb | mit | i = 0
def clean(s):
return " ".join(re.findall(r'\w+', s,flags = re.UNICODE | re.LOCALE)).lower()
with open("train_titanic.csv", "r") as infile:
reader = csv.reader(infile)
for line in reader:
print line
i += 1
if (i == 2): break
i = 0
def clean(s):
return " ".join(re.findall(r'\w+', s,... |
mayankjohri/LetsExplorePython | Section 1 - Core Python/Chapter 09 - Classes & OOPS/08_MetaProgramming.ipynb | gpl-3.0 | class Foo(object): pass
print(type(Foo))
class Foo: pass
Foo.field = 42
x = Foo()
x.field
Foo.field2 = 99
x.field2
Foo.method = lambda self: "Hi!"
x.method()
"""
Explanation: Metaprogramming
Objects are created by other objects: special objects called “classes” that we can set up to spit out objects that are co... |
Weenkus/Machine-Learning-University-of-Washington | Regression/assignments/.ipynb_checkpoints/Ridge Regression Programming Assignment 1-checkpoint.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_model
import numpy as np
from math import ceil
"""
Explanation: Initialise the libs
End of explanation
"""
dtype_dict = {'bathrooms':float, 'waterfront':int, 'sqft_above':int, 'sqft_living15':float, 'grade':int, 'yr_renovated':int, 'pric... |
feststelltaste/software-analytics | demos/Big Data Meetup Exercises.ipynb | gpl-3.0 | import pandas as pd
df = pd.read_csv(
r'C:\Users\Markus\Downloads\Fire_Department_Calls_for_Service.csv')
df.head()
df.columns
len(df)
"""
Explanation: San Francisco Fire Incidents
Fileset (1,5 GB): https://data.sfgov.org/api/views/nuek-vuh3/rows.csv?accessType=DOWNLOAD
End of explanation
"""
len(df['Call Typ... |
olinguyen/shogun | doc/ipython-notebooks/clustering/GMM.ipynb | gpl-3.0 | %pylab inline
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
# import all Shogun classes
from shogun import *
from matplotlib.patches import Ellipse
# a tool for visualisation
def get_gaussian_ellipse_artist(mean, cov, nstd=1.96, color="red", linewidth=3):
"""
Retur... |
ultiyuan/test0 | lessons/.ipynb_checkpoints/HydroAssignment-checkpoint.ipynb | gpl-2.0 | #Import the required functions from VortexPanel.py and BoundaryLayer.py
from VortexPanel import Panel, solve_gamma, plot_flow, make_circle
#Create function to calculate the pressure coefficient
def cp(gamma): return gamma**2-1
def calc_Cp(u_e, U_inf=1):
#Find analytical result for Cp.
Cp = []
Cp = [(1-((i... |
muxiaobai/CourseExercises | python/kaggle/data-visual/Multivariate.ipynb | gpl-2.0 | sns.lmplot(x='Attack',y='Defense',hue='Legendary',fit_reg=False,markers=['x','o'],data = pokemon)
plt.show()
sns.heatmap(
pokemon.loc[:, ['HP', 'Attack', 'Sp. Atk', 'Defense', 'Sp. Def', 'Speed']].corr(),
annot=True
)
plt.show()
import pandas as pd
from pandas.plotting import parallel_coordinates
p = (pokemo... |
eshlykov/mipt-day-after-day | statistics/hw-09/09.2.ipynb | unlicense | import numpy
"""
Explanation: 9. Линейная регрессия
2. В четырехугольнике $ABCD$ независимые равные по точности измерения углов $ABD$, $DBC$, $ABC$, $BCD$, $CDB$, $BDA$, $CDA$, $DAB$ (в градусах) дали результаты $50.78$, $30.25$, $78.29$, $99.57$, $50.42$, $40.59$, $88.87$, $89.86$ соответственно. Считая, что ошибки и... |
fonnesbeck/scientific-python-workshop | notebooks/Model Building with PyMC.ipynb | cc0-1.0 | import pymc as pm
import numpy as np
from pymc.examples import disaster_model
switchpoint = pm.DiscreteUniform('switchpoint', lower=0, upper=110)
"""
Explanation: Building Models in PyMC
Bayesian inference begins with specification of a probability model
relating unknown variables to data. PyMC provides three basic b... |
wryoung412/CS294_Deep_RL | hw2/HW2.ipynb | mit | from frozen_lake import FrozenLakeEnv
env = FrozenLakeEnv()
print(env.__doc__)
"""
Explanation: Assignment 2: Markov Decision Processes
Homework Instructions
All your answers should be written in this notebook. You shouldn't need to write or modify any other files.
Look for four instances of "YOUR CODE HERE"--those a... |
ceos-seo/data_cube_notebooks | notebooks/training/ardc_training/Training_TaskE_Transect.ipynb | apache-2.0 | import xarray as xr
import numpy as np
import datacube
import utils.data_cube_utilities.data_access_api as dc_api
from datacube.utils.aws import configure_s3_access
configure_s3_access(requester_pays=True)
api = dc_api.DataAccessApi()
dc = api.dc
"""
Explanation: ARDC Training: Python Notebooks
Task-E: This noteb... |
wei-Z/Python-Machine-Learning | code/ch08/ch08.ipynb | mit | %load_ext watermark
%watermark -a 'Sebastian Raschka' -u -d -v -p numpy,pandas,matplotlib,scikit-learn,nltk
# to install watermark just uncomment the following line:
#%install_ext https://raw.githubusercontent.com/rasbt/watermark/master/watermark.py
"""
Explanation: Sebastian Raschka, 2015
https://github.com/rasbt/py... |
tensorflow/docs | site/en/tutorials/load_data/images.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... |
esa-as/2016-ml-contest | MSS_Xmas_Trees/ml_seg_try1.ipynb | apache-2.0 | from numpy.fft import rfft
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt
import plotly.plotly as py
import pandas as pd
import timeit
from sqlalchemy.sql import text
from sklearn import tree
from sklearn import cross_validation
from sklearn.cross_validation import train_test_split
from ... |
alee156/NeuroCV | 2 Dimensional Array Manipulations and Equalization.ipynb | apache-2.0 | import matplotlib.pyplot as plt
import scipy.ndimage
import csv,gc
import matplotlib
import numpy as np
import nibabel as nb
%matplotlib inline
BINS = 32
import csv,gc
import matplotlib
import numpy as np
import nibabel as nb
%matplotlib inline
BINS = 32
### Run below if necessary
##import sys
##sys.path.append(... |
djgagne/hagelslag-unidata | demos/unidata_users_workshop_2015.ipynb | mit | %matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
from mpl_toolkits.basemap import Basemap
from IPython.display import display
from IPython.html import widgets
from scipy.ndimage import gaussian_filter, find_objects
from copy import deepco... |
ddtm/dl-course | Seminar2/Seminar2.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import random
from IPython import display
from sklearn import datasets, preprocessing
(X, y) = datasets.make_circles(n_samples=1024, shuffle=True, noise=0.2, factor=0.4)
ind = np.logical_or(y==1, X[:,1] > X[:,0] - 0.5)
X = X[ind,:]
m = np.array([[1,... |
mas-dse-greina/neon | Display CIFAR-10 Images.ipynb | apache-2.0 | from neon.data import CIFAR10 # Neon's helper function to download the CIFAR-10 data
from PIL import Image # The Python Image Library (PIL)
import numpy as np # Our old friend numpy
"""
Explanation: Displaying the CIFAR-10 Images In Neon
Tony Reina<br>
27 JUN 2017
Neon has convolutional neural... |
EmuKit/emukit | notebooks/Emukit-tutorial-multi-fidelity-bayesian-optimization.ipynb | apache-2.0 | # Load function
import emukit.test_functions.forrester
# The multi-fidelity Forrester function is already wrapped as an Emukit UserFunction object in
# the test_functions package
forrester_fcn, _ = emukit.test_functions.forrester.multi_fidelity_forrester_function()
forrester_fcn_low = forrester_fcn.f[0]
forrester_fcn... |
wangzexian/summrerschool2015 | theano_mlp/theano_mlp.ipynb | bsd-3-clause | import numpy
import theano
from theano import tensor
# Set lower precision float, otherwise the notebook will take too long to run
theano.config.floatX = 'float32'
class HiddenLayer(object):
def __init__(self, rng, input, n_in, n_out, W=None, b=None,
activation=tensor.tanh):
"""
... |
Cyb3rWard0g/ThreatHunter-Playbook | docs/notebooks/windows/08_lateral_movement/WIN-201012004336.ipynb | gpl-3.0 | from openhunt.mordorutils import *
spark = get_spark()
"""
Explanation: SMB Create Remote File
Metadata
| | |
|:------------------|:---|
| collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] |
| creation date | 2020/10/12 |
| modification date | 2020/10/12 |
| playbook related | [] |
Hypothe... |
mathcoding/programming | notebooks/Lab3_RadiceQuadrata.ipynb | mit | def Enumerate(y, x):
# print(y)
if y == 0:
return -1
if x == y*y:
return y
return Enumerate(y-1, x)
print(Enumerate(16, 16))
print(Enumerate(15, 15))
"""
Explanation: Calcolo della radice quadrata di un numero
Le procedure che abbiamo introdotto sino ad ora sono essenzialmente delle f... |
mne-tools/mne-tools.github.io | 0.24/_downloads/cc2f4b498fc65366ac39d017e939eec5/xdawn_denoising.ipynb | bsd-3-clause | # Authors: Alexandre Barachant <alexandre.barachant@gmail.com>
#
# License: BSD-3-Clause
from mne import (io, compute_raw_covariance, read_events, pick_types, Epochs)
from mne.datasets import sample
from mne.preprocessing import Xdawn
from mne.viz import plot_epochs_image
print(__doc__)
data_path = sample.data_path(... |
slundberg/shap | notebooks/text_examples/text_entailment/Textual Entailment Explanation Demo.ipynb | mit | import numpy as np
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import shap
from datasets import load_dataset
"""
Explanation: Multi-Input Text Explanation: Textual Entailment with Facebook BART
This notebook demonstrates how to get explanations for the output of the Facebook BART model t... |
shareactorIO/pipeline | source.ml/jupyterhub.ml/notebooks/zz_old/Spark/Intro/Lab 2 - Spark SQL/Lab 2 - Spark SQL - Instructor Notebook.ipynb | apache-2.0 | from pyspark.sql import SQLContext
sqlContext = SQLContext(sc)
"""
Explanation: <img src='https://raw.githubusercontent.com/bradenrc/sparksql_pot/master/sparkSQL3.png' width="80%" height="80%"></img>
<img src='https://raw.githubusercontent.com/bradenrc/sparksql_pot/master/sparkSQL1.png' width="80%" height="80%"></img>... |
jseabold/statsmodels | examples/notebooks/rolling_ls.ipynb | bsd-3-clause | import pandas_datareader as pdr
import pandas as pd
import statsmodels.api as sm
from statsmodels.regression.rolling import RollingOLS
import matplotlib.pyplot as plt
import seaborn
seaborn.set_style('darkgrid')
pd.plotting.register_matplotlib_converters()
%matplotlib inline
"""
Explanation: Rolling Regression
Rollin... |
phoebe-project/phoebe2-docs | 2.2/tutorials/requiv.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: Equivalent Radius
Setup
Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""
%matplotlib inline
im... |
mathnathan/notebooks | .ipynb_checkpoints/Intro to PyTorch-checkpoint.ipynb | mit | import torch as t
# Tensors
a = t.tensor([1,2,3])
# Can specify type during construction
a = t.tensor([1,2,3], dtype=t.half)
# Can cast to different types once constructed
a
a.double()
a.float()
a.short()
a.long()
"""
Explanation: What is PyTorch?
It’s a Python based scientific computing package targeted at two ... |
WNoxchi/Kaukasos | FACLA/SVD-NMF-review.ipynb | mit | from scipy.stats import ortho_group
import numpy as np
Q = ortho_group.rvs(dim=3)
B = np.random.randint(0,10,size=(3,3))
A = Q@B@Q.T
U,S,V = np.linalg.svd(A, full_matrices=False)
U
S
V
for i in range(3):
print(U[i] @ U[(i+1) % len(U)])
# wraps around
# U[0] @ U[1]
# U[1] @ U[2]
# U[2] @ U[0]
... |
jmschrei/pomegranate | examples/bayesnet_monty_hall_train.ipynb | mit | import math
from pomegranate import *
"""
Explanation: Training a Monty Hall Bayesian Network
authors:<br>
Jacob Schreiber [<a href="mailto:jmschreiber91@gmail.com">jmschreiber91@gmail.com</a>]<br>
Nicholas Farn [<a href="mailto:nicholasfarn@gmail.com">nicholasfarn@gmail.com</a>]
Lets test out the Bayesian Network fra... |
astroumd/GradMap | notebooks/Lectures2018/Lecture4/Lecture4-2BodyProblem-Student-NEW.ipynb | gpl-3.0 | #Physical Constants (SI units)
G=6.67e-11
AU=1.5e11 #meters. Distance between sun and earth.
daysec=24.0*60*60 #seconds in a day
"""
Explanation: Welcome to your first numerical simulation! The 2 Body Problem
Many problems in statistical physics and astrophysics requiring solving problems consisting of many particles ... |
darrenxyli/deeplearning | projects/project1/DLND-your-first-network/dlnd-your-first-neural-network.ipynb | apache-2.0 | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
mwickert/SP-Comm-Tutorial-using-scikit-dsp-comm | tutorial_part3/Arduino_FSK.ipynb | bsd-2-clause | import sk_dsp_comm.pyaudio_helper as pah
"""
Explanation: Record a Short Message to be PCM Encoded
Using pyaudio_helper record a short message that will ultimately be PCM encoded and stored in C header file along with a preamble/frame sync pattern.
End of explanation
"""
pah.available_devices()
"""
Explanation: Fin... |
pkreissl/espresso | doc/tutorials/visualization/visualization.ipynb | gpl-3.0 | import numpy as np
import sys
import tqdm
import logging
import matplotlib.pyplot as plt
import espressomd
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
np.random.seed(42)
matplotlib_notebook = True # toggle this off when outside IPython/Jupyter
espressomd.assert_features("WCA")
# interaction parameters... |
qutip/qutip-notebooks | examples/landau-zener.ipynb | lgpl-3.0 | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from qutip import *
import time
def hamiltonian_t(t, args):
""" evaluate the hamiltonian at time t. """
H0 = args[0]
H1 = args[1]
return H0 + t * H1
def qubit_integrate(delta, eps0, A, gamma1, gamma2, psi0, tlist):
# Hamil... |
Upward-Spiral-Science/spect-team | Code/Assignment-11/GridSearch_YatingJing.ipynb | apache-2.0 | import pandas as pd
import numpy as np
df_adhd = pd.read_csv('ADHD_Gender_rCBF.csv')
df_bipolar = pd.read_csv('Bipolar_Gender_rCBF.csv')
n1, n2 = df_adhd.shape[0], df_bipolar.shape[0]
print 'Number of ADHD patients (without Bipolar) is', n1
print 'Number of Bipolar patients (without ADHD) is', n2
print 'Chance befor... |
stinebuu/nest-simulator | doc/userdoc/model_details/aeif_models_implementation.ipynb | gpl-2.0 | # Install assimulo package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install assimulo
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (15, 6)
"""
Explanation: NEST implementation of the aeif models
Hans E... |
phoebe-project/phoebe2-docs | development/examples/extinction_BK_binary.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Extinction: B-K Binary
In this example, we'll reproduce Figures 1 and 2 in the extinction release paper (Jones et al. 2020).
"Let us begin with a rather extreme case, a synthetic binary comprised of a hot, B-type main sequence star(M=6.5 Msol,Teff=17000 K,... |
OpenAstronomy/workshop_sunpy_astropy | 05-images-and-plotting-instructor.ipynb | mit | # Get some import statements out of the way.
from __future__ import division, print_function
%matplotlib inline
import matplotlib.pyplot as plt
from skimage import data
# Load the data.moon() image and print it
moon = data.moon()
print(moon)
"""
Explanation: Images and Image Plotting
<section class="objectives panel ... |
opalytics/opalytics-ticdat | examples/expert_section/notebooks/gurobi_toehold_problem.ipynb | bsd-2-clause | def exception_thrown(f):
try:
f()
except Exception as e:
return str(e)
"""
Explanation: The toehold problem
The "toehold problem" is named after a tech support response from Gurobi. The nature of the problem is that in order to take advantage of the algebraic constraint modeling provided by gur... |
timkpaine/lantern | experimental/widgets/Using Interact.ipynb | apache-2.0 | from __future__ import print_function
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
"""
Explanation: Using Interact
The interact function (ipywidgets.interact) automatically creates user interface (UI) controls for exploring code and data interactively. It is the eas... |
boada/planckClusters | analysis_ir/notebooks/05. Make real models.ipynb | mit | cosmo = LambdaCDM(H0=70, Om0=0.3, Ode0=0.7, Tcmb0=2.725)
"""
Explanation: Setup Cosmology
End of explanation
"""
# check to make sure we have defined the bpz filter path
if not os.getenv('EZGAL_FILTERS'):
os.environ['EZGAL_FILTERS'] = (f'{os.environ["HOME"]}/Projects/planckClusters/MOSAICpipe/bpz-1.99.3/FILTER/'... |
ohbm/brain-hacking-101 | beginner-python/002-plots.ipynb | apache-2.0 | import numpy as np
import nibabel as nib
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
img = nib.load('./data/run1.nii.gz')
data = img.get_data()
fig, ax = plt.subplots(1)
ax.plot(data[32, 32, 15, :])
"""
Explanation: Brain-hacking 101
Author: Ariel Rokem, The University of Washington... |
ES-DOC/esdoc-jupyterhub | notebooks/bcc/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', 'bcc', 'sandbox-2', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: BCC
Source ID: SANDBOX-2
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbulen... |
davidchall/topas2numpy | docs/usage.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Usage
Here are some examples of how to use topas2numpy in an IPython notebook.
Before starting, we setup plotting with matplotlib.
End of explanation
"""
from topas2numpy import read_ntuple
x = read_ntuple('../tests/data/ascii-pha... |
cstrelioff/ARM-ipynb | Chapter3/chptr3.1-R.ipynb | mit | %%R
# I had to import foreign to get access to read.dta
library("foreign")
kidiq <- read.dta("../../ARM_Data/child.iq/kidiq.dta")
# I won't attach kidiq-- i generally don't attach to avoid confusion(s)
#attach(kidiq)
"""
Explanation: 3.1: One predictor
A note on R packages
If the arm
library is not installed in your ... |
chetnapriyadarshini/deep-learning | gan_mnist/Intro_to_GANs_Solution.ipynb | mit | %matplotlib inline
import pickle as pkl
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')
"""
Explanation: Generative Adversarial Network
In this notebook, we'll be building a generativ... |
tensorflow/hub | examples/colab/tf_hub_generative_image_module.ipynb | apache-2.0 | # Copyright 2018 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 by app... |
openstreams/wflow | notebooks/BMI-Test.ipynb | gpl-3.0 | import wflow.wflow_bmi as bmi
import logging
reload(bmi)
%pylab inline
import datetime
from IPython.html.widgets import interact
"""
Explanation: <h1>Basic test of the wflow BMI interface
End of explanation
"""
# This is the LAnd Atmophere (LA) model
LA_model = bmi.wflowbmi_csdms()
LA_model.initialize('../examples... |
mdda/fossasia-2016_deep-learning | notebooks/2-CNN/6-StyleTransfer/2-Art-Style-Transfer-googlenet_theano.ipynb | mit | import theano
import theano.tensor as T
import lasagne
from lasagne.utils import floatX
import numpy as np
import scipy
import matplotlib.pyplot as plt
%matplotlib inline
import os # for directory listings
import pickle
import time
AS_PATH='./images/art-style'
from model import googlenet
net = googlenet.build_mo... |
GHorace/ma2823_2016 | lab_notebooks/Lab 4 2016-10-07 Regularized logistic regression.ipynb | mit | import numpy as np
%pylab inline
# Load the data as usual (here the code for Python 2.7)
X = np.loadtxt('data/small_Endometrium_Uterus.csv', delimiter=',', skiprows=1, usecols=range(1, 3001))
y = np.loadtxt('data/small_Endometrium_Uterus.csv', delimiter=',', skiprows=1, usecols=[3001],
converters={300... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_head_positions.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
from os import path as op
import mne
print(__doc__)
data_path = op.join(mne.datasets.testing.data_path(verbose=True), 'SSS')
pos = mne.chpi.read_head_pos(op.join(data_path, 'test_move_anon_raw.pos'))
"""
Explanation: Visualize subject he... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/jax/solutions/flax.ipynb | apache-2.0 | # from typing import Callable, Sequence # used ?
import flax
from flax import linen as nn
"""
Explanation: See go/flax-air
Flax
You probably want to keep the Flax documentation ready in another tab:
https://flax.readthedocs.io/
End of explanation
"""
# Simple module with matmul layer. Note that we could build this... |
wenduowang/git_home | python/MSBA/intro/group_project/Project_Expedia_test1_yawen.ipynb | gpl-3.0 | train["date_time"] = pd.to_datetime(train["date_time"])
train["year"] = train["date_time"].dt.year
train["month"] = train["date_time"].dt.month
"""
Explanation: Convert date time type to seperate the train and test set. becasue the test set data time have to be come later than the train set
End of explanation
"""
im... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160502월_1일차_분석 환경, 소개/15.Pandas 피봇과 그룹 연산.ipynb | mit | data = {
'state': ['Ohio', 'Ohio', 'Ohio', 'Nevada', 'Nevada'],
'year': [2000, 2001, 2002, 2001, 2002],
'pop': [1.5, 2.5, 3.0, 2.5, 3.5]
}
df = pd.DataFrame(data, columns=["state", "year", "pop"])
df
df.pivot("state", "year", "pop")
"""
Explanation: Pandas 피봇과 그룹 연산
피봇 테이블
피봇 테이블(pivot table)이란 데이터 열(colu... |
saashimi/code_guild | wk5/notebooks/wk5.1.ipynb | mit | class Car(object):
wheels = 4
def __init__(self, make, model):
self.make = make
self.model = model
mustang = Car('Ford', 'Mustang')
print(mustang.wheels)
# 4
print(Car.wheels)
# 4
"""
Explanation: Instance Attributes and Methods
(source: Jeff Knupp)
Class attributes
Class attributes are at... |
metpy/MetPy | v0.7/_downloads/Wind_SLP_Interpolation.ipynb | bsd-3-clause | import cartopy
import cartopy.crs as ccrs
from matplotlib.colors import BoundaryNorm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from metpy.calc import get_wind_components
from metpy.cbook import get_test_data
from metpy.gridding.gridding_functions import interpolate, remove_nan_observations... |
transcranial/keras-js | notebooks/layers/convolutional/Cropping3D.ipynb | mit | data_in_shape = (3, 5, 3, 3)
L = Cropping3D(cropping=((1,1), (1,1), (1,1)), data_format='channels_last')
layer_0 = Input(shape=data_in_shape)
layer_1 = L(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)
# set weights to random (use seed for reproducibility)
np.random.seed(260)
data_in = 2 * np.random.random(da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.