repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
mne-tools/mne-tools.github.io | 0.24/_downloads/772492bca9aff751a357f5e3e0163e67/50_cluster_between_time_freq.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD-3-Clause
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.time_frequency import tfr_morlet
from mne.stats import permutation_cluster_test
from mne.datasets import sample
print(__doc__)
"""
Explanation: Non-parametric ... |
PerryGrossman/ds_jr | HourofCode2015.ipynb | mit | # you can also access this directly:
from PIL import Image
im = Image.open("DataScienceProcess.jpg")
im
#path=\'DataScienceProcess.jpg'
#image=Image.open(path)
"""
Explanation: Hour of Code 2015
For Mr. Clifford's Class (5C)
Perry Grossman
December 2015
Introduction
From the Hour of Code to the Power of Co
How to use ... |
tennem01/pymks_overview | notebooks/checker_board.ipynb | mit | %matplotlib inline
%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Checkerboard Microstructure
Introduction - What are 2-Point Spatial Correlations (also called 2-Point Statistics)?
The purpose of this example is to introduce 2-point spatial correlations and how ... |
nick-youngblut/SIPSim | ipynb/bac_genome/priming_exp/validation_sample/X12C.700.14.05_fracRichness-moreDif.ipynb | mit | workDir = '/home/nick/notebook/SIPSim/dev/priming_exp/validation_sample/X12C.700.14_fracRichness-moreDif/'
genomeDir = '/home/nick/notebook/SIPSim/dev/priming_exp/genomes/'
allAmpFrags = '/home/nick/notebook/SIPSim/dev/bac_genome1210/validation/ampFrags.pkl'
otuTableFile = '/var/seq_data/priming_exp/data/otu_table.txt'... |
lisa-1010/smart-tutor | code/test_drqn.ipynb | mit | data = d_utils.load_data(filename="../synthetic_data/test-n10000-l3-random.pickle")
dqn_data = d_utils.preprocess_data_for_dqn(data, reward_model="dense")
# Single Trace
print (dqn_data[0])
# First tuple in a trace
s,a,r,sp = dqn_data[0][0]
print (s)
print (a)
print (r)
print (sp)
# Last tuple
s,a,r,sp = dqn_data[0]... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/cmip6/models/hadgem3-gc31-hh/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mohc', 'hadgem3-gc31-hh', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: MOHC
Source ID: HADGEM3-GC31-HH
Topic: Ocean
Sub-Topics: Timestepping Framewor... |
ecabreragranado/OpticaFisicaII | Trabajo Filtro Interferencial/.ipynb_checkpoints/TrabajoFiltrosweb-checkpoint.ipynb | gpl-3.0 | from IPython.core.display import Image
Image("http://upload.wikimedia.org/wikipedia/commons/thumb/2/28/IEC60825_MPE_W_s.png/640px-IEC60825_MPE_W_s.png")
"""
Explanation: TRABAJO PROPUESTO SOBRE FILTROS INTERFERENCIALES
Consultar el manual de uso de los cuadernos interactivos (notebooks) que se encuentra disponible en ... |
cing/rapwords | RapWordsTalk.ipynb | mit | import pandas as pd
import numpy as np
import glob
import re
from collections import defaultdict
"""
Explanation: Word! Automating a Hip-hop word of the day blog
Chris Ing, @jsci http://rapwords.tumblr.com (Soon: https://github.com/cing/rapwords/)
Requirements
standard library (re, glob, collections, html)
pand... |
rfinn/LCS | notebooks/LCS-MS-Diagnostic-Plots.ipynb | gpl-3.0 | import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
"""
Explanation: Making some plots:
NUV-M24 vs R24/Rd
R24 vs 24um Sersic index
Main sequence plot on full LIR sample
But first, import some modules...
End of explanation
"""
%run ~/github/L... |
yashdeeph709/Algorithms | PythonBootCamp/Complete-Python-Bootcamp-master/Files.ipynb | apache-2.0 | %%writefile test.txt
Hello, this is a quick test file
"""
Explanation: Files
Python uses file objects to interact with external files on your computer. These file objects can be any sort of file you have on your computer, whether it be an audio file, a text file, emails, Excel documents, etc. Note: You will probably n... |
cfcdavidchan/Deep-Learning-Foundation-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... |
eatingcrispr/VirtualEating | archive/Simulating and generating 3MB Xenopus library/VirtualEating_AsInDevCell.ipynb | apache-2.0 | import Bio
from Bio.Blast.Applications import NcbiblastnCommandline
from Bio import SeqIO
from Bio.Blast import NCBIXML
from Bio import Restriction
from Bio.Restriction import *
from Bio.Alphabet.IUPAC import IUPACAmbiguousDNA
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
import cPickle as pickle
import... |
Jackie789/JupyterNotebooks | 3.KNN_Classifiers.ipynb | gpl-3.0 | music = pd.DataFrame()
# Some data to play with.
music['duration'] = [184, 134, 243, 186, 122, 197, 294, 382, 102, 264,
205, 110, 307, 110, 397, 153, 190, 192, 210, 403,
164, 198, 204, 253, 234, 190, 182, 401, 376, 102]
music['loudness'] = [18, 34, 43, 36, 22, 9, 29, 22, 10, ... |
mne-tools/mne-tools.github.io | dev/_downloads/64e3b6395952064c08d4ff33d6236ff3/evoked_whitening.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.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 a noise covari... |
tzoiker/gensim | docs/notebooks/doc2vec-lee.ipynb | lgpl-2.1 | import gensim
import os
import collections
import random
"""
Explanation: Doc2Vec Tutorial on the Lee Dataset
End of explanation
"""
# Set file names for train and test data
test_data_dir = '{}'.format(os.sep).join([gensim.__path__[0], 'test', 'test_data'])
lee_train_file = test_data_dir + os.sep + 'lee_background.c... |
fonnesbeck/scientific-python-workshop | notebooks/Plotting and Visualization.ipynb | cc0-1.0 | import numpy as np
import pandas as pd
import matplotlib as mpl # used sparingly
import matplotlib.pyplot as plt
pd.set_option("notebook_repr_html", False)
pd.set_option("max_rows", 10)
"""
Explanation: Plotting and Visualization
End of explanation
"""
%matplotlib inline
"""
Explanation: Landscape of Plotting Lib... |
KMFleischer/PyEarthScience | Tutorial/04a_PyNGL_xy.ipynb | mit | import Ngl
wks = Ngl.open_wks('png', 'plot_xy')
"""
Explanation: 4.a Plot type - xy
Our first plot example is a simple xy-plot and the graphics output format is PNG.
End of explanation
"""
import numpy as np
x = np.arange(0,5)
y = np.arange(0,10,2)
plot = Ngl.xy(wks, x, y)
"""
Explanation: To use Numpy arrays we... |
ealogar/curso-python | sysadmin/1_Gathering_system_data.ipynb | apache-2.0 | import psutil
import glob
import sys
import subprocess
#
# Our code is p3-ready
#
from __future__ import print_function, unicode_literals
def grep(needle, fpath):
"""A simple grep implementation
goal: open() is iterable and doesn't
need splitlines()
goal: comprehension can filter list... |
NYUDataBootcamp/Projects | UG_S17/Sohil-Patel-Final-Project.ipynb | mit | import sys # system module
import pandas as pd # data package
import matplotlib as mpl # graphics package
import matplotlib.pyplot as plt # pyplot module
import datetime as dt # date and time module
import numpy as np
import pandas as... |
SamLau95/nbinteract | docs/notebooks/tutorial/tutorial_monty_hall.ipynb | bsd-3-clause | from ipywidgets import interact
import numpy as np
import random
PRIZES = ['Car', 'Goat 1', 'Goat 2']
def monty_hall(example_num=0):
'''
Simulates one round of the Monty Hall Problem. Outputs a tuple of
(result if stay, result if switch, result behind opened door) where
each results is one of PRIZES.
... |
bicepjai/Puzzles | adventofcode/2017/.ipynb_checkpoints/day1_9-checkpoint.ipynb | bsd-3-clause | import sys
import os
import re
import collections
import itertools
import bcolz
import pickle
import numpy as np
import pandas as pd
import gc
import random
import smart_open
import h5py
import csv
import tensorflow as tf
import gensim
import string
import datetime as dt
from tqdm import tqdm_notebook as tqdm
impo... |
iurilarosa/thesis | codici/Archiviati/prove TF/.ipynb_checkpoints/Prove TF-checkpoint.ipynb | gpl-3.0 | #basic python
x = 35
y = x + 5
print(y)
#basic TF
#x = tf.random_uniform([1, 2], -1.0, 1.0)
x = tf.constant(35, name = 'x')
y = tf.Variable(x+5, name = 'y')
model = tf.global_variables_initializer()
sess = tf.Session()
sess.run(model)
print(sess.run(y))
#per scrivere il grafo
#writer = tf.summary.FileWriter("out... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/how_google_does_ml/solutions/automl-tabular-classification.ipynb | apache-2.0 | # Setup your dependencies
import os
# The Google Cloud Notebook product has specific requirements
IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version")
USER_FLAG = ""
# Google Cloud Notebook requires dependencies to be installed with '--user'
if IS_GOOGLE_CLOUD_NOTEBOOK:
USER_FLAG = ... |
planet-os/notebooks | api-examples/CFSv2_winter_forecast.ipynb | mit | %matplotlib notebook
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import calendar
import datetime
import matplotlib.dates as mdates
from API_client.python.datahub import datahub_main
from API_client.python.lib.dataset import dataset
from API_client.python.lib.variables import variables
import ... |
mayank-johri/LearnSeleniumUsingPython | Section 1 - Core Python/Chapter 02 - Basics/2.3. Maths Operators.ipynb | gpl-3.0 | # Sample Code
# Say Cheese
x = 34 - 23
y = "!!! Say"
z = 3.45
print(id(x), id(y), id(z))
print(x, y, z)
x = x + 1
y = y + " Cheese !!!"
print("x = " + str(x))
print(y, id(y))
print("Is x > z", x > z ,"and y is", y, "and x =", x)
print("x - z =", x - z)
print("~^" * 30)
print(30 * "~_")
print(id(x), id(y), id(z))
pr... |
seniosh/StatisticalMethods | examples/StraightLine/ModelEvaluation.ipynb | gpl-2.0 | %load_ext autoreload
%autoreload 2
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (6.0, 6.0)
plt.rcParams['savefig.dpi'] = 100
from straightline_utils import *
"""
Explanation: Testing the Straight Line Model
End of expla... |
NICTA/revrand | demos/regression_demo.ipynb | apache-2.0 | %matplotlib inline
import matplotlib.pyplot as pl
pl.style.use('ggplot')
import numpy as np
from scipy.stats import gamma
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import WhiteKernel, RBF
from revrand import StandardLinearModel, GeneralizedLinearModel, likeli... |
google/jax | docs/notebooks/Common_Gotchas_in_JAX.ipynb | apache-2.0 | import numpy as np
from jax import grad, jit
from jax import lax
from jax import random
import jax
import jax.numpy as jnp
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib import rcParams
rcParams['image.interpolation'] = 'nearest'
rcParams['image.cmap'] = 'viridis'
rcParams['axes.grid'] = ... |
atulsingh0/MachineLearning | HandsOnML/code/15_autoencoders.ipynb | gpl-3.0 | # To support both python 2 and python 3
from __future__ import division, print_function, unicode_literals
# Common imports
import numpy as np
import os
import sys
# to make this notebook's output stable across runs
def reset_graph(seed=42):
tf.reset_default_graph()
tf.set_random_seed(seed)
np.random.seed(... |
elektrobohemian/courses | ImageSimilarity_and_ClusterDemo.ipynb | mit | %matplotlib inline
import os
import tarfile as TAR
import sys
from datetime import datetime
from PIL import Image
import warnings
import json
import pickle
import zipfile
from math import *
import numpy as np
import pandas as pd
from sklearn.cluster import MiniBatchKMeans
import matplotlib.pyplot as plt
import matplot... |
statsmodels/statsmodels.github.io | v0.13.2/examples/notebooks/generated/recursive_ls.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import statsmodels.api as sm
from pandas_datareader.data import DataReader
np.set_printoptions(suppress=True)
"""
Explanation: Recursive least squares
Recursive least squares is an expanding window version of ordinary least squa... |
sdaros/placeword | build_wordlist.ipynb | unlicense | wordlists = []
"""
Explanation: Importing our wordlists
Here we import all of our wordlists and add them to an array which me can merge at the end.
This wordlists should not be filtered at this point. However they should all contain the same columns to make merging easier for later.
End of explanation
"""
!head -n ... |
cuttlefishh/emp | code/10-sequence-lookup/trading-card-latex/blast_xml_to_taxonomy.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
import Bio.Blast.NCBIXML
from cStringIO import StringIO
from __future__ import print_function
# convert RDP-style lineage to Greengenes-style lineage
def rdp_lineage_to_gg(lineage):
d = {}
linlist = lineage.split(';')
for i in np.arange(0, len(linlist), 2):
d[... |
uber/pyro | tutorial/source/contrib_funsor_intro_ii.ipynb | apache-2.0 | from collections import OrderedDict
import functools
import torch
from torch.distributions import constraints
import funsor
from pyro import set_rng_seed as pyro_set_rng_seed
from pyro.ops.indexing import Vindex
from pyro.poutine.messenger import Messenger
funsor.set_backend("torch")
torch.set_default_dtype(torch.f... |
mne-tools/mne-tools.github.io | 0.19/_downloads/70d3a0e5dfbb415abf141d93f82df981/plot_55_setting_eeg_reference.ipynb | bsd-3-clause | import os
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False)
raw.crop(tmax=60).load_data()
raw.pick(['EEG 0{:... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_raw_objects.ipynb | bsd-3-clause | from __future__ import print_function
import mne
import os.path as op
from matplotlib import pyplot as plt
"""
Explanation: .. _tut_raw_objects
The :class:Raw <mne.io.RawFIF> data structure: continuous data
End of explanation
"""
# Load an example dataset, the preload flag loads the data into memory now
data_... |
yw-fang/readingnotes | machine-learning/handson_scikitlearn_tf_2017/ch01-notebook.ipynb | apache-2.0 | # To support both python 2 and python 3
from __future__ import division, print_function, unicode_literals
# Common imports
import numpy as np
import os
# to make this notebook's output stable across runs
np.random.seed(42) # I don't understand this line very much!
# To plot pretty figures
%matplotlib inline
import ... |
mrcinv/matpy | 03c_bisekcija.ipynb | gpl-2.0 | f = lambda x: x-2**(-x)
a,b=(0,1) # začetni interval
(f(a),f(b))
"""
Explanation: ^ gor: Uvod
Reševanje enačb z bisekcijo
Vsako enačbo $l(x)=d(x)$ lahko prevedemo na iskanje ničle funkcije
$$f(x)=l(x)-d(x)=0.$$
Ničlo zvezne funkcije lahko zanesljivo poiščemo z bisekcijo. Ideja je preprosta. Če so vrednosti funkcije ... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/production_ml/labs/tfdv_basic_spending.ipynb | apache-2.0 | !pip install pyarrow==5.0.0
!pip install numpy==1.19.2
!pip install tensorflow-data-validation
"""
Explanation: Introduction to TensorFlow Data Validation
Learning Objectives
Review TFDV methods
Generate statistics
Visualize statistics
Infer a schema
Update a schema
Introduction
This lab is an introduction to Tenso... |
bwgref/nustar_pysolar | notebooks/20200912/Planning 20200912.ipynb | mit | fname = io.download_occultation_times(outdir='../data/')
print(fname)
"""
Explanation: Download the list of occultation periods from the MOC at Berkeley.
Note that the occultation periods typically only are stored at Berkeley for the future and not for the past. So this is only really useful for observation planning.
... |
ellisonbg/talk-2014 | Notebook Usage.ipynb | mit | from IPython.display import display, Image, HTML
from talktools import website, nbviewer
"""
Explanation: How are people using the Jupyter Notebook and IPython?
End of explanation
"""
website('http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/')
"""
Explanation: Cam Davids... |
tebeka/pythonwise | First-Contact-With-Data.ipynb | bsd-3-clause | # Command line
!ls -lh taxi.csv
# Python
from os import path
print('%.2f KB' % (path.getsize('taxi.csv')/(1<<10)))
print('%.2f MB' % (path.getsize('taxi.csv')/(1<<20)))
"""
Explanation: First Contact with Data
Every time I encounter new data file. There are few initial "looks" that I take on it. This help me understa... |
dmnfarrell/mhcpredict | examples/advanced.ipynb | apache-2.0 | import numpy as np
import pandas as pd
pd.set_option('display.width', 100)
pd.set_option('max_colwidth', 80)
%matplotlib inline
import matplotlib as mpl
import seaborn as sns
sns.set_context("notebook", font_scale=1.4)
from IPython.display import display, HTML
import epitopepredict as ep
from epitopepredict import bas... |
datactive/bigbang | examples/git-analysis/Git Interaction Graph.ipynb | mit | %matplotlib inline
from bigbang.ingress.git_repo import GitRepo;
from bigbang.analysis import repo_loader;
import matplotlib.pyplot as plt
import networkx as nx
import pandas as pd
repos = repo_loader.get_org_repos("codeforamerica")
repo = repo_loader.get_multi_repo(repos=repos)
full_info = repo.commit_data;
"""
Exp... |
SchwaZhao/networkproject1 | 03_Introduction_To_Supervised_Machine_Learning.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
x = np.linspace(-10,10)
y = 1/(1+np.exp(-x))
p = plt.plot(x,y)
plt.grid(True)
"""
Explanation: In this section we will see the basics of supervised machine learning with a logistic regression classifier. We will see a simple example and see how to... |
fastai/fastai | dev_nbs/explorations/tokenizing.ipynb | apache-2.0 | path = untar_data(URLs.IMDB_SAMPLE)
df = pd.read_csv(path/'texts.csv')
df.head(2)
ss = L(list(df.text))
ss[0]
"""
Explanation: Let's look at how long it takes to tokenize a sample of 1000 IMDB review.
End of explanation
"""
def delim_tok(s, delim=' '): return L(s.split(delim))
s = ss[0]
delim_tok(s)
"""
Explanatio... |
OceanPARCELS/parcels | parcels/examples/tutorial_diffusion.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
from datetime import timedelta
from parcels import ParcelsRandom
from parcels import (FieldSet, Field, ParticleSet, JITParticle, AdvectionRK4, ErrorCode,
DiffusionUniformKh, AdvectionDiffusionM1, AdvectionDiff... |
changshuaiwei/Udc-ML | creating_customer_segments/customer_segments.ipynb | gpl-3.0 | # Import libraries necessary for this project
import numpy as np
import pandas as pd
import renders as rs
from IPython.display import display # Allows the use of display() for DataFrames
# Show matplotlib plots inline (nicely formatted in the notebook)
%matplotlib inline
# Load the wholesale customers dataset
try:
... |
AdityaSoni19031997/Machine-Learning | cmu/pytorch_tutorial_gpu.ipynb | mit | import numpy as np
import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import time
print(torch.__version__)
%matplotlib inline
def sample_points(n):
# returns (X,Y), where X of shape (n,2) is the numpy array of points and Y is the (n) array of classes
radius = np.random.uniform(low=0,high=2... |
tensorflow/docs-l10n | site/ko/guide/variable.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/building_production_ml_systems/labs/3_kubeflow_pipelines.ipynb | apache-2.0 | !pip3 install --user kfp --upgrade
"""
Explanation: Kubeflow pipelines
Learning Objectives:
1. Learn how to deploy a Kubeflow cluster on GCP
1. Learn how to create a experiment in Kubeflow
1. Learn how to package you code into a Kubeflow pipeline
1. Learn how to run a Kubeflow pipeline in a repeatable and trac... |
FordyceLab/AcqPack | examples/.ipynb_checkpoints/imaging_and_gui-checkpoint.ipynb | mit | # test image stack
arr = []
for i in range(50):
b = np.random.rand(500,500)
b= (b*(2**16-1)).astype('uint16')
arr.append(b)
# snap (MPL)
button = widgets.Button(description='Snap')
display.display(button)
def on_button_clicked(b):
img=arr.pop()
plt.imshow(img, cmap='gray')
display.clear_ou... |
mattgiguere/doglodge | code/.ipynb_checkpoints/bf_qt_scraping-checkpoint.ipynb | mit | import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *
from lxml import html
class Render(QWebPage):
def __init__(self, url):
self.app = QApplication(sys.argv)
QWebPage.__init__(self)
self.loadFinished.connect(self._loadFinished)
... |
goerlitz/text-mining | python/REST-API Content Retriever.ipynb | apache-2.0 | from pymongo import MongoClient
from urllib import urlopen
from jsonpath_rw import jsonpath, parse
from datetime import datetime
import json
import yaml
"""
Explanation: About
Retrieve JSON documents which are accessible via REST API and store them in mongodb.
Prerequesites
A running mongodb instance to store the JSO... |
ToqueWillot/M2DAC | FDMS/TME6/TME6_Reco.ipynb | gpl-2.0 | from random import random
import math
import numpy as np
import copy
"""
Explanation: TME4 FDMS Collaborative Filtering
Florian Toqué & Paul Willot
End of explanation
"""
def loadMovieLens(path='./data/movielens'):
#Get movie titles
movies={}
rev_movies={}
for idx,line in enumerate(open(path+'/u.item... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/computer_vision_fun/solutions/classifying_images_using_dropout_and_batchnorm_layer.ipynb | apache-2.0 | import tensorflow as tf
print(tf.version.VERSION)
"""
Explanation: Classifying Images using Dropout and Batchnorm Layer
Introduction
In this notebook, you learn how to build a neural network to classify the tf-flowers dataset using dropout and batchnorm layer.
Learning objectives
Define Helper Functions.
Apply dropou... |
danielhomola/boruta_py | boruta/examples/Madalon_Data_Set.ipynb | bsd-3-clause | # Installation
#!pip install boruta
import pandas as pd
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
from boruta import BorutaPy
def load_data():
# URLS for dataset via UCI
train_data_url='https://archive.ics.uci.edu/ml/machine-learning-databases/madelon/MADELON/m... |
dietmarw/EK5312_ElectricalMachines | Chapman/Ch9-Problem_9-02.ipynb | unlicense | %pylab notebook
%precision %.4g
"""
Explanation: Excercises Electric Machinery Fundamentals
Chapter 9
Problem 9-2
End of explanation
"""
V = 120 # [V]
p = 4
R1 = 2.0 # [Ohm]
R2 = 2.8 # [Ohm]
X1 = 2.56 # [Ohm]
X2 = 2.56 # [Ohm]
Xm = 60.5 # [Ohm]
s = 0.025
Prot = 51 # [W]
"""
Explanation: Desc... |
NREL/bifacial_radiance | docs/tutorials/16 - AgriPV - 3-up and 4-up collector optimization.ipynb | bsd-3-clause | import os
from pathlib import Path
testfolder = Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'Tutorial_16'
if not os.path.exists(testfolder):
os.makedirs(testfolder)
print ("Your simulation will be stored in %s" % testfolder)
import bifacial_radiance
import numpy as np
rad_obj = bifacial_ra... |
fastai/fastai | dev_nbs/course/lesson6-rossmann.ipynb | apache-2.0 | path = Config().data/'rossmann'
train_df = pd.read_pickle(path/'train_clean')
train_df.head().T
n = len(train_df); n
"""
Explanation: Rossmann
Data preparation
To create the feature-engineered train_clean and test_clean from the Kaggle competition data, run rossman_data_clean.ipynb. One important step that deals wit... |
mattilyra/gensim | docs/notebooks/wikinews-bigram-en.ipynb | lgpl-2.1 | LANG="english"
%%bash
fdate=20170327
fname=enwikinews-$fdate-cirrussearch-content.json.gz
if [ ! -e $fname ]
then
wget "https://dumps.wikimedia.org/other/cirrussearch/$fdate/$fname"
fi
# iterator
import gzip
import json
FDATE = 20170327
FNAME = "enwikinews-%s-cirrussearch-content.json.gz" % FDATE
def iter_te... |
ES-DOC/esdoc-jupyterhub | notebooks/nasa-giss/cmip6/models/giss-e2-1h/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nasa-giss', 'giss-e2-1h', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: NASA-GISS
Source ID: GISS-E2-1H
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, ... |
luofan18/deep-learning | language-translation/dlnd_language_translation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
cbare/Etudes | notebooks/covid-model.ipynb | apache-2.0 | def spread(cases, pop, n, r0=15):
mu = 0
sigma = 1
new_cases = (sum(cases > 0) * r0/10* np.random.lognormal(mu, sigma) / np.exp(mu + sigma**2/2)).round().astype(int)
for exposure in np.random.choice(n, new_cases, replace=True):
# if you're already infected, nothing happens
if cases... |
poldrack/fmri-analysis-vm | analysis/MVPA/ClassificationAnalysis-Haxby.ipynb | mit | import nipype.algorithms.modelgen as model # model generation
import nipype.interfaces.fsl as fsl # fsl
from nipype.interfaces.base import Bunch
import os,json,glob
import numpy
import nibabel
import nilearn.plotting
import sklearn.multiclass
from sklearn.svm import SVC
import sklearn.metrics
import sklearn.... |
Iolaum/ud370 | assignments/5_word2vec.ipynb | gpl-3.0 | # These are all the modules we'll be using later.
# Make sure you can import them before proceeding further.
%matplotlib inline
from __future__ import print_function
import collections
import math
import numpy as np
import os
import random
import tensorflow as tf
import zipfile
from matplotlib import pylab
from six.mo... |
ireapps/pycar | completed/filter_csv_notebook_complete.ipynb | mit | from urllib.request import urlretrieve
import csv
"""
Explanation: Filter a CSV
We're going to use built-in Python modules - programs really - to download a csv file from the Internet and save it locally.
CSV stands for comma-separated values. It's a common file format a file format that resembles a spreadsheet or dat... |
bgruening/EDeN | examples/annotation.ipynb | gpl-3.0 | pos = 'bursi.pos.gspan'
neg = 'bursi.neg.gspan'
from eden.converter.graph.gspan import gspan_to_eden
iterable_pos = gspan_to_eden( pos )
iterable_neg = gspan_to_eden( neg )
#split train/test
train_test_split=0.9
from eden.util import random_bipartition_iter
iterable_pos_train, iterable_pos_test = random_bipartition_i... |
banduri/snippets | BitCoinInContextDE.ipynb | gpl-3.0 | (mil,mrd,bil) = (pow(10,6),pow(10,9),pow(10,12))
bip_de=3466639*mil # USD
einwohner = int(82457000)
verschuldung=2022.6*mrd
bip_wo=119884004*mil # bip der Welt
"""
Explanation: Wie bewerte ich eigentlich Bitcoins?
erstmal ein paar Zahlen zu Deutschland von https://de.wikipedia.org/wiki/Deutschland. und von https://de... |
dbouquin/AstroHackWeek2015 | day3-machine-learning/07 - Grid Searches for Hyper Parameters.ipynb | gpl-2.0 | from sklearn.grid_search import GridSearchCV
from sklearn.svm import SVC
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,
digits.targ... |
mjbommar/cscs-530-w2016 | samples/cscs530-w2015-midterm-sample1.ipynb | bsd-2-clause | #Imports
%matplotlib inline
# Standard imports
import copy
import itertools
# Scientific computing imports
import numpy
import matplotlib.pyplot as plt
import networkx
import pandas
import seaborn; seaborn.set()
import scipy.stats as stats
# Import widget methods
from IPython.html.widgets import *
"""
Explanation... |
mohanprasath/Course-Work | coursera/machine_learning_with_python/Machine Learning Coursera Project.ipynb | gpl-3.0 | import itertools
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
import pandas as pd
import numpy as np
import matplotlib.ticker as ticker
from sklearn import preprocessing
%matplotlib inline
"""
Explanation: <a href="https://www.bigdatauniversity.com"><img src="https://i... |
mariuszrokita/money-machine | Notebooks/EURPLN_exchange_rate_analysis.ipynb | mit | # customarilily import most important libraries
import pandas as pd # pandas is a dataframe library
import matplotlib.pyplot as plt # matplotlib.pyplot plots data
import numpy as np # numpy provides N-dim object support
import matplotlib.dates as mdates
import m... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/image_models/solutions/4_tpu_training.ipynb | apache-2.0 | import os
PROJECT = !(gcloud config get-value core/project)
PROJECT = PROJECT[0]
BUCKET = PROJECT
os.environ["BUCKET"] = BUCKET
"""
Explanation: Transfer Learning on TPUs
In the <a href="3_tf_hub_transfer_learning.ipynb">previous notebook</a>, we learned how to do transfer learning with TensorFlow Hub. In this noteb... |
vbarua/PythonWorkshop | Code/Numerical Computing with Numpy/1 - Introduction to Numpy.ipynb | mit | x = [1,2,3]
y = [4,5,6]
x + y
"""
Explanation: Introduction to NumPy
Numpy is a library that provides multi-dimensional array objects. You can think of these somewhat like normal Python lists, except they have a number of qualities that make them better for numeric computations.
Let's try adding two lists together
End... |
FabricioMatos/ifes-dropout-machine-learning | extra/datavix-meetup/Predicao de Evasao.ipynb | bsd-3-clause | %matplotlib inline
#import math
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm as cm
from pandas.tools.plotting import scatter_matrix
from pandas import DataFrame
from sklearn import cross_validation
from sklearn.dummy import DummyClassifier
from sklearn.ensemble impo... |
joommf/tutorial | workshops/2017-04-05-IOPMagnetism2017/tutorial4_current_induced_dw_motion.ipynb | bsd-3-clause | # Definition of parameters
L = 500e-9 # sample length (m)
w = 20e-9 # sample width (m)
d = 2.5e-9 # discretisation cell size (m)
Ms = 5.8e5 # saturation magnetisation (A/m)
A = 15e-12 # exchange energy constant (J/)
D = 3e-3 # Dzyaloshinkii-Moriya energy constant (J/m**2)
K = 0.5e6 # uniaxial anisotropy constant... |
myselfHimanshu/UdacityDSWork | Deep Learning Nanodegree/Project_1/dlnd-your-first-neural-network.ipynb | gpl-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... |
paris-saclay-cds/python-workshop | Day_1_Scientific_Python/scikit-learn/13-Cross-Validation.ipynb | bsd-3-clause | from sklearn.datasets import load_iris
from sklearn.neighbors import KNeighborsClassifier
iris = load_iris()
X, y = iris.data, iris.target
classifier = KNeighborsClassifier()
"""
Explanation: Cross-Validation and scoring methods
In the previous sections and notebooks, we split our dataset into two parts, a training ... |
phoebe-project/phoebe2-docs | 2.2/tutorials/ebv_Av_Rv.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: Extinction (ebv, Av, & Rv)
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 i... |
psi4/psi4meta | download-analysis/conda/2017-07-03-scrape_anacondaorg.ipynb | gpl-2.0 | import re
import requests
import numpy as np
from datetime import date
from pandas import DataFrame
from bs4 import BeautifulSoup
from dateutil.relativedelta import relativedelta
def todatetime(ul_str):
upload = re.compile(r'((?P<year>\d+) years?)?( and )?((?P<month>\d+) months?)?( and )?((?P<day>\d+) days?)?( an... |
sspickle/sci-comp-notebooks | P01-Euler.ipynb | mit | #
# Simple python program to calculate s as a function of t.
# Any line that begins with a '#' is a comment.
# Anything in a line after the '#' is a comment.
#
lam=0.01 # define some variables: lam, dt, s, s0 and t. Set initial values.
dt=1.0
s=s0=100.0
t=0.0
def f_s(s,t): # define a function that... |
mne-tools/mne-tools.github.io | 0.17/_downloads/2ef6921dc0a9b8045508fcba2760290e/plot_resample.ipynb | bsd-3-clause | # Authors: Marijn van Vliet <w.m.vanvliet@gmail.com>
#
# License: BSD (3-clause)
from matplotlib import pyplot as plt
import mne
from mne.datasets import sample
"""
Explanation: Resampling data
When performing experiments where timing is critical, a signal with a high
sampling rate is desired. However, having a sign... |
luiscruz/udacity_data_analyst | P02/Project2_Investigate_a_Dataset_NYC.ipynb | mit |
print ggplot(turnstile_weather, aes(x='ENTRIESn_hourly')) +\
geom_histogram(binwidth=1000,position="identity") +\
scale_x_continuous(breaks=range(0, 60001, 10000), labels = range(0, 60001, 10000))+\
facet_grid("rain")+\
ggtitle('Distribution of ENTRIESn_hourly in non-rainy days (0.0) and rainy days(1.0... |
tgsmith61591/skutil | doc/examples/pipeline/skutil grid demo.ipynb | bsd-3-clause | from sklearn.pipeline import Pipeline
from skutil.preprocessing import BoxCoxTransformer, SelectiveScaler
from skutil.decomposition import SelectivePCA
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
# build a pipeline
pipe = Pipeline([
('collinearity', Multicolli... |
tpin3694/tpin3694.github.io | machine-learning/multinomial_naive_bayes_classifier.ipynb | mit | # Load libraries
import numpy as np
from sklearn.naive_bayes import MultinomialNB
from sklearn.feature_extraction.text import CountVectorizer
"""
Explanation: Title: Multinomial Naive Bayes Classifier
Slug: multinomial_naive_bayes_classifier
Summary: How to train a Multinomial naive bayes classifer in Scikit-Learn ... |
catalystcomputing/DSIoT-Python-sessions | Session1/code/Pandas.ipynb | apache-2.0 | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
"""
Explanation: Pandas is an open source library tailored for data manipulation, data analysis, and data visualization. Written for Python, provides high-performance, robust methods and flexible data structures. It's geared to ... |
bbglab/adventofcode | 2015/ferran/day7.ipynb | mit | binary_command = {'NOT': '~', 'AND': '&', 'OR': '|', 'LSHIFT': '<<', 'RSHIFT': '>>'}
operators = binary_command.values()
import csv
def translate(l):
return [binary_command[a] if a in binary_command else a for a in l]
def display(input_file):
"""produce a dict mapping variables to expressions"""
co... |
patrick-kidger/diffrax | examples/stiff_ode.ipynb | apache-2.0 | import time
import diffrax
import equinox as eqx # https://github.com/patrick-kidger/equinox
import jax
import jax.numpy as jnp
"""
Explanation: Stiff ODE
This example demonstrates the use of implicit integrators to handle stiff dynamical systems. In this case we consider the Robertson problem.
This example is avail... |
miaecle/deepchem | examples/tutorials/04_Introduction_to_Graph_Convolutions.ipynb | mit | %tensorflow_version 1.x
!curl -Lo deepchem_installer.py https://raw.githubusercontent.com/deepchem/deepchem/master/scripts/colab_install.py
import deepchem_installer
%time deepchem_installer.install(version='2.3.0')
"""
Explanation: Tutorial Part 4: Introduction to Graph Convolutions
In the previous sections of the tu... |
phoebe-project/phoebe2-docs | 2.2/tutorials/pblum.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: Passband Luminosity
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
... |
AtmaMani/pyChakras | python_crash_course/seaborn_cheat_sheet_1.ipynb | mit | import seaborn as sns
%matplotlib inline
"""
Explanation: Seaborn crash course
<img src='https://seaborn.pydata.org/_images/hexbin_marginals.png' height="150" width="150">
Seaborn is an amazing data and statistical visualization library that is built using matplotlib. It has good defaults and very easy to use.
ToC
- ... |
pedrosiracusa/pedrosiracusa.github.io | _notebooks/construindo-redes-sociais-com-dados-de-colecoes-biologicas.ipynb | mit | # este pedaço de código só é necessário para atualizar o PATH do Python
import sys,os
sys.path.insert(0,os.path.expanduser('~/Documents/caryocar'))
from caryocar.models import CWN, SCN
"""
Explanation: Construindo redes sociais com dados de coleções biológicas
Em um artigo anterior fiz uma breve caracterização das re... |
leliel12/scikit-criteria | doc/source/tutorial/simus.ipynb | bsd-3-clause | # first lets import the DATA class
from skcriteria import Data
data = Data(
# the alternative matrix
mtx=[[250, 120, 20, 800],
[130, 200, 40, 1000],
[350, 340, 15, 600]],
# optimal sense
criteria=[max, max, min, max],
# names of alternatives and criteria
anames=["Prj... |
aymeric-spiga/eduplanet | TOOLS/atlas-marsfrost.ipynb | gpl-2.0 | filename = 'resultat.nc'
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
import cartopy.crs as ccrs
from netCDF4 import Dataset
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
data = Dataset(filename)
longitude=data.variables['longitude'][:]
latitude=data.variables['latit... |
darrenxyli/deeplearning | projects/project2/dlnd_image_classification.ipynb | apache-2.0 | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
class DLProgress(tqdm):
last_block = 0
def hoo... |
ES-DOC/esdoc-jupyterhub | notebooks/inpe/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', 'inpe', 'sandbox-3', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: INPE
Source ID: SANDBOX-3
Topic: Atmoschem
Sub-Topics: Transport, Emissions ... |
atulsingh0/MachineLearning | MasteringML_wSkLearn/02b_Classification.ipynb | gpl-3.0 | name = ['Quality','Alcohol','Malic acid', 'Ash', 'Alcalinity of ash ', 'Magnesium', 'Total phenols', 'Flavanoids', 'Nonflavanoid phenols', 'Proanthocyanins',
'Color intensity', 'Hue', 'OD280/OD315 of diluted wines', 'Proline']
wine = pd.read_csv("data/wine.data", names=name)
#print(wine.describe)
wine[:5]
# ... |
cipang/hello-world | Welcome_To_Colaboratory.ipynb | gpl-2.0 | seconds_in_a_day = 24 * 60 * 60
seconds_in_a_day
"""
Explanation: <a href="https://colab.research.google.com/github/cipang/hello-world/blob/master/Welcome_To_Colaboratory.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
<p><img alt="Colaboratory logo... |
Echelle/AO_bonding_paper | notebooks/SiGaps_12_VG12_twoGaps.ipynb | mit | %pylab inline
import emcee
import triangle
import pandas as pd
import seaborn as sns
from astroML.decorators import pickle_results
sns.set_context("paper", font_scale=2.0, rc={"lines.linewidth": 2.5})
sns.set(style="ticks")
"""
Explanation: This IPython Notebook is for performing a fit and generating a figure of the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.