repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
eyadsibai/rep | howto/03-howto-gridsearch.ipynb | apache-2.0 | %pylab inline
"""
Explanation: About
This notebook demonstrates several additional tools to optimize classification model provided by Reproducible experiment platform (REP) package:
grid search for the best classifier hyperparameters
different optimization algorithms
different scoring models (optimization of ar... |
sdpython/teachpyx | _doc/notebooks/numpy/numpy_tricks.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: Points d'implémentation avec numpy
Quelques écritures efficaces et non efficaces avec numpy.
End of explanation
"""
import numpy
mat = numpy.zeros((5, 5))
for i in range(mat.shape[0]):
for j in range(mat.shape[1]):
mat[i, j]... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/feature_engineering/labs/mobile_gaming_feature_store.ipynb | apache-2.0 | import os
# The Google Cloud Notebook product has specific requirements
IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version")
# Google Cloud Notebook requires dependencies to be installed with '--user'
USER_FLAG = ""
if IS_GOOGLE_CLOUD_NOTEBOOK:
USER_FLAG = "--user"
# Install additi... |
JCardenasRdz/Machine-Learning-4-MRI | Infection_vs_Inflammation/Code/01-Process_Data.ipynb | mit | # Import Python Modules
import numpy as np
#import seaborn as sn
import matplotlib.pyplot as plt
%matplotlib inline
from pylab import *
import pandas as pd
# Import LOCAL functions written by me
from mylocal_functions import *
"""
Explanation: Goal: Differentiate Infections, sterile inflammation, and healthy tissue u... |
hyzhak/k-nn | k_nn.ipynb | mit | import pandas as pd
# define column names
names = ['sepal_length', 'sepal_width', 'petal_length', 'petal_width', 'class']
# loading training data
df = pd.read_csv('dataset/iris.data', header=None, names=names)
df.head()
"""
Explanation: Load Data Set
Tutorials:
- https://kevinzakka.github.io/2016/07/13/k-nearest-nei... |
dennys-bd/Udacity-Deep-Learning | 3 - Convolutional Neural Net/Project/dlnd_image_classification.ipynb | mit | """
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'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
Kaggle/learntools | notebooks/computer_vision/raw/ex6.ipynb | apache-2.0 | # Setup feedback system
from learntools.core import binder
binder.bind(globals())
from learntools.computer_vision.ex6 import *
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.layers.experimental import preprocessing
# Imports
import os, warnings
import matplotlib.pyplot as plt
f... |
dahak-metagenomics/dahak | workflows/functional_inference/antibiotic_resistance/functional_inference_antibiotic_res_example.ipynb | bsd-3-clause | from antibiotic_res import *
"""
Explanation: Summary:
This notebook is for visualizing antibiotic resistance gene tables generated by ABRicate and SRST2.
Example Use Case:
In this example, the complete Shakya et al. 2013 metagenome is being compared to small, medium, and large subsamples of itself after conservative... |
qaisermazhar/qaisermazhar.github.io | markdown_generator/talks.ipynb | mit | import pandas as pd
import os
"""
Explanation: Talks markdown generator for academicpages
Takes a TSV of talks with metadata and converts them for use with academicpages.github.io. This is an interactive Jupyter notebook (see more info here). The core python code is also in talks.py. Run either from the markdown_gener... |
danui/project-euler | solutions/jupyter/problem-34.ipynb | mit | from scipy.special import factorial
factorial(9)
def fac(n):
return int(factorial(n))
fac(3)
import numpy as np
N = 100000
for i in range(10, N+1):
digits = list(''+str(i))
factorials = list(map(lambda x: fac(int(x)), digits))
summation = np.sum(factorials)
#print('{} -> {} -> sum {}'.format(i, fa... |
tensorflow/docs-l10n | site/ja/lite/tutorials/model_maker_image_classification.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... |
kanhua/pypvcell | demos/efficiency_vs_bandgap.ipynb | apache-2.0 | %matplotlib inline
%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from pypvcell.solarcell import SQCell,MJCell,DBCell
from pypvcell.illumination import Illumination
from pypvcell.photocurrent import gen_step_qe
font = {'size' : 12}
matplotlib.rc('font', **fon... |
jrieke/machine-intelligence-2 | sheet11/sheet11.ipynb | mit | from __future__ import division, print_function
import matplotlib.pyplot as plt
%matplotlib inline
import scipy.stats
import numpy as np
from scipy.ndimage import imread
import sys
"""
Explanation: Machine Intelligence II - Team MensaNord
Sheet 11
Nikolai Zaki
Alexander Moore
Johannes Rieke
Georg Hoelger
Oliver Atana... |
joegomes/deepchem | examples/broken/solubility.ipynb | mit | %autoreload 2
%pdb off
from deepchem.utils.save import load_from_disk
dataset_file= "../datasets/delaney-processed.csv"
dataset = load_from_disk(dataset_file)
print("Columns of dataset: %s" % str(dataset.columns.values))
print("Number of examples in dataset: %s" % str(dataset.shape[0]))
"""
Explanation: Written by Bh... |
Skylion007/Reed-Solomon | Generating the exponent and log tables.ipynb | mit | generator = ff.GF256int(3)
generator
"""
Explanation: I used 3 as the generator for this field. For a field defined with the polynomial x^8 + x^4 + x^3 + x + 1, there may be other generators (I can't remember)
End of explanation
"""
generator*generator
generator*generator*generator
generator**1
generator**2
gene... |
liufuyang/deep_learning_tutorial | course-deeplearning.ai/course5-rnn/Week 3/Machine Translation/Neural machine translation with attention - v4.ipynb | mit | from keras.layers import Bidirectional, Concatenate, Permute, Dot, Input, LSTM, Multiply
from keras.layers import RepeatVector, Dense, Activation, Lambda
from keras.optimizers import Adam
from keras.utils import to_categorical
from keras.models import load_model, Model
import keras.backend as K
import numpy as np
from... |
mne-tools/mne-tools.github.io | 0.15/_downloads/decoding_rsa.ipynb | bsd-3-clause | # Authors: Jean-Remi King <jeanremi.king@gmail.com>
# Jaakko Leppakangas <jaeilepp@student.jyu.fi>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
from pandas import read_csv
import matplotlib.pyplot as plt
from sklea... |
efoley/deep-learning | transfer-learning/Transfer_Learning.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
vgg_dir = 'tensorflow_vgg/'
# Make sure vgg exists
if not isdir(vgg_dir):
raise Exception("VGG directory doesn't exist!")
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_s... |
Upward-Spiral-Science/uhhh | code/[Assignment 12] JM.ipynb | apache-2.0 | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
"""
Explanation: Verifying Non-Uniformity of Subvolumes
Here, I sample subvolumes of a predetermined size, count the synapse contents, and then plot that distribution in order to show that the synapses... |
datapythonista/datapythonista.github.io | content/2018-05-31-psf-candidates.ipynb | apache-2.0 | import pandas
from matplotlib import pyplot
directors = pandas.read_json('{"Location":{"Naomi Ceder":"Chicago, IL","Eric Holscher":"Portland, OR","Jackie Kazil":"DC \\/ Bradenton FL","Lorena Mesa":"Chicago, IL","Thomas Wouters":"Amsterdam","Kushal Das":"Kolkata, India","Marlene Mhangami":"Zimbawe","Van Lindberg":"San A... |
minesense/VisTrails | examples/api/ipython-notebook.ipynb | bsd-3-clause | import vistrails as vt
"""
Explanation: VisTrails API example
This notebook showcases the new API. Inlined are some comments and explanations.
End of explanation
"""
vt.ipython_mode(True)
"""
Explanation: The new API is exposed under the top-level vistrails package. The moment you use one of the API functions, like... |
betoesquivel/comment_summarization | .ipynb_checkpoints/guardian_first_attempt-checkpoint.ipynb | mit | import requests
from bs4 import BeautifulSoup
url = "http://www.theguardian.com/discussion/p/4fqc7"
r = requests.get(url)
html = r.text
soup = BeautifulSoup(html, "html.parser")
comments = soup.select(".d-comment__main")
comment_authors = soup.select(".d-comment__author")
print len (comments), " comments found in fir... |
openmrslab/suspect | docs/notebooks/tut06_mpl.ipynb | mit | import suspect
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: 6. Image co-registration
One of the most important steps in MRS processing is visualising the spectroscopy region on a structural image. This not only allows us to validate that the voxel was correctly placed and assess any partial volu... |
steven-murray/pydftools | docs/example_notebooks/basic_example.ipynb | mit | # Import relevant libraries
%matplotlib inline
import pydftools as df
import time
# Make figures a little bigger in the notebook
import matplotlib as mpl
mpl.rcParams['figure.dpi'] = 120
# For displaying equations
from IPython.display import display, Markdown
"""
Explanation: Basic Example
This example is a basic... |
BDannowitz/polymath-progression-blog | jlab-ml-lunch-2/notebooks/03-Recurrent-Network-Model.ipynb | gpl-2.0 | %matplotlib inline
import pandas as pd
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM, Dense, LeakyReLU, Dropout, ReLU, GRU, TimeDistributed, Conv2D, MaxPooling2D, Flatten
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras... |
nehal96/Deep-Learning-ND-Exercises | Sentiment Analysis/Sentiment Analysis with Andrew Trask/1-framing-problems-for-nns.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()... |
scotgl/sonify | ver_0.5.1/2. Full_or_Empty_Training_Module.ipynb | gpl-3.0 | import random
from gtts import gTTS
import time
from IPython.display import Image, display, clear_output
from ipywidgets import widgets
import os
import platform
speechflag = 0
if (platform.system()=='Windows'):
speechflag = 2
if (platform.system()!='Windows'):
speechflag = 1
display(Image('dep/images/glasses... |
qinwf-nuan/keras-js | notebooks/layers/pooling/GlobalAveragePooling3D.ipynb | mit | data_in_shape = (6, 6, 3, 4)
L = GlobalAveragePooling3D(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(270)
data_in = 2 * np.random.random(data_in_shape) - 1
res... |
BYUFLOWLab/MDOnotebooks | StepSize.ipynb | mit | %matplotlib inline
import numpy as np
from math import sin, cos, exp
import matplotlib.pyplot as plt
# just a simple 1D function to illustarate
def f(x):
return exp(x)*sin(x)
# these are the exact derivatives so we can compare performance
def g(x):
return exp(x)*sin(x) + exp(x)*cos(x)
"""
Explanation: Step S... |
NuSTAR/nustar_pysolar | notebooks/Ephemeris_Test.ipynb | mit | dt = 0.
# Using JPL Horizons web interface at 2017-05-19T01:34:40
horizon_ephem = SkyCoord(*[193.1535, -4.01689]*u.deg)
for orbit in orbits:
tstart = orbit[0]
tend = orbit[1]
print()
# print('Orbit duration: ', tstart.isoformat(), tend.isoformat())
on_time = (tend - tstart).total_seconds()
... |
josdaza/deep-toolbox | TensorFlow/03_Autoencoder.ipynb | mit | import tensorflow as tf
import numpy as np
class Autoencoder:
def __init__(self, input_dim, hidden_dim, epoch=250, learning_rate=0.001):
self.epoch = epoch # Numero de ciclos para aprender
self.learning_rate = learning_rate #Hiper parametro para el optimizador (RMSProppOptimizer en este caso)
... |
maciejkula/lightfm | examples/quickstart/quickstart.ipynb | apache-2.0 | import numpy as np
from lightfm.datasets import fetch_movielens
data = fetch_movielens(min_rating=5.0)
"""
Explanation: Quickstart
In this example, we'll build an implicit feedback recommender using the Movielens 100k dataset (http://grouplens.org/datasets/movielens/100k/).
The code behind this example is available ... |
HrantDavtyan/Data_Scraping | Week 4/B_soup_1_(my_page).ipynb | apache-2.0 | import requests
# import everything from BeautifulSoup
from BeautifulSoup import *
url = "https://hrantdavtyan.github.io/"
"""
Explanation: BeautifulSoup 1: scraping my page
BeautifulSoup is a powerful Python library used for pulling data out of HTML documents. In this notebook we will use the requests library to get... |
maojrs/riemann_book | Advection.ipynb | bsd-3-clause | %matplotlib inline
%config InlineBackend.figure_format = 'svg'
from ipywidgets import interact
from exact_solvers import advection
"""
Explanation: Advection
We start our study with the scalar, linear hyperbolic PDE: the advection equation. The solution to this equation simply consists of the initial condition propag... |
gojomo/gensim | docs/notebooks/atmodel_prediction_tutorial.ipynb | lgpl-2.1 | !wget -O - "https://archive.ics.uci.edu/ml/machine-learning-databases/00217/C50.zip" > /tmp/C50.zip
import logging
logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s', level=logging.DEBUG, datefmt='%I:%M:%S')
import zipfile
filename = '/tmp/C50.zip'
zip_ref = zipfile.ZipFile(filename, 'r')
zip_ref.ex... |
metpy/MetPy | v0.4/_downloads/Station_Plot_with_Layout.ipynb | bsd-3-clause | import cartopy.crs as ccrs
import cartopy.feature as feat
import matplotlib.pyplot as plt
import numpy as np
from metpy.calc import get_wind_components
from metpy.cbook import get_test_data
from metpy.plots import simple_layout, StationPlot, StationPlotLayout
from metpy.units import units
"""
Explanation: Station Plo... |
QuantEcon/QuantEcon.notebooks | ddp_ex_rust96_py.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import itertools
import scipy.optimize
import matplotlib.pyplot as plt
import pandas as pd
from quantecon.markov import DiscreteDP
# matplotlib settings
plt.rcParams['axes.autolimit_mode'] = 'round_numbers'
plt.rcParams['axes.xmargin'] = 0
plt.rcParams['axes.ymargin'] = 0
plt.rcP... |
mdigiorgio/lisa | ipynb/tutorial/00_LisaInANutshell.ipynb | apache-2.0 | import logging
from conf import LisaLogging
LisaLogging.setup()
# Execute this cell to enable verbose SSH commands
logging.getLogger('ssh').setLevel(logging.DEBUG)
# Other python modules required by this notebook
import json
import os
"""
Explanation: Linux Interactive System Analysis DEMO
Get LISA and start the Not... |
newsapps/public-notebooks | Download recent crimes from the data portal.ipynb | mit | import json
import requests
CRIME_SOCRATA_VIEW_ID = 'ijzp-q8t2'
def get_data_portal_url(view_id):
return 'http://data.cityofchicago.org/api/views/{view_id}'.format(
view_id=view_id)
def get_dataset_columns(view_id):
"""
Get dataset field names from the Socrata API
Returns:
A dictionar... |
MikeLing/shogun | doc/ipython-notebooks/intro/Introduction.ipynb | gpl-3.0 | %pylab inline
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
#To import all Shogun classes
from shogun import *
"""
Explanation: Machine Learning with Shogun
By Saurabh Mahindre - <a href="https://github.com/Saurabh7">github.com/Saurabh7</a> as a part of <a href="http://www.... |
zakandrewking/cobrapy | documentation_builder/getting_started.ipynb | lgpl-2.1 | from __future__ import print_function
import cobra
import cobra.test
# "ecoli" and "salmonella" are also valid arguments
model = cobra.test.create_test_model("textbook")
"""
Explanation: Getting Started
Loading a model and inspecting it
To begin with, cobrapy comes with bundled models for Salmonella and E. coli, as ... |
GoogleCloudPlatform/vertex-ai-samples | community-content/pytorch_image_classification_single_gpu_with_vertex_sdk_and_torchserve/vertex_training_with_custom_container.ipynb | apache-2.0 | PROJECT_ID = "YOUR PROJECT ID"
BUCKET_NAME = "gs://YOUR BUCKET NAME"
REGION = "YOUR REGION"
SERVICE_ACCOUNT = "YOUR SERVICE ACCOUNT"
content_name = "pt-img-cls-gpu-cust-cont-torchserve"
"""
Explanation: PyTorch Image Classification Single GPU using Vertex Training with Custom Container
<table align="left">
<td>
... |
girving/tensorflow | tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb | apache-2.0 | from __future__ import absolute_import, division, print_function
# Import TensorFlow >= 1.10 and enable eager execution
import tensorflow as tf
tf.enable_eager_execution()
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import unicodedata
import re
import numpy as np
import os
i... |
vinit-n/dataAnalysis | Python Pandas US Census names/Vinit_Nalawade_Project_Pandas.ipynb | apache-2.0 | #import required libraries
import pandas as pd
import numpy as np
#for counter operations
from collections import Counter
#for plotting graphs
import matplotlib.pyplot as plt
# Make the graphs a bit prettier, and bigger
pd.set_option('display.mpl_style', 'default')
pd.set_option('display.width', 5000)
pd.set_option('di... |
infilect/ml-course1 | week3/seq2seq/language-translation-notebook/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... |
feststelltaste/software-analytics | demos/20190425_JUGH_Kassel/Code-Hotspots.ipynb | gpl-3.0 | from ozapfdis import git
log = git.log_numstat_existing("../../../dropover/")
log.head()
"""
Explanation: Code-HotSpots
Welche Dateien werden wie oft geändert?
Input
Git-Versionskontrollsystemdaten einlesen.
End of explanation
"""
java_prod = log[log['file'].str.contains("backend/src/main/java/")].copy()
java_prod ... |
inageorgescu/OpenStreeMap | P3_Open_street_map_20170416.ipynb | mit | from IPython.display import Image
Image("Malaga_map.jpg")
"""
Explanation: OpenStreetMap Project
Udacity Data Analyst Nanodegree Project 3: Data Wrangling with MongoDB
Florina Georgescu - Airbus Operations SL
Github: https://github.com/inageorgescu
Map Area: Málaga, Spain
https://www.openstreetmap.org/relation/340746... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/ukesm1-0-ll/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'ukesm1-0-ll', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: NERC
Source ID: UKESM1-0-LL
Sub-Topics: Radiative Forcings.
Properties: 85 ... |
jerkos/cobrapy | documentation_builder/simulating.ipynb | lgpl-2.1 | import pandas
pandas.options.display.max_rows = 100
import cobra.test
model = cobra.test.create_test_model("textbook")
"""
Explanation: Simulating with FBA
Simulations using flux balance analysis can be solved using Model.optimize(). This will maximize or minimize (maximizing is the default) flux through the objectiv... |
lorisercole/thermocepstrum | examples/example_cepstrum_singlecomp_silica.ipynb | gpl-3.0 | import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
try:
import sportran as st
except ImportError:
from sys import path
path.append('..')
import sportran as st
c = plt.rcParams['axes.prop_cycle'].by_key()['color']
%matplotlib notebook
"""
Explanation: Example 1: Cepstral Analysis of... |
Bihaqo/t3f | docs/tutorials/tensor_completion.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
# Import TF 2.
%tensorflow_version 2.x
import tensorflow as tf
# Fix seed so that the results are reproducable.
tf.random.set_seed(0)
np.random.seed(0)
try:
import t3f
except ImportError:
# Install T3F if it's not already installed.
!git clone https://git... |
arturops/deep-learning | image-classification/dlnd_image_classification.ipynb | mit | """
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'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
planetlabs/notebooks | jupyter-notebooks/forest-monitoring/drc_roads_mosaic.ipynb | apache-2.0 | from functools import reduce
import os
import subprocess
import tempfile
import numpy as np
from planet import api
from planet.api import downloader, filters
import rasterio
from skimage import feature, filters
from sklearn.ensemble import RandomForestClassifier
# load local modules
from utils import Timer
import vis... |
roatienza/Deep-Learning-Experiments | versions/2022/supervised/python/mnist_demo.ipynb | mit | %pip install pytorch-lightning --upgrade
%pip install torchmetrics --upgrade
import torch
import torchvision
import wandb
from argparse import ArgumentParser
from pytorch_lightning import LightningModule, Trainer, Callback
from pytorch_lightning.loggers import WandbLogger
from torchmetrics.functional import accuracy
... |
jmschrei/pomegranate | tutorials/B_Model_Tutorial_2_General_Mixture_Models.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn; seaborn.set_style('whitegrid')
import numpy
from pomegranate import *
numpy.random.seed(0)
numpy.set_printoptions(suppress=True)
%load_ext watermark
%watermark -m -n -p numpy,scipy,pomegranate
"""
Explanation: General Mixture Models
author: Jacob Sc... |
ageron/tensorflow-safari-course | 05_autodiff_ex5.ipynb | apache-2.0 | from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
tf.__version__
"""
Explanation: Try not to peek at the solutions when you go through the exercises. ;-)
First let's make sure this notebook works well in both Python 2 and Python 3:
End of explanation
"""
impo... |
Alexoner/skynet | notebooks/linear/decisonBoundary.ipynb | mit | xx, yy = np.mgrid[-5:5:.01, -5:5:.01]
grid = np.c_[xx.ravel(), yy.ravel()]
probs = clf.predict_proba(grid)[:, 1].reshape(xx.shape)
"""
Explanation: Next, make a continuous grid of values and evaluate the probability of each (x, y) point in the grid:
End of explanation
"""
f, ax = plt.subplots(figsize=(8, 6))
contou... |
humberto-ortiz/bioinf2017 | directed-graphs.ipynb | gpl-3.0 | graph = {"forward" : {}, "reverse" : {}}
"""
Explanation: Directed graphs
Humberto Ortiz-Zuazaga
A directed graph $G = (V, E)$, also called a digraph, is a set $V$ of vertices and a set $E$ of directed edges, or edges that proceed from a source vertex to a sink vertex. Here's a crude diagram of a directed graph:
(1) -... |
quantumlib/OpenFermion | docs/fqe/tutorials/hamiltonian_time_evolution_and_expectation_estimation.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... |
ES-DOC/esdoc-jupyterhub | notebooks/cas/cmip6/models/fgoals-g3/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cas', 'fgoals-g3', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: CAS
Source ID: FGOALS-G3
Topic: Ocean
Sub-Topics: Timestepping Framework, Advection, ... |
numb3r33/StumbpleUponChallenge | notebooks/EnsemblingAndTextParsing.ipynb | mit | import pandas as pd
import numpy as np
import os, sys
import re, json
from urllib.parse import urlparse
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.preprocessing import Imputer, FunctionTransformer
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.preprocessing import Standard... |
mne-tools/mne-tools.github.io | 0.18/_downloads/db126f84a1b5439712a1d57b1be2255c/plot_time_frequency_global_field_power.ipynb | bsd-3-clause | # Authors: Denis A. Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import somato
from mne.baseline import rescale
from mne.stats import _bootstrap_ci
"""
Explanation: Explore event-related dynamics for specific frequency... |
paulgradie/SeqPyPlot | main_app/notebooks/correction_experiments.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
import seaborn as sns
from random import randint as rand
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.linear_model import LinearRegression
from sklearn.metrics.pairwise import euclidean_distances
from scipy.linalg import svd
from seqpyplot.container.data_cont... |
jmhsi/justin_tinker | data_science/courses/deeplearning1/nbs/dogs_cats_redux.ipynb | apache-2.0 | #Verify we are in the lesson1 directory
%pwd
#Create references to important directories we will use over and over
import os, sys
current_dir = os.getcwd()
LESSON_HOME_DIR = current_dir
DATA_HOME_DIR = current_dir+'/data/redux'
#Allow relative imports to directories above lesson1/
sys.path.insert(1, os.path.join(sys.... |
olihit/Defensive-prgramming | DefensiveProgramming_3.ipynb | mit | def test_range_overlap():
assert range_overlap([(-3.0, 5.0), (0.0, 4.5), (-1.5, 2.0)]) == (0.0, 2.0)
assert range_overlap([ (2.0, 3.0), (2.0, 4.0) ]) == (2.0, 3.0)
assert range_overlap([ (0.0, 1.0), (0.0, 2.0), (-1.0, 1.0) ]) == (0.0, 1.0)
"""
Explanation: # Defensive programming (2)
We have seen the ba... |
slundberg/shap | notebooks/tabular_examples/model_agnostic/Iris classification with scikit-learn.ipynb | mit | import sklearn
from sklearn.model_selection import train_test_split
import numpy as np
import shap
import time
X_train,X_test,Y_train,Y_test = train_test_split(*shap.datasets.iris(), test_size=0.2, random_state=0)
# rather than use the whole training set to estimate expected values, we could summarize with
# a set of... |
ES-DOC/esdoc-jupyterhub | notebooks/cnrm-cerfacs/cmip6/models/cnrm-esm2-1/toplevel.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', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CNRM-CERFACS
Source ID: CNRM-ESM2-1
Sub-Topics: Radiative Forcings. ... |
tensorflow/docs-l10n | site/ko/guide/keras/transfer_learning.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... |
OxES/k2sc | notebooks/lightkurve.ipynb | gpl-3.0 | import numpy as np
import matplotlib
import matplotlib as mpl
import lightkurve as lk
import k2sc
from k2sc.standalone import k2sc_lc
from astropy.io import fits
%pylab inline --no-import-all
matplotlib.rcParams['image.origin'] = 'lower'
matplotlib.rcParams['figure.figsize']=(10.0,10.0) #(6.0,4.0)
matplotlib.r... |
DJCordhose/ai | notebooks/2019_tf/rnn-add-example.ipynb | mit | # Adapted from
# https://github.com/keras-team/keras/blob/master/examples/addition_rnn.py
import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
%pylab inline
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
print(tf.__version__)
# let's see what compute devices we have available, ho... |
xpmanoj/content | HW0_solutions.ipynb | mit | x = [10, 20, 30, 40, 50]
for item in x:
print "Item is ", item
"""
Explanation: Homework 0
Due Tuesday, September 10 (but no submission is required)
Welcome to CS109 / STAT121 / AC209 / E-109 (http://cs109.org/). In this class, we will be using a variety of tools that will require some initial configuration. To ... |
Cyb3rWard0g/HELK | docker/helk-jupyter/notebooks/tutorials/07-pyspark-sparkSQL_tables.ipynb | gpl-3.0 | from pyspark.sql import SparkSession
"""
Explanation: Spark SQL Tables via Pyspark
Goals:
Practice Spark SQL via PySpark skills
Ensure JupyterLab Server, Spark Cluster & Elasticsearch are communicating
Practice Query execution via Pyspark
Create template for future queries
Import SparkSession Class
End of explanati... |
abatula/MachineLearningIntro | KMeans_Tutorial.ipynb | gpl-2.0 | # Print figures in the notebook
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn import datasets # Import the dataset from scikit-learn
from sklearn.cluster import KMeans # Import the KMeans classifier
# Import patch for drawing rectangle... |
h-mayorquin/hopfield_sequences | notebooks/2016-11-29(Overlap reproduction).ipynb | mit | from __future__ import print_function
import sys
sys.path.append('../')
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from hopfield import Hopfield
%matplotlib inline
sns.set(font_scale=2.0)
"""
Explanation: Overlap reproduction
This notebook should reproduce some results of the Amit's bo... |
chrismcginlay/crazy-koala | jupyter/01_basic_input_and_output.ipynb | gpl-3.0 | print(42)
print('Boris')
pint[47
print'Jane
"""
Explanation: Basic Input and Output
Basic Output - print()
In Python, we talk about the terminal - by this we really just mean the screen, or maybe a window on the screen.
Python 3 can output to the terminal using the print() function. In the very early days of computers... |
PMEAL/OpenPNM-Examples | Simulations/fickian_diffusion.ipynb | mit | import openpnm as op
net = op.network.Cubic(shape=[1, 10, 10], spacing=1e-5)
"""
Explanation: Summary
One of the main applications of OpenPNM is simulating transport phenomena such as Fickian diffusion, advection diffusion, reactive transport, etc. In this example, we will learn how to perform Fickian diffusion on a C... |
OceanPARCELS/parcels | parcels/examples/tutorial_Argofloats.ipynb | mit | # Define the new Kernel that mimics Argo vertical movement
def ArgoVerticalMovement(particle, fieldset, time):
driftdepth = 1000 # maximum depth in m
maxdepth = 2000 # maximum depth in m
vertical_speed = 0.10 # sink and rise speed in m/s
cycletime = 10 * 86400 # total time of cycle in seconds
dr... |
google/objax | examples/tutorials/objax_to_tf.ipynb | apache-2.0 | # install the latest version of Objax from github
%pip --quiet install git+https://github.com/google/objax.git
import math
import random
import tempfile
import numpy as np
import tensorflow as tf
import objax
from objax.zoo.wide_resnet import WideResNet
"""
Explanation: Conversion of Objax models to Tensorflow
This... |
AstroHackWeek/AstroHackWeek2015 | day3-machine-learning/06 - Model Complexity.ipynb | gpl-2.0 | from plots import plot_kneighbors_regularization
plot_kneighbors_regularization()
"""
Explanation: Model Complexity, Overfitting and Underfitting
End of explanation
"""
from sklearn.datasets import load_digits
from sklearn.ensemble import RandomForestClassifier
from sklearn.learning_curve import validation_curve
di... |
fonnesbeck/PyMC3_Oslo | notebooks/5. Model Building with PyMC3.ipynb | cc0-1.0 | import pymc3 as pm
with pm.Model() as disaster_model:
switchpoint = pm.DiscreteUniform('switchpoint', lower=0, upper=110)
"""
Explanation: Building Models in PyMC3
Bayesian inference begins with specification of a probability model relating unknown variables to data. PyMC3 provides the basic building blocks for ... |
xaibeing/cn-deep-learning | image-classification/dlnd_image_classification.ipynb | mit | """
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'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
zomansud/coursera | ml-regression/week-6/week-6-local-regression-assignment-blank.ipynb | mit | import graphlab
"""
Explanation: Predicting house prices using k-nearest neighbors regression
In this notebook, you will implement k-nearest neighbors regression. You will:
* Find the k-nearest neighbors of a given query input
* Predict the output for the query input using the k-nearest neighbors
* Choose the be... |
atulsingh0/MachineLearning | HandsOnML/code/11_deep_learning.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
# 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(seed)
# To... |
librosa/tutorial | Librosa tutorial.ipynb | cc0-1.0 | import librosa
print(librosa.__version__)
y, sr = librosa.load(librosa.util.example_audio_file())
print(len(y), sr)
"""
Explanation: Librosa tutorial
Version: 0.4.3
Tutorial home: https://github.com/librosa/tutorial
Librosa home: http://librosa.github.io/
User forum: https://groups.google.com/forum/#!forum/librosa
... |
Alenwang1/Python_Practice | Practice_03/Python与择天记.ipynb | gpl-3.0 | # 读取择天记小说
with open('64565.txt',encoding='utf-8') as f:
cont = [line.strip() for line in f.readlines() if line.strip()]
# 尝试在控制台打印一段文本
for line in cont[105:107]:
print(line)
"""
Explanation: 《择天记》与自然语言处理
本文的灵感来源于李金同学的一篇关于金庸武侠小说的自然语言处理的文章,大家有兴趣可以在GitHub上关注他。地址
02 前言
在上一篇文章中,我们使用Python来收集网络数据。这个可以复用的Python小程序... |
roebius/deeplearning1_keras2 | nbs/statefarm.ipynb | apache-2.0 | from __future__ import division, print_function
%matplotlib inline
#path = "data/state/"
path = "data/state/sample/"
from importlib import reload # Python 3
import utils; reload(utils)
from utils import *
from IPython.display import FileLink
batch_size=64
"""
Explanation: Enter State Farm
End of explanation
"""
ba... |
hashiprobr/redes-sociais | encontro02/5-kruskal.ipynb | gpl-3.0 | import sys
sys.path.append('..')
import socnet as sn
"""
Explanation: Encontro 02, Parte 5: Algoritmo de Kruskal
Este guia foi escrito para ajudar você a atingir os seguintes objetivos:
implementar o algoritmo de Kruskal;
praticar o uso da biblioteca da disciplina.
Primeiramente, vamos importar a biblioteca:
End of... |
nicoguaro/notebooks_examples | Manufactured solutions.ipynb | mit | from __future__ import division
from sympy import *
x, y, z, t = symbols('x y z t')
f, g, h = symbols('f g h', cls=Function)
init_printing()
L = symbols('L')
a1, a2, a3, b1, b2, b3, c1, c2, c3 = symbols('a1 a2 a3 b1 b2 b3 c1 c2 c3')
u0, ux, uy, uz, v0, vx, vy, vz, w0, wx, wy, wz = symbols('u0 u_x u_y u_z\
... |
metpy/MetPy | v0.10/_downloads/e62e0f98c4e8c49126bfa0b8b589a902/Parse_Angles.ipynb | bsd-3-clause | import metpy.calc as mpcalc
"""
Explanation: Parse angles
Demonstrate how to convert direction strings to angles.
The code below shows how to parse directional text into angles.
It also demonstrates the function's flexibility
in handling various string formatting.
End of explanation
"""
dir_str = 'SOUTH SOUTH EAST'... |
zrhans/python | exemplos/dapp-bc/Leitura14.ipynb | gpl-2.0 | import sys
import numpy as np
print(sys.version) # Versao do python - Opcional
print(np.__version__) # VErsao do modulo numpy - Opcional
# Criando um vetor padrao com 25 valores
npa = np.arange(25)
npa
# Transformando o vetor npa em um vetor multidimensional usando o metodo reshape
npa.reshape(5,5)
# Podemos criar ... |
EoinTravers/QuickstartMousetracking | results/SqueakIntro.ipynb | gpl-2.0 | # For reading data files
import os
import glob
import numpy as np # Numeric calculation
import pandas as pd # General purpose data analysis library
import squeak # For mouse data
# For plotting
import matplotlib.pyplot as plt
%matplotlib inline
# Prettier default settings for plots (optional)
import seaborn
seaborn... |
geoneill12/phys202-2015-work | assignments/assignment10/ODEsEx03.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
"""
Explanation: Ordinary Differential Equations Exercise 3
Imports
End of explanation
"""
g = 9.81 # m/s^2
l = 0.5 # length of pendulum... |
pagutierrez/tutorial-sklearn | notebooks-spanish/11-extraccion_caracteristicas_texto.ipynb | cc0-1.0 | X = ["Algunos dicen que el mundo terminará siendo fuego,",
"Otros dicen que terminará siendo hielo."]
len(X)
from sklearn.feature_extraction.text import CountVectorizer
vectorizer = CountVectorizer()
vectorizer.fit(X)
vectorizer.vocabulary_
X_bag_of_words = vectorizer.transform(X)
X_bag_of_words.shape
X_bag... |
vinecopulib/pyvinecopulib | examples/vine_copulas.ipynb | mit | import pyvinecopulib as pv
import numpy as np
# Specify pair-copulas
bicop = pv.Bicop(pv.BicopFamily.bb1, 90, [3, 2])
pcs = [[bicop, bicop], [bicop]]
# Specify R-vine matrix
mat = np.array([[1, 1, 1], [2, 2, 0], [3, 0, 0]])
# Set-up a vine copula
cop = pv.Vinecop(mat, pcs)
print(cop)
"""
Explanation: Import the lib... |
ES-DOC/esdoc-jupyterhub | notebooks/ncc/cmip6/models/sandbox-3/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncc', 'sandbox-3', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: NCC
Source ID: SANDBOX-3
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radiat... |
bmorris3/gsoc2015 | constraints-demo.ipynb | mit | ##############################################################
# Import my dev version of astroplan:
import os; astroplan_dev = os.environ['GITASTROPLANPATH']
import sys; sys.path.insert(0, astroplan_dev)
##############################################################
from astroplan import Observer, FixedTarget
from as... |
csaladenes/csaladenes.github.io | present/mcc2/PythonDataScienceHandbook/05.10-Manifold-Learning.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
import numpy as np
"""
Explanation: <!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png">
This notebook contains an excerpt from the Python Data Science Handbook by Jake VanderPlas; t... |
DigitalSlideArchive/HistomicsTK | docs/examples/semantic_segmentation_superpixel_approach.ipynb | apache-2.0 | import tempfile
import girder_client
import numpy as np
from histomicstk.annotations_and_masks.annotation_and_mask_utils import (
delete_annotations_in_slide)
from histomicstk.saliency.cellularity_detection_superpixels import (
Cellularity_detector_superpixels)
import matplotlib.pylab as plt
from matplotlib.co... |
NelisW/ComputationalRadiometry | 12d-SpectralTemperatureEstimation.ipynb | mpl-2.0 | from IPython.display import display
from IPython.display import Image
from IPython.display import HTML
%matplotlib inline
import numpy as np
from scipy.optimize import curve_fit
import pyradi.ryutils as ryutils
import pyradi.ryplot as ryplot
import pyradi.ryplanck as ryplanck
#make pngs at required dpi
import matplot... |
mldbai/mldb | container_files/tutorials/Querying Data Tutorial.ipynb | apache-2.0 | from pymldb import Connection
mldb = Connection()
"""
Explanation: Querying Data Tutorial
MLDB comes with a powerful SQL-like Select Query implementation accessible via its REST API. This tutorial will show a few different ways to query data.
The notebook cells below use pymldb; you can check out the Using pymldb Tuto... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.