repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
MadsJensen/intro_to_scientific_computing | notebooks/raw_bytes_manipulations.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
show_as_hex = np.vectorize(hex)
"""
Explanation: Demo: raw byte manipulations
What is data? It depends on how you (choose to) intepret it! There may be more than one way...
End of explanation
"""
img_file = 'binary_image_file'
img_size = (324, 32... |
cmshobe/landlab | notebooks/teaching/geomorphology_exercises/hillslope_notebooks/north_carolina_piedmont_hillslope_class_notebook.ipynb | mit | # Code Block 1
import numpy as np
from landlab.io import read_esri_ascii
from landlab.plot.imshow import imshow_grid
import matplotlib.pyplot as plt
#below is to make plots show up in the notebook
%matplotlib inline
"""
Explanation: <a href="http://landlab.github.io"><img style="float: left" src="../../../landlab_he... |
NEONInc/NEON-Data-Skills | code/Python/lidar/Mask_Raster.ipynb | gpl-2.0 | import numpy as np
import gdal
import matplotlib.pyplot as plt
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
# Define the plot_band_array function from Day 1
def plot_band_array(band_array,refl_extent,colorlimit,ax=plt.gca(),title='',cbar ='on',cmap_title='',colormap='spectral'):
plot = plt.... |
tensorflow/decision-forests | documentation/tutorials/proximities_colab.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
metpy/MetPy | v0.5/_downloads/Wind_SLP_Interpolation.ipynb | bsd-3-clause | import cartopy
import cartopy.crs as ccrs
from matplotlib.colors import BoundaryNorm
import matplotlib.pyplot as plt
import numpy as np
from metpy.calc import get_wind_components
from metpy.cbook import get_test_data
from metpy.gridding.gridding_functions import interpolate, remove_nan_observations
from metpy.units im... |
benbovy/cosmogenic_dating | emcee_test_2params.ipynb | mit | import math
import numpy as np
import pandas as pd
from scipy import stats
from scipy import optimize
import emcee
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
clr_plt = sns.color_palette()
"""
Explanation: Bayesian approach with emcee - Test case - 2 free parameters
An example of applyin... |
Kaggle/learntools | notebooks/microchallenges/raw/ex1.ipynb | apache-2.0 | def should_hit(player_total, dealer_card_val, player_aces):
"""Return True if the player should hit (request another card) given the current game
state, or False if the player should stay. player_aces is the number of aces the player has.
"""
return False
"""
Explanation: Blackjack Rules
We'll use a sl... |
mne-tools/mne-tools.github.io | 0.19/_downloads/80342e62fc31882c2b53e38ec1ed14a6/plot_background_filtering.ipynb | bsd-3-clause | import numpy as np
from numpy.fft import fft, fftfreq
from scipy import signal
import matplotlib.pyplot as plt
from mne.time_frequency.tfr import morlet
from mne.viz import plot_filter, plot_ideal_filter
import mne
sfreq = 1000.
f_p = 40.
flim = (1., sfreq / 2.) # limits for plotting
"""
Explanation: Background in... |
LimeeZ/phys292-2015-work | assignments/assignment03/NumpyEx01.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import antipackage
import github.ellisonbg.misc.vizarray as va
"""
Explanation: Numpy Exercise 1
Imports
End of explanation
"""
def checkerboard(size):
Z = np.empty((size,size),dtype=float)
Z.fill(1.0)
Z[1::2,::2... |
mrcslws/nupic.research | projects/archive/dynamic_sparse/notebooks/mcaporale/2019-10-02--Experiment-Analysis-NonBinaryHeb.ipynb | agpl-3.0 | %load_ext autoreload
%autoreload 2
import sys
sys.path.append("../../")
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import glob
import tabulate
import pprint
import click
import numpy as np
import pandas as pd
from ray.tune.commands import *
... |
infimath/optimization-method | week05/Problem 3 - Printing Press.ipynb | mit | using JuMP
m = Model()
# Definig variable
Classes = ["A", "B", "C"]
Shift = ["R", "O"]
@variable(m, x[Classes, Shift] >= 0)
# Define Constraints
@constraints m begin
2x["B","R"] + 3x["C","R"] <= 40
2x["B","O"] + 3x["C","O"] <= 35
3x["A","R"] + x["B","R"] + 3x["C","R"] + x["B","O"] + 3x["C","O"] <= 60
... |
ngmarchant/oasis | docs/tutorial/tutorial.ipynb | mit | import numpy as np
import random
import oasis
import matplotlib.pyplot as plt
%matplotlib inline
np.random.seed(319158)
random.seed(319158)
"""
Explanation: Tutorial
This Python notebook demonstrates how OASIS can be used to efficiently evaluate a classifier, based on an example dataset from the entity resolution dom... |
LucaCanali/Miscellaneous | Spark_Notes/Spark_Histograms/Spark_DataFrame_Frequency_Histograms.ipynb | apache-2.0 | # Start the Spark Session
# This uses local mode for simplicity
# the use of findspark is optional
# install pyspark if needed
# ! pip install pyspark
# import findspark
# findspark.init("/home/luca/Spark/spark-3.3.0-bin-hadoop3")
from pyspark.sql import SparkSession
spark = (SparkSession.builder
.appName("... |
amanabt/DG_Maxwell | examples/maxwells_equations/advec_1d_multiple_u_surface_term.ipynb | gpl-3.0 | import os
import sys
sys.path.insert(0, os.path.abspath('../../'))
import numpy as np
from matplotlib import pyplot as plt
import arrayfire as af
from dg_maxwell import params
from dg_maxwell import lagrange
from dg_maxwell import wave_equation as w1d
from dg_maxwell import utils
af.set_backend('opencl')
af.set_devi... |
DB2-Samples/db2jupyter | v1/Db2 11 Statistical Functions.ipynb | apache-2.0 | %run db2.ipynb
"""
Explanation: <a id='top'></a>
Db2 11 Statistical Functions
Db2 already has a variety of Statistical functions built in. In Db2 11.1, a number of new
functions have been added including:
COVARIANCE_SAMP - The COVARIANCE_SAMP function returns the sample covariance of a set of number pairs
STDDEV_SAMP... |
ARM-software/lisa | ipynb/tests/noise_analysis.ipynb | apache-2.0 | def collect_value(db, cls, key_path):
"""
Collect objects computed for the exekall subexpression
pointed at by ``key_path``, starting from objects of type ``cls``.
The path is a list of parameter names that allows locating a node in the graph of an expression.
The path from z to x is ['param2', 'par... |
phoebe-project/phoebe2-docs | 2.3/tutorials/requiv_crit_contact.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: Critical Radii: Contact Systems
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # units
import nu... |
kubeflow/examples | github_issue_summarization/pipelines/example_pipelines/pipelines-notebook.ipynb | apache-2.0 | !pip install -U kfp
# Restart kernel after the pip install
import IPython
IPython.Application.instance().kernel.do_shutdown(True)
import kfp # the Pipelines SDK.
from kfp import compiler
import kfp.dsl as dsl
import kfp.gcp as gcp
import kfp.components as comp
from kfp.dsl.types import Integer, GCSPath, String
i... |
JamesSample/icpw | upload_icpw_template.ipynb | mit | # Path to template to process
in_xlsx = (r'../../../Call_For_data_2018/replies'
r'/netherlands/icpw_toc_trends_nl_tidied_core.xls')
# Read useful tables from database
# Stations
sql = ('SELECT UNIQUE(station_code) '
'FROM resa2.stations')
stn_df = pd.read_sql_query(sql, eng)
# Methods
sql = ("SELECT... |
besser82/shogun | doc/ipython-notebooks/pca/pca_notebook.ipynb | bsd-3-clause | %pylab inline
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
# import all shogun classes
from shogun import *
import shogun as sg
"""
Explanation: Principal Component Analysis in Shogun
By Abhijeet Kislay (GitHub ID: <a href='https://github.com/kislayabhi'>kislayabhi</a>)
Th... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/jax/exercises/JAX_Flax_for_AI_Residents_Practical_Session_(go_flax_air) (2).ipynb | apache-2.0 | import jax
import jax.numpy as jnp
import numpy as np
from matplotlib import pyplot as plt
# Check connected accelerators. Depending on what runtime you're connected to,
# this will show a single CPU/GPU, or 8 TPU cores (jf_2x2 aka JellyDonut).
# You can start a TPU runtime via : "Connect to a runtime" -> "Start" ->
... |
pyqg/pyqg | docs/examples/parameterizations.ipynb | mit | import numpy as np
import pandas as pd
pd.set_option('display.max_columns', 10)
import pyqg
import pyqg.diagnostic_tools
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Parameterizations
In this notebook, we'll review tools for defining, running, and comparing subgrid parameterizations.
End of expl... |
ctroupin/OceanData_NoteBooks | PythonNotebooks/PlatformPlots/plot_CMEMS_drifter.ipynb | gpl-3.0 | %matplotlib inline
import netCDF4
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import colors
from mpl_toolkits.basemap import Basemap
"""
Explanation: The objective of this notebook is to show how to read and plot the trajectory and the temperature measured by a drifting ... |
rbiswas4/SimulatedObservationsofVariablesoverLargeSkyArea | examples/Demo_BasicSimulations.ipynb | gpl-3.0 | import os
from opsimsummary import HealpixTiles, OpSimOutput
import numpy as np
import pandas as pd
from lsst.sims.photUtils import BandpassDict
from varsim import BasePopulation, BasicSimulation, BaseModel
#hptiles = HealpixTiles(nside=256,
# preComputedMap='/Users/rbiswas/data/LSST/OpSimDa... |
coolharsh55/advent-of-code | 2016/python3/Day12.ipynb | mit | with open('../inputs/day12.txt', 'r') as f:
input_data = [line.strip().split() for line in f.readlines()]
registers = {
'a': 0,
'b': 0,
'c': 0,
'd': 0
}
def run():
program_counter = 0
while program_counter < len(input_data):
line = input_data[program_counter]
if l... |
sorig/shogun | doc/ipython-notebooks/multiclass/Tree/DecisionTrees.ipynb | bsd-3-clause | import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../../data')
# training data
train_income=['Low','Medium','Low','High','Low','High','Medium','Medium','High','Low','Medium',
'Medium','High','Low','Medium']
train_age = ['Old','Young','Old','Young','Old','Young','Young','Old','Old','Old','Young','Old',
'Old... |
zephirefaith/AI_Fall15_Assignments | A3/.ipynb_checkpoints/probability_notebook-checkpoint.ipynb | mit | """Testing pbnt.
Run this before anything else
to get pbnt to work!"""
import sys
# from importlib import reload
if('pbnt/combined' not in sys.path):
sys.path.append('pbnt/combined')
from exampleinference import inferenceExample
# Should output:
# ('The marginal probability of sprinkler=false:', 0.80102921)
#('The... |
vascotenner/holoviews | doc/Tutorials/Pandas_Conversion.ipynb | bsd-3-clause | import numpy as np
import pandas as pd
import holoviews as hv
from IPython.display import HTML
hv.notebook_extension()
%output holomap='widgets'
"""
Explanation: Pandas is one of the most popular Python libraries providing high-performance, easy-to-use data structures and data analysis tools. It also provides I/O in... |
josephcslater/mousai | docs/tutorial/demos/Duffing.ipynb | bsd-3-clause | %matplotlib inline
%load_ext autoreload
%autoreload 2
import scipy as sp
import numpy as np
import matplotlib.pyplot as plt
import mousai as ms
from scipy import pi, sin
# Test that all is working.
# f_tol adjusts accuracy. This is smaller than reasonable, but illustrative of usage.
t, x, e, amps, phases = ms.hb_tim... |
massimo-nocentini/simulation-methods | notes/set-based-type-system/lists-types.ipynb | mit | from itertools import repeat
from sympy import *
#from type_system import *
%run ../../src/commons.py
%run ./type-system.py
"""
Explanation: <p>
<img src="http://www.cerm.unifi.it/chianti/images/logo%20unifi_positivo.jpg"
alt="UniFI logo" style="float: left; width: 20%; height: 20%;">
<div align="right">
Ma... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a_algo/td1a_correction_session8_wikiroot.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 1A.algo - Parcours dans un graphe (wikipédia) - correction
Correction du notebook du même titre. On part d'une page, on explore les liens des pages liées à la première et on continue. On utilise le module beautifulsoup4 (web scrapping) po... |
phockett/ePSproc | docs/doc-source/methods/geometric_method_dev_260220.ipynb | gpl-3.0 | # Imports
import numpy as np
import pandas as pd
import xarray as xr
from functools import lru_cache # For function result caching
# Special functions
# from scipy.special import sph_harm
import spherical_functions as sf
import quaternion
# Performance & benchmarking libraries
from joblib import Memory
import xyzpy ... |
dmitrinesterenko/cs294 | sp17_hw/hw2/HW2.ipynb | mit | from frozen_lake import FrozenLakeEnv
env = FrozenLakeEnv()
print(env.__doc__)
"""
Explanation: Assignment 2: Markov Decision Processes
Homework Instructions
All your answers should be written in this notebook. You shouldn't need to write or modify any other files.
Look for four instances of "YOUR CODE HERE"--those a... |
datapolitan/lede_algorithms | class3_1/.ipynb_checkpoints/regression_review-checkpoint.ipynb | gpl-2.0 | df = pd.read_csv('data/apib12tx.csv')
df.describe()
"""
Explanation: Setting things up
Let's load the data and give it a quick look.
End of explanation
"""
df.corr()
"""
Explanation: Checking out correlations
Let's start looking at how variables in our dataset relate to each other so we know what to expect when we... |
computational-class/computational-communication-2016 | code/17.networkx.ipynb | mit | %matplotlib inline
import networkx as nx
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import networkx as nx
G=nx.Graph() # G = nx.DiGraph() # 有向网络
# 添加(孤立)节点
G.add_node("spam")
# 添加节点和链接
G.add_edge(1,2)
print(G.nodes())
print(G.edges())
# 绘制网络
nx.draw(G, with_labels = True)
"""
Explanation: 网络科学理论
... |
astroumd/GradMap | notebooks/Lectures2021/Lecture1/GradMap_L1_Instructor.ipynb | gpl-3.0 | ## You can use Python as a calculator:
5*7 #This is a comment and does not affect your code.
#You can have as many as you want.
#Comments help explain your code to others and yourself.
#No worries.
5+7
5-7
5/7
"""
Explanation: Introduction to "Doing Science" in Python for REAL Beginners
Python is one of many lan... |
bayespy/bayespy | doc/source/examples/regression.ipynb | mit | import numpy as np
k = 2 # slope
c = 5 # bias
s = 2 # noise standard deviation
# This cell content is hidden from Sphinx-generated documentation
%matplotlib inline
np.random.seed(42)
"""
Explanation: This example is a Jupyter notebook. You can download it or run it interactively on mybinder.org.
Linear regression
Dat... |
dsevilla/bdge | mongo/sesion3.ipynb | mit | !pip install --upgrade pymongo
from pprint import pprint as pp
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
matplotlib.style.use('ggplot')
"""
Explanation: NoSQL (MongoDB) (sesión 3)
Esta hoja muestra cómo acceder a bases de datos MongoDB y también a conectar la salida co... |
starbro/BeastMode | .ipynb_checkpoints/Final_Project_vAUS-checkpoint.ipynb | apache-2.0 | %matplotlib inline
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import pandas as pd
import time
import json
import statsmodels.api as sm
from statsmodels.formula.api import glm, ols
pd.set_option('display.width', 500)
pd.set_option('display.m... |
sfstoolbox/sfs-python | doc/examples/sound-field-synthesis.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import sfs
# Simulation parameters
number_of_secondary_sources = 56
frequency = 680 # in Hz
pw_angle = 30 # traveling direction of plane wave in degree
xs = [-2, -1, 0] # position of virtual point source in m
grid = sfs.util.xyz_grid([-2, 2], [-2, 2], 0, spacing=... |
xpmanoj/content | labs/lab7/GibbsSampler.ipynb | mit | f= lambda x,y: np.exp(-(x*x*y*y+x*x+y*y-8*x-8*y)/2.)
"""
Explanation: Gibbs Sampling Example
Imagine your posterior distribution has the following form:
$$ f(x, y \mid data) = (1/C)e^{-\frac{(x^2y^2+x^2+y^2-8x-8y)}{2}} $$
As is typical in Bayesian inference, you don't know what C (the normalizing constant) is, so yo... |
weixuanfu/tpot | tutorials/Higgs_Boson.ipynb | lgpl-3.0 | import os
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from tpot import TPOTClassifier
# This is a 2.7 GB file.
# Please make sure you have enough space available before
# uncommenting the code below and downloading this file.
... |
samirma/deep-learning | batch-norm/Batch_Normalization_Lesson.ipynb | mit | # Import necessary packages
import tensorflow as tf
import tqdm
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Import MNIST data so we have something for our experiments
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
"... |
seg/2016-ml-contest | PA_Team/PA_Team_Submission_4-revised.ipynb | apache-2.0 | import numpy as np
np.random.seed(1337)
import warnings
warnings.filterwarnings("ignore")
import time as tm
import pandas as pd
from keras.models import Sequential, Model
from keras.constraints import maxnorm
from keras.layers import Dense, Dropout, Activation
from keras.utils import np_utils
from sklearn.metrics ... |
tensorflow/docs-l10n | site/ko/guide/keras/rnn.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... |
tensorflow/docs-l10n | site/ja/addons/tutorials/losses_triplet.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0
# 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 the License is d... |
TESScience/FPE_Test_Procedures | Manual_cmds.ipynb | mit | from tessfpe.dhu.fpe import FPE
from tessfpe.dhu.unit_tests import check_house_keeping_voltages
fpe1 = FPE(1, debug=False, preload=True, FPE_Wrapper_version='6.1.1')
print fpe1.version
fpe1.cmd_start_frames()
fpe1.cmd_stop_frames()
if check_house_keeping_voltages(fpe1):
print "Wrapper load complete. Interface volta... |
gfeiden/Notebook | Projects/ngc2516_spots/sta_spots_hrd_spread.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
cd /Users/grefe950/Projects/starspot/models/age_120.0+z_0.00/sts/
# routine to load a compressed isochrones
def loadIsochrone(filename):
iso = np.genfromtxt(filename)
bools = [x[0] < 1.65 for x in iso]
return np.compress(bools, iso, axi... |
NeuroDataDesign/seelviz | Jupyter/ClarityVizPipelineResultsAccuracy.ipynb | apache-2.0 | from clarityviz import claritybase
from clarityviz import densitygraph
c = claritybase(token, source_directory)
c.applyLocalEq()
c.loadGeneratedNii()
c.calculatePoints(0.9, 0.005)
c.savePoints()
c.generate_plotly_html()
"""
Explanation: Testing the pipeline and seeing if results are accurate.
img -> nii -> csv -... |
anhquan0412/deeplearning_fastai | deeplearning1/nbs/dogscats-ensemble.ipynb | apache-2.0 | path = "data/dogscats/"
# path = "data/dogscats/sample/"
model_path = path + 'models/'
if not os.path.exists(model_path): os.mkdir(model_path)
batch_size=128
# batch_size=1
batches = get_batches(path+'train', shuffle=False, batch_size=batch_size)
val_batches = get_batches(path+'valid', shuffle=False, batch_size=batch... |
tanmay987/deepLearning | dcgan-svhn/DCGAN_Exercises.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... |
alexandrnikitin/workshops | automated-feature-engineering-selection/notebooks/3-featuretools-scale.ipynb | mit | import os
from datetime import datetime
from glob import glob
import numpy as np
import pandas as pd
import featuretools as ft
from dask import bag
from dask.diagnostics import ProgressBar
from featuretools.primitives import *
pbar = ProgressBar()
pbar.register()
"""
Explanation: Scaling Featuretools with Dask
htt... |
hagne/atm-py | examples/instruments_POPS_calibration.ipynb | mit | reload(calibration)
cal = calibration.generate_calibration(
single_pnt_cali_d=508,
single_pnt_cali_ior=1.6,
single_pnt_cali_int=1000,
noise_level = 12,
ior=2.95,
dr=[100, 5000],
no_pts=500,
no_cal_pts=60,
plot=True,
raise_error=True,
test=False,
)
"""
Explanation: Generate ... |
bashtage/statsmodels | examples/notebooks/predict.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
plt.rc("figure", figsize=(16, 8))
plt.rc("font", size=14)
"""
Explanation: Prediction (out of sample)
End of explanation
"""
nsample = 50
sig = 0.25
x1 = np.linspace(0, 20, nsample)
X = np.column_stack((x1, np.sin(x... |
Aniruddha-Tapas/Applied-Machine-Learning | Classification/Car Evaluation using Decision trees and Random Forests.ipynb | mit | import os
from sklearn.tree import DecisionTreeClassifier, export_graphviz
import pandas as pd
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn import cross_validation, metrics
from sklearn.ensemble import RandomForestClassifier
from time import time
from sklearn import preprocessin... |
berquist/ipython_notebooks_for_qc | notebooks/Reading QM outputs - EDA and COVP.ipynb | mpl-2.0 | from __future__ import print_function
from __future__ import division
import numpy as np
"""
Explanation: Reading QM outputs - EDA and COVP calculations
End of explanation
"""
outputfilepath = "../qm_files/drop_0001_1qm_2mm_eda_covp.out"
"""
Explanation: Normally, one would want a very generalized way of reading i... |
google-research/rigl | rigl/rigl_tf2/colabs/MnistProp.ipynb | apache-2.0 | #@title Imports and Definitions
import numpy as np
import os
import tensorflow.compat.v2 as tf
tf.enable_v2_behavior()
import gin
from rigl import sparse_utils
from rigl.rigl_tf2 import init_utils
from rigl.rigl_tf2 import utils
from rigl.rigl_tf2 import train
from rigl.rigl_tf2 import networks
from rigl.rigl_tf2 impo... |
M-R-Houghton/euroscipy_2015 | scikit_image/lectures/0_color_and_exposure.ipynb | mit | from skimage import data
color_image = data.chelsea()
print(color_image.shape)
plt.imshow(color_image);
"""
Explanation: Color and exposure
As discussed earlier, images are just numpy arrays. The numbers in those arrays correspond to the intensity of each pixel (or, in the case of a color image, the intensity of a s... |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_topo_compare_conditions.ipynb | bsd-3-clause | # Authors: Denis Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne.viz import plot_evoked_topo
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
"""
... |
jinzishuai/learn2deeplearn | deeplearning.ai/C2.ImproveDeepNN/week1-hw/Regularization/Regularization.ipynb | gpl-3.0 | # import packages
import numpy as np
import matplotlib.pyplot as plt
from reg_utils import sigmoid, relu, plot_decision_boundary, initialize_parameters, load_2D_dataset, predict_dec
from reg_utils import compute_cost, predict, forward_propagation, backward_propagation, update_parameters
import sklearn
import sklearn.da... |
kit-cel/lecture-examples | mloc/ch4_Deep_Learning/pytorch/Deep_NN_Detection_BPSK.ipynb | gpl-2.0 | import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import matplotlib.pyplot as plt
from ipywidgets import interactive
import ipywidgets as widgets
%matplotlib inline
device = 'cuda' if torch.cuda.is_available() else 'cpu'
print("We are using the following device for learning:",device)
... |
qutip/qutip-notebooks | examples/qip-customize-device.ipynb | lgpl-3.0 | # imports
import numpy as np
from qutip import sigmax, sigmay, sigmaz, tensor, fidelity
from qutip import basis
from qutip_qip.pulse import Pulse
from qutip_qip.device import ModelProcessor, Model
from qutip_qip.circuit import QubitCircuit
from qutip_qip.compiler import GateCompiler, Instruction, SpinChainCompiler
fr... |
ajhenrikson/phys202-2015-work | assignments/assignment05/InteractEx02.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 2
Imports
End of explanation
"""
def plot_sine1(a,b):
x=np.arange(0,4*np.pi,.1)
plt.plot(np.sin(a*x+... |
kingmolnar/DataScienceProgramming | 04-Pandas-Data-Tables/APD-Crime-Data_class.ipynb | cc0-1.0 | ### Load libraries
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
help(plt.legend)
"""
Explanation: Atlanta Police Department
The Atlanta Police Department provides Part 1 crime data at http://www.atlantapd.org/i-want-to/crime-data-downloads
A recent copy of the data file i... |
feststelltaste/software-analytics | notebooks/Spotting co-changing files.ipynb | gpl-3.0 | from lib.ozapfdis.git_tc import log_numstat
commits = log_numstat("../../synthetic_repo//")
commits
"""
Explanation: Introduction
In his book Software Design X-Rays, Adam Tornhill shows a nice metric to find out if some parts of your code are coupled regarding their conjoint changes: Temporal Coupling.
In this and the... |
khalido/nd101 | intro_to_CNN.ipynb | gpl-3.0 | input = tf.placeholder(tf.float32, (None, 32, 32, 3))
filter_weights = tf.Variable(tf.truncated_normal((8, 8, 3, 20))) # (height, width, input_depth, output_depth)
filter_bias = tf.Variable(tf.zeros(20))
strides = [1, 2, 2, 1] # (batch, height, width, depth)
padding = 'VALID'
conv = tf.nn.conv2d(input, filter_weights, ... |
poldrack/fmri-analysis-vm | analysis/MVPA/RSA.ipynb | mit | import numpy
import nibabel
import os
from haxby_data import HaxbyData
from nilearn.input_data import NiftiMasker
%matplotlib inline
import matplotlib.pyplot as plt
import sklearn.manifold
import scipy.cluster.hierarchy
datadir='/home/vagrant/nilearn_data/haxby2001/subj2'
print('Using data from %s'%datadir)
haxbydat... |
kkai/perception-aware | 5.workshop/US Baby Names.ipynb | mit | !head -n 10 data/names/yob1880.txt
import pandas as pd
import numpy as np
%matplotlib inline
names1880 = pd.read_csv('data/names/yob1880.txt', names=['name', 'sex', 'births'])
names1880
names1880.groupby('sex').births.sum()
"""
Explanation: US Baby Names
This example is taken and adapted from the "Data Analysis fo... |
conversationai/conversationai-models | model_evaluation/jigsaw_evaluation_pipeline.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import getpass
from IPython.display import display
import json
import nltk
import numpy as np
import pandas as pd
import pkg_resources
import os
import random
import re
impo... |
ES-DOC/esdoc-jupyterhub | notebooks/nims-kma/cmip6/models/sandbox-2/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nims-kma', 'sandbox-2', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: NIMS-KMA
Source ID: SANDBOX-2
Sub-Topics: Radiative Forcings.
Properties:... |
jcbozonier/research | notebooks/PyDataNYC2017.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Bayesian Statistics From Scratch
Building up to MCMC
Justin Bozonier
Lead Data Scientist, GrubHub
@databozo
justin@bozonier.com
http://www.databozo.com
GETTING STARTED
End of explanation
"""
p_m1 = (0.05*0.2)#/(.2*0.05+0.3*0.03+0.... |
jbwhit/WSP-312-Tips-and-Tricks | notebooks/09-Extras.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format='retina'
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_context('talk')
sns.set_style('darkgrid')
plt.rcParams['figure.figsize'] = 12, 8 # plotsize
import numpy as np
import pandas as pd
# plot residuals
from itertools import groupby # NOT REG... |
tien-le/uranus | 03_getting_started_with_iris.ipynb | mit | from IPython.display import IFrame
IFrame('http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data', width=300, height=200)
"""
Explanation: Getting started in scikit-learn with the famous iris dataset
From the video series: Introduction to machine learning with scikit-learn
Agenda
What is the famous ... |
mne-tools/mne-tools.github.io | 0.21/_downloads/04c2d1e64afcdd4e5032afb2212a74e5/plot_objects_from_arrays.ipynb | bsd-3-clause | # Author: Jaakko Leppakangas <jaeilepp@student.jyu.fi>
#
# License: BSD (3-clause)
import numpy as np
import neo
import mne
print(__doc__)
"""
Explanation: Creating MNE objects from data arrays
In this simple example, the creation of MNE objects from
numpy arrays is demonstrated. In the last example case, a
NEO fil... |
ricklupton/ipysankeywidget | examples/Exporting Images.ipynb | mit | from ipysankeywidget import SankeyWidget
from ipywidgets import Layout
links = [
{'source': 'start', 'target': 'A', 'value': 2},
{'source': 'A', 'target': 'B', 'value': 2},
{'source': 'C', 'target': 'A', 'value': 2},
{'source': 'A', 'target': 'C', 'value': 2},
]
layout = Layout(width="500", height="20... |
maxis42/ML-DA-Coursera-Yandex-MIPT | 2 Supervised learning/Lectures notebooks/8 bike sharing demand part 2/sklearn.case_part2.ipynb | mit | from sklearn import cross_validation, grid_search, linear_model, metrics, pipeline, preprocessing
import numpy as np
import pandas as pd
%pylab inline
"""
Explanation: Sklearn
Bike Sharing Demand
Задача на kaggle: https://www.kaggle.com/c/bike-sharing-demand
По историческим данным о прокате велосипедов и погодных ус... |
jo-c-2017/DS_Projects | dsi_json_exercise.ipynb | apache-2.0 | import pandas as pd
"""
Explanation: JSON examples and exercise
get familiar with packages for dealing with JSON
study examples with JSON strings and files
work on exercise to be completed and submitted
reference: http://pandas.pydata.org/pandas-docs/stable/io.html#io-json-reader
data source: http://jsonstudio.... |
tuanavu/coursera-university-of-washington | machine_learning/3_classification/assigment/week7/module-10-online-learning-assignment-graphlab.ipynb | mit | from __future__ import division
import graphlab
"""
Explanation: Training Logistic Regression via Stochastic Gradient Ascent
The goal of this notebook is to implement a logistic regression classifier using stochastic gradient ascent. You will:
Extract features from Amazon product reviews.
Convert an SFrame into a Num... |
zczapran/datascienceintensive | racial_disc/sliderule_dsi_inferential_statistics_exercise_2.ipynb | mit | import pandas as pd
import numpy as np
from scipy import stats
data = pd.io.stata.read_stata('data/us_job_market_discrimination.dta')
# number of callbacks for black-sounding names
sum(data[data.race=='b'].call)
data.head()
"""
Explanation: Examining Racial Discrimination in the US Job Market
Background
Racial disc... |
tiagoantao/biopython-notebook | notebooks/06 - Multiple Sequence Alignment objects.ipynb | mit | from Bio import AlignIO
alignment = AlignIO.read("data/PF05371_seed.sth", "stockholm")
"""
Explanation: Source of the materials: Biopython cookbook (adapted)
<font color='red'>Status: Draft</font>
Multiple Sequence Alignment objects {#chapter:Bio.AlignIO}
This chapter is about Multiple Sequence Alignments, by which we... |
wbinventor/openmc | examples/jupyter/mdgxs-part-i.ipynb | mit | from IPython.display import Image
Image(filename='images/mdgxs.png', width=350)
"""
Explanation: This IPython Notebook introduces the use of the openmc.mgxs module to calculate multi-energy-group and multi-delayed-group cross sections for an infinite homogeneous medium. In particular, this Notebook introduces the the ... |
WNoxchi/Kaukasos | FAI02_old/Lesson9/Neural-Super-Resolution-codealong.ipynb | mit | %matplotlib inline
import importlib
import sys, os; sys.path.insert(1, os.path.join('../utils'))
from utils2 import *
from scipy.optimize import fmin_l_bfgs_b
from scipy.misc import imsave
from keras import metrics
from vgg16_avg import VGG16_Avg
from bcolz_array_iterator import BcolzArrayIterator
limit_mem()
# path... |
mne-tools/mne-tools.github.io | 0.21/_downloads/6684371ec2bc8e72513b3bdbec0d3a9f/plot_20_events_from_raw.ipynb | bsd-3-clause | import os
import numpy as np
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)
raw.crop(tmax=60).load_data()
"""
Explanati... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/SDK_Custom_Training_Python_Package_Managed_Text_Dataset_Tensorflow_Serving_Container.ipynb | apache-2.0 | !pip3 uninstall -y google-cloud-aiplatform
!pip3 install google-cloud-aiplatform
import IPython
app = IPython.Application.instance()
app.kernel.do_shutdown(True)
"""
Explanation: Feedback or issues?
For any feedback or questions, please open an issue.
Vertex SDK for Python: Custom Training using Python Package, Manag... |
kmclaugh/fastai_courses | deeplearning1/nbs/lesson5.ipynb | apache-2.0 | from keras.datasets import imdb
idx = imdb.get_word_index()
"""
Explanation: Setup data
We're going to look at the IMDB dataset, which contains movie reviews from IMDB, along with their sentiment. Keras comes with some helpers for this dataset.
End of explanation
"""
idx_arr = sorted(idx, key=idx.get)
idx_arr[:10]
... |
eds-uga/cbio4835-sp17 | lectures/Lecture24.ipynb | mit | import matplotlib as mpl
import matplotlib.pyplot as plt
"""
Explanation: Lecture 24: Visualization with matplotlib
CBIO (CSCI) 4835/6835: Introduction to Computational Biology
Overview and Objectives
Data visualization is one of, if not the, most important method of communicating data science results. It's analogous ... |
broundy/udacity | nanodegrees/deep_learning_foundations/unit_3/project_3/dlnd_tv_script_generation.ipynb | unlicense | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
data_dir = './data/simpsons/moes_tavern_lines.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
text = text[81:]
"""
Explanation: TV Script Generation
In this project, you'll generate your own Simpsons TV scrip... |
alexvmarch/pandas_intro | 03_pcf.ipynb | mit | xyz = pd.read_hdf('xyz.hdf5', 'xyz')
twobody = pd.read_hdf('twobody.hdf5', 'twobody')
"""
Explanation: Load the twobody data
End of explanation
"""
from scipy.integrate import cumtrapz
def pcf(A, B, a, twobody, dr=0.05, start=0.5, end=7.5):
'''
Pair correlation function between two atom types.
'''
d... |
random-forests/tensorflow-workshop | archive/zurich/00_download_data.ipynb | apache-2.0 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
# Some of these are hard to distinguish.
# Check https://quickdraw.withgoogle.com/data for examples
zoo = ['frog', 'horse', 'lion', 'monkey', 'octopus', 'owl', 'rhino... |
chengsoonong/mclass-sky | projects/alasdair/notebooks/contextual_bandits.ipynb | bsd-3-clause | import numpy as np
import pandas as pd
import pickle
import seaborn as sns
from pandas import DataFrame, Index
from sklearn import metrics
from sklearn.linear_model import SGDClassifier
from sklearn.svm import SVC
from sklearn.kernel_approximation import RBFSampler, Nystroem
from sklearn.linear_model import PassiveAggr... |
lionell/university-labs | eco_systems/lab4.ipynb | mit | br = 128 # birth rate
dr = 90 # death rate
cr = 2 # inner competiton
"""
Explanation: <img src='https://i.ytimg.com/vi/P1X-WpfUvm4/maxresdefault.jpg' />
Part 1
$$ \frac{dN}{dt} = \frac{\alpha N^{2}}{N + 1} - \beta N - \gamma N^{2} $$
End of explanation
"""
s = br - dr - cr
c = (s**2 - 4*dr*cr)**0.5
a, b = (-c-s) ... |
ES-DOC/esdoc-jupyterhub | notebooks/awi/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', 'awi', 'sandbox-3', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: AWI
Source ID: SANDBOX-3
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radiat... |
kristinriebe/cosmosim-uws-notebook | cosmosim-uws-intro.ipynb | apache-2.0 | # load astropy for reading VOTABLE format
from astropy.io.votable import parse_single_table
# import matplotlib for plotting results, mplot3d for 3D plots
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# import sys
# sys.path.append('<your own path>/uws-client')
from uws import UWS
"""
Expl... |
gojomo/gensim | docs/notebooks/deepir.ipynb | lgpl-2.1 | # ### uncomment below if you want...
# ## ... copious amounts of logging info
# import logging
# logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
# rootLogger = logging.getLogger()
# rootLogger.setLevel(logging.INFO)
# ## ... or auto-reload of gensim during development
# %load... |
tensorflow/examples | lite/codelabs/digit_classifier/ml/step2_train_ml_model.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... |
kaysg/NLPatelier | libexp_PyTorch/libexp_PyTorch1.ipynb | gpl-3.0 | import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
torch.manual_seed(1)
# ベクトルからテンソルへの変換
V_data = [1., 2., 3.]
V = torch.Tensor(V_data)
print(V)
# テンソルの転置
print(V.view(1,-1))
# 2次元行列からテンソルへの変換
M_data = [[1., 2., 3.], [4., 5., 6]]
M = torc... |
SGenheden/lammps | python/examples/ipython/interface_usage.ipynb | gpl-2.0 | from lammps import IPyLammps
L = IPyLammps()
# 3d Lennard-Jones melt
L.units("lj")
L.atom_style("atomic")
L.atom_modify("map array")
L.lattice("fcc", 0.8442)
L.region("box block", 0, 4, 0, 4, 0, 4)
L.create_box(1, "box")
L.create_atoms(1, "box")
L.mass(1, 1.0)
L.velocity("all create", 1.44, 87287, "loop geom")
L.... |
ES-DOC/esdoc-jupyterhub | notebooks/csir-csiro/cmip6/models/sandbox-1/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csir-csiro', 'sandbox-1', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: CSIR-CSIRO
Source ID: SANDBOX-1
Topic: Landice
Sub-Topics: Glaciers, Ice. ... |
YuguangTong/AY250-hw | hw_4/homework4_Tong.ipynb | mit | from random import uniform
from time import time
def sample_circle(n):
"""
throw n darts in [0, 1] * [0, 1] square, return the number
of darts inside unit circle.
Parameter
---------
n: number of darts to throw.
Return
------
m: number of darts inside unit circle.
... |
Kunstenpunt/datakunstjes | cd_of_vinyl/CD of Vinyl in het muziekcentrum?.ipynb | apache-2.0 | from pandas import read_csv
df = read_csv("carriers.csv", delimiter=",", quoting=1, escapechar="\\", header=None)
df.columns = ["Titel", "Jaar van uitgave", "Type drager"]
df.head()
"""
Explanation: CD of Vinyl?
Gisteren deed mijn collega de boude uitspraak dat er steeds meer en meer op vinyl uitgebracht werd. Ik vro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.