repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
nbokulich/short-read-tax-assignment
ipynb/mock-community/taxonomy-assignment-qiime1.ipynb
bsd-3-clause
from os.path import join, expandvars from joblib import Parallel, delayed from glob import glob from os import system from tax_credit.framework_functions import (parameter_sweep, generate_per_method_biom_tables, move_results_to_rep...
tanyaschlusser/stats-via-python
notebooks/input_output.ipynb
mit
# The library for handling tabular data is called 'pandas' # Everyone shortens this to 'pd' for convenience. import pandas as pd """ Explanation: Reading Excel files This notebook demonstrates how to read and manipulate data from Excel using Pandas: Input / Output summaries plotting First, import the Pandas library:...
ereodeereigeo/dataTritiumWS22
histograma de velocidades.ipynb
gpl-2.0
import pandas as pd import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Número de datos obtenidos y perdidos Importamos las librerías necesarias End of explanation """ import ext_datos as ext import procesar as pro import time_plot as tplt """ Explanation: Importamos las librerías creadas para tra...
google/starthinker
colabs/lineitem_read_to_bigquery_via_value.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: 1. Install Dependencies First install the libraries needed to execute recipes, this only needs to be done once, then click play. End of explanation """ CLOUD_PROJECT = 'PASTE PROJECT ID HERE' print("Cloud Project Set To: %s" % CLOUD_PROJECT) ...
drakero/Electron_Spectrometer
Read MCNP Output.ipynb
mit
#Imports from math import * import cmath import numpy as np import scipy as sp import scipy.special import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns import IPython.display as IPdisplay import sys import os #Import custom modules from physics import * sns.set(font_scale=2.0) sns.set_style...
mne-tools/mne-tools.github.io
0.23/_downloads/98d9662291626be9c938eee7a8fcc9bd/sensor_noise_level.ipynb
bsd-3-clause
# Author: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import os.path as op import mne data_path = mne.datasets.sample.data_path() raw_erm = mne.io.read_raw_fif(op.join(data_path, 'MEG', 'sample', 'ernoise_raw.fif'), preload=True) """ Explanation: Show nois...
xtr33me/deep-learning
embeddings/Skip-Grams-Solution.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...
sourabhrohilla/ds-masterclass-hands-on
session-1/python/intrusion_detection_binary.ipynb
mit
# read raw data raw_data = pd.read_csv('/home/phoenix/Documents/session_1_data_train.csv') test_data = pd.read_csv('/home/phoenix/Documents/session_1_data_test.csv') test_data.columns = raw_data.columns raw_data.head() raw_data.label.value_counts().keys() test_data.label.value_counts().keys() # remove ". " from la...
andim/evolimmune
figSIopt/figure-SIopt.ipynb
mit
import sys sys.path.append('../lib/') import numpy as np import matplotlib.text import matplotlib.pyplot as plt from matplotlib import cm %matplotlib inline import shapely.ops import plotting import evolimmune from plotting import * import analysis %load_ext autoreload %autoreload 2 plt.style.use(['paper']) eps = 1e-8 ...
bennyrowland/suspect
docs/notebooks/plot_1D_signals_tutorial.ipynb
mit
import suspect import numpy as np import matplotlib.pyplot as plt import matplotlib %matplotlib inline """ Explanation: Plotting 1D MRS data using Suspect's plot_1D_signals module Suspect's plot_1D_signals module provides a set of functions for plotting MRS data. It is built on matplotlib's library of plotting functio...
adrianstaniec/deep-learning
01_first-neural-network/Your_first_neural_network.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: My first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code, ...
satishgoda/learning
python/jupyter/usecases/py3_docs_tutorial_controlflow.ipynb
mit
x = int(input("Please enter an integer: ")) x if x < 0: x = 0 print('Negative changed to zero') elif x == 0: print('Zero') elif x == 1: print('Single') else: print('More') """ Explanation: https://docs.python.org/3.7/tutorial/controlflow.html if Statements End of explanation """ # Measure some ...
jacobdein/alpine-soundscapes
Compute naturalness areas.ipynb
mit
naturalness = 'naturalness' naturalness_value_field = 'value' n_types = 7 sample_points = 'sample_points_field' radius = 500 use_viewshed = False """ Explanation: Compute naturalness areas This notebook computes the naturalness areas for each point in a 'sample_points' vector map based on a 'naturalness' vector m...
JShadowMan/package
python/course/ch02-syntax-and-container/常用容器.ipynb
mit
# 空元祖可以直接使用 `()` 进行声明, 也可以使用tuple()进行声明 (), type(()), tuple(), type(tuple()) # 单个元素的元组使用`()`的方式声明必须在元素之后增加`,` print( (1), (1,) ) t1 = (1, 2.33, ("tuple",), ["hello"]) """ Explanation: Python中的常用容器 Python中的容器类型包括序列类型, 集合类型, 映射类型 序列类型 Python中有以下三种基本序列类型, 所谓序列(Sequence)即表示容器内的元素是有顺序的. * tuple(元组): 元组是不可变序列,通常用于储存异构数据的...
jserenson/Python_Bootcamp
Numbers.ipynb
gpl-3.0
# Addition 2+1 # Subtraction 2-1 # Multiplication 2*2 # Division 3/2 """ Explanation: Numbers and more in Python! In this lecture, we will learn about numbers in Python and how to use them. We'll learn about the following topics: 1.) Types of Numbers in Python 2.) Basic Arithmetic 3.) Differences between Python 2 v...
ES-DOC/esdoc-jupyterhub
notebooks/dwd/cmip6/models/sandbox-3/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'dwd', 'sandbox-3', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: DWD Source ID: SANDBOX-3 Topic: Ocean Sub-Topics: Timestepping Framework, Advection, ...
luisriera/Udacity_Finding_Lane_Lines
P1-luis.riera.ipynb
gpl-3.0
#importing some useful packages import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 %matplotlib inline """ Explanation: Self-Driving Car Engineer Nanodegree Project: Finding Lane Lines on the Road In this project, you will use the tools you learned about in the lesson to ide...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/recommendation_systems/labs/dcn.ipynb
apache-2.0
# Installing the necessary libraries. !pip install -q tensorflow-recommenders !pip install -q --upgrade tensorflow-datasets # Importing the necessary modules. import pprint %matplotlib inline import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable import numpy as np import tensorflow ...
JamesSample/icpw
toc_report_feb_2019_part2.ipynb
mit
# Select projects prj_grid = nivapy.da.select_resa_projects(eng) prj_grid prj_df = prj_grid.get_selected_df() print (len(prj_df)) prj_df # Get stations stn_df = nivapy.da.select_resa_project_stations(prj_df, eng) print(len(stn_df)) stn_df.head() # Map nivapy.spatial.quickmap(stn_df, popup='station_code') """ Explan...
h-mayorquin/time_series_basic
presentations/2016-01-22(Wall-Street-Letter-Prediction-Ndata).ipynb
bsd-3-clause
import numpy as np import h5py from sklearn import svm, cross_validation from sklearn.naive_bayes import MultinomialNB """ Explanation: Prediction of letters as a function of data used In this notebook we do the same tasks of predicting next letter using Nexa. However, we test here how does the prediction become with ...
mne-tools/mne-tools.github.io
0.23/_downloads/f5853db1ea98f82173310d147f23289c/compute_mne_inverse_epochs_in_label.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.minimum_norm import apply_inverse_epochs, read_inverse_operator from mne.minimum_norm import apply_inverse print(__doc__) data...
TheOregonian/long-term-care-db
notebooks/analysis/.ipynb_checkpoints/facilities_analysis-checkpoint.ipynb
mit
import pandas as pd import numpy as np from IPython.core.display import display, HTML display(HTML("<style>.container { width:100% !important; }</style>")) df = pd.read_csv('/Users/fzarkhin/OneDrive - Advance Central Services, Inc/fproj/github/database-story/data/processed/facilities.csv') """ Explanation: This is a ...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/cmip6/models/miroc-es2h/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'miroc-es2h', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: MIROC Source ID: MIROC-ES2H Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy B...
vinitsamel/udacitydeeplearning
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...
griffinfoster/fundamentals_of_interferometry
6_Deconvolution/6_5_source_finding.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt %matplotlib inline from IPython.display import HTML HTML('../style/course.css') #apply general CSS import matplotlib from scipy import optimize import astropy.io.fits matplotlib.rcParams.update({'font.size': 18}) matplotlib.rcParams.update({'figure.figsize': [12,8]}...
pastas/pasta
examples/notebooks/19_snowmodel.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.signal import fftconvolve import pastas as ps ps.set_log_level("ERROR") ps.show_versions(numba=True) """ Explanation: Snow model R.A. Collenteur, University of Graz / Eawag, November 2021 In this notebook it is shown how to account for...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/cmip6/models/miroc-es2l/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'miroc-es2l', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: MIROC Source ID: MIROC-ES2L Sub-Topics: Radiative Forcings. Properties: 85 ...
BDannowitz/polymath-progression-blog
jlab-ml-lunch-2/notebooks/01-Recommender-System.ipynb
gpl-2.0
import numpy as np import pandas as pd from scipy.sparse.linalg import svds from sklearn.metrics import mean_squared_error import matplotlib.pyplot as plt from jlab import load_test_data X_train = pd.read_csv('MLchallenge2_training.csv') X_test = load_test_data('test_in.csv') X = (pd.concat([X_test, X_train], axis=0)...
paulcon/active_subspaces
tutorials/test_functions/wing_weight/wing_example.ipynb
mit
import active_subspaces as ac import numpy as np %matplotlib inline # The wing_functions.py file contains two functions: the wing function (wing(xx)) # and its gradient (wing_grad(xx)). Each takes an Mx10 matrix (M is the number of data # points) with rows being normalized inputs; wing returns a column vector of funct...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session05/Day4/stackdiff_Narayan/01_Registration/Register_images_solutions.ipynb
mit
!ls *fits """ Explanation: Image Registration Exercise Written by Gautham Narayan (gnarayan@stsci.edu) for LSST DSFP #5 In this directory, you should be able to find two fits file from one of the projects I worked on End of explanation """ import astropy.io.fits as afits from astropy.wcs import WCS from astropy.visu...
neurodata/ndmg
tutorials/Tutorial_of_QA_for_FAST.ipynb
apache-2.0
import matplotlib.pyplot as plt import numpy as np import nibabel as nb from scipy import ndimage from matplotlib.colors import LinearSegmentedColormap from m2g.utils.qa_utils import pad_im from m2g.stats.qa_fast import qa_fast_png """ Explanation: Tutorial of QA_FAST(FMRIB's Automated Segmentation Tool) FAST (FMRIB's...
GoogleCloudPlatform/asl-ml-immersion
notebooks/docker_and_kubernetes/solutions/3_k8s_hello_node.ipynb
apache-2.0
!cat ./src/server.js """ Explanation: Hello Node Kubernetes Learning Objectives * Create a Node.js server * Create a Docker container image * Create a container cluster and a Kubernetes pod * Scale up your services Overview The goal of this hands-on lab is for you to turn code that you have developed into a replic...
NathanYee/ThinkBayes2
bayesianLinearRegression/Final Report-V2.ipynb
gpl-2.0
from __future__ import print_function, division % matplotlib inline import warnings warnings.filterwarnings('ignore') import math import numpy as np from thinkbayes2 import Pmf, Cdf, Suite, Joint, EvalNormalPdf import thinkplot import pandas as pd import matplotlib.pyplot as plt """ Explanation: Bayesian Linear Reg...
empet/Plotly-plots
Strips-on-sphere.ipynb
gpl-3.0
import numpy as np """ Explanation: Strips on sphere End of explanation """ theta=np.linspace(0, 5*np.pi/36, 30) #5pi/36=25 degrees phi=np.linspace(-np.pi/2, np.pi/2, 100) theta, phi=np.meshgrid(theta, phi) x=np.cos(theta)*np.cos(phi) y=np.sin(theta)*np.cos(phi) z=np.sin(phi) """ Explanation: We generate a sphere ...
ebegoli/SynthNotes
extra/clustering.ipynb
mit
# do the reading templates = pd.read_parquet('data/processed_dfs/templates.parquet' ) sentences = pd.read_parquet('data/processed_dfs/sentences.parquet') mentions = pd.read_parquet('data/processed_dfs/mentions.parquet') umls = pd.read_parquet('data/processed_dfs/umls.parquet') sentences.head() mentions.head() templ...
heprom/pymicro
examples/SampleDataUserGuide/4_SampleData_Mesh_groups.ipynb
mit
# Import the Sample Data class from pymicro.core.samples import SampleData as SD from config import PYMICRO_EXAMPLES_DATA_DIR # import file directory path import os dataset_file = os.path.join(PYMICRO_EXAMPLES_DATA_DIR, 'test_sampledata_ref') # test dataset file path data = SD(filename=dataset_file) """ Explanation: ...
idekerlab/py2cytoscape
examples/view_api_samples.ipynb
mit
from py2cytoscape.data.cynetwork import CyNetwork from py2cytoscape.data.cyrest_client import CyRestClient import pandas as pd import json # Create REST client for Cytoscape cy = CyRestClient() # Reset current session for fresh start cy.session.delete() # Load a sample network network1 = cy.network.create_from('htt...
google-research/rlds
rlds/examples/rlds_performance.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...
nick-youngblut/SIPSim
ipynb/bac_genome/fullCyc/trimDataset/.ipynb_checkpoints/dataset_info-checkpoint.ipynb
mit
%load_ext rpy2.ipython %%R workDir = '/home/nick/notebook/SIPSim/dev/fullCyc/' physeqDir = '/home/nick/notebook/SIPSim/dev/fullCyc_trim/' physeqBulkCore = 'bulk-core_trm' physeqSIP = 'SIP-core_unk_trm' ampFragFile = '/home/nick/notebook/SIPSim/dev/bac_genome1147/validation/ampFrags_kde.pkl' """ Explanation: General...
jvitria/DeepLearningBBVA2016
3.0 Basic Concepts.ipynb
mit
# import some python packages %matplotlib inline import matplotlib.pyplot as plt import seaborn """ Explanation: Start with TensorFlow End of explanation """ import numpy as np a = np.zeros((2,2)); b = np.ones((2,2)) print np.sum(b,axis=1) print a.shape print np.reshape(a,(1,4)) """ Explanation: What is TensorF...
rsterbentz/phys202-2015-work
days/day20/Cython.ipynb
mit
import numpy as np %load_ext Cython """ Explanation: Short Tour of Cython In general, Python is slower than other programming languages such as C, C++ and Java. Much of this comes from the fact that Python is dynamically typed. This means that when Python is compiling code to be run by the interpreter, it doesn't ma...
garibaldu/multicauseRBM
Max/Evaluating-using-Dreams-from-the-orbm.ipynb
mit
pp.image(expit(two_dream_phi).reshape(28,28), color_range=(0,1)) pp.image(expit(three_dream_phi).reshape(28,28), color_range=(0,1)) """ Explanation: Lets take a quick look at the images if instead of combining they had just done their own thing End of explanation """ pp.image(np.maximum(two_ds[0], three_ds[0]), cmap...
sz2472/foundations-homework
data and database/Homework_5.ipynb
mit
from bs4 import BeautifulSoup from urllib.request import urlopen html = urlopen("http://static.decontextualize.com/cats.html").read() document = BeautifulSoup(html, "html.parser") """ Explanation: Homework #5 This homework presents a sophisticated scenario in which you must design a SQL schema, insert data into it, an...
adamamiller/PS1_star_galaxy
gaia/Gaia_PS1_compare.ipynb
mit
gaia_dir = "/Users/adamamiller/Desktop/PS1_fits/gaia_stars/" ps1_files = glob.glob("/Users/adamamiller/Desktop/PS1_fits/hdf5/*h5") """ Explanation: Merge the PS1 RF catalogs and the Gaia obvi stars catalog End of explanation """ gaia_df = pd.read_hdf(gaia_dir + "parallax_ps1_gaia_mag_pm_plx.h5") gaia_df.set_index("o...
RealPolitiX/mpes
examples/Tutorial_04_Distortion Correction.ipynb
mit
fpath = r'../data/data_114_4axis_100x100x200x50.h5' fbinned = fp.readBinnedhdf5(fpath) V = fbinned['V'] V.shape Eslice = V[15:20, :, :, 35:41].sum(axis=(0,3)) plt.imshow(Eslice, origin='lower', cmap='terrain_r') mc = aly.MomentumCorrector(V[15:20, :, :, :].sum(axis=0), rotsym=6) """ Explanation: 3.1 Correction of s...
TeachingDataScience/python-data-080815
Admin Notes.ipynb
mit
# Copy the file !curl https://raw.githubusercontent.com/TeachingDataScience/datasets/master/nyt1.csv > nyt1.csv # %load nytimes_counter.py # Import required libraries import csv # Start a counter and store the textfile in memory gender_counter = {} age_counter = {} lines = csv.reader(open('nyt1.csv')) lines.next(...
mne-tools/mne-tools.github.io
0.17/_downloads/66fec418bceb5ce89704fb8b44930330/plot_3d_to_2d.ipynb
bsd-3-clause
# Authors: Christopher Holdgraf <choldgraf@berkeley.edu> # # License: BSD (3-clause) from scipy.io import loadmat import numpy as np from mayavi import mlab from matplotlib import pyplot as plt from os import path as op import mne from mne.viz import ClickableImage # noqa from mne.viz import plot_alignment, snapshot_...
synthicity/activitysim
activitysim/examples/example_mtc/notebooks/change_in_auto_ownership.ipynb
agpl-3.0
!activitysim create -e example_mtc -d example_base_auto_own !activitysim create -e example_mtc -d example_base_auto_own_alternative """ Explanation: Testing a Change in the Auto Owernship Model Create two auto ownership examples to illustrate running two scenarios and analyzing results. This notebook assumes users a...
ethen8181/machine-learning
deep_learning/softmax_tensorflow.ipynb
mit
# code for loading the format for the notebook import os # path : store the current path to convert back to it later path = os.getcwd() os.chdir(os.path.join('..', 'notebook_format')) from formats import load_style load_style(plot_style = False) os.chdir(path) import numpy as np import matplotlib.pyplot as plt # 1....
google/applied-machine-learning-intensive
content/00_prerequisites/00_introduction_to_python/colab.ipynb
apache-2.0
# 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 the L...
IanHawke/ET-NumericalMethods-2016
solutions/01-finite-differencing.ipynb
mit
def backward_differencing(f, x_i, dx): """ Backward differencing of f at x_i with grid spacing dx. """ f_i = f(x_i) f_i_minus_1 = f(x_i - dx) return (f_i - f_i_minus_1) / dx def forward_differencing(f, x_i, dx): """ Forward differencing of f at x_i with grid spacing dx. """ ...
hankcs/HanLP
plugins/hanlp_demo/hanlp_demo/zh/tok_mtl.ipynb
apache-2.0
!pip install hanlp -U """ Explanation: <h2 align="center">点击下列图标在线运行HanLP</h2> <div align="center"> <a href="https://colab.research.google.com/github/hankcs/HanLP/blob/doc-zh/plugins/hanlp_demo/hanlp_demo/zh/tok_mtl.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Ope...
sorig/shogun
doc/ipython-notebooks/ica/bss_image.ipynb
bsd-3-clause
# change to the shogun-data directory import os import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') os.chdir(os.path.join(SHOGUN_DATA_DIR, 'ica')) import Image import numpy as np # Load Images as grayscale images and convert to numpy arrays s1 = np.asarray(Image.open("lena.jpg").convert('L')) s2 =...
statsmodels/statsmodels
examples/notebooks/statespace_sarimax_faq.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd rng = np.random.default_rng(20210819) eta = rng.standard_normal(5200) rho = 0.8 beta = 10 epsilon = eta.copy() for i in range(1, eta.shape[0]): epsilon[i] = rho * epsilon[i - 1] + eta[i] y = beta + epsilon y = y[200:] from statsmodels.tsa.api import SARIM...
telescopeuser/workshop_blog
setup_cloud.ipynb
mit
!python --version !pip install -U html !pip install -U pyqrcode !pip install -U config !pip install -U backports.tempfile !mv docs org_docs """ Explanation: Workshop Installation Guide 如何使用和开发微信聊天机器人的系列教程 A workshop to develop & use an intelligent and interactive chat-bot in WeChat WeChat is a popular social medi...
rishuatgithub/MLPy
classification/.ipynb_checkpoints/iris_ds-checkpoint.ipynb
apache-2.0
# Import the necessary ML Libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import neighbors, datasets from sklearn.model_selection import train_test_split # Read the Iris data set from pre-build scikit learn library iris=datasets.load_iris() iris.keys() # printing the fea...
ppham27/MLaPP-solutions
chap01/1.ipynb
mit
%matplotlib inline import numpy as np import idx2numpy import matplotlib.pyplot as plt import matplotlib.image as mpimg import matplotlib.colors as mpcolors import mnist from sklearn import neighbors train_image_labels = idx2numpy.convert_from_file('train-labels-idx1-ubyte') train_images = idx2numpy.convert_from_file...
hasadna/knesset-data-pipelines
jupyter-notebooks/running kns_committeesession pipeline.ipynb
mit
!{'cd /pipelines; KNESSET_LOAD_FROM_URL=1 dpp run ./committees/kns_documentcommitteesession >/dev/null'} !{'cd /pipelines; KNESSET_LOAD_FROM_URL=1 dpp run ./committees/kns_committee >/dev/null'} !{'cd /pipelines; KNESSET_LOAD_FROM_URL=1 dpp run ./committees/kns_cmtsessionitem >/dev/null'} !{'cd /pipelines; KNESSET_L...
rasbt/pattern_classification
parameter_estimation_techniques/maximum_likelihood_estimate.ipynb
gpl-3.0
import numpy as np np.random.seed(123456) # Generate 100 random patterns for class1 mu_vec1 = np.array([[0],[0]]) cov_mat1 = np.array([[3,0],[0,3]]) x1_samples = np.random.multivariate_normal(mu_vec1.ravel(), cov_mat1, 100) # Generate 100 random patterns for class2 mu_vec2 = np.array([[9],[0]]) cov_mat2 = np.array([...
AutuanLiu/Python
fastai_notes/LinearAlgebra/speech05.ipynb
mit
import numpy as np n = 5 A = np.random.rand(n,n) npQ, npR = np.linalg.qr(A) """ Explanation: fastai 线性代数 8. Implementing QR Factorization QR 分解 for any matrix $A$, $A = QR$ where $Q$ is orthogonal and $R$ is upper-triangular. End of explanation """ np.allclose(np.eye(n), npQ @ npQ.T), np.allclose(np.eye(n), npQ.T...
rigetticomputing/grove
examples/IsingSolver.ipynb
apache-2.0
from mock import patch, Mock from pyquil.api import WavefunctionSimulator from grove.ising.ising_qaoa import ising """ Explanation: This notebook is a short example of how to use the Ising solver implemented using the QAOA algorithm. We start by declaring the import of the ising function. End of explanation """ wit...
fluffy-hamster/A-Beginners-Guide-to-Python
A Beginners Guide to Python/Final Project (Minesweeper)/07. Lets Play!.ipynb
mit
import sys sys.path.append("..\misc") # Adding to sys.path allows us to find "minsweeper.py" import minesweeper minesweeper.main() """ Explanation: Lets play Minesweeper This lecture is a chill one. All I am going to do is play my implementation of minesweeper. I'll show you the code in the next lecture. End of exp...
nkarast/notebooks
Matplotlib_tutorial.ipynb
mit
from matplotlib import pyplot as plt %matplotlib inline plt.plot([5,6,7,8],[7,4,8,4]) ## Adding labels plt.title("Random Plot") plt.xlabel("$1/2\cdot x$") plt.ylabel("Dispersion $[m]$") """ Explanation: Matplotlib Tutorial Usually what we use is the pyplot module of matplotlib. Let's inline plt and make a simple plo...
gaufung/Data_Analytics_Learning_Note
DesignPattern/ComponentPattern.ipynb
mit
class Company: name = '' def __init__(self, name): self.name = name def add(self, company): pass def remove(self, company): pass def display(self, depth): pass def listDuty(self): pass class ConcreteCompany(Company): childrenCompany = None def __i...
feststelltaste/software-analytics
courses/20191014_ML-Summit/Parsing and Analysing vmstat Data the Easy Way (Demo Notebook).ipynb
gpl-3.0
%less ../datasets/vmstat_loadtest.log """ Explanation: Idea Using the vmstat command line utility to quickly determine the root cause of performance problems. End of explanation """ from ozapfdis.linux import vmstat stats = vmstat.read_logfile("../datasets/vmstat_loadtest.log") stats.head() """ Explanation: Data I...
echohenry2006/tvb-library
tvb/simulator/demos/region_stochastic.ipynb
gpl-2.0
from tvb.simulator.lab import * """ Explanation: Demonstrate using the simulator at the region level, stochastic integration. Run time: approximately 2 seconds (workstation circa 2010) Memory requirement: < 1GB End of explanation """ LOG.info("Configuring...") #Initialise a Model, Coupling, and Connectivity. oscill...
deepmind/educational
colabs/summer_schools/intro_to_graph_nets_tutorial_with_jraph.ipynb
apache-2.0
!pip install git+https://github.com/deepmind/jraph.git !pip install flax !pip install dm-haiku # Imports %matplotlib inline import functools import matplotlib.pyplot as plt import jax import jax.numpy as jnp import jax.tree_util as tree import jraph import flax import haiku as hk import optax import pickle import nump...
InsightSoftwareConsortium/SimpleITK-Notebooks
Python/35_Segmentation_Shape_Analysis.ipynb
apache-2.0
import SimpleITK as sitk import pandas as pd %matplotlib notebook import matplotlib.pyplot as plt import gui from math import ceil %run update_path_to_download_script from downloaddata import fetch_data as fdata """ Explanation: Focused Ion Beam Scanning Electron Microscopy Image Segmentation Summary: 1. SimpleITK ...
pligor/predicting-future-product-prices
04_time_series_prediction/27_price_history_generate_train_test_and_baseline.ipynb
agpl-3.0
bltest = MyBaseline(npz_path=npz_test) bltest.getMSE() bltest.renderMSEs() plt.show() bltest.getHuberLoss() bltest.renderHuberLosses() plt.show() %%time bltest.get_dtw() bltest.renderRandomTargetVsPrediction() plt.show() """ Explanation: Baseline is static, a straight line for each input - Test End of explanatio...
Kappa-Dev/ReGraph
examples/Tutorial_hierarchy_audit.ipynb
mit
from regraph import NXGraph, NXHierarchy from regraph.audit import VersionedHierarchy from regraph.rules import Rule from regraph import print_graph, plot_rule, plot_graph """ Explanation: Audit trails for hierarchy objects in ReGraph (aka versioning) ReGraph implements a framework for the version control (VC) of grap...
brettavedisian/Liquid-Crystals-Summer-2015
.ipynb_checkpoints/Annulus_Simple_Matplotlib-checkpoint.ipynb
mit
# commands for plotting, "plot" works with matplotlib def mesh2triang(mesh): xy = mesh.coordinates() return tri.Triangulation(xy[:, 0], xy[:, 1], mesh.cells()) def mplot_cellfunction(cellfn): C = cellfn.array() tri = mesh2triang(cellfn.mesh()) return plt.tripcolor(tri, facecolors=C) def mplot_fun...
pmorissette/bt
examples/buy_and_hold.ipynb
mit
names = ['foo','bar','rf'] dates = pd.date_range(start='2017-01-01',end='2017-12-31', freq=pd.tseries.offsets.BDay()) n = len(dates) rdf = pd.DataFrame( np.zeros((n, len(names))), index = dates, columns = names ) np.random.seed(1) rdf['foo'] = np.random.normal(loc = 0.1/n,scale=0.2/np.sqrt(n),size=n) rdf['...
solowPy/solowPy
examples/0 Motivation.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import numpy as np import sympy as sym import quantecon as qe import solowpy """ Explanation: <div align='center' ><img src='https://raw.githubusercontent.com/davidrpugh/numerical-methods/master/images/sgpe-logo.jpg' width="1200" height="100"><...
KitwareMedical/TubeTK
docs/examples/ConvertTubesToImages/ConvertTubesToImages.ipynb
apache-2.0
import os import sys import numpy # Path for TubeTK libs and bin #Values takend from TubeTK launcher sys.path.append("C:/src/TubeTK_Python_ITK/TubeTK-build/lib/") sys.path.append("C:/src/TubeTK_Python_ITK/TubeTK-build/lib/Release") # Setting TubeTK Build Directory TubeTK_BUILD_DIR=None if 'TubeTK_BUILD_DIR' in os.e...
xMyrst/BigData
python/howto/011_Módulo_NumPy_Arrays.ipynb
gpl-3.0
import numpy as np """ Explanation: MÓDULO NumPy Los módulos NumPy (Numerical Python) y SciPy proporcionan funciones y rutinas matemáticas para la manipulación de arrays y matrices de datos numéricos de una forma eficiente. El módulo SciPy extiende la funcionalidad de NumPy con una colección de algoritmos matemáticos...
beangoben/HistoriaDatos_Higgs
Dia3/.ipynb_checkpoints/6_Datos_Iris-checkpoint.ipynb
gpl-2.0
import pandas as pd import numpy as np # modulo de computo numerico import matplotlib.pyplot as plt # modulo de graficas # esta linea hace que las graficas salgan en el notebook import seaborn as sns %matplotlib inline """ Explanation: Classificando Iris Ahora vamos a ver un conjunto de datos muy famosos, los datos ir...
wise-r/R-Topics
7.Crawler/Presentation/爬虫工具.ipynb
mit
# 载入rpy2.ipython # rpy2提供了Python和R之间的交互环境 %load_ext rpy2.ipython """ Explanation: rvest & urllib2 简介 Fibears 2016.03.29 End of explanation """ %%R library(rvest) # vignette("selectorgadget") lego_movie <- read_html("http://www.imdb.com/title/tt1490017/") %%R lego_movie %%R rating <- lego_movie %>% html_nodes(...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/.ipynb_checkpoints/n08_simple_q_learner_1000_states_4_actions_full_training-checkpoint.ipynb
mit
# Basic imports import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime as dt import scipy.optimize as spo import sys from time import time from sklearn.metrics import r2_score, median_absolute_error from multiprocessing import Pool %matplotlib inline %pylab inline pylab.rcPar...
nbokulich/short-read-tax-assignment
ipynb/simulated-community/dataset-generation.ipynb
bsd-3-clause
from os.path import join, expandvars from tax_credit.simulated_communities import generate_simulated_communities # Project directory project_dir = expandvars("$HOME/Desktop/projects/short-read-tax-assignment/") # Directory containing reference sequence databases reference_database_dir = join(project_dir, 'data', 'ref...
yhilpisch/dx
06_dx_portfolio_parallel.ipynb
agpl-3.0
from dx import * import time from pylab import plt plt.style.use('seaborn') %matplotlib inline """ Explanation: <img src="http://hilpisch.com/tpq_logo.png" alt="The Python Quants" width="45%" align="right" border="4"> Parallel Valuation of Large Portfolios Derivatives (portfolio) valuation by Monte Carlo simulation is...
kevntao/ThinkStats2
code/.ipynb_checkpoints/chap03ex-checkpoint.ipynb
gpl-3.0
kids = resp['numkdhh'] kids """ Explanation: Make a PMF of <tt>numkdhh</tt>, the number of children under 18 in the respondent's household. End of explanation """ pmf = thinkstats2.Pmf(kids) thinkplot.Pmf(pmf, label='PMF') thinkplot.Show(xlabel='# of Children', ylabel='PMF') """ Explanation: Display the PMF. End of...
eigendreams/TensorFlow-Tutorials
01_Simple_Linear_Model.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import tensorflow as tf import numpy as np from sklearn.metrics import confusion_matrix """ Explanation: TensorFlow Tutorial #01 Simple Linear Model by Magnus Erik Hvass Pedersen / GitHub / Videos on YouTube Introduction This tutorial demonstrates the basic workflow o...
xR86/ml-stuff
labs-python/PythonLab-7.ipynb
mit
import time import random #import sys #a = int(sys.argv[1]) #b = int(sys.argv[2]) def wait(x): time.sleep(x) def time_cron(a,b): time_interval = random.uniform(a,b) # while(1): # measure process time t0 = time.clock() wait(time_interval) print time.clock() - t0, "seconds process time" ...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch2-Problem_2-07.ipynb
unlicense
%pylab notebook %precision 4 """ Explanation: Excercises Electric Machinery Fundamentals Chapter 2 Problem 2-7 End of explanation """ Zeq = 20.0 + 100.0j # [Ohm] Rc = 100.0e3 # [Ohm] Xm = 20.0e3 # [Ohm] Zload = 2.0 + 0.7j # [Ohm] Xload = -3.0j # [Ohm] Vp = 7967.0 # [V...
jamesfolberth/NGC_STEM_camp_AWS
notebooks/data8_notebooks/project2/project2.ipynb
bsd-3-clause
# Run this cell to set up the notebook, but please don't change it. import numpy as np from datascience import * # These lines do some fancy plotting magic. import matplotlib %matplotlib inline import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') import warnings warnings.simplefilter('ignore', FutureWarnin...
marcelomiky/PythonCodes
scikit-learn/scikit-learn-book/Chapter 3 - Unsupervised Learning - Principal Component Analysis.ipynb
mit
%pylab inline import IPython import sklearn as sk import numpy as np import matplotlib import matplotlib.pyplot as plt print 'IPython version:', IPython.__version__ print 'numpy version:', np.__version__ print 'scikit-learn version:', sk.__version__ print 'matplotlib version:', matplotlib.__version__ """ Explanation:...
ceos-seo/data_cube_notebooks
notebooks/water/coastline/Coastline_Classifier.ipynb
apache-2.0
import scipy.ndimage.filters as conv import numpy as np def _coastline_classification(dataset, water_band='wofs'): kern = np.array([[1, 1, 1], [1, 0.001, 1], [1, 1, 1]]) convolved = conv.convolve(dataset[water_band], kern, mode='constant') // 1 ds = dataset.where(convolved > 0) ds = ds.where(convolved...
MBARIMike/biofloat
notebooks/calibrate_all_oxygen_floats.ipynb
mit
from biofloat import ArgoData from os.path import join, expanduser ad = ArgoData(cache_file = join(expanduser('~'), 'biofloat_fixed_cache_age365_variablesDOXY_ADJUSTED-PSAL_ADJUSTED-TEMP_ADJUSTED.hdf')) ocdf = ad.get_cache_file_oxy_count_df() print ocdf.groupby('wmo').sum().sum() print 'Float having DOXY_ADJUSTE...
Kaggle/learntools
notebooks/ethics/raw/ex2.ipynb
apache-2.0
# Set up feedback system from learntools.core import binder binder.bind(globals()) from learntools.ethics.ex2 import * print("Setup Complete") """ Explanation: In the tutorial, you learned about human-centered design (HCD) and became familiar with six general steps to apply it to AI systems. In this exercise, you will...
maxkleiner/maXbox4
ARIMA_Predictor2.ipynb
gpl-3.0
#sign:max: MAXBOX8: 03/02/2021 18:34:41 # optimal moving average OMA for market index signals ARIMA study- Max Kleiner # v2 shell argument forecast days - 4 lines compare - ^GDAXI for DAX # pip install pandas-datareader # C:\maXbox\mX46210\DataScience\princeton\AB_NYC_2019.csv AB_NYC_2019.csv #https://medium.co...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/supplemental_gradient_boosting/labs/c_boosted_trees_model_understanding.ipynb
apache-2.0
import time # We will use some np and pandas for dealing with input data. import numpy as np import pandas as pd # And of course, we need tensorflow. import tensorflow as tf from matplotlib import pyplot as plt from IPython.display import clear_output tf.__version__ """ Explanation: Model understanding and interpre...
rhyswhitley/fire_limitation
notebooks/prepare_data.ipynb
bsd-3-clause
# data munging and analytical libraries import re import os import numpy as np import pandas as pd from netCDF4 import Dataset # graphical libraries import matplotlib.pyplot as plt %matplotlib inline # set paths outPath = "../data/globfire.csv" """ Explanation: <table style="width: 100%; border-collapse: collapse;...
chseifert/tutorials
PythonTutorial/PythonTutorial.ipynb
apache-2.0
# variable assignments myInt = 1 myFloat = 12.2 myString = "Hallo" myBoolean = True """ Explanation: # Introduction to Python! Python Files and Modules Python Files Structure of the Code file Code files end with ".py": myprogram.py Every line is a Python statement (or part thereof). * comment line start with `#...
satishkt/sudo_make_me_sandwich
hackathon/Intro_to_Pandas.ipynb
unlicense
# imports a library 'pandas', names it as 'pd' import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt # enables inline plots, without it plots don't show up in the notebook %matplotlib inline """ Explanation: Set up Use conda to install seaborn by running in a terminal conda ins...
nproctor/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): #style graph plt.figure(figsize=(10,5)) pl...
ES-DOC/esdoc-jupyterhub
notebooks/bcc/cmip6/models/bcc-csm2-mr/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'bcc', 'bcc-csm2-mr', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: BCC Source ID: BCC-CSM2-MR Topic: Ocean Sub-Topics: Timestepping Framework, Advecti...
planetlabs/notebooks
jupyter-notebooks/in-class-exercises/mosaicing-and-masking/mosaicing-and-masking-key.ipynb
apache-2.0
# Load our 3 images using rasterio import rasterio img1 = rasterio.open('data/20170721_175836_103c/20170721_175836_103c_3B_Visual.tif') img2 = rasterio.open('data/20170721_175837_103c/20170721_175837_103c_3B_Visual.tif') img3 = rasterio.open('data/20170721_175838_103c/20170721_175838_103c_3B_Visual.tif') """ Explana...
agrc/Presentations
UGIC/2022/SpatiallyEnabledDataFrames/alpha.ipynb
mit
import pandas as pd medians_df = pd.read_csv('assets/median_age.csv') medians_df.head() """ Explanation: Ditch the Cursor Editing Feature Classes with Spatialy-Enabled DataFrames ArcPy Is Great, But... Problem one: row[0] ```python def update_year_built(layer, year_fields): with arcpy.da.UpdateCursor(layer, yea...
feststelltaste/software-analytics
demos/20191119_rheinJUG_Duesseldorf/Analyzing the community activity for version control systems (Slides Edition).ipynb
gpl-3.0
import pandas as pd vcs_data = pd.read_csv('../dataset/stackoverflow_vcs_data_subset.gz') vcs_data.head() """ Explanation: Analyzing the community activity for version control systems Context You are a new team member in a software company The developers there are using CVS (Concurrent Versions System) You propose G...
mdezube/sms-analysis
sms_analysis.ipynb
mit
from __future__ import print_function from __future__ import division import copy import json import re import string import matplotlib import matplotlib.pyplot as plt import pandas as pd import seaborn # To improve the chart styling. import wordtree from IPython.display import display from IPython.display import H...