repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
tensorflow/docs-l10n
site/en-snapshot/hub/tutorials/text_classification_with_tf_hub.ipynb
apache-2.0
# Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
tpin3694/tpin3694.github.io
statistics/spearmans_rank_correlation.ipynb
mit
import numpy as np import pandas as pd import scipy.stats """ Explanation: Title: Spearman's Rank Correlation Slug: spearmans_rank_correlation Summary: Spearman's Rank Correlation in Python. Date: 2016-02-08 12:00 Category: Statistics Tags: Basics Authors: Chris Albon Preliminaries End of explanation """ # Creat...
probml/pyprobml
notebooks/book1/20/skipgram_torch.ipynb
mit
import numpy as np import matplotlib.pyplot as plt np.random.seed(seed=1) import math import os import random try: import torch except ModuleNotFoundError: %pip install -qq torch import torch from torch import nn from torch.nn import functional as F import requests import zipfile import hashlib import c...
mne-tools/mne-tools.github.io
0.20/_downloads/20f35983ef279d1b30aa970c81aafe26/plot_read_events.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Chris Holdgraf <choldgraf@berkeley.edu> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() fname = data_path + '/MEG/sample/sample_audvis_raw-eve.fi...
whitead/numerical_stats
unit_10/hw_2019/homework_10_key.ipynb
gpl-3.0
import scipy.stats as ss import numpy as np """ Explanation: Homework 10 Key CHE 116: Numerical Methods and Statistics 4/3/2019 End of explanation """ import scipy.stats as ss ss.t.cdf(-2, 4) * 2 """ Explanation: 1. Conceptual Questions Describe the general process for parametric hypothesis tests. Why would y...
adityaka/misc_scripts
python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/04_02/Begin/.ipynb_checkpoints/Select-checkpoint.ipynb
bsd-3-clause
import pandas as pd import numpy as np """ Explanation: Select, Add, Delete, Columns End of explanation """ cookbook_df = pd.DataFrame({'AAA' : [4,5,6,7], 'BBB' : [10,20,30,40],'CCC' : [100,50,-30,-50]}) cookbook_df['BBB'] """ Explanation: dictionary like operations dictionary selection with string index End of exp...
cavestruz/StrongCNN
notebooks/Bootstrap_Analysis.ipynb
mit
import glob import numpy as np import pandas as pd from sklearn.metrics import precision_score, recall_score, roc_auc_score def get_data(datadir): """ Read the data files from different subdirectories of datadir corresponding to different HOG configurations. Inputs datadir: top level dire...
akafael/unb-vc
notes/vc_aula3.ipynb
gpl-3.0
from sympy import * from IPython.display import display,Math r1,r2,t1,t2 = symbols("rho_1 rho_2 theta_1 theta_2",constant=true,real=true) z1 = r1*exp(I*t1) z2 = r2*exp(I*t2) """ Explanation: Aula 3 Operações com números complexos Forma Polar Supondo dois números complexos $z_1$ e $z_2$ tais que $$z_1 = r_1 e^{i\thet...
hunterherrin/phys202-2015-work
assignments/assignment06/InteractEx05.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as mp from IPython.html.widgets import interact, interactive, fixed from IPython.html import widgets from IPython.display import display from IPython.display import Image,HTML,SVG """ Explanation: Interact Exercise 5 Imports Put the standard imports ...
abmantz/lrgs
notebooks/example_python.ipynb
mit
import lrgs import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Example in Python This is a fairly minimal example, demonstrating the slightly different calling convention in the Python version of LRGS, compared with the R version. One notable and practical difference is that the Pyt...
NewKnowledge/punk
examples/Feature Selection.ipynb
mit
import punk help(punk) %matplotlib inline import matplotlib.pyplot as plt import pandas as pd import numpy as np from sklearn import datasets from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from punk import feature_selection """ E...
ryan-leung/PHYS4650_Python_Tutorial
notebooks/Feb2017/CH1 Syntax.ipynb
bsd-3-clause
print "Hello World!" """ Explanation: CH 1 Syntax In this tutorial notebook, you will learn how to do programming in python and jupyter. Open a new notebook in ipython or https://try.jupyter.org/, try to "copy" and "paste" the following codes. Jupyter - Basic operations: Click on the cell to select it. Press SHIFT+EN...
GoogleCloudPlatform/tf-estimator-tutorials
00_Miscellaneous/text-similarity-analysis/bqml/classification_with_embeddings.ipynb
apache-2.0
from google.colab import auth auth.authenticate_user() from google.cloud import bigquery client = bigquery.Client(project='YOUR-PROJECT-NAME') """ Explanation: <a href="https://colab.research.google.com/github/GoogleCloudPlatform/tf-estimator-tutorials/blob/master/00_Miscellaneous/text-similarity-analysis/bqml/classi...
bayesimpact/bob-emploi
data_analysis/notebooks/datasets/usa/soc_dmtf.ipynb
gpl-3.0
from os import path import pandas as pd import seaborn as sns DATA_FOLDER = %env DATA_FOLDER sns.set() dmtf = pd.read_excel(path.join(DATA_FOLDER, 'usa/soc/DMTF.xlsx')) dmtf.head(10) """ Explanation: SOC Direct Match Title File Author: pascal@bayesimpact.org Date: 2020-06-19 The US Bureau of Labor Statistics (BLS) ...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_introduction.ipynb
bsd-3-clause
import mne """ Explanation: Basic MEG and EEG data processing MNE-Python reimplements most of MNE-C's (the original MNE command line utils) functionality and offers transparent scripting. On top of that it extends MNE-C's functionality considerably (customize events, compute contrasts, group statistics, time-frequenc...
PG-TUe/tpot
tutorials/MAGIC Gamma Telescope/MAGIC Gamma Telescope.ipynb
lgpl-3.0
# Import required libraries from tpot import TPOTClassifier from sklearn.cross_validation import train_test_split import pandas as pd import numpy as np #Load the data telescope=pd.read_csv('MAGIC Gamma Telescope Data.csv') telescope.head(5) """ Explanation: MAGIC Gamma Telescope - TPOT Classification Study The belo...
rusucosmin/courses
ml/ex05/solution/ex05.ipynb
mit
from helpers import sample_data, load_data, standardize # load data. height, weight, gender = load_data() # build sampled x and y. seed = 1 y = np.expand_dims(gender, axis=1) X = np.c_[height.reshape(-1), weight.reshape(-1)] y, X = sample_data(y, X, seed, size_samples=200) x, mean_x, std_x = standardize(X) """ Expla...
SN-Isotropy/Isotropy
doc/esmeralda/Hubble+Diagram.ipynb
mit
import sys import gzip, pickle if sys.version.startswith('2'): snFits = pickle.load(gzip.GzipFile('snFits.p.gz')) else: snFits = pickle.load(gzip.GzipFile('snFits.p.gz'), encoding='latin1') print(len(snFits)) snf = [s for s in snFits.values() if s is not None] print(len(snf)) snf[0] """ E...
landlab/landlab
notebooks/tutorials/terrain_analysis/flow__distance_utility/application_of_flow__distance_utility.ipynb
mit
from landlab.io import read_esri_ascii from landlab.components import FlowAccumulator from landlab.plot import imshow_grid from matplotlib.pyplot import figure %matplotlib inline from landlab.utils import watershed import numpy as np from landlab.utils.flow__distance import calculate_flow__distance """ Explanation: <...
tkzeng/molecular-design-toolkit
moldesign/_notebooks/Tutorial 1. Making a molecule.ipynb
apache-2.0
import moldesign as mdt import moldesign.units as u """ Explanation: <span style="float:right"><a href="http://moldesign.bionano.autodesk.com/" target="_blank" title="About">About</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://forum.bionano.autodesk.com/c/Molecular-Design-Toolkit" target="_blank" title="Forum...
google/starthinker
colabs/sheets_clear.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: Sheet Clear Clear data from a sheet. License Copyright 2020 Google LLC, 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...
ktmud/deep-learning
language-translation/dlnd_language_translation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: Language Translation In this project, you’re going...
egillanton/Udacity-SDCND
1. Computer Vision and Deep Learning/L1 TensorFlow Lab/lab.ipynb
mit
import hashlib import os import pickle from urllib.request import urlretrieve import numpy as np from PIL import Image from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelBinarizer from sklearn.utils import resample from tqdm import tqdm from zipfile import ZipFile print('All m...
DawesLab/LabNotebooks
control-pulseoptim-CRAB-2qubitInerac.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import datetime from qutip import Qobj, identity, sigmax, sigmaz, tensor, mesolve import random import qutip.logging_utils as logging logger = logging.get_logger() #Set this to None or logging.WARN for 'quiet' execution log_level = logging.INFO #QuT...
HrWangChengdu/CS231n
assignment1/knn.ipynb
mit
# Run some setup code for this notebook. import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt # This is a bit of magic to make matplotlib figures appear inline in the notebook # rather than in a new window. %matplotlib inline plt.rcParams['figure.figsize'] = (10....
julianogalgaro/udacity
nd101/c2l8-sentiment-analysis/sentiment_network/Sentiment Classification - Mini Project 3.ipynb
mit
def pretty_print_review_and_label(i): print(labels[i] + "\t:\t" + reviews[i][:80] + "...") g = open('reviews.txt','r') # What we know! reviews = list(map(lambda x:x[:-1],g.readlines())) g.close() g = open('labels.txt','r') # What we WANT to know! labels = list(map(lambda x:x[:-1].upper(),g.readlines())) g.close()...
gidden/salamanca
doc/notebooks/currencies.ipynb
apache-2.0
from salamanca.currency import Translator """ Explanation: Translating between Currencies End of explanation """ xltr = Translator() """ Explanation: Translating between currencies requires a number of different choices do you want to consider the relative value of two currencies based on Market Exchange Rates or...
mjuric/LSSTC-DSFP-Sessions
Session3/Day4/ANTARES/miniAntaresSolutions_parallel.ipynb
mit
# first we need to construct a client that will interface with our cluster from ipyparallel import Client, require worker = Client() # once we create a client, we can decide how to allocate tasks across the cluster # we've got however many 'engines' you started in the cluster # lets just use all of them lview = worke...
AllenDowney/ProbablyOverthinkingIt
socks_and_skeets.ipynb
mit
from __future__ import print_function, division %matplotlib inline import warnings warnings.filterwarnings("ignore") from thinkbayes2 import Pmf, Hist, Beta import thinkbayes2 import thinkplot """ Explanation: Socks, Skeets, and Space Invaders This notebook contains code from my blog, Probably Overthinking It Copyr...
possnfiffer/py-emde
Py-EMDE-Kenya-GLOBE-01.ipynb
bsd-2-clause
import requests import json r = requests.get('http://3d-kenya.chordsrt.com/instruments/1.geojson?start=2016-09-01T00:00&end=2016-11-01T00:00') if r.status_code == 200: d = r.json()['Data'] else: print("Please verify that the URL for the weather station is correct. You may just have to try again with a differe...
bmorris3/gsoc2015
finder_chart.ipynb
mit
import matplotlib.pyplot as plt import numpy as np from astroplan import FixedTarget import astropy.units as u from astropy.wcs import WCS from astropy.coordinates import SkyCoord from astropy.io import fits from astroquery.skyview import SkyView @u.quantity_input(fov_radius=u.deg) def plot_finder_image(target, su...
TheLampshady/tensor_tutorial
Convolutional_101.ipynb
mit
# 3 x 3 filter shape filter1 = [ [.1, .1, .2], [.1, .1, .2], [.2, .2, .2], ] # Each filter only has one input channel (grey scale) # 3 x 3 x 1 channel_filters1 = [filter1] # We want to output 2 channels which requires another set of 3 x 3 x 1 filter2 = [ [.9, .5, .9], [.5, .3, .5], [.9, .5, ...
phuongxuanpham/SelfDrivingCar
CarND-LeNet-Lab/LeNet-Lab-Solution.ipynb
gpl-3.0
from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", reshape=False) X_train, y_train = mnist.train.images, mnist.train.labels X_validation, y_validation = mnist.validation.images, mnist.validation.labels X_test, y_test = mnist.test.images, mn...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/statespace_cycles.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt from pandas_datareader.data import DataReader endog = DataReader('UNRATE', 'fred', start='1954-01-01') endog.index.freq = endog.index.inferred_freq """ Explanation: Trends and cycles in unemployment...
tensorflow/hub
docs/tutorials/text_classification_with_tf_hub.ipynb
apache-2.0
# Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/.ipynb_checkpoints/n08_simple_q_learner_fast_learner-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...
jdsanch1/SimRC
02. Parte 2/11. Clase 11/11Class NB.ipynb
mit
#importar los paquetes que se van a usar import pandas as pd import numpy as np import datetime from datetime import datetime import scipy.stats as stats import scipy as sp import matplotlib.pyplot as plt import seaborn as sns import sklearn.covariance as skcov import cvxopt as opt from cvxopt import blas, solvers solv...
the-deep-learners/TensorFlow-LiveLessons
notebooks/tensor-fied_intro_to_tensorflow.ipynb
mit
import numpy as np np.random.seed(42) import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import tensorflow as tf tf.set_random_seed(42) xs = [0., 1., 2., 3., 4., 5., 6., 7.] ys = [-.82, -.94, -.12, .26, .39, .64, 1.02, 1.] fig, ax = plt.subplots() _ = ax.scatter(xs, ys) m = tf.Variable(-0.5) b ...
timothydmorton/usrp-sciprog
day2/python-intro.ipynb
mit
#Integers a = 1 a #floats b = 2. print(b) print(type(b)) #strings s = 'list of letters' print(s) print(type(s)) #lists l = [4,5,2.,'hello', 'world'] l #list elements l[1] #A word on indexing # : means continuation from the preceding index l[2:] # or to the following index l[-4] #string are lists of letters: l[-...
AstroHackWeek/AstroHackWeek2016
day4-sampling/Worksheet.ipynb
mit
def log_p_func(theta): pass """ Explanation: A simple Metropolis MCMC In this exercise, we'll implement the simplest MCMC algorithm and sample from a two-dimensional Gaussian to demonstrate the method. First, implement the probability distribution as a function that takes in a 2-D vector $\theta$ and returns: $$ ...
atulsingh0/MachineLearning
Sklearn_MLPython/cross_validation-0.18.ipynb
gpl-3.0
# import from sklearn.datasets import load_iris from sklearn.model_selection import cross_val_score, KFold, train_test_split, cross_val_predict, LeaveOneOut, LeavePOut from sklearn.model_selection import ShuffleSplit, StratifiedKFold, StratifiedShuffleSplit, GroupKFold, LeaveOneGroupOut from sklearn.model_selection imp...
simpeg/simpegExamples
SciPy2015/DCResistivityEx.ipynb
mit
# Define a unit square domain # This can be hidden and imported depending on how much you want to show nx,ny = 60,60 # number of cells in x,y mesh = Mesh.TensorMesh([nx,ny]) # build a tensor mesh sigma = np.ones(mesh.nC) # assign a conductivity model # create source xp, yp = 0.25, 0.5 xn, yn = 0.75, 0.5 sigmaback = ...
lileiting/goatools
notebooks/cell_cycle.ipynb
bsd-2-clause
# Get http://geneontology.org/ontology/go-basic.obo from goatools.base import download_go_basic_obo obo_fname = download_go_basic_obo() """ Explanation: Cell Cycle genes Using Gene Ontologies (GO), create an up-to-date list of all human protein-coding genes that are know to be associated with cell cycle. 1. Download O...
probml/pyprobml
notebooks/book2/12/smc_ibis_1d.ipynb
mit
#!git clone https://github.com/nchopin/particles.git !pip install -qq git+https://github.com/nchopin/particles.git try: import particles except ModuleNotFoundError: %pip install -qq particles import particles import particles.state_space_models as ssm import particles.distributions as dists %matplotlib i...
abevieiramota/data-science-cookbook
2017/06-linear-regression/resp_abelardo_mota.ipynb
mit
import pandas as pd df = pd.read_csv("insurance.csv", header=None, names=['r', 'p']) df.head() """ Explanation: Regressão Linear Simples - Trabalho Estudo de caso: Seguro de automóvel sueco Agora, sabemos como implementar um modelo de regressão linear simples. Vamos aplicá-lo ao conjunto de dados do seguro de automóv...
Copper-Head/the-three-stooges
Sandbox.ipynb
mit
# Load the network from network import NetworkType, Network # 3-layer LSTM net = Network(NetworkType.LSTM, input_dim_file='data/onehot_size.npy') net.set_parameters('data/seqgen_lstm.pkl') char2ind = pickle.load(open("data/char_to_ind.pkl")) # SimpleRecurrent LK # net = Network(input_dim_file='data/lk_onehot_size.np...
statsmodels/statsmodels.github.io
v0.13.2/examples/notebooks/generated/statespace_fixed_params.ipynb
bsd-3-clause
%matplotlib inline from importlib import reload import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt from pandas_datareader.data import DataReader """ Explanation: Estimating or specifying parameters in state space models In this notebook we show how to fix specific val...
littlepea/python-refactoring-talk
refactoring.ipynb
mit
"""Movie Reviews. Usage: movie_reviews.py <title> movie_reviews.py (-h | --help) movie_reviews.py --version Arguments: <title> Movie title Options: -h --help Show this screen. --version Show version. """ from docopt import docopt from TwitterSearch import * from dateutil impor...
Kaggle/learntools
notebooks/feature_engineering/raw/ex1.ipynb
apache-2.0
# Set up code checking from learntools.core import binder binder.bind(globals()) from learntools.feature_engineering.ex1 import * """ Explanation: Introduction In the exercise, you will work with data from the TalkingData AdTracking competition. The goal of the competition is to predict if a user will download an app...
danielfrg/word2vec
examples/word2vec.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 """ Explanation: word2vec This notebook is equivalent to demo-word.sh, demo-analogy.sh, demo-phrases.sh and demo-classes.sh from the Google examples. End of explanation """ import word2vec """ Explanation: Training Download some data, for example: http://mattmahoney.net/dc/text8.z...
DJCordhose/ai
notebooks/nlp/0-imdb-parse.ipynb
mit
# Based on # https://github.com/fchollet/deep-learning-with-python-notebooks/blob/master/6.1-using-word-embeddings.ipynb # https://machinelearningmastery.com/develop-word-embeddings-python-gensim/ import warnings warnings.filterwarnings('ignore') %matplotlib inline %pylab inline import tensorflow as tf tf.logging.se...
pschragger/big-data-python-class
Lectures/Lecture 10 - Graph Algorithms/Python Graphs - networkx intro .ipynb
mit
#Example Small social newtork as a connection matrix sc1 = ([(0, 1, 1, 0, 0, 0, 0), (1, 0, 1, 1, 0, 0, 0), (1, 1, 0, 0, 0, 0, 0), (0, 1, 0, 0, 1, 1, 1), (0, 0, 0, 1, 0, 1, 0), (0, 0, 0, 1, 1, 0, 1), (0, 0, 0, 1, 0, 1, 0)]) """ Explanation: Using the graph from figure 10...
SunPower/pvfactors
docs/tutorials/pvfactors_demo.ipynb
bsd-3-clause
# Import external libraries import numpy as np import matplotlib.pyplot as plt from datetime import datetime import pandas as pd import warnings warnings.filterwarnings("ignore", category=RuntimeWarning) # Settings %matplotlib inline np.set_printoptions(precision=3, linewidth=300) """ Explanation: pvfactors: Jupyter...
gschivley/Index-variability
Notebooks/archive/Trying geopandas to assign NERC regions.ipynb
bsd-3-clause
# EIA NERC region shapefile, which has an "Indeterminate" region # path = os.path.join(data_path, 'NERC_Regions_EIA', 'NercRegions_201610.shp') # regions = gpd.read_file(path) # regions.crs path = os.path.join(data_path, 'nercregions', 'NERCregions.shp') regions_nerc = gpd.read_file(path) regions_nerc['nerc'] = regio...
gaufung/Data_Analytics_Learning_Note
DesignPattern/ChainofResponsibilityPattern.ipynb
mit
class manager(): def __init__(self, name): self.name = name def setSuccessor(self, successor): self.successor = successor def handleRequest(self, request): pass class lineManager(manager): def handleRequest(self, request): if request.requestType == 'DaysOff' and request.n...
CopernicusMarineInsitu/INSTACTraining
PythonNotebooks/PlatformPlots/Read_TimeSeries_2.ipynb
mit
%matplotlib inline import netCDF4 import matplotlib.pyplot as plt """ Explanation: Reading a remote file using OPeNDAP Now we will read a remote file using the OPeNDAP protocol. The advantage is that the file has not to be downloaded on your computer, while you can access the variables you want using it as it were on ...
SheffieldML/GPyOpt
manual/GPyOpt_context.ipynb
bsd-3-clause
%pylab inline import GPyOpt from numpy.random import seed func = GPyOpt.objective_examples.experimentsNd.alpine1(input_dim=5) """ Explanation: GPyOpt: using context variables Javier Gonzalez and Rodolphe Jenatton, Amazon.com Last updated Monday, July 2017 In this notebook we are going to see how to used GPyOpt to s...
empirical-org/WikipediaSentences
notebooks/BERT-4.1 Experiments Multilabel-QuillNLP.ipynb
agpl-3.0
from multilabel import EATINGMEAT_BECAUSE_MAP, EATINGMEAT_BUT_MAP, JUNKFOOD_BECAUSE_MAP, JUNKFOOD_BUT_MAP LABEL_MAP = JUNKFOOD_BUT_MAP BERT_MODEL = 'bert-base-uncased' BATCH_SIZE = 16 if "base" in BERT_MODEL else 2 GRADIENT_ACCUMULATION_STEPS = 1 if "base" in BERT_MODEL else 8 MAX_SEQ_LENGTH = 100 PREFIX = "junkfood_b...
ethen8181/machine-learning
big_data/h2o/h2o_api_walkthrough.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) # 1. magic for inline plot # 2. magic to print ver...
intel-analytics/analytics-zoo
pyzoo/zoo/chronos/use-case/AIOps/AIOps_anomaly_detect_unsupervised.ipynb
apache-2.0
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline df_1932 = pd.read_csv("m_1932.csv", header=None, usecols=[1,2,3], names=["time_step", "cpu_usage","mem_usage"]) """ Explanation: Unsupervised Anomaly Detection Anomaly detection detects data points in data that does n...
thalesians/tsa
src/jupyter/python/foundations/linear-algebra-2.ipynb
apache-2.0
# Copyright (c) Thalesians Ltd, 2018-2019. All rights reserved # Copyright (c) Paul Alexander Bilokon, 2018-2019. All rights reserved # Author: Paul Alexander Bilokon <paul@thalesians.com> # Version: 2.0 (2019.04.19) # Previous versions: 1.0 (2018.08.03) # Email: education@thalesians.com # Platform: Tested on Windows 1...
james-prior/cohpy
20160708-dojo-user-input-loop-with-iter-partial-input-prompt-sentinel.ipynb
mit
from functools import partial def convert(s): converters = (int, float) for converter in converters: try: value = converter(s) except ValueError: pass else: return value return s def process_input(s): value = convert(s) prin...
ES-DOC/esdoc-jupyterhub
notebooks/test-institute-3/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', 'test-institute-3', 'sandbox-3', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: TEST-INSTITUTE-3 Source ID: SANDBOX-3 Topic: Ocean Sub-Topics: Timestepp...
mdalvi/financial-analysis-and-algo-trading
visualization_matplotlib_pandas/matplotlib_notes.ipynb
mit
import matplotlib.pyplot as plt import numpy as np %matplotlib inline x = np.linspace(0,5,11) y = x ** 2 x y """ Explanation: Matplotlib Basics End of explanation """ plt.plot(x, y) plt.xlabel('X Label') plt.ylabel('Y Label') plt.title('Title') plt.show() # Multiplot on same canvas plt.subplot(1,2,1) # rows, c...
albahnsen/ML_RiskManagement
notebooks/01-IntroMachineLearning.ipynb
mit
# Import libraries %matplotlib inline import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt plt.style.use('ggplot') """ Explanation: 01 - Introduction to Machine Learning by Alejandro Correa Bahnsen & Iván Torroledo version 1.2, Feb 2018 Part of the class Machine Learning for Risk Management This...
henchc/Rediscovering-Text-as-Data
09-Topic-Modeling/01-Topic-Modeling.ipynb
mit
metadata_tb = Table.read_table('data/txtlab_Novel150_English.csv') metadata_tb.show(5) """ Explanation: Topic Modeling in Python In Lisa Rhody's article, "Topic Modeling and Figurative Language", she uses LDA topic modeling to look at ekphrasis poetry. She argues that ekphrasis poetry is particulary well-suited to an ...
emsi/ml-toolbox
random/Atmosfera/LSTM-10-conv.ipynb
agpl-3.0
root_services=np.sort(np.unique(Y)) # skonstruuj odwrtotny indeks kategorii głównych services_idx={root_services[i]: i for i in range(len(root_services))} # Zamień Y=[services_idx[y] for y in Y] Y=to_categorical(Y) Y.shape top_words = 5000 classes=Y[0,].shape[0] print(classes) # max_length (98th percentile is 476)...
Merinorus/adaisawesome
Homework/03 - Interactive Viz/HW3_Interactive_Viz.ipynb
gpl-3.0
import pandas as pd import numpy as np # We will read json files, for instance API keys stored in our computers for using Google Maps API, so they're not publicly visible import json # Geolocation import geopy from geopy.geocoders import geonames import math import logging p3_grant_export_data = pd.read_csv("P3_GrantE...
FireCARES/data
sources/parcels/notebooks/parcel-loading.ipynb
mit
import psycopg2 as pg import pandas as pd import os conn = pg.connect('service=parcels') conn_str = os.environ.get('PARCELS_CONNECTION') """ Explanation: Parcel loading Given a set of parcels (assumes GDB format) from the parcel provider, this notebook will load individual features (from the parcel provider -- curren...
kunaltyagi/SDES
notes/python/p_norvig/logic/Cheryl-and-Eve.ipynb
gpl-3.0
# Albert and Bernard just became friends with Cheryl, and they want to know when her birthday is. # Cheryl gave them a set of 10 possible dates: from __future__ import division, print_function CHERYL_DATES = { 'May 15', 'May 16', 'May 19', 'June 17', 'June 18', 'July 14', 'July 16', 'August ...
mrcslws/nupic.research
projects/archive/dynamic_sparse/notebooks/ExperimentAnalysis-ReplicateHSD-2x.ipynb
agpl-3.0
%load_ext autoreload %autoreload 2 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 * from nupic.research.frameworks.dynamic...
tensorflow/workshops
extras/amld/notebooks/solutions/2_keras.ipynb
apache-2.0
# In Jupyter, you would need to install TF 2.0 via !pip. %tensorflow_version 2.x import tensorflow as tf import json, os # Tested with TensorFlow 2.1.0 print('version={}, CUDA={}, GPU={}, TPU={}'.format( tf.__version__, tf.test.is_built_with_cuda(), # GPU attached? len(tf.config.list_physical_devices('GPU...
dombrno/PG
Notebooks/test_DOS.ipynb
bsd-2-clause
Tc_mf = meV_to_K(0.5*250) print '$T_c^{MF} = $', Tc_mf, "K" print r"$T_{KT} = $", Tc_mf/10.0, "K" """ Explanation: TB Model We pick the following parameters: + hopping constant $ t= 250$ meV + $\Delta = 1.0 t$ so that $T_c^{MF} = 0.5 t$, and so that $\xi_0 \simeq a_0$ + $g = -0.25$, unitless, so as to match the artic...
pm4py/pm4py-core
notebooks/3_process_discovery.ipynb
gpl-3.0
import pandas as pd import pm4py df = pm4py.format_dataframe(pd.read_csv('data/running_example.csv', sep=';'), case_id='case_id',activity_key='activity', timestamp_key='timestamp') bpmn_model = pm4py.discover_bpmn_inductive(df) pm4py.view_bpmn(bpmn_model) """ Explanation: Process Discovery...
nilbody/h2o-3
h2o-py/demos/kmeans_aic_bic_diagnostics.ipynb
apache-2.0
import h2o import imp from h2o.estimators.kmeans import H2OKMeansEstimator # Start a local instance of the H2O engine. h2o.init(); """ Explanation: Much data produced is unlabeled data, data where the target vale or class is unknown. Unsupervised learning gives us the tools to find hidden structure in unlabeled data...
ozorich/phys202-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): """Return a 2d checkboard of 0.0 and 1.0 as a NumPy array""" # Y...
wazaahhh/bountyhunt
jupyter/bhunt_dynamics.ipynb
mit
1000*(1/10**1.5) """ Explanation: CDF(X > x) = 1/x^mu = x^-mu PDF(X=x) = 1/x^(mu+1) = x^-(mu +1) alpha = mu +1 mu = 1.5 # coinbase CDF (X > x = 5) = 1/5^1.5 End of explanation """ bins = np.arange(1,max(date)+1,7) H = pl.histogram(date,bins = bins) x = H[1][:-1] y = H[0] c = (y>0)*(x > 30.0) lx = np.log10(x[c] - m...
fascow/bruker_compass_scripts
LibraryEditor/Library_Spectra_Export_process_results.ipynb
mit
folder = 'D:\data\Libraries\Example_Xpec' archive = 'all_spectra.json' """ Explanation: Library Spectra Export process results Read spectra files exported from the Bruker Spectra Library. All spectra files shall end with ".spectrum" and be located in one folder. Only one spectrum per file. Please, specify the folder ...
CNS-OIST/STEPS_Example
user_manual/source/well_mixed.ipynb
gpl-2.0
import steps.model as smodel """ Explanation: Well-Mixed Reaction Systems The simulation script described in this chapter is available at STEPS_Example repository. In this chapter, we'll use some simple classical reaction systems as examples to introduce the basics of using STEPS. More specifically, we'll focus on rea...
jarthurgross/arxiv-submission-modeling
arxiv-modeling.ipynb
mit
from collections import Counter import itertools as it from IPython.display import display import pandas import numpy as np import matplotlib.pyplot as plt from scipy import stats %matplotlib inline %config InlineBackend.figure_formats = ['svg'] """ Explanation: When will monthly arXiv submissions hit 10,000? End of...
PyladiesMx/Pyladies_ifc
1. PrimitiveTypes_and_operators/objetos simples y operaciones básicas.ipynb
mit
import turtle ventana = turtle.Screen() ventana.bgcolor('lightblue') ventana.title('Hello Erika!') erika = turtle.Turtle() erika.color('blue') erika.pensize(5) erika.forward(100) erika.left(90) erika.forward(100) """ Explanation: Bienvenid@s!! En la reunión de hoy aprenderemos acerca de python y sus cimientos. Verem...
tanmay987/deepLearning
intro-to-tflearn/TFLearn_Sentiment_Analysis.ipynb
mit
import pandas as pd import numpy as np import tensorflow as tf import tflearn from tflearn.data_utils import to_categorical print(1) """ Explanation: Sentiment analysis with TFLearn In this notebook, we'll continue Andrew Trask's work by building a network for sentiment analysis on the movie review data. Instead of a ...
feststelltaste/software-analytics
demos/20210630_WeAreDevelopersWorldCongress/Parsing and Analysing vmstat Data the Easy Way.ipynb
gpl-3.0
%less ../dataset/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("../dataset/vmstat_loadtest.log") stats.head() """ Explanation: Data Inp...
wem3/gems_vs_bomb
rez/all_bandits.ipynb
mit
# imports / display plots in cell output %matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.stats as ss import pandas as pd import seaborn as sns import statsmodels """ Explanation: Reinforcement Learning Models of Social Group Preferences Bandit Experiments 1-7 End of explanation """ ...
rpestourie/filters_AVX
Final_Report.ipynb
mit
import sys import os.path sys.path.append(os.path.join('.', 'util')) import set_compiler set_compiler.install() import pyximport pyximport.install() from timer import Timer import pylab as plt import numpy as np """ Explanation: Gaussian and Bilateral filters with AVX Table of Contents <p><div class="lev1"><a href...
sdpython/pyensae
_doc/notebooks/pyensae_text2table.ipynb
mit
import random, pandas text = [ "one","two","three","four","five","six","seven","eight","nine","ten" ] data = [ { "name": text[random.randint(0,9)], "number": random.randint(0,99)} \ for i in range(0,10000) ] df = pandas.DataFrame(data) df.head(n=3) df.to_csv("flatfile.txt", sep="\t", encoding="...
mdpiper/dakota-tutorial
notebooks/4-WMT.ipynb
mit
%pylab inline import os """ Explanation: <img src="images/csdms_logo.jpg"> Example 4 Let's use IPython Notebook to download model output from WMT and examine the results. Set up with pylab magic, plus other global imports: End of explanation """ os.chdir(os.path.join('..', 'examples', '4-WMT')) os.getcwd() """ Exp...
yangdikun/magLab
MagDipole.ipynb
mit
def MagneticMonopoleField(obsloc,poleloc=(0.,0.,0.),Q=1): # relative obs. loc. to pole, assuming pole at origin dx, dy, dz = obsloc[0]-poleloc[0], obsloc[1]-poleloc[1], obsloc[2]-poleloc[2] r = np.sqrt(dx**2+dy**2+dz**2) Bx = Q * 1e-7 / r**2 * dx By = Q * 1e-7 / r**2 * dy Bz = Q * 1e-7 / r**2 * ...
deeplook/notebooks
mapping/here_maps_api_explorer_no_creds.ipynb
mit
import os msg = "Error: Environment variable {} not found" for varname in ["HEREMAPS_APP_ID", "HEREMAPS_APP_CODE"]: assert os.getenv(varname), msg.format(varname) import folium import requests import ipywidgets print("You are ready to go!") """ Explanation: HERE Map Tiles Rest API Explorer This notebook is inten...
JakeColtman/BayesianSurvivalAnalysis
PyMC Part 2 Done.ipynb
mit
running_id = 0 output = [[0]] with open("E:/output.txt") as file_open: for row in file_open.read().split("\n"): cols = row.split(",") if cols[0] == output[-1][0]: output[-1].append(cols[1]) output[-1].append(True) else: output.append(cols) output = out...
mne-tools/mne-tools.github.io
0.19/_downloads/5405ec123125b53ac343bbc1ba002342/plot_stats_spatio_temporal_cluster_sensors.ipynb
bsd-3-clause
# Authors: Denis Engemann <denis.engemann@gmail.com> # Jona Sassenhagen <jona.sassenhagen@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable from mne.viz import plot_topomap import mne from mne.stats import spatio_...
ronnydw/data-science-projects
class-central-survey-2016-17/Graduated.ipynb
mit
df = pd.read_csv('raw/2016-17-ClassCentral-Survey-data-noUserText.csv', decimal=',', encoding = "ISO-8859-1") """ Explanation: Read the survey data End of explanation """ df['What is your level of formal education?'].value_counts() target_name = 'Graduated' graduated = (pd.to_numeric(df['What is your level of forma...
mediagit2016/workcamp-maschinelles-lernen-grundlagen
18-05-14-ml-workcamp/sensor-daten-10/Projekt-Sensordaten-Feature-Selektion-Workcamp-ML.ipynb
gpl-3.0
# Laden der entsprechenden Module (kann etwas dauern !) # Wir laden die Module offen, damit man einmal sieht, was da alles benötigt wird # Allerdings aufpassen, dann werden die Module anderst angesprochen wie beim Standard # zum Beispiel pyplot und nicht plt from matplotlib import pyplot pyplot.rcParams["figure.figsize...
amitkaps/applied-machine-learning
Module-03e-Model-RandomForest.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline plt.style.use('fivethirtyeight') df = pd.read_csv("data/historical_loan.csv") # refine the data df.years = df.years.fillna(np.mean(df.years)) #Load the preprocessing module from sklearn import preprocessing categorical_variable...
FowlerLab/Enrich2
docs/notebooks/min_count.ipynb
bsd-3-clause
% matplotlib inline from __future__ import print_function import os.path import numpy as np import pandas as pd import matplotlib.pyplot as plt from enrich2.variant import WILD_TYPE_VARIANT import enrich2.plots as enrich_plot pd.set_option("display.max_rows", 10) # rows shown when pretty-printing """ Explanation: Sel...
pysal/spaghetti
notebooks/quickstart.ipynb
bsd-3-clause
%config InlineBackend.figure_format = "retina" %load_ext watermark %watermark import geopandas import libpysal import matplotlib import matplotlib.pyplot as plt import matplotlib.lines as mlines import matplotlib_scalebar from matplotlib_scalebar.scalebar import ScaleBar import shapely import spaghetti %matplotlib in...
Upward-Spiral-Science/uhhh
code/.ipynb_checkpoints/[Assignment 14] JM-checkpoint.ipynb
apache-2.0
import numpy as np import seaborn as sns from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import csv data = open('../data/data.csv', 'r').readlines() fieldnames = ['x', 'y', 'z', 'unmasked', 'synapses'] reader = csv.reader(data) reader.next() rows = [[int(col) for col in row] for row in reader]...
wgong/open_source_learning
projects/Open_Food/data-incubator-challenge-100k.ipynb
apache-2.0
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: Data Incubator Fellowship Semifinalist Challenge <a href="mailto:wen.gong@gmail.com"><font size=+2>Wen Gong</font></a> Motivation <br> <font color=red size=+2>Know what we eat, </font> <font color=green size=+2> Gain insight into food, </...
Boialex/MIPT-ML
hw3/Contest.ipynb
gpl-3.0
import pandas as pd from sklearn import model_selection, metrics import numpy as np import matplotlib.pyplot as plt import seaborn import xgboost import os %pylab inline train = pd.read_csv("train.tsv") test = pd.read_csv("test.tsv") sample_submission = pd.read_csv("sample_submission.tsv") sample_submission_a = pd.rea...
minxuancao/shogun
doc/ipython-notebooks/regression/Regression.ipynb
gpl-3.0
%pylab inline %matplotlib inline import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') from cycler import cycler # import all shogun classes from modshogun import * slope = 3 X_train = rand(30)*10 y_train = slope*(X_train)+random.randn(30)*2+2 y_true = slope*(X_train)+2 X_test = concatenate((linspace...