repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
AllenDowney/ThinkBayes2 | examples/geiger_soln.ipynb | mit | # Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
import numpy as np
import pandas as pd
# import classes from thinkbayes2
from thinkbayes2 import Pmf, Cd... |
arongdari/almc | notebooks/freebase_subset_selector.ipynb | gpl-2.0 | datafile = '../data/freebase/train_single_relation.txt'
entities = set()
relations = set()
with open(datafile, 'r') as f:
for line in f.readlines():
start, relation, end = line.split('\t')
if start.strip() not in entities:
entities.add(start.strip())
if end.strip() not in entiti... |
PiercingDan/mat245 | Labs/Lab5/lab5_assignment.ipynb | mit | from sklearn import datasets
bost = datasets.load_boston()
bost.keys()
bost.data.shape
"""
Explanation: MAT245 Lab 5 - Linear Regression
Overview
Regression analysis is a set of statistical techniques for modelling the relationships between a dependent variable and a set of independent (or predictor) variables. Line... |
Salman-H/mars-search-robot | .ipynb_checkpoints/Rover_Project_Test_Notebook-checkpoint.ipynb | bsd-2-clause | #%%HTML
#<style> code {background-color : orange !important;} </style>
%matplotlib inline
#%matplotlib qt # Choose %matplotlib qt to plot to an interactive window
import cv2 # OpenCV for perspective transform
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import scipy.misc # For... |
google/CFU-Playground | third_party/tflite-micro/tensorflow/lite/micro/examples/hello_world/train/train_hello_world_model.ipynb | apache-2.0 | # Define paths to model files
import os
MODELS_DIR = 'models/'
if not os.path.exists(MODELS_DIR):
os.mkdir(MODELS_DIR)
MODEL_TF = MODELS_DIR + 'model'
MODEL_NO_QUANT_TFLITE = MODELS_DIR + 'model_no_quant.tflite'
MODEL_TFLITE = MODELS_DIR + 'model.tflite'
MODEL_TFLITE_MICRO = MODELS_DIR + 'model.cc'
"""
Explanation... |
jasonjensen/Montreal-Python-Web | 2.Python_Quickstart.ipynb | apache-2.0 | # Assign value 1 to variable x
x = 1
"""
Explanation: Python Quickstart
Workshop on Web Scraping and Text Processing with Python
by Radhika Saksena, Princeton University, saksena@princeton.edu, radhika.saksena@gmail.com
Disclaimer: The code examples presented in this workshop are for educational purposes only. Please ... |
amcdawes/QMlabs | Lab 2 - Quantum States.ipynb | mit | import numpy as np
from qutip import *
"""
Explanation: Lab 2 - Quantum States
Useful for working examples and problems with photon quantum states. You may notice some similarity to the Jones Calculus ;-)
End of explanation
"""
H = Qobj([[1],[0]])
V = Qobj([[0],[1]])
P45 = Qobj([[1/np.sqrt(2)],[1/np.sqrt(2)]])
M45 =... |
InsightLab/data-science-cookbook | 2020/05-geographic-information-system/Notebook_Network_Analysis.ipynb | mit | import osmnx as ox
import matplotlib.pyplot as plt
%matplotlib inline
# Specify the name that is used to seach for the data
place_name = "Brasil, Ceará, Fortaleza"
# Fetch OSM street network from the location
graph = ox.graph_from_place(place_name)
type(graph)
"""
Explanation: Recuperando dados do OpenStreetMap
O q... |
michrawson/nyu_ml_lectures | notebooks/07.1 Case Study - Large Scale Text Classification.ipynb | cc0-1.0 | from sklearn.feature_extraction.text import CountVectorizer
vectorizer = CountVectorizer(min_df=1)
vectorizer.fit([
"The cat sat on the mat.",
])
vectorizer.vocabulary_
"""
Explanation: Large Scale Text Classification for Sentiment Analysis
Scalability Issues
The sklearn.feature_extraction.text.CountVectorizer a... |
atlury/deep-opencl | DL0110EN/5.1.1dropoutPredictin.ipynb | lgpl-3.0 | import torch
import matplotlib.pyplot as plt
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from matplotlib.colors import ListedColormap
"""
Explanation: <div class="alert alert-block alert-info" style="margin-top: 20px">
<a href="http://cocl.us/pytorch_link_top"><img src = "http://cocl.us/P... |
nick-youngblut/SIPSim | ipynb/bac_genome/n1147/.ipynb_checkpoints/atomIncorp_taxaIncorp_HMW-HR-SIP_run1-checkpoint.ipynb | mit | import os
import glob
import itertools
import nestly
%load_ext rpy2.ipython
%load_ext pushnote
%%R
library(ggplot2)
library(dplyr)
library(tidyr)
library(gridExtra)
"""
Explanation: Goal
Follow-up to: atomIncorp_taxaIncorp
Determining the effect of 'heavy' BD window (number of windows & window sizes) on HR-SIP accu... |
mzszym/oedes | examples/scl/transient-with-trapping.ipynb | agpl-3.0 | %matplotlib inline
import matplotlib.pylab as plt
from oedes import *
init_notebook()
"""
Explanation: Transient space-charge-limited current with trapping
This example shows how to run transient simulation of space-charge-limited diode. It considers a case of investigated in a classical paper.
In the reference, an i... |
theandygross/HIV_Methylation | Setup/DX_Imports.ipynb | mit | import os
if os.getcwd().endswith('Setup'):
os.chdir('..')
import NotebookImport
from Setup.Imports import *
from scipy.special import logit
logit_adj = lambda df: logit(df.clip(.001, .999))
"""
Explanation: Helpers for Finding Differentially Methylated Probes
End of explanation
"""
def boxplot_panel(hit_vec,... |
omoju/Fundamentals | Data/data_Stats_4_ABTesting.ipynb | gpl-3.0 | %pylab inline
# Import libraries
from __future__ import absolute_import, division, print_function
# Ignore warnings
import warnings
#warnings.filterwarnings('ignore')
import sys
sys.path.append('tools/')
import numpy as np
import pandas as pd
import scipy.stats as st
# Graphing Libraries
import matplotlib.pyplot a... |
fonnesbeck/scientific-python-workshop | notebooks/Regression Modeling.ipynb | cc0-1.0 | %matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
from scipy.optimize import fmin
x = np.array([2.2, 4.3, 5.1, 5.8, 6.4, 8.0])
y = np.array([0.4, 10.1, 14.0, 10.9, 15.4, 18.5])
plt.plot(x,y,'ro')
"""
Explanation: Regression modeling
A general, pr... |
sgagnon/moore | notebooks/ObjFam Iterated Estimation of fMRI Data (LS-S).ipynb | bsd-3-clause | import pandas as pd
import json
from scipy import stats, signal, linalg
from sklearn.decomposition import PCA
import nibabel as nib
import nipype
from nipype import Node, SelectFiles, DataSink, IdentityInterface
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use("Agg")
from nipype.interfaces import fsl
fr... |
newsapps/public-notebooks | Weekend shootings and homicides.ipynb | mit | import os
import requests
# Some constants
NEWSROOMDB_URL = os.environ['NEWSROOMDB_URL']
# Utilities for loading data from NewsroomDB
def get_table_url(table_name, base_url=NEWSROOMDB_URL):
return '{}table/json/{}'.format(base_url, table_name)
def get_table_data(table_name):
url = get_table_url(table_name)
... |
ES-DOC/esdoc-jupyterhub | notebooks/cnrm-cerfacs/cmip6/models/cnrm-cm6-1/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cnrm-cerfacs', 'cnrm-cm6-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CNRM-CERFACS
Source ID: CNRM-CM6-1
Topic: Aerosol
Sub-Topics: Transport... |
4dsolutions/Python5 | PySummary1.ipynb | mit | lessons = {
"1": "Python is part of a bigger ecosystem (example: Jupyter Notebooks).",
"2": "Batteries Included refers to the well-stocked standard library.",
"3": "Built-ins inside __builtins__ include the basic types such as...",
"4": "__ribs__ == special names == magic methods (but not all are method... |
planetlabs/notebooks | jupyter-notebooks/pixels-to-tabular-data/field_statistical_analysis.ipynb | apache-2.0 | import datetime
import json
import os
from pathlib import Path
from pprint import pprint
import shutil
import time
from zipfile import ZipFile
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from planet import api
from planet.api import downloader, filters
import pyproj
from rasterio import plot... |
igabr/Metis_Projects_Chicago_2017 | 05-project-kojack/Notebook_4_DataFrame_Creation_Modeling.ipynb | mit | %run helper_functions.py
%run filters.py
%run plotly_functions.py
import quandl
from datetime import date
from tabulate import tabulate
from collections import Counter
from IPython.display import Image
import math
import string
%matplotlib inline
plt.rcParams["figure.figsize"] = (15,10)
plt.rcParams["xtick.labelsize"] ... |
jagarzone6/cmos | notebooks/CMOS- Taller 6 de Octubre.ipynb | mit | from IPython.core.display import Image, display
display(Image(url='images/taller-oct-6/fig-20-15.png'))
"""
Explanation: CMOS - Taller 6 de OCtubre
Simulacion del circuito de la figura 20,15 (Beta-Multiplier)
End of explanation
"""
from IPython.core.display import Image, display
display(Image(url='images/taller-oct-... |
matthiaskoenig/tellurium-web | api/api.ipynb | lgpl-3.0 | BASE_URL = "http://127.0.0.1:8001"
import os
import coreapi
import json
import pandas as pd
# some of the functionality requires authentication
auth = coreapi.auth.BasicAuthentication(
username='mkoenig',
password=os.environ['DJANGO_ADMIN_PASSWORD']
)
client = coreapi.Client(auth=auth)
# get the api scema
do... |
mldbai/mldb | container_files/demos/Recommending Movies.ipynb | apache-2.0 | from pymldb import Connection
mldb = Connection()
"""
Explanation: Recommending Movies
The MovieLens 20M dataset contains 20 million user ratings from 1 to 5 of thousands of movies. In this demo we'll build a simple recommendation system which will use this data to suggest 25 movies based on a seed movie you provide.
... |
SXBK/kaggle | mercedes-benz/Mercedes-Benz.ipynb | gpl-3.0 | #Drop quantitative features for which most samples take 0 or 1
for cols in quan:
if train_c[cols].mean() < 0.01 or train_c[cols].mean() > 0.99:
train_c.drop(cols, inplace=True, axis=1)
test_c.drop(cols, inplace=True, axis=1)
#For now we only use the quantitative features left to make predictions
qu... |
essicolo/GCI733-A2015 | isothermes.ipynb | mit | %pylab inline
def freundlich(C, kp, b):
S = kp*C**b
return(S)
def langmuir(C, Smax, kp):
S = C*kp*Smax/(1+kp*C)
return(S)
conc = linspace(num = 11, start = 0, stop = 10, endpoint=True)
S_freundlich1 = freundlich(C = conc, kp = 1, b = 0.1)
S_freundlich2 = freundlich(C = conc, kp = 1, b = 0.5)
S_freund... |
kubeflow/pipelines | components/google-cloud/google_cloud_pipeline_components/experimental/tensorflow_probability/anomaly_detection/tfp_anomaly_detection.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"
! pip3 install {... |
neurodata/ndmg | tutorials/Tutorial_For_QA_Registration.ipynb | apache-2.0 | import os
import nibabel as nb
import matplotlib.image as mpimg
from m2g.utils.gen_utils import get_braindata, get_filename
from m2g.utils.qa_utils import get_min_max, opaque_colorscale, pad_im
from argparse import ArgumentParser
from scipy import ndimage
from matplotlib.colors import LinearSegmentedColormap
from nilea... |
ucsd-ccbb/jupyter-genomics | notebooks/rnaSeq/Functional_Enrichment_Analysis_Pathway_Visualization.ipynb | mit | #Import Python modules
import os
import pandas
import qgrid
import mygene
#Change directory
os.chdir("/data/test")
"""
Explanation: ToppGene & Pathway Visualization
Authors: N. Mouchamel, L. Huang, T. Nguyen, K. Fisch
Email: Kfisch@ucsd.edu
Date: June 2016
Goal: Create Jupyter notebook that runs an enrichment analys... |
GoogleCloudPlatform/tf-estimator-tutorials | 08_Text_Analysis/06 - Part_2 - Text Classification - Hacker News - DNNClassifier with TF-Hub Sentence Embedding.ipynb | apache-2.0 | import os
class Params:
pass
# Set to run on GCP
Params.GCP_PROJECT_ID = 'ksalama-gcp-playground'
Params.REGION = 'europe-west1'
Params.BUCKET = 'ksalama-gcs-cloudml'
Params.PLATFORM = 'local' # local | GCP
Params.DATA_DIR = 'data/news' if Params.PLATFORM == 'local' else 'gs://{}/data/news'.format(Params.BUCKE... |
mne-tools/mne-tools.github.io | dev/_downloads/7ca3f34c286b629113cbb522edf26a21/75_cluster_ftest_spatiotemporal.ipynb | bsd-3-clause | # Authors: Denis Engemann <denis.engemann@gmail.com>
# Jona Sassenhagen <jona.sassenhagen@gmail.com>
# Alex Rockhill <aprockhill@mailbox.org>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
#
# License: BSD-3-Clause
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_... |
thanhleviet/weed | 1-Acquire.ipynb | mit | # Load the libraries
import pandas as pd
import numpy as np
# Load the dataset
df = pd.read_csv("data/Weed_Price.csv")
# Shape of the dateset - rows & columns
df.shape
# Check for type of each variable
df.dtypes
# Lets load this again with date as date type
df = pd.read_csv("data/Weed_Price.csv", parse_dates=[-1])
... |
GoogleCloudPlatform/rad-lab | modules/data_science/scripts/build/notebooks/Exploring_gnomad_on_BigQuery.ipynb | apache-2.0 | # Import libraries
import numpy as np
import os
"""
Explanation: Sample Notebook for exploring gnomAD in BigQuery
This notebook contains sample queries to explore the gnomAD dataset which is hosted through the Google Cloud Public Datasets Program.
Setup
If you just want to look at sample results, you can scroll down t... |
rusucosmin/courses | ml/ex02/template/ex02.ipynb | mit | import datetime
from helpers import *
height, weight, gender = load_data(sub_sample=False, add_outlier=False)
x, mean_x, std_x = standardize(height)
y, tx = build_model_data(x, weight)
y.shape, tx.shape
"""
Explanation: Load the data
End of explanation
"""
def loss_mse(e):
"""Compute the Mean Square Error for ... |
ES-DOC/esdoc-jupyterhub | notebooks/cccr-iitm/cmip6/models/sandbox-2/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-2', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: SANDBOX-2
Topic: Aerosol
Sub-Topics: Transport, Emissi... |
cristhro/Machine-Learning | ejercicio 3/.ipynb_checkpoints/titanic-checkpoint.ipynb | gpl-3.0 | %matplotlib inline
import pandas as pd
import numpy as np
import random as rnd
import seaborn as sns
import matplotlib.pyplot as plt
"""
Explanation: Alumnos: Cristhian Rodriguez y Jesus Perucha
Practica 3: Titanic
End of explanation
"""
train_df = pd.read_csv('train.csv')
test_df = pd.read_csv('test.csv')
"""
Exp... |
mtambos/springleaf | Springleaf - preprocess - date columns.ipynb | mit | %pylab inline
%load_ext autoreload
%autoreload 2
from __future__ import division
from collections import defaultdict, namedtuple
import cPickle as pickle
from datetime import datetime, timedelta
import dateutil
from functools import partial
import inspect
import json
import os
import re
import sys
import numpy as np... |
MCardus/foodnet | graph_analytics/graph_analytics.ipynb | mit | #imports
import networkx as nx
import pandas as pd
from itertools import combinations
import matplotlib.pyplot as plt
from matplotlib import pylab
import sys
from itertools import combinations
import operator
from operator import itemgetter
from scipy import integrate
# Exploring data
recipes_df = pd.read_csv('../da... |
svdwulp/da-programming-1 | week_08_oefeningen_uitwerkingen.ipynb | gpl-2.0 | n = 10000
steps_to_exit = []
for i in range(n):
x = 0
steps = 0
while -7 < x < 7:
x += np.random.choice([-1, 1]) # step left or right
steps += 1
steps_to_exit.append(steps)
print("Gemiddeld aantal stappen tot suiker: {:.3f}".format(mean(steps_to_exit)))
"""
Explanation: Oefening ... |
mne-tools/mne-tools.github.io | dev/_downloads/f31e73ee907864d95a2b617fdc76b71e/source_label_time_frequency.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 import io
from mne.datasets import sample
from mne.minimum_norm import read_inverse_operator, source_induced_power
print(__doc__)
"""
Explanation: Compute powe... |
enakai00/jupyter_ml4se_commentary | 04-Graph.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas import Series, DataFrame
from numpy.random import randint
"""
Explanation: グラフの描画
End of explanation
"""
dices = randint(1,7,(100, 2))
dices[:5]
"""
Explanation: 2個のサイコロを100回振った結果を保存
End of explanation
"""
total = np.sum(dices, a... |
waltervh/BornAgain-tutorial | talks/day_1/python_introduction/BornAgainSchool_Basic.ipynb | gpl-3.0 | import sys
print(sys.version)
"""
Explanation: 1. Basic Python Types
1.1 Verifying the python version you are using
End of explanation
"""
print(2 / 3)
print(2 // 3)
print(2 - 3)
print(2 * 3)
print(2 ** 3)
print(12 % 5)
"""
Explanation: At this point anything above python 3.5 should be ok.
1.2 Perform basic operati... |
scikit-optimize/scikit-optimize.github.io | dev/notebooks/auto_examples/interruptible-optimization.ipynb | bsd-3-clause | print(__doc__)
import sys
import numpy as np
np.random.seed(777)
import os
"""
Explanation: Interruptible optimization runs with checkpoints
Christian Schell, Mai 2018
Reformatted by Holger Nahrstaedt 2020
.. currentmodule:: skopt
Problem statement
Optimization runs can take a very long time and even run for multiple ... |
YuriyGuts/kaggle-quora-question-pairs | notebooks/feature-fuzzy.ipynb | mit | from pygoose import *
"""
Explanation: Feature: Fuzzy String Matching
Calculate edit distances between each question pair (Levenshtein, Jaro, Jaro-Winkler, ...).
Imports
This utility package imports numpy, pandas, matplotlib and a helper kg module into the root namespace.
End of explanation
"""
from fuzzywuzzy impor... |
ComputationalModeling/spring-2017-danielak | past-semesters/spring_2016/day-by-day/day10-random-walks-and-random-numbers/Random_Walks_OLD_SOLUTIONS.ipynb | agpl-3.0 | # put your code for Part 1 here. Add extra cells as necessary!
%matplotlib inline
import matplotlib.pyplot as plt
import random
import math
import numpy as np
n_trials = 1000 # number of trials (i.e., number of independent walks)
n_steps = 100 # number of steps taken during each trial
distances = [] # use this... |
aidiary/notebooks | keras/170526-airline-passengers.ipynb | mit | %matplotlib inline
import pandas
import matplotlib.pyplot as plt
dataset = pandas.read_csv('data/international-airline-passengers.csv',
usecols=[1], engine='python', skipfooter=3)
plt.plot(dataset)
plt.show()
dataset
"""
Explanation: Time Series Prediction with LSTM Recurrent Neural Networks... |
TheMitchWorksPro/DataTech_Playground | Python_Misc/TMWP_DFBuilder_OO_PY/testing_and_documentation/TMWP_DFBuilder_GMapsSubClass_Module_Testing.ipynb | mit | # general libraries
import pandas as pd
## required for Google Maps API code
import os
## for larger data and/or make many requests in one day - get Google API key and use these lines:
# os.environ["GOOGLE_API_KEY"] = "YOUR_GOOGLE_API_Key"
## for better security (PROD environments) - install key to server and use jus... |
thalesians/tsa | src/jupyter/python/signatures.ipynb | apache-2.0 | import os, sys
sys.path.append(os.path.abspath('../../main/python'))
import datetime as dt
import numpy as np
import pandas as pd
import thalesians.tsa.signatures as signatures
import importlib
importlib.reload(signatures)
"""
Explanation: Time series signatures
End of explanation
"""
df = pd.DataFrame(
np.a... |
albahnsen/ML_RiskManagement | exercises/04-CreditScoring.ipynb | mit | import pandas as pd
pd.set_option('display.max_columns', 500)
import zipfile
with zipfile.ZipFile('../datasets/KaggleCredit2.csv.zip', 'r') as z:
f = z.open('KaggleCredit2.csv')
data = pd.read_csv(f, index_col=0)
data.head()
data.shape
"""
Explanation: Exercise 04
Logistic regression for credit scoring
Banks ... |
AllenDowney/ModSimPy | soln/chap21soln.ipynb | mit | # Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
# import functions from the modsim.py module
from modsim import *
"""
Explanation: Modeling and Simulati... |
clausherther/public | Rethinking - Andrew's Spinner.ipynb | cc0-1.0 | data = pd.DataFrame([18, 19, 22, float(np.nan), float(np.nan), 19, 20, 22], columns=["frequency"])
k = len(data)
p = 1/k
k, p
data
missing_indeces = np.argwhere(np.isnan(data["frequency"])).flatten()
missing_indeces
"""
Explanation: This notebook was inspired by this homework problem post by Richard McElreath:
http... |
benneely/qdact-basic-analysis | notebooks/comppheno.ipynb | gpl-3.0 | import pickle
import re
dd = pickle.load(open('./python_scripts/02_data_dictionary_dict.p','rb'))
#get all variables that begin with 'ESAS' and print
variables = list(dd.keys())
variables.sort()
pattern = r'\b' + re.escape('ESAS')
symptoms = [variables[i] for i, x in enumerate(variables) if re.search(pattern, x)]
print... |
dirkseidensticker/CARD | Python/aDRACtoOxCal.ipynb | mit | %matplotlib inline
from IPython.display import display
import pandas as pd
"""
Explanation: Conversion to OxCal-compliant output
Archives des datations radiocarbone d'Afrique centrale
Dirk Seidensticker
see: https://c14.arch.ox.ac.uk/embed.php?File=oxcal.html
End of explanation
"""
df = pd.read_csv("https://raw.git... |
nehal96/Deep-Learning-ND-Exercises | DCGAN/DCGAN.ipynb | mit | %matplotlib inline
import pickle as pkl
import matplotlib.pyplot as plt
import numpy as np
from scipy.io import loadmat
import tensorflow as tf
!mkdir data
"""
Explanation: Deep Convolutional GANs
In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a De... |
WNoxchi/Kaukasos | pytorch/LSTM GloVe dropout - PyTorch - incomplete.ipynb | mit | import pathlib
import os
import torchtext
# from torchtext.data import Field
from torchtext import data
# import spacy
import pandas as pd
import numpy as np
# from torchtext.data import TabularDataset
"""
Explanation: PyTorch LSTM: GloVe + dropout --- Incomplete
This is a reimplementation of J.Howard's Improved LSTM ... |
crocha700/UpperOceanSeasonality | notebooks/LLCProcessing.ipynb | cc0-1.0 | import datetime
import numpy as np
import scipy as sp
from scipy import interpolate
import matplotlib.pyplot as plt
%matplotlib inline
import cmocean
import seawater as sw
from netCDF4 import Dataset
from llctools import llc_model
from pyspec import spectrum as spec
c1 = 'slateblue'
c2 = 'tomato'
c3 = 'k'
c4 = 'in... |
lilleswing/deepchem | examples/tutorials/15_Training_a_Generative_Adversarial_Network_on_MNIST.ipynb | mit | !curl -Lo conda_installer.py https://raw.githubusercontent.com/deepchem/deepchem/master/scripts/colab_install.py
import conda_installer
conda_installer.install()
!/root/miniconda/bin/conda info -e
!pip install --pre deepchem
import deepchem
deepchem.__version__
"""
Explanation: Tutorial Part 15: Training a Generative... |
dereneaton/ipyrad | testdocs/analysis/cookbook-digest_genomes.ipynb | gpl-3.0 | # conda install ipyrad -c conda-forge -c bioconda
import ipyrad.analysis as ipa
"""
Explanation: <span style="color:gray">ipyrad-analysis toolkit: </span> digest genomes
The purpose of this tool is to digest a genome file in silico using the same restriction enzymes that were used for an empirical data set to attempt... |
skorokithakis/pythess-files | 014 - Lorde/tao_mro/tao_of_python.ipynb | mit | two = 2
print(type(two))
print(type(type(two)))
print(type(two).__bases__)
print(dir(two))
"""
Explanation: The Tao of Python
The intricate relationship between "object" and "type" and how metaclasses, classes and instances are related
<img src="figures/yin_yang.png" style="display:block;margin:auto;width:60%;"/>
A... |
UltronAI/Deep-Learning | CS231n/assignment1/features.ipynb | mit | import random
import numpy as np
from cs231n.data_utils import load_CIFAR10
import matplotlib.pyplot as plt
from __future__ import print_function
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gr... |
kanhua/pypvcell | demos/dealing_with_spectrum_data.ipynb | apache-2.0 | %matplotlib inline
import numpy as np
import scipy.constants as sc
import matplotlib.pyplot as plt
from pypvcell.spectrum import Spectrum
from pypvcell.illumination import Illumination
from pypvcell.photocurrent import gen_step_qe_array
"""
Explanation: Dealing with spectrum data
This tutorial demonstrates how to use ... |
csherwood-usgs/landlab | landlab/components/depth_dependent_cubic_soil_creep/tests/solution_for_4x7_grid_steady_state.ipynb | mit | D = 0.01
Sc = 0.8
Hstar = 0.5
E = 0.0001
P0 = 0.0002
"""
Explanation: This notebook works out the expected hillslope sediment flux, topography, and soil thickness for steady state on a 4x7 grid. This provides "ground truth" values for tests.
Let the hillslope erosion rate be $E$, the flux coefficient $D$, critical gra... |
samuxiii/notebooks | simpsons/Simpsons-PyTorch.ipynb | apache-2.0 | import os, random
from scipy.misc import imread, imresize
width = 0
lenght = 0
num_test_images = len(test_image_names)
for i in range(num_test_images):
path_file = os.path.join(test_root_path, test_image_names[i])
image = imread(path_file)
width += image.shape[0]
lenght += image.shape[1]
width_mean =... |
davidbrough1/pymks | notebooks/structure_md_2D.ipynb | mit | import pymks
%matplotlib inline
%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
from pymks_share import DataManager
manager = DataManager('pymks.me.gatech.edu')
X = manager.fetch_data('Molecular Dynamics')
"""
Explanation: Phase Transition in Molecular Dynamics Simulation... |
louridas/rwa | content/notebooks/chapter_03.ipynb | bsd-2-clause | def create_pq():
return []
"""
Explanation: Compressing
Chapter 3 of Real World Algorithms.
Panos Louridas<br />
Athens University of Economics and Business
Huffman Encoding
To implement Huffman encoding we need a priority queue.
We will implement the priority queue as a min-heap.
A min-heap is a complete binar... |
kitu2007/dl_class | embeddings/Skip-Gram-word2vec.ipynb | mit | import time
import numpy as np
import tensorflow as tf
import utils
"""
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p... |
InsightSoftwareConsortium/SimpleITK-Notebooks | Python/03_Image_Details.ipynb | apache-2.0 | import SimpleITK as sitk
# If the environment variable SIMPLE_ITK_MEMORY_CONSTRAINED_ENVIRONMENT is set, this will override the ReadImage
# function so that it also resamples the image to a smaller size (testing environment is memory constrained).
%run setup_for_testing
%matplotlib inline
import matplotlib.pyplot as ... |
bwbadger/mifid2-rts | rts/Using sample trades in an SI calculation.ipynb | bsd-3-clause | # First we need to import the libraries we'll be needing
import rts2_annex3
import pandas as pd
import random
random.seed()
# Get the root of the RTS 2 Annex III taxonomy
root = rts2_annex3.class_root
# Get the Asset Class we would like to generate trades for
asset_class = root.asset_class_by_name("Credit Derivative... |
vlad17/vlad17.github.io | assets/2019-10-20-prngs.ipynb | apache-2.0 | import numpy as np
from multiprocessing import Pool
from scipy.stats import ttest_1samp
def something_random(_):
return np.random.randn()
n = 2056
print("stddev {:.5f}".format(1 / np.sqrt(n)))
with Pool(4) as p:
mu = np.mean(p.map(something_random, range(n)))
mu
"""
Explanation: Numpy Gems, Part 2
Trying o... |
ES-DOC/esdoc-jupyterhub | notebooks/test-institute-2/cmip6/models/sandbox-3/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'test-institute-2', 'sandbox-3', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: TEST-INSTITUTE-2
Source ID: SANDBOX-3
Topic: Landice
Sub-Topics: Gla... |
mne-tools/mne-tools.github.io | 0.23/_downloads/b2637a9801fb152d611a08a816cc5583/sensor_regression.ipynb | bsd-3-clause | # Authors: Tal Linzen <linzen@nyu.edu>
# Denis A. Engemann <denis.engemann@gmail.com>
# Jona Sassenhagen <jona.sassenhagen@gmail.com>
#
# License: BSD (3-clause)
import pandas as pd
import mne
from mne.stats import linear_regression, fdr_correction
from mne.viz import plot_compare_evokeds
from mne.da... |
shumway/srt_bootcamp | Mandelbrot_CPU_Example.ipynb | mit | import numpy as np
import bokeh.plotting as bk
bk.output_notebook()
from numba import jit
from timeit import default_timer as timer
from IPython.html.widgets import interact, interact_manual, fixed, FloatText
"""
Explanation: CPU Acceleration of Mandelbrot Generation
In this example we use numba to accelerate the gene... |
mne-tools/mne-tools.github.io | 0.22/_downloads/f760cc2f1a5d6c625b1e14a0b05176dd/plot_ecog.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
# Chris Holdgraf <choldgraf@gmail.com>
# Adam Li <adam2392@gmail.com>
#
# License: BSD (3-clause)
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import mne
from mne.viz import plot_align... |
CrowdTruth/CrowdTruth-core | tutorial/notebooks/Custom Platform - Multiple Choice Task - Person Type Annotation in Video.ipynb | apache-2.0 | import pandas as pd
test_data = pd.read_csv("../data/custom-platform-person-video-multiple-choice.csv")
test_data.head()
"""
Explanation: CrowdTruth for Multiple Choice Tasks: Person Type Annotation in Video on a Custom Platform
In this tutorial, we will apply CrowdTruth metrics to a multiple choice crowdsourcing tas... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/image_models/solutions/2_mnist_models_vertex.ipynb | apache-2.0 | import os
from datetime import datetime
REGION = "us-central1"
PROJECT = !(gcloud config get-value core/project)
PROJECT = PROJECT[0]
BUCKET = PROJECT
MODEL_TYPE = "cnn" # "linear", "dnn", "dnn_dropout", or "cnn"
# Do not change these
os.environ["PROJECT"] = PROJECT
os.environ["BUCKET"] = BUCKET
os.environ["REGION"]... |
TomTranter/OpenPNM | examples/tutorials/Working with Mixtures.ipynb | mit | import openpnm as op
ws = op.Workspace()
ws.settings['loglevel'] = 40
"""
Explanation: Working with Mixtures
In version 2.1, OpenPNM introduced a new Mixture class, which as the name suggests, combines the properties of several phases into a single mixture. The most common example would be diffusion of oxygen in air,... |
VectorBlox/PYNQ | Pynq-Z1/notebooks/examples/pmod_oled.ipynb | bsd-3-clause | from pynq import Overlay
from pynq.iop import Pmod_OLED
from pynq.iop import PMODA
ol = Overlay("base.bit")
ol.download()
pmod_oled = Pmod_OLED(PMODA)
pmod_oled.clear()
pmod_oled.write('Welcome to the\nPynq-Z1 board!')
"""
Explanation: Displaying text on a PmodOLED
This demonstration shows how to display text on a ... |
phuongxuanpham/SelfDrivingCar | CarND-Keras-Lab/traffic-sign-classification-with-keras.ipynb | gpl-3.0 | from urllib.request import urlretrieve
from os.path import isfile
from tqdm import tqdm
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_size=None):
self.total = total_size
self.update((block_num - self.last_block) * block_size)
self.last_block = b... |
tritemio/PyBroMo | notebooks/PyBroMo - 4. Two-state dynamics - Static smFRET simulation.ipynb | gpl-2.0 | %matplotlib inline
from pathlib import Path
import numpy as np
import tables
import matplotlib.pyplot as plt
import seaborn as sns
import pybromo as pbm
import phconvert as phc
print('Numpy version:', np.__version__)
print('PyTables version:', tables.__version__)
print('PyBroMo version:', pbm.__version__)
print('phconv... |
satishgoda/learning | web/coffeescript/coffeescript.ipynb | mit | from IPython.core.display import HTML, Javascript
from IPython.core import display
"""
Explanation: About
http://coffeescript.org
https://en.wikipedia.org/wiki/Jeremy_Ashkenas
https://en.wikipedia.org/wiki/CoffeeScript
End of explanation
"""
!ls *b
!coffee -v
"""
Explanation: Installed coffee script using npm
Fol... |
kinshuk4/MoocX | misc/deep_learning_notes/Ch2 Intro to Tensorflow/007 - tensorflow API exploration.ipynb | mit | import tensorflow as tf
from pprint import pprint
"""
Explanation: Here we go through the API doc for tensorflow, and test various senarious out to get a better understanding of the mechanics of tensorflow
End of explanation
"""
c = tf.constant(4.0)
assert c.graph is tf.get_default_graph()
g = tf.Graph()
with g.as_... |
marcus-nystrom/python_course | Week4_lecture.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
# A first attempt (we ignore the target for now)
image_size = (1280, 1024) # Size of background in pixels
nDistractors = 10 # Number of distractors
distractor_size = 500
# Generate positions where to put the distractors
xr = np.random.randint(0, image_size[0], nDis... |
ES-DOC/esdoc-jupyterhub | notebooks/csir-csiro/cmip6/models/sandbox-2/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csir-csiro', 'sandbox-2', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: CSIR-CSIRO
Source ID: SANDBOX-2
Topic: Seaice
Sub-Topics: Dynamics, Thermody... |
tensorflow/docs-l10n | site/en-snapshot/tensorboard/graphs.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... |
ultiyuan/test0 | lessons/yuan coursework.ipynb | gpl-2.0 | import numpy
from matplotlib import pyplot
%matplotlib inline
#Import the required functions from VortexPanel.py and BoundaryLayer.py
from VortexPanel import Panel, solve_gamma, plot_flow, make_circle
pyplot.figure(figsize=(10,6))
def c_p(gamma): return 1-gamma**2
def C_P(theta): return 1-4*(numpy.sin(theta))**2
N_r... |
tpin3694/tpin3694.github.io | machine-learning/stemming_words.ipynb | mit | # Load library
from nltk.stem.porter import PorterStemmer
"""
Explanation: Title: Stemming Words
Slug: stemming_words
Summary: How to stem words in unstructured text data for machine learning in Python.
Date: 2016-09-09 12:00
Category: Machine Learning
Tags: Preprocessing Text
Authors: Chris Albon
<a alt="Stemming Wo... |
PyLCARS/PythonUberHDL | myHDL_DigLogicFundamentals/myHDL_Latches.ipynb | bsd-3-clause | import numpy as np
import pandas as pd
from sympy import *
init_printing()
from myhdl import *
from myhdlpeek import *
import random
#python file of convince tools. Should be located with this notebook
from sympy_myhdl_tools import *
"""
Explanation: \title{Digital Latches with myHDL}
\author{Steven K Armour}
\maket... |
jdhp-docs/python-notebooks | python_numpy_fourier_transform_en.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
"""
Explanation: Fast Fourier Transform snippets
Documentation
Numpy implementation: http://docs.scipy.org/doc/numpy/reference/routines.fft.html
Scipy implementation: http://docs.scipy.org/doc/scipy/reference/fftpack.html
Import directives
... |
blue-yonder/tsfresh | notebooks/examples/01 Feature Extraction and Selection.ipynb | mit | %matplotlib inline
import matplotlib.pylab as plt
from tsfresh import extract_features, extract_relevant_features, select_features
from tsfresh.utilities.dataframe_functions import impute
from tsfresh.feature_extraction import ComprehensiveFCParameters
from sklearn.tree import DecisionTreeClassifier
from sklearn.mod... |
metpy/MetPy | v0.12/_downloads/9041777e133eed610f5b243c688e89f9/surface_declarative.ipynb | bsd-3-clause | from datetime import datetime, timedelta
import cartopy.crs as ccrs
import pandas as pd
from metpy.cbook import get_test_data
import metpy.plots as mpplots
"""
Explanation: Surface Analysis using Declarative Syntax
The MetPy declarative syntax allows for a simplified interface to creating common
meteorological analy... |
Hyperparticle/graph-nlu | notebooks/dynamic_memory_1.ipynb | mit | # Import the necessary packages
import pandas as pd
import numpy as np
import nltk
from sklearn.metrics import accuracy_score
# Download NLTK packages
# An OS window should pop up for you to download the appropriate packages
# Select all-nltk and click on the download button. Once download has finished exit the window... |
DataPilot/notebook-miner | Notebook-miner test.ipynb | apache-2.0 | from base_loader import base_loader
"""
Explanation: Notebook-miner tests
This Notebook is meant to test the notebook-miner initial library (currently base_loader), making sure that we are able to import and use it as expected.
End of explanation
"""
notebook_loaded = base_loader('example_notebooks/ML-Exercise2.ipyn... |
ueapy/ueapy.github.io | content/notebooks/2017-10-30-pythonic-code.ipynb | mit | import this
"""
Explanation: Writing idiomatic python code
the Zen of Python
End of explanation
"""
if []:
print('this is false')
False # false is false
[] # empty lists
{} # empty dictionaries or sets
"" # empty strings
0 # zero integers
0.00000 # zero floats
None # None... |
thempel/adaptivemd | examples/tutorial/1_example_setup_project.ipynb | lgpl-2.1 | import sys, os
"""
Explanation: First we cover some basics about adaptive sampling to get you going.
We will briefly talk about
resources
files
generators
how to run a simple trajectory
Imports
End of explanation
"""
from adaptivemd import Project
"""
Explanation: Alright, let's load the package and pick the Proj... |
fja05680/pinkfish | examples/120.sell-short/strategy.ipynb | mit | import datetime
import matplotlib.pyplot as plt
import pandas as pd
import pinkfish as pf
# Format price data
pd.options.display.float_format = '{:0.2f}'.format
%matplotlib inline
# Set size of inline plots
'''note: rcParams can't be in same cell as import matplotlib
or %matplotlib inline
%matplotlib not... |
brianray/puppy_dec_2015 | PuPPy Dec 2015-Parts of Speech in Python.ipynb | apache-2.0 | sent = "Each of us is full of shit in our own special way"
# setup display for demo
%matplotlib inline
import os
os.environ['DISPLAY'] = 'localhost:1'
"""
Explanation: ```
First, let's analyze some text...
...
```
“Each of us is full of shit in our own special way. We are all shitty little snowflakes dancing in the u... |
gwsb-istm-6212-fall-2016/syllabus-and-schedule | exercises/exercise-03.ipynb | cc0-1.0 | NAME = "dchud"
COLLABORATORS = ""
"""
Explanation: Before you turn this problem in, make sure everything runs as expected. First, restart the kernel (in the menubar, select Kernel$\rightarrow$Restart) and then run all cells (in the menubar, select Cell$\rightarrow$Run All).
Make sure you fill in any place that says YO... |
ray-project/ray | doc/source/tune/examples/ax_example.ipynb | apache-2.0 | # !pip install ray[tune]
!pip install ax-platform==0.2.4
"""
Explanation: Running Tune experiments with AxSearch
In this tutorial we introduce Ax, while running a simple Ray Tune experiment. Tune’s Search Algorithms integrate with Ax and, as a result, allow you to seamlessly scale up a Ax optimization process - withou... |
tensorflow/recommenders | docs/examples/sequential_retrieval.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... |
AnyBody-Research-Group/AnyPyTools | docs/Tutorial/01_Getting_started_with_anypytools.ipynb | mit | from anypytools import AnyPyProcess
app = AnyPyProcess()
"""
Explanation: Getting Started with AnyPyTools
Running a simple macro
<img src="Tutorial_files/knee.gif" alt="Drawing" align="Right" width=120 />
For the sake of the tutorial we will use a small 'toy' model of a simplified knee joint (see the figure.) The mod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.