repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
nyoungb2/CLdb
doc/examples/Ecoli/DR_consensus.ipynb
gpl-2.0
# directory where you want the spacer blasting to be done ## CHANGE THIS! workDir = "/home/nyoungb2/t/CLdb_Ecoli/DR_consensus/" """ Explanation: Description: This notebook goes through the creation and assessment of direct repeat (DR) consensus sequences Before running this notebook: run the Setup notebook User-de...
mayankjohri/LetsExplorePython
Section 1 - Core Python/Chapter 09 - Classes & OOPS/02_02_Single_Inheritance.ipynb
gpl-3.0
class Pen(): def __init__(self, size, name): self.name = name self.size = size def set_name(self, name): self.name = name class BallPen(Pen): def __init__(self, size, name, color): self.color = color super().__init__(size, name) def set_color(self, col...
banyh/ShareIPythonNotebook
Gensim - Corpora and Vector.ipynb
gpl-3.0
corpus = [[(0, 1.0), (1, 1.0), (2, 1.0)], [(2, 1.0), (3, 1.0), (4, 1.0), (5, 1.0), (6, 1.0), (8, 1.0)], [(1, 1.0), (3, 1.0), (4, 1.0), (7, 1.0)], [(0, 1.0), (4, 2.0), (7, 1.0)], [(3, 1.0), (5, 1.0), (6, 1.0)], [(9, 1.0)], [(9, 1.0), (10, 1.0)], ...
JaviMerino/lisa
ipynb/tutorial/UseCaseExamples_SchedTuneAnalysis.ipynb
apache-2.0
res_dir = '../../results/SchedTuneAnalysis/' !tree {res_dir} noboost_trace = res_dir + 'trace_noboost.dat' boost15_trace = res_dir + 'trace_boost15.dat' boost25_trace = res_dir + 'trace_boost25.dat' # trace_file = noboost_trace trace_file = boost15_trace # trace_file = boost25_trace """ Explanation: Experiments coll...
hsaghir/hsaghir.github.io
_posts/_code/RBC-DeepLearning-Notebooks/02 - LinearAlgebra.ipynb
mit
%matplotlib notebook # Note that this is the usual way that I import Numpy and Matplotlib import numpy as np import matplotlib.pyplot as plt """ Explanation: Attribution: Most material based on Sam Roweis' Linear Algebra Review End of explanation """ a = np.array([1, 2, 3]) b = np.ones(3,) print a print b print a...
springcoil/PyDataLondonTutorial
.ipynb_checkpoints/Statistics-checkpoint.ipynb
mit
def generate_data(no_samples, treatment_proportion=0.1, treatment_mu=1.2, control_mu=1.0, sigma=0.4): """ Generate sample data from the experiment. """ rnd = np.random.RandomState(seed=12345) treatment = rnd.binomial(1, treatm...
emmaqian/DataScientistBootcamp
DS_HW2_HuiminQian_060117.ipynb
mit
%%javascript $.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js') # import the necessary package at the very beginning import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import sklearn """ Explanation: 数据应用学院 Data Scientist Program Hw2 <h1...
sbu-python-summer/python-tutorial
day-2/python-functions.ipynb
bsd-3-clause
def my_fun(i): print("in the function, i = {}".format(i)) my_fun(10) my_fun(5) a = my_fun(0) print(a) """ Explanation: functions Functions are used to organize program flow, especially to allow us to easily do commonly needed tasks over and over again. We've already used a lot of functions, such as those th...
ucbrise/clipper
examples/image_query/pytorch_on_docker_example.ipynb
apache-2.0
!conda list |grep -i torch """ Explanation: Prerequisites pip install clipper_admin==0.4.1 \ torch==1.0.1 \ torchvision==0.2.2 \ numpy==1.16.4 \ pandas==0.24.2 \ pillow==6.0.0 End of explanation """ from torchvision.models.resnet import resnet50 model = re...
quole/gensim
docs/notebooks/gensim_news_classification.ipynb
lgpl-2.1
import os import re import operator import matplotlib.pyplot as plt import warnings import gensim import numpy as np warnings.filterwarnings('ignore') # Let's not pay heed to them right now import nltk nltk.download('stopwords') # Let's make sure the 'stopword' package is downloaded & updated nltk.download('wordnet')...
pligor/predicting-future-product-prices
04_time_series_prediction/35_price_history_autoencoder_dyn_rnn_with_diff.ipynb
agpl-3.0
factors(689) max_seq_len = 682 #full_train_size = 55820 #train_size = 55800 #small_train_size = 6000 #just because of performance reasons, no statistics behind this decision #test_size = 6200 data_path = '../../../../Dropbox/data' phae_path = data_path + '/price_hist_autoencoder' csv_in = '../price_history_03_seq_...
drincruz/PyGotham-2016
POS_Example.ipynb
mit
import nltk abstract = """ It's morning, you settle in, check your dashboards and it looks like there is an increase of load coming through on some of your web server logs. What happened? You're about to deploy code that will hopefully fix some issues; how will you know that things worked well? The design team is thin...
whitead/numerical_stats
unit_9/lectures/lecture_1.ipynb
gpl-3.0
import this """ Explanation: Advanced Python Unit 9, Lecture 1 Numerical Methods and Statistics Prof. Andrew White, March 30, 2020 Becoming Pythonic End of explanation """ my_list = ['hi', 'this', 'is', 'my', 'list'] for i,e in enumerate(my_list): print(i, e) """ Explanation: Programming Idioms To Make Life E...
cdpetty/Pixal
VidAnalysis/old_hw_reference_for_panda.ipynb
apache-2.0
# this is a comment # you can execute this cell by hitting shift+enter # the output will appear immediately below print 'Hello world!' """ Explanation: CSCE 489 :: Data Science and Analytics :: Texas A&M University :: Fall 2016 Homework 0: Welcome to the Thunderdome 100 points [5% of your final grade] Due: Wednesday, ...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/production_ml/labs/custom_model_training.ipynb
apache-2.0
USER_FLAG = "--user" !pip3 install {USER_FLAG} google-cloud-aiplatform==1.7.0 --upgrade !pip3 install {USER_FLAG} kfp==1.8.9 google-cloud-pipeline-components==0.2.0 """ Explanation: Running custom model training on Vertex AI Pipelines In this lab, you will learn how to run a custom model training job using the Kubefl...
tensorflow/docs-l10n
site/en-snapshot/tensorboard/hyperparameter_tuning_with_hparams.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...
datactive/bigbang
examples/datatracker/Working Group Affiliations.ipynb
mit
window = { 'since' : "2018-01-01T00:00:00", 'until' : "2018-01-10T00:00:00" } dt = DataTracker() def extract_data(doc): data = {} ## TODO: Add document UID? data['title'] = doc.title data['time'] = doc.time data['group-acronym'] = dt.group(doc.group).acronym data['type'] = doc.type.uri...
jgomezc1/FEM-Notes
notebooks/gauss_integration.ipynb
mit
from __future__ import division from sympy.utilities.codegen import codegen from sympy import * from sympy import init_printing from IPython.display import Image init_printing() r, s, t, x, y, z = symbols('r s t x y z') k, m, n = symbols('k m n', integer=True) rho, nu, E = symbols('rho, nu, E') """ Explanation: Gaus...
dereneaton/ipyrad
testdocs/analysis/cookbook-raxml-ipcoal.ipynb
gpl-3.0
# conda install ipyrad -c conda-forge -c bioconda # conda install raxml -c conda-forge -c bioconda # conda install ipcoal -c conda-forge import ipyrad.analysis as ipa import toytree import ipcoal """ Explanation: <span style="color:gray">ipyrad-analysis toolkit:</span> RAxML RAxML is one of the most popular tools for...
leosartaj/scipy-2016-tutorial
tutorial_exercises/Advanced-Solvers.ipynb
bsd-3-clause
from sympy import * from sympy.solvers.solveset import solveset init_printing() """ Explanation: Solvers End of explanation """ a, b, c, d, x, y, z, t = symbols('a b c d x y z t') f, g, h = symbols('f g h', cls=Function) """ Explanation: For each exercise, fill in the function according to its docstring. End of exp...
kkhenriquez/python-for-data-science
Week-7-MachineLearning/European Soccer Regression Analysis using scikit-learn.ipynb
mit
import sqlite3 import pandas as pd from sklearn.tree import DecisionTreeRegressor from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error from math import sqrt """ Explanation: <p style="font-family: Arial; font-size:2.75em;...
harshnisar/badfish
Getting Started With Badfish.ipynb
mit
import pandas as pd import badfish as bf import matplotlib.pyplot as plt %matplotlib inline df = pd.read_csv('data/airquality.csv', index_col=0) """ Explanation: Getting Started with Badfish - A library for missing data For the purposes of this tutorial, I am using R's Airquality dataset. (Attach Link). Let's do a q...
NeuroDataDesign/pan-synapse
pipeline_3/background/OTSU_Notebook.ipynb
apache-2.0
import sys import scipy.io as sio import glob import numpy as np import matplotlib.pyplot as plt from skimage.filters import threshold_otsu sys.path.append('../code/functions') import qaLib as qLib sys.path.append('../../pipeline_1/code/functions') import connectLib as cLib from IPython.display import Image """ Explan...
nikkirubinstein/Intro-to-programming-concepts
examples/fileIO.ipynb
apache-2.0
import numpy as np import pandas as pd #Go up one directory as this is where the 'current' directory assumed in the course notes cd .. !head -3 "data/titanic.csv" !tail -3 "data/titanic.csv" """ Explanation: File IO These notebooks are used to check certain examples in the course notes, hence they are mainly for ...
agile-geoscience/notebooks
Linear_sampling.ipynb
apache-2.0
area = 120000.0 # km^2, area covered by transects population = 120 # Total number of features (guess) no_lines = 250 # Total number of transects line_length = 150 # km, mean length of a transect feature_width = 0.5 # km, width of features density = population / area length = no_lines * line_length ...
JohnGriffiths/ConWhAt
docs/examples/downloading_conwhat_atlases.ipynb
bsd-3-clause
from conwhat.utils.fetchers import fetch_conwhat_atlas import glob """ Explanation: Downloading ConWhAt Atlases Import the fetcher function End of explanation """ atlas_dir = '/scratch/hpc3230/Data/conwhat_atlases' """ Explanation: Define the output directory End of explanation """ atlas_name = 'CWL2k8Sc33Vol3d10...
fdion/stemgraphic
notebooks/Quickstart with number.ipynb
mit
%matplotlib inline import pandas as pd from stemgraphic import stem_graphic """ Explanation: stemgraphic quickstart with numbers Import stem_graphic from stemgraphic (shortcut) or explicitely from stemgraphic.num. End of explanation """ df = pd.read_csv('../iris.csv') df.describe() """ Explanation: Load a data fra...
luofan18/deep-learning
batch-norm/Batch_Normalization_Exercises.ipynb
mit
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False) """ Explanation: Batch Normalization – Practice Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a con...
wasit7/cs439_python
week07/Titanic Clustering.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import pandas as pd plt.style.use('ggplot') # Anaconda on Windows will get warning """ Explanation: Titanic Survival Prediction Data Dictionary Here we got the data dictionary. This useful info will help you to understand the csv. |Variable |Definition |Key| |:--...
JorisBolsens/PYNQ
Pynq-Z1/notebooks/examples/video_filters.ipynb
bsd-3-clause
from pynq import Overlay from pynq.drivers import Frame, HDMI from IPython.display import Image Overlay('base.bit').download() hdmi=HDMI('in') hdmi.start() """ Explanation: Software Grayscale and Sobel filters on HDMI input This example notebook will demonstrate two image filters using a snapshot from the HDMI input:...
PythonFreeCourse/Notebooks
week05/1_Modules.ipynb
mit
import random """ Explanation: <img src="images/logo.jpg" style="display: block; margin-left: auto; margin-right: auto;" alt="לוגו של מיזם לימוד הפייתון. נחש מצויר בצבעי צהוב וכחול, הנע בין האותיות של שם הקורס: לומדים פייתון. הסלוגן המופיע מעל לשם הקורס הוא מיזם חינמי ללימוד תכנות בעברית."> <span style="text-align: ri...
girpas-ulg/nb_tseries
Drift_Fourier_Analysis_Bootstrap_CCL4_NYA.ipynb
gpl-3.0
import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns %matplotlib inline sns.set_context('notebook') """ Explanation: Trend analysis with bootstrap resampling Python / Numpy implementation of the trend analysis presented in Gardiner et al., 2008 The following model is used to fi...
endgameinc/youarespecial
BSidesLV -- your model isn't that special -- (3) MalwaResNet.ipynb
mit
# for this demo, will slurp in only the first 256K (2**18) bytes of the file max_file_length = int(2**18) file_chunks = 16 # break file into this many chunks file_chunk_size = max_file_length // file_chunks batch_size = 4 # That this is very long running cell, and # it may appear that the output is truncated before ...
mne-tools/mne-tools.github.io
0.19/_downloads/352c73e605c2040fbc0559050b15d343/plot_read_noise_covariance_matrix.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD (3-clause) from os import path as op import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() fname_cov = op.join(data_path, 'MEG', 'sample', 'sample_audvis-cov.fif') fname_evo = op.join(data_path, 'MEG', 'sam...
dtamayo/reboundx
ipython_examples/StochasticForces.ipynb
gpl-3.0
import rebound sim = rebound.Simulation() sim.add(m=1.) # Star sim.add(m=1e-3, a=1) # Jupiter mass planet sim.move_to_com() """ Explanation: Adding stochastic forces In this example, we add a stochastic force to a planet. This can be used simulate migration in a turbulent disk. See e.g. Rein (2012) and Rein and Papal...
interactionlab/imui-tutorial
03_Model-Training-CNN.ipynb
gpl-3.0
# If GPU is not available: # GPU_USE = '/cpu:0' # config = tf.ConfigProto(device_count = {"GPU": 0}) # If GPU is available: config = tf.ConfigProto() config.log_device_placement = True config.allow_soft_placement = True config.gpu_options.allocator_type = 'BFC' # Limit the maximum memory used config.gpu_options.pe...
amanahuja/adaptive_resonance_networks
ipynb/ART1_demo_simple.ipynb
mit
import numpy as np data = np.array([" O ", " O O", " O", " O O", " O", " O O", " O", " OO O", " OO ", " OO O", " OO ", "OOO ", "OO ", "O ", "OO ", "OOO ", "OOOO ", ...
quantumlib/Cirq
docs/tutorials/shor.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...
raghakot/keras-vis
examples/mnist/attention.ipynb
mit
from __future__ import print_function import numpy as np import keras from keras.datasets import mnist from keras.models import Sequential, Model from keras.layers import Dense, Dropout, Flatten, Activation, Input from keras.layers import Conv2D, MaxPooling2D from keras import backend as K batch_size = 128 num_class...
lmoresi/UoM-VIEPS-Intro-to-Python
Notebooks/Numpy+Scipy/7 - Scipy Optimize.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: scipy.optimize See the following page for a detailed list of routines: scipy.optimize reference docs The module contains: Unconstrained and constrained minimization of multivariate scalar functions (minimize) using a variety of al...
rahulremanan/python_tutorial
Machine_Vision/07_Bayesian_deep_learning/notebook/Monte_Carlo_Dropout_MNIST_Example.ipynb
mit
! wget https://media.githubusercontent.com/media/rahulremanan/python_tutorial/master/Machine_Vision/07_Bayesian_deep_learning/weights/bayesianLeNet.h5 -O ./bayesianLeNet.h5 """ Explanation: Monte Carlo Dropout -- Example Notebook Launch this notebook in Google CoLab This notebook is a modified fork of the Bayesian MNI...
batfish/pybatfish
jupyter_notebooks/Safely refactoring ACLs and firewall rules.ipynb
apache-2.0
# The ACL before refactoring original_acl = """ ip access-list acl 10 deny icmp any any redirect 20 permit udp 117.186.185.0/24 range 49152 65535 117.186.185.0/24 eq 3784 30 permit udp 117.186.185.0/24 range 49152 65535 117.186.185.0/24 eq 3785 40 permit tcp 11.36.216.170/32 11.36.216.169/32 eq bgp 50 permit ...
InsightLab/data-science-cookbook
2019/12-spark/12-spark-intro/Transformations.ipynb
mit
data = sc.parallelize(range(1, 11)) def duplicar(x): return x*x # data é um rdd res = data.map( duplicar ) print (res.collect()) """ Explanation: map(func) Retorna um novo RDD formado pela passagem de cada elemento do RDD de origem através de uma da função func. Exemplo: End of explanation """ data = sc.parallel...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/gapic/custom/showcase_local_image_classification_online.ipynb
apache-2.0
import os import sys # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install -U google-cloud-aiplatform $USER_FLAG """ Explanation: Vertex client library: Local image classification model for online prediction <table align=...
fartashh/fartashh.github.io
static/data/post/how-calculate-mrr/MRR-Report.ipynb
mit
import csv import pandas as pd import numpy as np from datetime import timedelta, date %matplotlib inline import matplotlib import matplotlib.pyplot as plt """ Explanation: Load required libraries End of explanation """ #loading data df = pd.read_csv('sample-subscription.csv') report_start_date = date(2015,1,1) repo...
juneeseo/foundations-homework
05/spotify_api.ipynb
mit
items = data['artists']['items'] for item in items: if len(item['genres'])==0: print("No genres listed") else: print(','.join(item['genres'])) # AGGREGATION PROBLEM all_genres = [] # THE LOOP for item in items: print ("All genres so far: ", all_genres) # THE CONDITIONAL print ("C...
xjwangsjtu/xjwangsjtu.github.io
markdown_generator/talks.ipynb
mit
import pandas as pd import os """ Explanation: Talks markdown generator for academicpages Takes a TSV of talks with metadata and converts them for use with academicpages.github.io. This is an interactive Jupyter notebook (see more info here). The core python code is also in talks.py. Run either from the markdown_gener...
turbomanage/training-data-analyst
blogs/ghcn/ghcn_on_bq.ipynb
apache-2.0
%bash echo 'Y' | apt-get install python-mpltoolkits.basemap from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import datalab.bigquery as bq import matplotlib as mpl import seaborn as sns import pandas as pd import numpy as np import shutil """ Explanation: <h2> Global Historical Climate Network...
sjqgithub/rquestions
Construct Dataset.ipynb
mit
# extract all the code part temp_code = questions['Body'].str.extractall(r'(<code>[^<]+</code>)') temp_code.head() # unstack and convert into a single column for cleaning test = temp_code.unstack('match') test.columns = test.columns.droplevel() # put all columns together code = pd.DataFrame(test.apply(lambda x: x.s...
probml/pyprobml
notebooks/book1/08/opt_jax.ipynb
mit
import sklearn import scipy import scipy.optimize import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") import itertools import time from functools import partial import os import numpy as np # np.set_printoptions(precision=3) np.set_printoptions(formatter={"float": lambda x: "{0:0.3f}".f...
ProfHoekstra/bluesky
docs/python_demo.ipynb
gpl-3.0
import numpy as np import bluesky as bs from bluesky.simulation import ScreenIO """ Explanation: Bluesky interfacing demo This Jupyter Notebook demonstrates the use of Bluesky as a Python package and how it can be used to generate aircraft trajectories. Note: Make sure that you have Bluesky installed as a package in...
gully/starfish-demo
demo3/notebooks/MCMC_step_size_02-autocorrelation_function.ipynb
mit
import h5py f = h5py.File('../data/mc.hdf5', mode='r') list(f.keys()) d = f['samples'] list(d.attrs) d.attrs['acceptance'] """ Explanation: Understanding the MCMC chains. gully February 2016 In this Notebook we pretty much just look at the Autocorrelation function, and try some experiments, most of which fizzled...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/launching_into_ml/solutions/bigquery.ipynb
apache-2.0
try: # Use the Colab's preinstalled TensorFlow 2.x %tensorflow_version 2.x except: pass # Install the required packages !pip install fastavro !pip install tensorflow-io==0.9.0 """ Explanation: End-to-End Example for BigQuery TensorFlow Reader Overview In this lab, you will use BigQuery TensorFlow reader and Ke...
ekergy/jupyter_notebooks
curso/4-Python.ipynb
gpl-3.0
import pandas as pd import numpy as np from sklearn import linear_model from matplotlib import pylab as plt plt.style.use('bmh') %matplotlib notebook wine = pd.read_csv('data/winequality-white.csv',delimiter=';') wine.describe() fig = plt.figure(2) ax = [fig.add_subplot(3,4,i) for i in range(1,12)] models = [linear_...
mikarubi/notebooks
worker/notebooks/thunder/tutorials/regression.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import seaborn as sns from thunder import Colorize image = Colorize.image tile = Colorize.tile sns.set_context('notebook') sns.set_style('darkgrid') """ Explanation: Regression Linear regression is a simple and powerful tool for describing relationships between a res...
opensanca/trilha-python
01-python-intro/aula-02/Aula 02.ipynb
mit
20 + 13 5 * 8 - 10 (5 * 8 - 10) / 3 8 / 5 # o resultado da divsião sempre é um float """ Explanation: [Py-Intro] Aula 02 Tipos básicos e estruturas de controles O que você vai aprender nesta aula? Após o término da aula você terá aprendido: Números e expressões aritméticas Strings Estruturas de controles de fluxo...
sergey-tomin/workshop
1_introduction.ipynb
mit
from IPython.display import Image #Image(filename='gui_example.png') """ Explanation: This notebook was created by Sergey Tomin for Workshop: Designing future X-ray FELs. Source and license info is on GitHub. August 2016. An Introduction to Ocelot Ocelot is a multiphysics simulation toolkit designed for studying FEL ...
smorton2/think-stats
code/chap04ex.ipynb
gpl-3.0
from __future__ import print_function, division %matplotlib inline import numpy as np import nsfg import first import thinkstats2 import thinkplot """ Explanation: Examples and Exercises from Think Stats, 2nd Edition http://thinkstats2.com Copyright 2016 Allen B. Downey MIT License: https://opensource.org/licenses/...
eecs445-f16/umich-eecs445-f16
handsOn_lecture17_clustering-mixtures-em/handsOn_lecture17_clustering-mixtures-em.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt; import matplotlib as mpl; import numpy as np; """ Explanation: $$ \LaTeX \text{ command declarations here.} \newcommand{\R}{\mathbb{R}} \renewcommand{\vec}[1]{\mathbf{#1}} \newcommand{\X}{\mathcal{X}} \newcommand{\D}{\mathcal{D}} \newcommand{\G}{\mathcal{G}} \n...
ledeprogram/algorithms
class9/homework/Skinner_Barnaby_9_2.ipynb
gpl-3.0
iris = datasets.load_iris() iris.keys() X = iris.data[:,2:] y = iris.target X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=42, test_size=0.25,train_size=0.75) #What is random_state? #What is stratify? #What is this doing in the moon example exactly? #X, y = make_moons(n_samples=...
rvernagus/data-science-notebooks
Data Science From Scratch/13 - Naive Bayes.ipynb
mit
def tokenize(message): message = message.lower() all_words = re.findall('[a-z0-9]+', message) return set(all_words) from collections import defaultdict def count_words(training_set): """training set consists of pairs (message, is_spam)""" counts = defaultdict(lambda: [0, 0]) for message, is_sp...
patonelli/map2110-modelagem
.ipynb_checkpoints/ArchiPi-checkpoint.ipynb
cc0-1.0
import decimal def ArchPi(precision=99): # x: circumference of the circumscribed (outside) regular polygon # y: circumference of the inscribed (inside) regular polygon decimal.getcontext().prec = precision+1 D=decimal.Decimal # max error allowed eps = D(1)/D(10**precision) # init...
kubeflow/pipelines
samples/contrib/mnist/04_Reusable_and_Pre-build_Components_as_Pipeline.ipynb
apache-2.0
import kfp import kfp.gcp as gcp import kfp.dsl as dsl import kfp.compiler as compiler import kfp.components as comp import datetime import kubernetes as k8s # Required Parameters PROJECT_ID='<ADD GCP PROJECT HERE>' GCS_BUCKET='gs://<ADD STORAGE LOCATION HERE>' """ Explanation: Composing a pipeline from reusable, pr...
mabevillar/rmtk
rmtk/vulnerability/model_generator/DBELA_approach/DBELA.ipynb
agpl-3.0
import DBELA from rmtk.vulnerability.common import utils %matplotlib inline """ Explanation: Generation of capacity curves using DBELA This notebook enables the user to generate capacity curves (in terms of spectral acceleration vs. spectral displacement) using the Displacement-based Earthquake Loss Assessment (DBELA)...
scotthuang1989/Python-3-Module-of-the-Week
data_structure/enum.ipynb
apache-2.0
import enum class BugStatus(enum.Enum): new = 7 incomplete = 6 invalid = 5 wont_fix = 4 in_progress = 3 fix_committed = 2 fix_released = 1 print("member name: {}".format(BugStatus.wont_fix.name)) print("member value: {}".format(BugStatus.wont_fix.value)) """ Explanation: Creating Enumerat...
IsaacLab/LaboratorioIntangible
T3/.ipynb_checkpoints/T3.2-Self-Organized-Criticality-checkpoint.ipynb
agpl-3.0
%%HTML <iframe src="https://www.openprocessing.org/sketch/434784/embed/" width="450" height="510"></iframe> """ Explanation: Self-Organized Criticality 1. Scale invariance In physics, mathematics, statistics, and economics, scale invariance is a feature of objects or laws that do not change if scales of length, energy...
mkuron/espresso
doc/tutorials/11-ferrofluid/11-ferrofluid_part1.ipynb
gpl-3.0
import espressomd espressomd.assert_features('DIPOLES', 'LENNARD_JONES') from espressomd.magnetostatics import DipolarP3M from espressomd.magnetostatic_extensions import DLC from espressomd.cluster_analysis import ClusterStructure from espressomd.pair_criteria import DistanceCriterion import numpy as np """ Explan...
sdpython/ensae_teaching_cs
_doc/notebooks/td1a_algo/td1a_cenonce_session9.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.algo - Optimisation sous contrainte L'optimisation sous contrainte est un problème résolu. Ce notebook utilise une librairie externe et la compare avec l'algorithme Arrow-Hurwicz qu'il faudra implémenter. Plus de précision dans cet art...
soccermetrics/project-data
jleague-effective-time/bayesian_regression.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' import os import pymc import numpy as np import pandas as pd import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') """ Explanation: Effective time in 2015 J-League: Club Impact in J1 The objective of this analysis is to determine the impac...
takanory/python-machine-learning
Pandas guide.ipynb
mit
# numpy と pandas を import する。np, pd と書くのは慣習っぽい import numpy as np import pandas as pd """ Explanation: Pandas 入門 Pythonを使ったデータ解析入門 3idea | OpenBook を見ながら、Pandasの基本的な操作を写経してなれる Pandas 基本操作 https://openbook4.me/projects/183/sections/777 End of explanation """ # Series # 軸にラベルを付けた1次元の配列 print(pd.Series([1,2,4])) # 値...
Pittsburgh-NEH-Institute/Institute-Materials-2017
schedule/week_2/collation/3_collation-outputs.ipynb
gpl-3.0
# import the collatex library from collatex import * # create an instance a Collation object collation = Collation() # add witnesses to the collateX instance collation.add_plain_witness( "A", "The quick brown fox jumped over the lazy dog.") collation.add_plain_witness( "B", "The brown fox jumped over the dog." ) collat...
graphistry/pygraphistry
demos/demos_databases_apis/sql/postgres.ipynb
bsd-3-clause
import graphistry #pip install graphistry -q # To specify Graphistry account & server, use: # graphistry.register(api=3, username='...', password='...', protocol='https', server='hub.graphistry.com') # For more options, see https://github.com/graphistry/pygraphistry#configure """ Explanation: SQL Example Get & plot ...
jonathf/chaospy
docs/user_guide/advanced_topics/stochastic_dependencies.ipynb
mit
import chaospy dist1 = chaospy.Gamma(1) dist2 = chaospy.Normal(mu=dist1, sigma=dist1+1) joint = chaospy.J(dist1, dist2) joint """ Explanation: Dependent random variable Some times simple stochastically independent random variables are not enough, and one have to use variables with stochastic dependencies. In chaospy...
theandygross/HIV_Methylation
PreProcessing/BMIQ_Horvath.ipynb
mit
cd .. import NotebookImport from Setup.Imports import * import os as os import pandas as pd from pandas.rpy.common import convert_to_r_dataframe, convert_robj import rpy2.robjects as robjects from IPython.display import clear_output """ Explanation: Horvath Normalization Pipeline Here we run the data normalization p...
AhmedHani/Kaggle-Machine-Learning-Competitions
Easy/PokerRuleInduction/PokerRuleInduction.ipynb
mit
import pandas as pnd from sklearn.cross_validation import cross_val_score from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LinearRegression from sklearn.neighbors import KNeighborsClassifier """ Explanation: Poker Induction Rule Problem The problem is about the famous Cards Game, Po...
jph00/part2
pytorch-tut.ipynb
apache-2.0
x = torch.Tensor(5, 3); x x = torch.rand(5, 3); x x.size() y = torch.rand(5, 3) x + y torch.add(x, y) result = torch.Tensor(5, 3) torch.add(x, y, out=result) # anything ending in '_' is an in-place operation y.add_(x) # adds x to y in-place # standard numpy-like indexing with all bells and whistles x[:,1] """ ...
eds-uga/cbio4835-sp17
lectures/Lecture8.ipynb
mit
matrix = [[ 1, 2, 3], [ 4, 5, 6], [ 7, 8, 9] ] print(matrix) """ Explanation: Lecture 8: Advanced Data Structures CBIO (CSCI) 4835/6835: Introduction to Computational Biology Overview and Objectives Before we get to some of the more advanced sequence analysis techniques, we need to cover some crit...
jhillairet/scikit-rf
doc/source/tutorials/NetworkSet.ipynb
bsd-3-clause
import skrf as rf rf.read_all(rf.data.pwd, contains='ro') """ Explanation: NetworkSet Introduction The NetworkSet object represents an unordered set of networks. It provides methods iterating and slicing the set, sorting by datetime, calculating statistical quantities, and displaying uncertainty bounds on plots. ...
dsacademybr/PythonFundamentos
Cap05/Notebooks/DSA-Python-Cap05-01-Classes.ipynb
gpl-3.0
# Versão da Linguagem Python from platform import python_version print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version()) """ Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 5</font> Download: http://github.com/dsacademybr End of explanation """ # Crian...
leopardbruce/FileFun
Horse_or_Human_NoValidation.ipynb
mit
!wget --no-check-certificate \ https://storage.googleapis.com/laurencemoroney-blog.appspot.com/horse-or-human.zip \ -O /tmp/horse-or-human.zip """ Explanation: <a href="https://colab.research.google.com/github/leopardbruce/TensorflowforAI-ML-DL/blob/master/Horse_or_Human_NoValidation.ipynb" target="_parent"><i...
machow/siuba
docs/developer/sql-translators.ipynb
mit
from sqlalchemy import sql col_names = ['id', 'x', 'y'] sel = sql.select([sql.column(x) for x in col_names]) print(sel) print(type(sel.columns)) print(sel.columns) """ Explanation: SQL translators The purpose of this vignette is to walk through how expressions like _.id.mean() are converted into SQL. This process inv...
farfan92/SpringBoard-
statistics project 2/.ipynb_checkpoints/sliderule_dsi_inferential_statistics_exercise_3-checkpoint.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt import bokeh.plotting as bkp from mpl_toolkits.axes_grid1 import make_axes_locatable %matplotlib inline # read in readmissions data provided hospital_read_df = pd.read_csv('data/cms_hospital_readmissions.csv') """ Explanation: Hospital readmission...
GoogleCloudPlatform/asl-ml-immersion
notebooks/text_models/labs/reusable_embeddings_vertex.ipynb
apache-2.0
import os import pandas as pd from google.cloud import bigquery """ Explanation: Reusable Embeddings Learning Objectives 1. Learn how to use a pre-trained TF Hub text modules to generate sentence vectors 1. Learn how to incorporate a pre-trained TF-Hub module into a Keras model 1. Learn how to deploy and use a text m...
jorisvandenbossche/DS-python-data-analysis
notebooks/python_recap/05-numpy.ipynb
bsd-3-clause
import numpy as np """ Explanation: Python the basics: numpy DS Data manipulation, analysis and visualization in Python May/June, 2021 © 2021, Joris Van den Bossche and Stijn Van Hoey (&#106;&#111;&#114;&#105;&#115;&#118;&#97;&#110;&#100;&#101;&#110;&#98;&#111;&#115;&#115;&#99;&#104;&#101;&#64;&#103;&#109;&#97;&#105...
muatik/dm
bike-sharing-demand.ipynb
mit
from IPython.core import display import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt from sklearn import svm, cross_validation from sklearn.ensemble import RandomForestRegressor from sklearn.grid_search import GridSearchCV %matplotlib inline def readCsv(name): df = pd.read...
SKA-ScienceDataProcessor/algorithm-reference-library
workflows/notebooks/imaging_serial.ipynb
apache-2.0
%matplotlib inline import os import sys sys.path.append(os.path.join('..', '..')) from data_models.parameters import arl_path results_dir = arl_path('test_results') from matplotlib import pylab pylab.rcParams['figure.figsize'] = (8.0, 8.0) pylab.rcParams['image.cmap'] = 'rainbow' import numpy from astropy.coord...
ceos-seo/data_cube_notebooks
notebooks/DCAL/DCAL_Cloud_Statistics.ipynb
apache-2.0
# Enable importing of utilities. import sys import os sys.path.append(os.environ.get('NOTEBOOK_ROOT')) import numpy as np import xarray as xr import pandas as pd import matplotlib.pyplot as plt # Load Data Cube Configuration import datacube import utils.data_cube_utilities.data_access_api as dc_api api = dc_api.Dat...
ZhiangChen/deep_learning
Tutorials/Udacity/2_fullyconnected.ipynb
mit
# These are all the modules we'll be using later. Make sure you can import them # before proceeding further. from __future__ import print_function import numpy as np import tensorflow as tf from six.moves import cPickle as pickle from six.moves import range """ Explanation: Deep Learning Assignment 2 Previously in 1_n...
tensorflow/docs-l10n
site/en-snapshot/agents/tutorials/2_environments_tutorial.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...
foxan/dataquest
Data Exploration/Challenge - Cleaning Data.ipynb
apache-2.0
# %sh # wget https://raw.githubusercontent.com/fivethirtyeight/data/master/avengers/avengers.csv # ls -l """ Explanation: https://www.dataquest.io/mission/114/challenge-cleaning-data/ 2: Life And Death Of Avengers The Avengers are a well-known and widely loved team of superheroes in the Marvel universe that were int...
mjasher/gac
original_libraries/flopy-master/examples/Notebooks/swiex4.ipynb
gpl-2.0
%matplotlib inline import os import platform import numpy as np import matplotlib.pyplot as plt import flopy.modflow as mf import flopy.utils as fu """ Explanation: SWI2 Example 4. Upconing Below a Pumping Well in a Two-Aquifer Island System This example problem is the fourth example problem in the SWI2 documentation...
marcelomiky/PythonCodes
Coursera/IDSP/Week+1.ipynb
mit
x = 1 y = 2 x + y x """ Explanation: You are currently looking at version 1.1 of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the Jupyter Notebook FAQ course resource. The Python Programming Language: Functions End of explanation """ d...
enram/infrastructure
file_transfer/ad_hoc_management/remove_corrupted_h5_files.ipynb
mit
from file_transfer.creds import URL, LOGIN, PASSWORD btos = dm.BaltradToS3(URL, LOGIN, PASSWORD, "lw-enram", profile_name="lw-enram") btos.transfer(name_match="_vp_", overwrite=True, limit=5, verbose=True) btos.transferred s3handle.create_zip_version(btos.transferred) import shutil shutil.rmtree(os...
fastai/fastai
nbs/18b_callback.preds.ipynb
apache-2.0
#|export class MCDropoutCallback(Callback): def before_validate(self): for m in [m for m in flatten_model(self.model) if 'dropout' in m.__class__.__name__.lower()]: m.train() def after_validate(self): for m in [m for m in flatten_model(self.model) if 'dropout' in m.__class__.__n...
mph-/lcapy
doc/examples/notebooks/dependent_source_example1.ipynb
lgpl-2.1
Vx = V('V_x').Voc I = (cct.V1.V - 4 * Vx) / (cct.R1.Z + cct.R2.Z) """ Explanation: Let's determine the current through R1. There are many ways to solve this; the easiest is to combine the sources, combine the resistances, and then use Ohm's law. The result is a function of $V_x$: End of explanation """ I * cct.R1.Z...
tensorflow/docs-l10n
site/ja/guide/estimator.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...
NeuroDataDesign/pan-synapse
pipeline_1/background/hungarianAlgorithms.ipynb
apache-2.0
###################################### ###THIS IS PSEUDOCODE, WILL NOT RUN### ###################################### def hungarian(costMatrix): p1CostMatrix = costMatrix.copy() p2CostMatrix = costMatrix.copy().T #for every point in the first set for all p1 in p1CostMatrix: #find its minimum weighted edge min...
davebshow/ten_million_books
demos/10_million_books.ipynb
mit
import string import unidecode s = "Historia de la Inquisición' " s = s.decode('utf-8') s = unidecode.unidecode(s) s = s.strip() s = s.strip(string.punctuation) s = s.lower() s """ Explanation: Ten Million Books Cleaning Basic Parsing Marc21 author -> 100, 110, 111 title -> 244a, 244b pub. location -> 264a,b,c Str...
totalgood/twip
docs/notebooks/10 Learning -- Predicting Impact.ipynb
mit
print(len(dates)) print(len(topics)) print(len(nums)) sum(nums.index == dates.index) == len(dates) sum(nums.index == topics.index) == len(dates) disc = LinearDiscriminantAnalysis() disc category = (np.ceil(nums.favorite_count ** .13)).astype(np.int8) disc = LinearDiscriminantAnalysis().fit(topics, category) predi...
maubarsom/ORFan-proteins
phage_assembly/5_annotation/asm_v1.2/assembly_homologues/3_parse_d9539_blast_hits.ipynb
mit
blast_file_regex = re.compile(r"(blast[np])_vs_([a-zA-Z_]+).tsv") blast_cols = ["query_id","subject_id","pct_id","ali_len","mism", "gap_open","q_start","q_end","s_start","s_end","e_value","bitscore"] blast_hits = [] for blast_filename in glob("blastn/*.tsv"): tool_id,db_id = blast_file_regex.search(b...