repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
seg/2016-ml-contest
geoLEARN/Submission_4_XtraTrees.ipynb
apache-2.0
###### Importing all used packages %matplotlib inline import warnings warnings.filterwarnings('ignore') import pandas as pd import numpy as np from pandas import set_option pd.options.mode.chained_assignment = None ###### Import packages needed for the make_vars functions import Feature_Engineering as FE ##### imp...
liganega/Gongsu-DataSci
previous/notes2017/W01/GongSu02_Anaconda_Installation.ipynb
gpl-3.0
a = 2 b = 3 a + b """ Explanation: 아나콘다(Anaconda) 소개 아나콘다 패키지 소개 파이썬 프로그래밍 언어 개발환경 파이썬 기본 패키지 이외에 데이터분석용 필수 패키지 포함 기본적으로 스파이더 에디터를 활용하여 강의 진행 아나콘다 패키지 다운로드 아나콘다 패키지를 다운로드 하려면 아래 사이트를 방문한다 https://www.anaconda.com/download/ 이후 아래 그림을 참조하여 다운받는다. 주의: 강의에서는 파이썬 2.7 버전을 사용한다. <p> <table cellspacing="20"> <tr> <td> ...
mjabri/holoviews
doc/Tutorials/Continuous_Coordinates.ipynb
bsd-3-clause
import numpy as np import holoviews as hv %reload_ext holoviews.ipython np.set_printoptions(precision=2, linewidth=80) %opts HeatMap (cmap="hot") """ Explanation: HoloViews is designed to work with scientific and engineering data, which is often in the form of discrete samples from an underlying continuous system. I...
SECOORA/GUTILS
docs/notebooks/0001 - Converting Slocum data to a standard DataFrame.ipynb
mit
from IPython.lib.pretty import pprint import logging logger = logging.getLogger('gutils') logger.handlers = [logging.StreamHandler()] logger.setLevel(logging.DEBUG) import sys from pathlib import Path # Just a hack to be able to `import gutils` sys.path.append(str(Path('.').absolute().parent.parent)) binary_folder =...
kit-cel/wt
mloc/ch6_Unsupervised_Learning/KMeans_Illustration_Animated.ipynb
gpl-2.0
import numpy as np import matplotlib as mpl mpl.use('TkAgg') import matplotlib.pyplot as plt import sklearn.datasets as sk from matplotlib import animation from matplotlib.animation import PillowWriter # Disable if you don't want to save any GIFs. %matplotlib inline """ Explanation: Illustration of the K-Means Algorit...
seanware/try_quantopian
mentorship.ipynb
mit
import datetime import numpy as np import pandas as pd import zipline %matplotlib inline STOCKS = ['AMD', 'CERN', 'COST', 'DELL', 'GPS', 'INTC', 'MMM'] """ Explanation: <img src="http://photos3.meetupstatic.com/photos/event/f/9/d/global_432903997.jpeg" style="display:inline;width:100px"></img> Mentorship Program Des...
jdhp-docs/python-notebooks
python_sklearn_mlp_fr.ipynb
mit
import sklearn # version >= 0.18 is required version = [int(num) for num in sklearn.__version__.split('.')] assert (version[0] >= 1) or (version[1] >= 18) """ Explanation: Le perceptron multicouche avec scikit-learn Documentation officielle: http://scikit-learn.org/stable/modules/neural_networks_supervised.html Noteb...
tensorflow/docs-l10n
site/zh-cn/hub/tutorials/bert_experts.ipynb
apache-2.0
#@title Copyright 2020 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 ...
dolittle007/dolittle007.github.io
notebooks/survival_analysis.ipynb
gpl-3.0
%matplotlib inline from matplotlib import pyplot as plt import numpy as np import pymc3 as pm from pymc3.distributions.timeseries import GaussianRandomWalk import seaborn as sns from statsmodels import datasets from theano import tensor as T """ Explanation: Bayesian Survival Analysis Author: Austin Rochford Survival...
hajicj/FEL-NLP-IR_2016
tutorial/tutorial.ipynb
apache-2.0
import npfl103 """ Explanation: Information Retrieval This is a tutorial for the npfl103 package for Information Retrieval assignments. Big picture In simple IR systems that we'll build in this lab session, two major things are happening more or less independently on each other. One: the similarity index of documents ...
cbpygit/pypmj
examples/Setting up a configuration file.ipynb
gpl-3.0
import config_tools as ct """ Explanation: Getting a config parser The pypmj-module uses a configuration file in which all information about the JCMsuite-installation, data storage, servers and so on are set. This makes pypmj very flexible, as you can generate as many configuration files as you like. Here, we show how...
NeuroDataDesign/fngs
docs/ebridge2/fngs_specs/week_0309/specs.ipynb
apache-2.0
%%script false ## disklog.sh #!/bin/bash -e # run this in the background with nohup ./disklog.sh > disk.txt & # while true; do echo "$(du -s $1 | awk '{print $1}')" sleep 30 done ##cpulog.sh import psutil import time import argparse def cpulog(outfile): with open(outfile, 'w') as outf: while(Tr...
gautam1858/tensorflow
tensorflow/lite/g3doc/tutorials/pose_classification.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...
robertoalotufo/ia898
src/sat.ipynb
mit
def sat(f): return f.cumsum(axis=1).cumsum(axis=0) def satarea(sat,r0_c0,r1_c1): a,b,c,d = 0,0,0,0 r0,c0 = r0_c0 r1,c1 = r1_c1 if ((r0 - 1 >= 0) and (c0 - 1 >= 0)): a = sat[r0-1,c0-1] if (r0 - 1 >= 0): b = sat[r0-1,c1] if (c0 - 1 >= 0): c = sat[r1,c0-1] d = sat[r...
awhite40/pymks
notebooks/intro.ipynb
mit
%matplotlib inline %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt """ Explanation: Meet PyMKS In this short introduction, we will demonstrate the functionality of PyMKS to compute 2-point statistics in order to objectively quantify microstructures, predict effective properties ...
msampathkumar/kaggle-quora-tensorflow
references/sentiment-rnn/Sentiment RNN.ipynb
apache-2.0
import numpy as np import tensorflow as tf with open('../sentiment_network/reviews.txt', 'r') as f: reviews = f.read() with open('../sentiment_network/labels.txt', 'r') as f: labels = f.read() reviews[:2000] """ Explanation: Sentiment Analysis with an RNN In this notebook, you'll implement a recurrent neural...
bregmanstudio/SoundscapeEcology
SoundscapeComponentAnalysis.ipynb
mit
from pylab import * # numpy, matplotlib, plt from bregman.suite import * # Bregman audio feature extraction library from soundscapeecology import * # 2D time-frequency shift-invariant convolutive matrix factorization %matplotlib inline rcParams['figure.figsize'] = (15.0, 9.0) """ Explanation: <h1>Soundscape Analysis b...
kit-cel/wt
ccgbc/ch2_Codes_Basic_Concepts/BEC_FiniteLength_Upper_Lower_Bounds.ipynb
gpl-2.0
import numpy as np import matplotlib import matplotlib.pyplot as plt # plotting options font = {'size' : 20} plt.rc('font', **font) plt.rc('text', usetex=matplotlib.checkdep_usetex(True)) matplotlib.rc('figure', figsize=(18, 6) ) """ Explanation: Finite-Length Performance on the BEC Channel This code is provided ...
NathanYee/ThinkBayes2
bayesianLinearRegression/nathanTest.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...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/08_image/mnist_models.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst from datetime import datetime import os PROJECT = "your-project-id-here" # REPLACE WITH YOUR PROJECT ID BUCKET = "your-bucket-id-here" # REPLACE WITH YOUR BUCKET NAME REGION = "us-central1" # REPLACE WITH YOUR BUCKET REGION e.g. us-central1 MODEL_T...
cosmicBboy/themis-ml
paper/Evaluating Themis-ml.ipynb
mit
from themis_ml import datasets from themis_ml.datasets.german_credit_data_map import \ preprocess_german_credit_data from themis_ml.metrics import mean_difference, normalized_mean_difference, \ mean_confidence_interval german_credit = datasets.german_credit() german_credit[ ["credit_risk", "purpose", "age_...
daviddesancho/mdtraj
examples/solvent-accessible-surface-area.ipynb
lgpl-2.1
%matplotlib inline from __future__ import print_function import numpy as np import mdtraj as md """ Explanation: In this example, we'll compute the solvent accessible surface area of one of the residues in our protien accross each frame in a MD trajectory. We're going to use our trustly alanine dipeptide trajectory fo...
H-E-L-P/XID_plus
docs/build/html/notebooks/examples/XID+example_run_script-PACS.ipynb
mit
import numpy as np from astropy.io import fits from astropy import wcs import pickle import dill import sys import os import xidplus import copy from xidplus import moc_routines, catalogue from xidplus import posterior_maps as postmaps from builtins import input """ Explanation: XID+ Example Run Script (This is based...
desihub/desisim
doc/nb/simqso-templates.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Polygon from desisim.templates import SIMQSO, QSO import multiprocessing nproc = multiprocessing.cpu_count() // 2 plt.style.use('seaborn-talk') %matplotlib inline """ Explanation: Simulate QSO spectra. The purpose of this notebook is ...
royalosyin/Python-Practical-Application-on-Climate-Variability-Studies
ex31-Harmonic Analysis - Monthly Mean Temperature at Orange, Australia.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt from HA_helpers import * %matplotlib inline # Set some parameters to apply to all plots. These can be overridden import matplotlib # Plot size to 12" x 7" matplotlib.rc('figure', figsize = (15, 7)) # Font size to 14 matplotlib.rc('font', size = 14...
Jackporter415/phys202-2015-work
assignments/assignment05/InteractEx04.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.display import display """ Explanation: Interact Exercise 4 Imports End of explanation """ def random_line(m, b, sigma, size=10): """Create a line y = m*x + b + N(0,si...
wbarfuss/pymofa
tutorial/02_LocalParallelization.ipynb
mit
from ipyparallel import Client import os c = Client() view = c[:] print(c.ids) %%px def find(name, path): for root, dirs, files in os.walk(path): if name in files: return root path = find('02_LocalParallelization.ipynb', '/home/') print(path) os.chdir(path) """ Explanation: How to locally run...
JJINDAHOUSE/deep-learning
autoencoder/Simple_Autoencoder.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) """ Explanation: A Simple Autoencoder We'll start off by building a simple autoencoder to compres...
bccp/imaginglss-notebooks
BrickInvestigation.ipynb
artistic-2.0
from imaginglss.analysis import completeness from imaginglss.analysis import targetselection from imaginglss.utils.npyquery import Column as C b = dr.brickindex.get_brick(dr.brickindex.search_by_name('2445p072')) tractor = dr.catalogue.open(b) sigma = {'r':5, 'z':5, 'g':5} LRG = targetselection.LRG(tractor) QSO = t...
atlury/deep-opencl
DL0110EN/3.3.3practice_predicting_MNIST.ipynb
lgpl-3.0
!conda install -y torchvision import torch import torch.nn as nn import torchvision.transforms as transforms import torchvision.datasets as dsets import matplotlib.pylab as plt import numpy as np """ Explanation: <div class="alert alert-block alert-info" style="margin-top: 20px"> <a href="http://cocl.us/pytorch_link...
tensorflow/docs-l10n
site/en-snapshot/io/tutorials/orc.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...
zhuanxuhit/deep-learning
intro-to-tensorflow/.ipynb_checkpoints/intro_to_tensorflow-checkpoint.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...
GoogleCloudPlatform/asl-ml-immersion
notebooks/docker_and_kubernetes/solutions/2_intro_k8s.ipynb
apache-2.0
import os CLUSTER_NAME = "asl-cluster" ZONE = "us-central1-a" os.environ["CLUSTER_NAME"] = CLUSTER_NAME os.environ["ZONE"] = ZONE """ Explanation: Introduction to Kubernetes Learning Objectives * Create GKE cluster from command line * Deploy an application to your cluster * Cleanup, delete the cluster Overview K...
esa-as/2016-ml-contest
Kr1m/Kr1m_SEG_ML_Attempt1.ipynb
apache-2.0
import warnings warnings.filterwarnings("ignore") %matplotlib inline import sys sys.path.append("..") #Import standard pydata libs import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns filename = '../facies_vectors.csv' training_data = pd.read_csv(filename) training_data['Well ...
google/physics-math-tutorials
colabs/QNN_hands_on.ipynb
apache-2.0
# install published dev version # !pip install cirq~=0.4.0.dev # install directly from HEAD: !pip install git+https://github.com/quantumlib/Cirq.git@8c59dd97f8880ac5a70c39affa64d5024a2364d0 """ Explanation: Copyright 2021 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this ...
google-research/ott
docs/notebooks/fairness.ipynb
apache-2.0
fig, ax = plt.subplots(1, 1, figsize=(8, 5)) plot_quantiles(logits, groups, ax) ax.tick_params(axis='both', which='major', labelsize=16) ax.set_title(f'Baseline Quantiles', fontsize=22) ax.set_xlabel('Quantile Level', fontsize=18) ax.set_ylabel('Prediction', fontsize=18) """ Explanation: Fairness regularizers In this ...
hanhanwu/Hanhan_Data_Science_Practice
make_sense_dimension_reduction.ipynb
mit
import sklearn.datasets as ds from sklearn.decomposition import PCA import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler import numpy as np %matplotlib inline data = ds.load_breast_cancer()['data'] data.shape # 30 features z_scaler = StandardScaler() z_data = z_scaler.fit_transform(data) ...
Kaggle/learntools
notebooks/intro_to_programming/raw/ex3.ipynb
apache-2.0
# Set up the exercise from learntools.core import binder binder.bind(globals()) from learntools.intro_to_programming.ex3 import * print('Setup complete.') """ Explanation: In the tutorial, you learned about four different data types: floats, integers, strings, and booleans. In this exercise, you'll experiment with th...
joshnsolomon/phys202-2015-work
assignments/assignment05/InteractEx01.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 01 Import End of explanation """ def print_sum(a, b): """Print the sum of the arguments a and b.""" ...
susantabiswas/Natural-Language-Processing
Notebooks/Word_Prediction_Add-1_Smoothing_with_Interpolation.ipynb
mit
from nltk.util import ngrams from collections import defaultdict from collections import OrderedDict import string import time import gc from math import log10 start_time = time.time() """ Explanation: <u>Word prediction</u> Language Model based on n-gram Probabilistic Model Add-1 Smoothing Used with Interpolation Hig...
ioshchepkov/SHTOOLS
examples/notebooks/tutorial_6.ipynb
bsd-3-clause
%matplotlib inline from __future__ import print_function # only necessary if using Python 2.x import numpy as np from pyshtools import SHCoeffs lmax = 30 coeffs = SHCoeffs.from_zeros(lmax) coeffs.set_coeffs(values=[1], ls=[10], ms=[0]) """ Explanation: 3D Spherical Harmonic Plots This example demonstrates how to gene...
mattssilva/UW-Machine-Learning-Specialization
Week 1/.ipynb_checkpoints/Getting Started with SFrames-checkpoint.ipynb
mit
import graphlab # Set product key on this computer. After running this cell, you will not need to re-enter your product key. graphlab.product_key.set_product_key('your product key here') # Limit number of worker processes. This preserves system memory, which prevents hosted notebooks from crashing. graphlab.set_runti...
jepegit/cellpy
dev_utils/lookup/cellpy_hdf5_tweaking.ipynb
mit
%load_ext autoreload %autoreload 2 from pathlib import Path from pprint import pprint import pandas as pd import cellpy """ Explanation: Tweaking the cellpy file format A cellpy file is a hdf5-type file. From v.5 it contains five top-level directories. ```python from cellreader.py raw_dir = prms._cellpyfile_raw ste...
ramseylab/networkscompbio
class20_partialcorr_python3.ipynb
apache-2.0
import pandas ## data file loading import numpy import sklearn.covariance ## for covariance matrix calculation import matplotlib.pyplot import matplotlib import pylab import scipy.stats ## for calculating the CDF of normal distribution import igraph ## for network visualization and finding components import math "...
roebius/deeplearning_keras2
nbs2/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) result1 = torch.Tensor(5, 3) result1 = x + y result1 # anything ending in '_' is an in-place operation y.add_(x) # adds x to y in-place # standard numpy-...
keras-team/keras-io
examples/generative/ipynb/adain.ipynb
apache-2.0
import os import glob import imageio import numpy as np from tqdm import tqdm import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt import tensorflow_datasets as tfds from tensorflow.keras import layers # Defining the global variables. IMAGE_SIZE = (224, 224) BATCH_SIZE = 64 # Training f...
bhargavvader/gensim
docs/notebooks/gensim Quick Start.ipynb
lgpl-2.1
raw_corpus = ["Human machine interface for lab abc computer applications", "A survey of user opinion of computer system response time", "The EPS user interface management system", "System and human system engineering testing of EPS", "Relation of user pe...
unpingco/Python-for-Probability-Statistics-and-Machine-Learning
chapters/machine_learning/notebooks/regularization.ipynb
mit
from IPython.display import Image Image('../../../python_for_probability_statistics_and_machine_learning.jpg') """ Explanation: Regularization End of explanation """ import sympy as S S.var('x:2 l',real=True) J=S.Matrix([x0,x1]).norm()**2 + l*(1-x0-2*x1) sol=S.solve(map(J.diff,[x0,x1,l])) print(sol) """ Explanatio...
mit-eicu/eicu-code
notebooks/nursecharting.ipynb
mit
# Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import psycopg2 import getpass # for configuring connection from configobj import ConfigObj import os %matplotlib inline # Create a database connection using settings from config file config='../db/config.ini' # connection in...
blevine37/pySpawn17
examples/spawn_analysis.ipynb
mit
print "Currently in directory:", os.getcwd() # THIS IS THE ONLY PART OF THE CODE THAT NEEDS TO BE CHANGED dir_name = "/Users/Dmitry/Documents/Research/MSU/4tce/cis/" h5filename = "sim.1.hdf5" os.chdir(dir_name) an = pyspawn.fafile(h5filename) an.fill_electronic_state_populations(column_filename="N.dat") an.fill_labe...
nbokulich/short-read-tax-assignment
ipynb/mock-community/taxonomy-assignment-vsearch.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_repo...
chetnapriyadarshini/deep-learning
autoencoder/Convolutional_Autoencoder.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) img = mnist.train.images[2] plt.imshow(img.reshape((28, 28)), cmap='Greys_r') """ Explanation: C...
sujitpal/polydlot
src/mxnet/01-mnist-fcn.ipynb
apache-2.0
from __future__ import division, print_function from sklearn.metrics import accuracy_score, confusion_matrix from sklearn.preprocessing import OneHotEncoder import matplotlib.pyplot as plt import mxnet as mx import numpy as np import os %matplotlib inline DATA_DIR = "../../data" TRAIN_FILE = os.path.join(DATA_DIR, "mn...
Chipe1/aima-python
planning_hierarchical_search.ipynb
mit
from planning import * from notebook import psource psource(Problem.refinements) """ Explanation: Hierarchical Search Hierarchical search is a a planning algorithm in high level of abstraction. <br> Instead of actions as in classical planning (chapter 10) (primitive actions) we now use high level actions (HLAs) (see...
YzPaul3/h2o-3
h2o-py/demos/H2O_tutorial_breast_cancer_classification.ipynb
apache-2.0
import h2o # Start an H2O Cluster on your local machine h2o.init() """ Explanation: H2O Tutorial: Breast Cancer Classification Author: Erin LeDell Contact: erin@h2o.ai This tutorial steps through a quick introduction to H2O's Python API. The goal of this tutorial is to introduce through a complete example H2O's capab...
slundberg/shap
notebooks/tabular_examples/tree_based_models/Explaining a simple OR function.ipynb
mit
import numpy as np import xgboost import shap """ Explanation: Explaining a simple OR function This notebook examines what it looks like to explain an OR function using SHAP values. It is based on a simple example with two features is_young and is_female, roughly motivated by the Titanic survival dataset where women a...
ES-DOC/esdoc-jupyterhub
notebooks/test-institute-1/cmip6/models/sandbox-3/atmoschem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'test-institute-1', 'sandbox-3', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: TEST-INSTITUTE-1 Source ID: SANDBOX-3 Topic: Atmoschem Sub-Topic...
caiyunapp/theano_lstm
Tutorial.ipynb
bsd-3-clause
## Fake dataset: class Sampler: def __init__(self, prob_table): total_prob = 0.0 if type(prob_table) is dict: for key, value in prob_table.items(): total_prob += value elif type(prob_table) is list: prob_table_gen = {} for key in prob_tabl...
catedrasaes-umu/NoSQLDataEngineering
projects/es.um.nosql.streaminginference.json2dbschema/benchmark/Benchmark.ipynb
mit
%%bash java -version """ Explanation: Pruebas de rendimiento sobre Streaming Inference Es necesario tener instalada la versión de java 1.8: End of explanation """ import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator import seaborn as sns from matplotlib import pylab import nu...
fjaviersanchez/JupyterTutorial
index.ipynb
mit
import datetime print(datetime.datetime.now()) """ Explanation: Introduction to Jupyter Notebooks Tutorial by Javier Sánchez, University of California, Irvine Prepared for the DESC Collaboration Meeting - Oxford - July 2016. Requirements: * anaconda (includes jupyter, astropy, numpy, scipy and matplotlib) * seaborn ...
metpy/MetPy
v1.0/_downloads/e5685967297554788de3cf5858571b23/Natural_Neighbor_Verification.ipynb
bsd-3-clause
import matplotlib.pyplot as plt import numpy as np from scipy.spatial import ConvexHull, Delaunay, delaunay_plot_2d, Voronoi, voronoi_plot_2d from scipy.spatial.distance import euclidean from metpy.interpolate import geometry from metpy.interpolate.points import natural_neighbor_point """ Explanation: Natural Neighbo...
srcole/qwm
misc/Nonuniform phase distribution.ipynb
mit
from neurodsp import sim freq = 8 T = 60 Fs = 1000 x = sim.sim_bursty_oscillator(freq, T, Fs, rdsym = .2, prob_enter_burst=1, prob_leave_burst=0) # Cut out buffer time t = np.arange(0, T, 1/Fs) # Plot signal tlim = (0,2) tidx = np.logical_and(t>=tlim[0], t<tlim[1]) plt.figure(figsize=(16,3)) plt.plot(t[tidx], x[tidx]...
jeroarenas/MLBigData
0_Introduction/Intro_PySpark_1.ipynb
mit
fruits = ['apple', 'orange', 'banana', 'grape', 'watermelon', 'apple', 'orange', 'apple'] number_partitions = 4 dataRDD = sc.parallelize(fruits, number_partitions) print type(dataRDD) """ Explanation: Counting words 1.- Creating a simple RDD . We will create a simple RDD and apply basic operations End of explanation ...
dolejarz/engsci_capstone_transport
python/DDM/DDM.ipynb
mit
import pandas as pd import matplotlib.pyplot as plt import matplotlib import datetime as dt import scipy.stats as stats from scipy.stats import norm import numpy as np import math import seaborn as sns from InvarianceTestEllipsoid import InvarianceTestEllipsoid from autocorrelation import autocorrelation import stats...
rokkamsatyakalyan/Machine_Learning
K_NEAREST_IMPLEMENTATION.ipynb
gpl-3.0
import pandas as pd import numpy as np from collections import Counter from math import sqrt import random import warnings """ Explanation: IMPLEMENTING K_NEAREST_NEIGHBOUR In the given data set we have to classify into which cluster a instance is going to fall Importing required predifined methods End of explanatio...
CAChemE/curso-python-datos
notebooks/010-NumPy-Intro.ipynb
bsd-3-clause
import numpy as np #para ver la versión que tenemos instalada: np.__version__ """ Explanation: Introducción a NumPy _Hasta ahora hemos visto los tipos de datos más básicos que nos ofrece Python: integer, real, complex, boolean, list, tuple... Pero ¿no echas algo de menos? Efectivamente, los arrays. _ En este notebook...
GoogleCloudPlatform/ml-design-patterns
03_problem_representation/reframing.ipynb
apache-2.0
import numpy as np import seaborn as sns from google.cloud import bigquery import matplotlib as plt %matplotlib inline bq = bigquery.Client() query = """ SELECT weight_pounds, is_male, gestation_weeks, mother_age, plurality, mother_race FROM `bigquery-public-data.samples.natality` WHERE weight_pounds...
gee-community/gee_tools
notebooks/date/since_epoch.ipynb
mit
date_band = tools.date.getDateBand(test_image, 'day') ui.eprint(date_band) """ Explanation: get_date_band Get the date of an image, compute how many units (for example day) has ellpsed since the epoch (1970-01-01) and set it to a band (called date) and a property (called unit_since_epoch, for example, day_since_epoch...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch2-Problem_2-05.ipynb
unlicense
%pylab notebook %precision 4 from scipy import constants as c # we like to use some constants """ Explanation: Excercises Electric Machinery Fundamentals Chapter 2 Problem 2-5 End of explanation """ #60Hz side (North America) Vrms60 = 120 # [V] freq60 = 60 # [Hz] #50Hz side (Europe) Vrms50 = 240 # [V] freq50 = 5...
mne-tools/mne-tools.github.io
0.18/_downloads/7bb2e6f1056f5cae3a98ccc12aac266f/plot_eeg_no_mri.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Joan Massich <mailsik@gmail.com> # # License: BSD Style. import os.path as op import mne from mne.datasets import eegbci from mne.datasets import fetch_fsaverage # Download fsaverage files fs_dir = fetch_fsaverage(verbose=True) subjects_dir = op....
statsmodels/statsmodels.github.io
v0.13.1/examples/notebooks/generated/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...
project-chip/connectedhomeip
docs/guides/repl/Matter - Multi Fabric Commissioning.ipynb
apache-2.0
import os, subprocess if os.path.isfile('/tmp/repl-storage.json'): os.remove('/tmp/repl-storage.json') # So that the all-clusters-app won't boot with stale prior state. os.system('rm -rf /tmp/chip_*') """ Explanation: Multi Fabric - Commissioning and Interactions <a href="http://35.236.121.59/hub/user-redire...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/end_to_end_ml/solutions/keras_dnn_babyweight.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst !pip install --user google-cloud-bigquery==1.25.0 """ Explanation: Creating Keras DNN model Learning Objectives Create input layers for raw features Create feature columns for inputs Create DNN dense hidden layers and output layer Build DNN model tyi...
mastertrojan/Udacity
batch-norm/Batch_Normalization_Solutions.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 – Solutions Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a co...
yevheniyc/Projects
1m_ML_Security/notebooks/answers/Worksheet 5 - DGA Detection Feature Engineering - Answers.ipynb
mit
## Load data df = pd.read_csv('../../data/dga_data_small.csv') df.drop(['host', 'subclass'], axis=1, inplace=True) print(df.shape) df.sample(n=5).head() # print a random sample of the DataFrame df[df.isDGA == 'legit'].head() # Google's 10000 most common english words will be needed to derive a feature called ngrams.....
ledeprogram/algorithms
class7/donow/wang_zhizhou_7_donow.ipynb
gpl-3.0
import pandas as pd %matplotlib inline import numpy as np from sklearn.linear_model import LogisticRegression """ Explanation: Apply logistic regression to categorize whether a county had high mortality rate due to contamination 1. Import the necessary packages to read in the data, plot, and create a logistic regressi...
jdvelasq/ingenieria-economica
05-bonos.ipynb
mit
# Importa la librería financiera. # Solo es necesario ejecutar la importación una sola vez. import cashflows as cf """ Explanation: Bonos Juan David Velásquez Henao jdvelasq@unal.edu.co Universidad Nacional de Colombia, Sede Medellín Facultad de Minas Medellín, Colombia Haga click aquí para acceder a la última versi...
scidash/sciunit
docs/chapter6.ipynb
mit
# Install SciUnit if necessary !pip install -q sciunit # Import the package import sciunit # Add some default CSS styles for these examples sciunit.utils.style() """ Explanation: <a href="https://colab.research.google.com/github/scidash/sciunit/blob/master/docs/chapter6.ipynb" target="_parent"><img src="https://cola...
TeamHG-Memex/eli5
notebooks/Debugging scikit-learn text classification pipeline.ipynb
mit
from sklearn.datasets import fetch_20newsgroups categories = ['alt.atheism', 'soc.religion.christian', 'comp.graphics', 'sci.med'] twenty_train = fetch_20newsgroups( subset='train', categories=categories, shuffle=True, random_state=42 ) twenty_test = fetch_20newsgroups( subset='test'...
DavidDobr/icef_thesis
dobrinskiy_thesis_v2_october.ipynb
gpl-3.0
# You should be running python3 import sys print(sys.version) import pandas as pd # http://pandas.pydata.org/ import numpy as np # http://numpy.org/ import statsmodels.api as sm # http://statsmodels.sourceforge.net/stable/index.html import statsmodels.formula.api as smf import statsmodels print("Pandas Version:...
lknelson/DH-Institute-2017
06-Literary Distinction (Probably)/Literary Patterns (Probably).ipynb
bsd-2-clause
import nltk nltk.download('stopwords') from sklearn.naive_bayes import MultinomialNB import pandas # Get texts of interest that belong to identifiably different categories unladen_swallow = 'high air-speed velocity' swallow_grasping_coconut = 'low air-speed velocity' # Transform them into a format scikit-learn can ...
brclark-usgs/flopy
examples/Notebooks/flopy3_ZoneBudget_example.ipynb
bsd-3-clause
%matplotlib inline import os import sys import platform import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import pandas as pd import flopy print(sys.version) print('numpy version: {}'.format(np.__version__)) print('matplotlib version: {}'.format(mpl.__version__)) print('pandas version: {}'.fo...
letsgoexploring/teaching
winter2017/econ129/python/Econ129_Class_06_Complete.ipynb
mit
# Use the requests module to download cross country GDP per capita url = 'http://www.briancjenkins.com/data/international/csv/crossCountryIncomePerCapita.csv' filename='crossCountryIncomePerCapita.csv' r = requests.get(url,verify=True) with open(filename,'wb') as newFile: newFile.write(r.content) # Import th...
sdpython/ensae_teaching_cs
_doc/notebooks/exams/td_note_2018_1.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.e - Enoncé 12 décembre 2017 (1) Correction du premier énoncé de l'examen du 12 décembre 2017. Celui-ci mène à l'implémentation d'un algorithme qui permet de retrouver une fonction $f$ en escalier à partir d'un ensemble de points $(X_i,...
graphistry/pygraphistry
demos/demos_databases_apis/gremlin-tinkerpop/TitanDemo.ipynb
bsd-3-clause
import asyncio import aiogremlin # Create event loop and initialize gremlin client loop = asyncio.get_event_loop() client = aiogremlin.GremlinClient(url='ws://localhost:8182/', loop=loop) # Default url """ Explanation: In this notebook, we demonstrate how to create and modify a Titan graph in python, and then visual...
mapagron/Boot_camp
hm7/Homework #7.ipynb
gpl-3.0
# Dependencies import numpy as np import pandas as pd import matplotlib.pyplot as plt import json import tweepy import time import seaborn as sns %pylab notebook # Initialize Sentiment Analyzer from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer analyzer = SentimentIntensityAnalyzer() # Twitter API K...
matthewpecsok/development
imbd.ipynb
apache-2.0
import tensorflow as tf import numpy as np import pandas as pd (x_train, y_train), (x_test, y_test) = tf.keras.datasets.imdb.load_data(num_words=10000) word_index = tf.keras.datasets.imdb.get_word_index() word_index['fawn'] # why in the world it's indexed by word? reverse_word_index = dict([(value,key) for (key,...
boffi/boffi.github.io
dati_2018/04/EP_Exact+Numerical.ipynb
mit
def resp_elas(m,c,k, cC,cS,w, F, x0,v0): wn2 = k/m ; wn = sqrt(wn2) ; beta = w/wn z = c/(2*m*wn) wd = wn*sqrt(1-z*z) # xi(t) = R sin(w t) + S cos(w t) + D det = (1.-beta**2)**2+(2*beta*z)**2 R = ((1-beta**2)*cS + (2*beta*z)*cC)/det/k S = ((1-beta**2)*cC - (2*beta*z)*cS)/det/k D = F/k ...
pligor/predicting-future-product-prices
04_time_series_prediction/26_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() bltest.get_dtw() bltest.renderRandomTargetVsPrediction() plt.show() """ Explanation: Baseline is static, a straight line for each input - Test End of explanation """ ...
astroai/starnet
VAE/StarNet_VAE.ipynb
bsd-2-clause
import numpy as np import time import h5py import keras import matplotlib.pyplot as plt import sys from keras.layers import (Input, Dense, Lambda, Flatten, Reshape, BatchNormalization, Activation, Dropout, Conv1D, UpSampling1D, MaxPooling1D, ZeroPadding1D, LeakyReLU) from keras.engine.topol...
probml/pyprobml
notebooks/book2/04/rbm_contrastive_divergence.ipynb
mit
!pip install -qq optax import numpy as np import jax from jax import numpy as jnp from jax import grad, jit, vmap, random try: import optax except ModuleNotFoundError: %pip install -qq optax import optax try: import tensorflow_datasets as tfds except ModuleNotFoundError: %pip install -qq tensorflo...
enchantner/python-zero
lesson_2/Slides.ipynb
mit
%time "list(range(1000000)); print('ololo')" """ Explanation: Пакеты и окружение для Python easy_install (setuptools) - старый менеджер пакетов (практически не используется) pip - новый менеджер пакетов virtualenv - установить конкретные версии пакетов локально virtualenvwrapper - отличная обертка для virtualenv Об...
Karuntg/SDSS_SSC
Analysis_2020/sdss_gaia_matching_IZv2.ipynb
gpl-3.0
# workhorse packages import matplotlib.pyplot as plt import numpy as np # Data handling from astropy.table import Table from astropy.coordinates import SkyCoord from astropy import units as u from astropy.table import hstack # for fits with log likelihood import scipy from scipy import stats from scipy import optimi...
dsacademybr/PythonFundamentos
Cap08/Notebooks/DSA-Python-Cap08-01-NumPy.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 8</font> Download: http://github.com/dsacademybr End of explanation """ # Impor...
amogh3892/Context-based-sentence-classification-using-word2vec
main_sentence_classification.ipynb
apache-2.0
# Importing all the required modules and the helper functions import numpy as np import urllib.request from bs4 import BeautifulSoup from nltk import sent_tokenize from nltk import word_tokenize import re from gensim.models import Word2Vec import pickle # the following two modules are helper functions to generate ...
computational-class/cjc2016
code/08.05-gradient_descent.ipynb
mit
import numpy as np # Size of the points dataset. m = 20 # Points x-coordinate and dummy value (x0, x1). X0 = np.ones((m, 1)) X1 = np.arange(1, m+1).reshape(m, 1) X = np.hstack((X0, X1)) # Points y-coordinate y = np.array([3, 4, 5, 5, 2, 4, 7, 8, 11, 8, 12, 11, 13, 13, 16, 17, 18, 17, 19, 21]).reshape(m, 1) # The ...
Neuroglycerin/neukrill-net-work
notebooks/model_run_and_result_analyses/Analyse alexnet_extra_layer_dropouts models.ipynb
mit
import pylearn2.utils import pylearn2.config import theano import neukrill_net.dense_dataset import neukrill_net.utils import numpy as np %matplotlib inline import matplotlib.pyplot as plt import holoviews as hl %load_ext holoviews.ipython import sklearn.metrics cd .. m = pylearn2.utils.serial.load("/disk/scratch/neu...
mne-tools/mne-tools.github.io
stable/_downloads/6608d2f46fa33fc4dfd4a7f07bd9bdc9/10_ieeg_localize.ipynb
bsd-3-clause
# Authors: Alex Rockhill <aprockhill@mailbox.org> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD-3-Clause import os.path as op import numpy as np import matplotlib.pyplot as plt import nibabel as nib import nilearn.plotting from dipy.align import resample import mne from mne.datasets import fetch...
slowvak/MachineLearningForMedicalImages
notebooks/Module 2 .ipynb
mit
%matplotlib inline import warnings warnings.filterwarnings('ignore') import os import numpy as np import matplotlib.pyplot as plt import pylab from mpl_toolkits.mplot3d import Axes3D from sklearn import svm import pandas as pd from matplotlib.colors import ListedColormap from sklearn.model_selection import StratifiedSh...
phoebe-project/phoebe2-docs
2.2/examples/sun_earth.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" """ Explanation: Sun-Earth System NOTE: planets are currently under testing and not yet supported Setup Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the l...