repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
fluffy-hamster/A-Beginners-Guide-to-Python
A Beginners Guide to Python/05. Variables & Assignment.ipynb
mit
the_number_four = 4 print(the_number_four) """ Explanation: Variables & Assignment What is assignment? Well, the short (and simple) answer is to say assignment is the process whereby we give a value a unique name. Once something has a name, we can use it later on. Please note that this is a bit of a oversimplification...
Hexiang-Hu/mmds
final/.ipynb_checkpoints/Final-basic-checkpoint.ipynb
mit
## Q2 Solution. def hash(x): return math.fmod(3 * x + 2, 11) for i in xrange(1,12): print hash(i) """ Explanation: Q1. Solution 3-shingles for "hello world": hel, ell, llo, lo_, o_w ,_wo, wor, orl, rld => 9 in total Q2. Solution End of explanation """ ## Q3 Solution. prob = 1.0 / 10 a = (1 - prob)**4 pr...
khalido/algorithims
breadth first search.ipynb
gpl-3.0
%matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt from geopy.distance import great_circle from collections import deque """ Explanation: First, we need a graph. A graph is just a bunch of objects, typically called nodes which are connected to each other. The connections are call...
michaelgat/Udacity_DL
intro-to-tflearn/TFLearn_Digit_Recognition-MG.ipynb
mit
# Import Numpy, TensorFlow, TFLearn, and MNIST data import numpy as np import tensorflow as tf import tflearn import tflearn.datasets.mnist as mnist """ Explanation: Handwritten Number Recognition with TFLearn and MNIST In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9. This...
erdc-cm/air-water-vv
3d/bathyduck/Read Lidar.ipynb
mit
%ls lidar """ Explanation: lidar subdir has the files - line.data.mat have "raw" data but includes some filtering and water level extraction - line.science.mat have processed data - Some jpg are also provide End of explanation """ import tables lineData = tables.openFile(r"lidar/20150927-0000-01.FRFNProp.line.data....
ShivakumarSwamy/MovieAnalysis
plotDataset2.ipynb
apache-2.0
import random import pandas as pd from plotly.graph_objs import * """ Explanation: <h1> <center> Season Movie Analysis </center> </h1> End of explanation """ from plotly.offline import init_notebook_mode, iplot, plot init_notebook_mode(connected=True) """ Explanation: Using plotly offline mode End of explanation ""...
nhuntwalker/gatspy
examples/FastLombScargle.ipynb
bsd-2-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt # use seaborn's default plotting styles for matplotlib import seaborn; seaborn.set() """ Explanation: Fast Lomb-Scargle Periodograms in Python The Lomb-Scargle Periodogram is a well-known method of finding periodicity in irregularly-sampled time-se...
tensorflow/docs-l10n
site/en-snapshot/tutorials/images/transfer_learning.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...
gsorianob/fiuba-python
.ipynb_checkpoints/Clase 04 - Excepciones, funciones lambda, búsquedas y ordenamientos-checkpoint.ipynb
apache-2.0
lista_de_numeros = [1, 6, 3, 9, 5, 2] lista_ordenada = sorted(lista_de_numeros) print lista_ordenada """ Explanation: 27/10 Ordenamientos y búsquedas Funciones anónimas. Excepciones. Ordenamiento de listas Las listas se pueden ordenar fácilmente usando la función sorted: End of explanation """ lista_de_numeros = [1...
cdt15/lingam
examples/MultiGroupDirectLiNGAM.ipynb
mit
import numpy as np import pandas as pd import graphviz import lingam from lingam.utils import print_causal_directions, print_dagc, make_dot print([np.__version__, pd.__version__, graphviz.__version__, lingam.__version__]) np.set_printoptions(precision=3, suppress=True) np.random.seed(0) """ Explanation: MultiGroupDi...
GoogleCloudPlatform/training-data-analyst
self-paced-labs/vertex-ai/vertex-distributed-tensorflow/Qwiklab_Running_Distributed_TensorFlow_using_Vertex_AI.ipynb
apache-2.0
import os ! pip3 install --user --upgrade google-cloud-aiplatform """ Explanation: Running Distributed TensorFlow on Vertex AI Overview This tutorial demonstrates how to Train a model using distribution strategies on Vertex AI using the SDK for Python Deploy a custom image classification model for online predictio...
tylere/jupyterlab-ee
ipynb/ee-test.ipynb
apache-2.0
import ipywidgets ipywidgets.IntSlider() """ Explanation: Test ipywidgets End of explanation """ import ipyleaflet ipyleaflet.Map(zoom=2) """ Explanation: Test ipyleaflet End of explanation """ import ee from IPython.display import Image ee.Initialize() url = ee.Image("CGIAR/SRTM90_V4").getThumbUrl({'min':0, 'm...
tensorflow/agents
docs/tutorials/9_c51_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...
sailuh/perceive
Notebooks/Full_Disclosure/full_disclosure_corpus_statistics.ipynb
gpl-2.0
#Input year for which the word count histogram is being plotted year='2012' #Directory with the files path = 'data/input/bodymessage_corpus/'+year file_name_list=[] file_wc_list=[] file_uq_wc_list=[] file_wc_df = pd.DataFrame(columns = ["file_name","word_count","unique_word_count"]) #function that returns the word co...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_run_ica.ipynb
bsd-3-clause
# Authors: Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import mne from mne.preprocessing import ICA, create_ecg_epochs from mne.datasets import sample print(__doc__) """ Explanation: Compute ICA components on epochs ICA is fit to MEG raw data. We assume that the non-stationary EOG artifacts...
fweik/espresso
doc/tutorials/lennard_jones/lennard_jones.ipynb
gpl-3.0
import espressomd required_features = ["LENNARD_JONES"] espressomd.assert_features(required_features) from espressomd import observables, accumulators, analyze # Importing other relevant python modules import numpy as np import matplotlib.pyplot as plt from scipy import optimize np.random.seed(42) plt.rcParams.update(...
sfomel/ipython
Swan.ipynb
gpl-2.0
%%file data.scons Flow('trace',None,'spike n1=2001 d1=0.001 k1=1001 | ricker1 frequency=30') Flow('gather','trace','spray axis=2 n=49 d=25 o=0 label=Offset unit=m | nmostretch inv=y half=n v0=2000') Result('gather','window f1=888 n1=392 | grey title=Gather') from m8r import view view('gather') """ Explanation: Mak...
apozas/BIST-Python-Bootcamp
3_Types_Functions_FlowControl.ipynb
gpl-3.0
x_int = 3 x_float = 3. x_string = 'three' x_list = [3, 'three'] type(x_float) type(x_string) type(x_list) """ Explanation: 3 Types, Functions and Flow Control Data types End of explanation """ abs(-1) import math math.floor(4.5) math.exp(1) math.log(1) math.log10(10) math.sqrt(9) round(4.54,1) """ Expl...
merryjman/astronomy
Word_frequency.ipynb
gpl-3.0
import re import pandas as pd import urllib.request frequency = {} document_text = urllib.request.urlopen \ ('http://www.textfiles.com/etext/FICTION/bronte-jane-178.txt') \ .read().decode('utf-8') text_string = document_text.lower() match_pattern = re.findall(r'\b[a-z]{3,15}\b', text_string) for word in ma...
crowd-course/datascience
5-classification/5.2 - Logistic Regression in Classifying Breast Cancer .ipynb
mit
import pandas as pd import numpy as np from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix %matplotlib inline import matplotlib.pyplot as plt from matplotlib import cm # this is for colormaps for 2D surfaces from mpl_toolkits.mplot3d import Axes3D # this is for 3D plots p...
nre-aachen/GeMpy
Tutorial/ch1.ipynb
mit
# These two lines are necessary only if gempy is not installed import sys, os sys.path.append("../") # Importing gempy import gempy as gp # Embedding matplotlib figures into the notebooks %matplotlib inline # Aux imports import numpy as np """ Explanation: Chapter 1: GemPy Basic In this first example, we will show ...
gaufung/PythonStandardLibrary
DataStructures/array.ipynb
mit
import array import binascii s= b'this is a array' a = array.array('b', s) print('As byte string', s) print('As array ', a) print('As hex', binascii.hexlify(a)) """ Explanation: Type code for array code | type | minimum size :---: | :---: | :---: b | int | 1 B | int | 1 h | signed int | 2 H | unsigned int | 2 i | sig...
UWashington-Astro300/Astro300-W17
09_Python_LaTeX.ipynb
mit
%matplotlib inline import sympy as sp import numpy as np import matplotlib.pyplot as plt """ Explanation: Python, SymPy, and $\LaTeX$ End of explanation """ sp.init_printing() # Turns on pretty printing np.sqrt(8) sp.sqrt(8) """ Explanation: # Symbolic Mathematics (SymPy) End of explanation """ x, y, z = ...
tuanavu/python-cookbook-3rd
notebooks/ch01/12_determine_the_top_n_items_occurring_in_a_list.ipynb
mit
words = [ 'look', 'into', 'my', 'eyes', 'look', 'into', 'my', 'eyes', 'the', 'eyes', 'the', 'eyes', 'the', 'eyes', 'not', 'around', 'the', 'eyes', "don't", 'look', 'around', 'the', 'eyes', 'look', 'into', 'my', 'eyes', "you're", 'under' ] from collections import Counter word_counts = Counter(words) top_thr...
ledeprogram/algorithms
class6/donow/Lee_Dongjin_6_Donow.ipynb
gpl-3.0
import pandas as pd %matplotlib inline import matplotlib.pyplot as plt # package for doing plotting (necessary for adding the line) import statsmodels.formula.api as smf # package we'll be using for linear regression import numpy as np import scipy as sp """ Explanation: 1. Import the necessary packages to read in the...
jtwhite79/pyemu
verification/henry/verify_unc_results.ipynb
bsd-3-clause
%matplotlib inline import os import numpy as np import matplotlib.pyplot as plt import pandas as pd import pyemu """ Explanation: verify pyEMU results with the henry problem End of explanation """ la = pyemu.Schur("pest.jco",verbose=False,forecasts=[]) la.drop_prior_information() jco_ord = la.jco.get(la.pst.obs_name...
dmnfarrell/gordon-group
mirnaseq/miRNA_features_analysis.ipynb
apache-2.0
import glob,os import pandas as pd import numpy as np import mirnaseq.mirdeep2 as mdp from mirnaseq import base, analysis pd.set_option('display.width', 130) %matplotlib inline import pylab as plt from mpl_toolkits.mplot3d import Axes3D base.seabornsetup() plt.rcParams['savefig.dpi']=80 plt.rcParams['font.size']=16 hom...
hasadna/knesset-data-pipelines
jupyter-notebooks/Render site pages for development and debugging.ipynb
mit
!{'cd /pipelines; KNESSET_LOAD_FROM_URL=1 dpp run --concurrency 4 '\ './committees/kns_committee,'\ './people/committee-meeting-attendees,'\ './members/mk_individual'} """ Explanation: Render site pages dpp runs the knesset data pipelines periodically on our server. This notebook shows how to run pipelines that ...
tacticsiege/TacticToolkit
examples/2017-09-11_TacticToolkit_Intro.ipynb
mit
# until we can install, add parent dir to path so ttk is found import sys sys.path.insert(0, '..') # basic imports import pandas as pd import numpy as np import re import matplotlib %matplotlib inline matplotlib.rcParams['figure.figsize'] = (10.0, 8.0) import matplotlib.pyplot as plt """ Explanation: TacticToolkit ...
luofan18/deep-learning
sentiment-rnn/Sentiment_RNN_Solution.ipynb
mit
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...
FRESNA/atlite
examples/logfiles_and_messages.ipynb
gpl-3.0
import logging logging.basicConfig(level=logging.INFO) """ Explanation: Logfiles and messages Atlite uses the logging library for displaying messages with different purposes. Minimum information We recommend that you always use logging when using atlite with information messages enabled. The simplest way is to End of ...
karlnapf/shogun
doc/ipython-notebooks/classification/Classification.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') from shogun import * import shogun as sg #Needed lists for the final plot classifiers_linear = []*10 classifiers_non_linear = []*10 classifiers_names = []*10 fadings = []*10 ""...
atulsingh0/MachineLearning
python_DC/Pandas_#1.ipynb
gpl-3.0
# # Create array of DataFrame values: np_vals # np_vals = df.values # # Create new array of base 10 logarithm values: np_vals_log10 # np_vals_log10 = np.log10(np_vals) # # Create array of new DataFrame by passing df to np.log10(): df_log10 # df_log10 = np.log10(df) # # Print original and new data containers # print(...
girving/tensorflow
tensorflow/contrib/eager/python/examples/generative_examples/text_generation.ipynb
apache-2.0
!pip install unidecode """ Explanation: Copyright 2018 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"). Text Generation using a RNN <table class="tfo-notebook-buttons" align="left"><td> <a target="_blank" href="https://colab.research.google.com/github/tensorflow/tensorflow/blob/...
WormLabCaltech/mprsq
src/stats_tutorials/Model Selection.ipynb
mit
# important stuff: import os import pandas as pd import numpy as np import statsmodels.tools.numdiff as smnd import scipy # Graphics import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns from matplotlib import rc rc('text', usetex=True) rc('text.latex', preamble=r'\usepackage{cmbright}') rc('f...
jrmontag/STLDecompose
STL-usage-example.ipynb
mit
def get_statsmodels_df(): """Return packaged data in a pandas.DataFrame""" # some hijinks to get around outdated statsmodels code dataset = sm.datasets.co2.load() start = dataset.data['date'][0].decode('utf-8') index = pd.date_range(start=start, periods=len(dataset.data), freq='W-SAT') obs = pd....
jbn/fast_proportional_selection
index.ipynb
mit
import random from bisect import bisect_left import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns %matplotlib inline """ Explanation: Fast Proportional Selection [RETWEET] Proportional selection -- or, roulette wheel selection -- comes up frequently when developing agent-based ...
istinspring/products-matching
notebooks/0.2-group-sizes.ipynb
gpl-3.0
%matplotlib inline import numpy as np import pandas as pd from scipy.stats import entropy from tabulate import tabulate from pymongo import MongoClient import matplotlib.pyplot as plt plt.style.use('seaborn') plt.rcParams["figure.figsize"] = (20,8) db = MongoClient()['stores'] TOTAL_NUMBER_OF_PRODUCTS = db.data.coun...
interactiveaudiolab/nussl
docs/recipes/wham/ideal_ratio_mask.ipynb
mit
from nussl import datasets, separation, evaluation import os import multiprocessing from concurrent.futures import ThreadPoolExecutor import logging import json import tqdm import glob import numpy as np import termtables # set up logging logger = logging.getLogger() logger.setLevel(logging.INFO) """ Explanation: Eva...
jmschrei/pomegranate
tutorials/B_Model_Tutorial_5_Bayes_Classifiers.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import seaborn; seaborn.set_style('whitegrid') import numpy from pomegranate import * numpy.random.seed(0) numpy.set_printoptions(suppress=True) %load_ext watermark %watermark -m -n -p numpy,scipy,pomegranate """ Explanation: Naive Bayes and Bayes Classifiers autho...
turbomanage/training-data-analyst
courses/machine_learning/deepdive/06_structured/labs/6_deploy.ipynb
apache-2.0
# change these to try this notebook out BUCKET = 'cloud-training-demos-ml' PROJECT = 'cloud-training-demos' REGION = 'us-central1' import os os.environ['BUCKET'] = BUCKET os.environ['PROJECT'] = PROJECT os.environ['REGION'] = REGION os.environ['TFVERSION'] = '1.13' %%bash if ! gsutil ls | grep -q gs://${BUCKET}/; t...
jo-tez/aima-python
knowledge_FOIL.ipynb
mit
from knowledge import * from notebook import pseudocode, psource """ Explanation: KNOWLEDGE The knowledge module covers Chapter 19: Knowledge in Learning from Stuart Russel's and Peter Norvig's book Artificial Intelligence: A Modern Approach. Execute the cell below to get started. End of explanation """ psource(FOI...
mne-tools/mne-tools.github.io
0.17/_downloads/99b2d0c9aaf0ce2af85d098f7ac4577c/plot_head_positions.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) from os import path as op import mne print(__doc__) data_path = op.join(mne.datasets.testing.data_path(verbose=True), 'SSS') pos = mne.chpi.read_head_pos(op.join(data_path, 'test_move_anon_raw.pos')) """ Explanation: Visualize subject he...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/text_classification/labs/fine_tune_bert.ipynb
apache-2.0
!pip install -q -U "tensorflow-text==2.8.*" !pip install -q tf-models-official==2.4.0 """ Explanation: Fine-Tuning a BERT Model Learning objectives Get the dataset from TensorFlow Datasets. Preprocess the data. Build the model. Train the model. Re-encoding a large dataset. Introduction In this notebook, you will wo...
PMEAL/OpenPNM
examples/simulations/transient/transient_fickian_diffusion.ipynb
mit
import numpy as np import openpnm as op %config InlineBackend.figure_formats = ['svg'] np.random.seed(10) %matplotlib inline np.set_printoptions(precision=5) """ Explanation: Transient Fickian Diffusion The package OpenPNM allows for the simulation of many transport phenomena in porous media such as Stokes flow, Ficki...
elastic/examples
Machine Learning/Query Optimization/notebooks/1 - Query tuning.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 import importlib import os import sys from elasticsearch import Elasticsearch from skopt.plots import plot_objective # project library sys.path.insert(0, os.path.abspath('..')) import qopt importlib.reload(qopt) from qopt.notebooks import evaluate_mrr100_dev, optimize_query_mrr10...
richjimenez/mysql-data-raspberry-pi
deliver/lesson-2-jupyter-notebook-for-data-analysis.ipynb
mit
%load_ext sql """ Explanation: Lesson 2: Setup Jupyter Notebook for Data Analysis Learning Objectives: <ol> <li>Create Python tools for data analysis using Jupyter Notebooks</li> <li>Learn how to access data from MySQL databases for data analysis</li> </ol> Exercise 1: Install Anaconda Access https://conda.i...
kirichoi/tellurium
examples/notebooks/core/tellurium_stochastic.ipynb
apache-2.0
from __future__ import print_function import tellurium as te te.setDefaultPlottingEngine('matplotlib') %matplotlib inline import numpy as np r = te.loada('S1 -> S2; k1*S1; k1 = 0.1; S1 = 40') r.integrator = 'gillespie' r.integrator.seed = 1234 results = [] for k in range(1, 50): r.reset() s = r.simulate(0, 40...
adelle207/pyladies.cz
original/v1/s010-data/data.ipynb
mit
import numpy pole = numpy.array([0, 1, 2, 3, 4, 5, 6]) pole pole[0] pole[1:-2] pole[0] = 9 pole """ Explanation: IPython IPython je nástroj, který zjednodušuje interaktivní práci v Pythonu, zvlášť výpočty a experimenty. Dá se spustit z příkazové řádky jako ipython – pak se chová podobně jako python, jen s barvičkam...
ethen8181/machine-learning
model_deployment/onnxruntime/text_classification_onnxruntime.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(css_style='custom2.css', plot_style=False) os.chdir(path) # 1. magic for inline plot...
roebius/deeplearning_keras2
nbs2/translate-pytorch.ipynb
apache-2.0
%matplotlib inline import re, pickle, collections, bcolz, numpy as np, keras, sklearn, math, operator from gensim.models import word2vec, KeyedVectors # - added KeyedVectors.load_word2vec_format import torch, torch.nn as nn from torch.autograd import Variable from torch import optim import torch.nn.functional as F ...
ernestyalumni/servetheloop
packetDef/podCommands.ipynb
mit
# find out where we are on the file directory import os, sys print( os.getcwd()) print( os.listdir(os.getcwd())) """ Explanation: server/udp/podCommands.js - from node.js /JavaScript to Python (object) End of explanation """ wherepodCommandsis = os.getcwd()+'/reactGS/server/udp/' print(wherepodCommandsis) """ Exp...
ES-DOC/esdoc-jupyterhub
notebooks/dwd/cmip6/models/mpi-esm-1-2-hr/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'dwd', 'mpi-esm-1-2-hr', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: DWD Source ID: MPI-ESM-1-2-HR Topic: Aerosol Sub-Topics: Transport, Emission...
tensorflow/docs
site/en/tutorials/estimator/keras_model_to_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...
graphistry/pygraphistry
demos/demos_databases_apis/gpu_rapids/part_iii_gpu_blazingsql.ipynb
bsd-3-clause
!wget -Pq data/ https://blazingsql-colab.s3.amazonaws.com/netflow_parquet/1_0_0.parquet !wget -Pq data/ https://blazingsql-colab.s3.amazonaws.com/netflow_parquet/1_1_0.parquet !wget -Pq data/ https://blazingsql-colab.s3.amazonaws.com/netflow_parquet/1_2_0.parquet !wget -Pq data/ https://blazingsql-colab.s3.amazonaws.c...
elliotk/twitter_eda
develop/20171010_realdonaldtrump_tweet_counts.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import seaborn as sns plt.style.use('fivethirtyeight') import tweepy import numpy as np import pandas as pd from collections import Counter from datetime import datetime # Turn on retina mode for high-quality inline plot resolution from IPython.display import set_mat...
mroberge/hydrofunctions
docs/notebooks/Writing_Valid_Requests_for_NWIS.ipynb
mit
# First, import hydrofunctions. import hydrofunctions as hf """ Explanation: Writing Valid Requests for NWIS The USGS National Water Information System (NWIS) is capable of handling a wide range of requests. A few features in Hydrofunctions are set up to help you write a successful request. End of explanation """ mi...
const-yield/const-yield.github.io
notebooks/2017-10-13/Demonstration_of_Linear_Discriminant_Anysis_on_Sythetic_Data.ipynb
mit
import numpy as np import numpy.random as rand import matplotlib.pyplot as plt matplotlib inline mu1, mu2, mu3 = [15,20], [24,25], [38,40] cov = [[10, 0], [0, 10]] n_samples = 5000 data1 = rand.multivariate_normal(mu1, cov, n_samples) data2 = rand.multivariate_normal(mu2, cov, n_samples) data3 = rand.multivariate_...
wayfair/gists
data-science/ViolinPlot_BlogPost/ViolinPlots_BlogPost.ipynb
mit
%matplotlib inline import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from fuzzywuzzy import fuzz import numpy as np # some settings to be used throughout the notebook pd.set_option('max_colwidth', 70) wf_colors = ["#C7DEB1","#9763A4"] # make some fake data for a demo split-violin plot data1 = ...
trangel/Data-Science
deep_learning_ai/Convolution+model+-+Application+-+v1.ipynb
gpl-3.0
import math import numpy as np import h5py import matplotlib.pyplot as plt import scipy from PIL import Image from scipy import ndimage import tensorflow as tf from tensorflow.python.framework import ops from cnn_utils import * %matplotlib inline np.random.seed(1) """ Explanation: Convolutional Neural Networks: Appli...
arongdari/python-topic-model
notebook/HMM_LDA_example.ipynb
apache-2.0
import logging from ptm.nltk_corpus import get_reuters_token_list_by_sentence from ptm import HMM_LDA from ptm.utils import get_top_words logger = logging.getLogger('HMM_LDA') logger.propagate=False """ Explanation: Example of HMM-LDA End of explanation """ n_docs = 1000 voca, corpus = get_reuters_token_list_by_sen...
donK23/pyData-Projects
HolmesClustering/holmes_clustering/notebook/2_Modeling.ipynb
apache-2.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Modeling ML Tasks End of explanation """ from sklearn.datasets import load_files corpus = load_files("../data/") doc_count = len(corpus.data) print("Doc count:", doc_count) assert doc_count is 56, "Wrong num...
karst87/ml
01_openlibs/tensorflow/00_resource/tf_examples/notebooks/0_Prerequisite/mnist_dataset_intro.ipynb
mit
# Import MNIST from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) # Load data X_train = mnist.train.images Y_train = mnist.train.labels X_test = mnist.test.images Y_test = mnist.test.labels """ Explanation: MNIST Dataset Introduction Most examples ...
Bio204-class/bio204-notebooks
2016-03-30-ANOVA-simulations.ipynb
cc0-1.0
## simulate one way ANOVA under the null hypothesis of no ## difference in group means groupmeans = [0, 0, 0, 0] k = len(groupmeans) # number of groups groupstds = [1] * k # standard deviations equal across groups n = 25 # sample size # generate samples samples = [stats.norm.rvs(loc=i, scale=j, size = n) for (i,j) ...
glasslion/data-science-notebooks
thinkstats/chapter1.ipynb
mit
import matplotlib import pandas as pd %matplotlib inline """ Explanation: Chapter 1 Exploratory data analysis Anecdotal evidence usually fails, because: - Small number of observations - Selection bias - Confirmation bias - Inaccuracy To address the limitations of anecdotes, we will use the tools of statistics, whic...
jo-tez/aima-python
games.ipynb
mit
from games import * from notebook import psource, pseudocode """ Explanation: GAMES OR ADVERSARIAL SEARCH This notebook serves as supporting material for topics covered in Chapter 5 - Adversarial Search in the book Artificial Intelligence: A Modern Approach. This notebook uses implementations from games.py module. Let...
tclaudioe/Scientific-Computing
SC1v2/Bonus - 11 - Pendulum, double pendulum and chaos.ipynb
bsd-3-clause
from ipywidgets import interact, fixed, IntSlider, FloatSlider, Checkbox import sympy as sym sym.init_printing() import numpy as np import ipywidgets as widgets from scipy.integrate import odeint import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib matplotlib.rc('xtick', labelsize=20) matplo...
quantopian/research_public
notebooks/data/quandl.fred_gdpdef/notebook.ipynb
apache-2.0
# import the dataset from quantopian.interactive.data.quandl import fred_gdpdef # Since this data is public domain and provided by Quandl for free, there is no _free version of this # data set, as found in the premium sets. This import gets you the entirety of this data set. # import data operations from odo import od...
sdpython/ensae_teaching_cs
_doc/notebooks/data/deal_flow_espace_vert.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() %matplotlib inline """ Explanation: Deal flow espaces verts 2018 - 2019 Ce jeu de données est proposé pour la réalisation d'un projet de module python pour partager une fonction de graphe. Un exemple de ce projet est proposé : td2a_plotting. End of expla...
StingraySoftware/notebooks
Lightcurve/Analyze light curves chunk by chunk - an example.ipynb
mit
from stingray.simulator.simulator import Simulator from scipy.ndimage.filters import gaussian_filter1d from stingray.utils import baseline_als from scipy.interpolate import interp1d np.random.seed(1034232) # Simulate a light curve with increasing variability and flux length = 10000 dt = 0.1 times = np.arange(0, lengt...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch1-Problem_1-18.ipynb
unlicense
%pylab notebook """ Explanation: Excercises Electric Machinery Fundamentals Chapter 1 Problem 1-18 End of explanation """ V = 208.0 * exp(-1j*30/180*pi) # [V] I = 2.0 * exp( 1j*20/180*pi) # [A] """ Explanation: Description Assume that the voltage applied to a load is $\vec{V} = 208\,V\angle -30^\circ$ and the c...
harishkrao/DSE200x
Week-7-MachineLearning/Weather Data Classification using Decision Trees.ipynb
mit
import pandas as pd from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier """ Explanation: <p style="font-family: Arial; font-size:2.75em;color:purple; font-style:bold"> Classification of Weather Data <br><br> using scikit-learn...
feststelltaste/software-analytics
courses/big_data_meetup/Production Coverage Demo Notebook.ipynb
gpl-3.0
import pandas as pd coverage = pd.read_csv("datasets/jacoco.csv") coverage = coverage[['PACKAGE', 'CLASS', 'LINE_COVERED' ,'LINE_MISSED']] coverage['LINES'] = coverage.LINE_COVERED + coverage.LINE_MISSED coverage.head(1) """ Explanation: Context John Doe remarked in #AP1432 that there may be too much code in our appli...
vascotenner/holoviews
doc/Tutorials/Dynamic_Map.ipynb
bsd-3-clause
import holoviews as hv import numpy as np hv.notebook_extension() """ Explanation: The Containers Tutorial introduced the HoloMap, a core HoloViews data structure that allows easy exploration of parameter spaces. The essence of a HoloMap is that it contains a collection of Elements (e.g. Images and Curves) that you ca...
StudyExchange/Udacity
MachineLearning(Advanced)/p2_finding_donors/.ipynb_checkpoints/finding_donors-checkpoint.ipynb
mit
# 为这个项目导入需要的库 import numpy as np import pandas as pd from time import time from IPython.display import display # 允许为DataFrame使用display() # 导入附加的可视化代码visuals.py import visuals as vs # 为notebook提供更加漂亮的可视化 %matplotlib inline # 导入人口普查数据 data = pd.read_csv("census.csv") # 成功 - 显示第一条记录 display(data.head()) """ Explanati...
arasdar/DL
impl-dl/etc/misc/nn_smartwatch.ipynb
unlicense
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Introduction: Neural Network for learning/processing time-series/historical data/signal In this project, we'll build a neural network (NN) to learn and process hist...
dolittle007/dolittle007.github.io
notebooks/GLM-rolling-regression.ipynb
gpl-3.0
%matplotlib inline import pandas as pd import numpy as np import pymc3 as pm import matplotlib.pyplot as plt """ Explanation: Rolling Regression Author: Thomas Wiecki Pairs trading is a famous technique in algorithmic trading that plays two stocks against each other. For this to work, stocks must be correlated (coint...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/sandbox-3/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'sandbox-3', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: NCC Source ID: SANDBOX-3 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Balance...
hzzyyy/pymcef
Quickstart tutorial.ipynb
bsd-3-clause
import pandas as pd returns = pd.read_json('data/Russel3k_return.json') """ Explanation: PyMCEF Quickstart tutorial <br> <br> Prerequisites Install Please install package PyMCEF through either conda or pip: <pre> $ conda install -c hzzyyy pymcef $ pip install pymcef </pre> conda packages are available on anaconda c...
arogozhnikov/einops
docs/2-einops-for-deep-learning.ipynb
mit
from einops import rearrange, reduce import numpy as np x = np.random.RandomState(42).normal(size=[10, 32, 100, 200]) # utility to hide answers from utils import guess """ Explanation: Einops tutorial, part 2: deep learning Previous part of tutorial provides visual examples with numpy. What's in this tutorial? work...
ML4DS/ML4all
C4.Classification_SVM/.ipynb_checkpoints/SupportVectorMachines-checkpoint.ipynb
mit
# To visualize plots in the notebook %matplotlib inline # Imported libraries #import csv #import random #import matplotlib #import matplotlib.pyplot as plt #import pylab #import numpy as np #from mpl_toolkits.mplot3d import Axes3D #from sklearn.preprocessing import PolynomialFeatures #from sklearn import linear_model...
Kaggle/learntools
notebooks/feature_engineering_new/raw/tut5.ipynb
apache-2.0
#$HIDE_INPUT$ import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from IPython.display import display from sklearn.feature_selection import mutual_info_regression plt.style.use("seaborn-whitegrid") plt.rc("figure", autolayout=True) plt.rc( "axes", labelweight="bold", ...
sdpython/ensae_teaching_cs
_doc/notebooks/1a/nbheap.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: Heap La structure heap ou tas en français est utilisée pour trier. Elle peut également servir à obtenir les k premiers éléments d'une liste. End of explanation """ %matplotlib inline """ Explanation: Un tas est peut être considéré comm...
ES-DOC/esdoc-jupyterhub
notebooks/mohc/cmip6/models/ukesm1-0-mmh/ocnbgchem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mohc', 'ukesm1-0-mmh', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: MOHC Source ID: UKESM1-0-MMH Topic: Ocnbgchem Sub-Topics: Tracers. Prope...
dssg/diogenes
doc/notebooks/read.ipynb
mit
import diogenes sample_csv_text = 'id,name,age\n0,Anne,57\n1,Bill,76\n2,Cecil,26\n' with open('sample.csv', 'w') as csv_in: csv_in.write(sample_csv_text) sample_table = diogenes.read.open_csv('sample.csv') """ Explanation: The Read Module The :mod:diogenes.read module provides tools for reading data from externa...
theideasmith/theideasmith.github.io
_notebooks/AsymptoticConvergence/Asymptotic Convergence of Gradient Descent for Linear Regression Least Squares Optimization.ipynb
mit
from pylab import * from numpy import random as random random.seed(1) N=1000. w = array([14., 30.]); x = zeros((2, int(N))).astype(float32) x[0,:] = arange(N).astype(float32) x[1,:] = 1 y = w.dot(x) + random.normal(size=int(N), scale=100.) """ Explanation: Supplementary Materials This code accompanies the paper Asymp...
jmlon/PythonTutorials
scipy/scipyOptimize.ipynb
gpl-3.0
from scipy.optimize import minimize import numpy as np """ Explanation: scipy : Optimización Inicialmente se importan los módulos de optimización y numpy End of explanation """ # Algunas constantes a=1 b=2 # La función a optimizar def parabola(x): return (x[0]-a)**2+(x[1]-b)**2 # Un punto inicial para arrancar...
ajul/zerosum
python/examples/super_street_fighter_2_turbo.ipynb
bsd-3-clause
import _initpath import numpy import dataset.matchup import dataset.csv import zerosum.balance from pandas import DataFrame # Balances a Super Street Fighter 2 Turbo matchup chart using a logistic handicap. # Produces a .csv file for the initial game and the resulting game. init = dataset.matchup.ssf2t.sorted_by_sum...
saturn77/CythonBootstrap
.ipynb_checkpoints/memoize-checkpoint.ipynb
gpl-2.0
from __future__ import print_function """ Explanation: This is based on the previous dojo-20150131-memoization notebook. End of explanation """ def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1) + fib(n-2) """ Explanation: We start with a function that ca...
metpy/MetPy
v0.5/_downloads/Point_Interpolation.ipynb
bsd-3-clause
import cartopy import cartopy.crs as ccrs from matplotlib.colors import BoundaryNorm import matplotlib.pyplot as plt import numpy as np from metpy.cbook import get_test_data from metpy.gridding.gridding_functions import (interpolate, remove_nan_observations, remove_repeat...
bjshaw/phys202-2015-work
assignments/assignment09/IntegrationEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from scipy import integrate """ Explanation: Integration Exercise 1 Imports End of explanation """ def trapz(f, a, b, N): """Integrate the function f(x) over the range [a,b] with N points.""" h = (b-a)/N k = np.arange(1,N) I = h * ...
recrm/Udebs
tutorial.ipynb
mit
import udebs game_config = """ <udebs> <config> <logging>True</logging> </config> <entities> <xplayer /> <oplayer /> </entities> </udebs> """ game = udebs.battleStart(game_config) """ Explanation: Udebs -- A discrete game analysis engine for python Udebs is a game engine that...
EvanBianco/striplog
tutorial/Well_object.ipynb
apache-2.0
from striplog import Well print(Well.__doc__) fname = 'P-129_out.LAS' well = Well(fname) well.data['GR'] well.well.DATE.data """ Explanation: Make a well End of explanation """ from striplog import Striplog, Legend legend = Legend.default() f = 'P-129_280_1935.png' name, start, stop = f.strip('.png').split('_') ...
duncanwp/python_for_climate_scientists
course_content/notebooks/numpy_intro.ipynb
gpl-3.0
import numpy as np """ Explanation: An introduction to NumPy NumPy provides an efficient representation of multidimensional datasets like vectors and matricies, and tools for linear algebra and general matrix manipulations - essential building blocks of virtually all technical computing Typically NumPy is imported as ...
ES-DOC/esdoc-jupyterhub
notebooks/pcmdi/cmip6/models/sandbox-3/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'pcmdi', 'sandbox-3', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: PCMDI Source ID: SANDBOX-3 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Bal...
dipanjank/ml
text_classification_and_clustering/problem_statement.ipynb
gpl-3.0
%matplotlib inline import matplotlib.pyplot as plt plt.style.use('ggplot') import pandas as pd import numpy as np import seaborn as sns raw_input = pd.read_pickle('input.pkl') raw_input.head() """ Explanation: <h1 align="center">EF Machine Learning Homework</h1> The Machine Learning Tasks The task(s) is(are) to bu...
weikang9009/pysal
notebooks/viz/splot/libpysal_non_planar_joins_viz.ipynb
bsd-3-clause
from pysal.lib.weights.contiguity import Queen import pysal.lib from pysal.lib import examples import matplotlib.pyplot as plt import geopandas as gpd %matplotlib inline from pysal.viz.splot.pysal.lib import plot_spatial_weights """ Explanation: splot.pysal.lib: assessing neigbors & spatial weights In spatial analysi...
astroNN/astroNN
notebooks/2_fullyconnected.ipynb
mit
import h5py import numpy as np import tensorflow as tf # this package from astronn.data import fetch_notMNIST """ Explanation: Deep Learning Assignment 2 Previously in 1_notmnist.ipynb, we 1. Downloaded a test dataset with training, development, and testing subsets (based on the notMNIST dataset). 2. We visualize...
googledatalab/notebooks
samples/contrib/mlworkbench/text_classification_20newsgroup/Text Classification --- 20NewsGroup (small data).ipynb
apache-2.0
import numpy as np import pandas as pd import os import re import csv from sklearn.datasets import fetch_20newsgroups # data will be downloaded. Note that an error message saying something like "No handlers could be found for # logger sklearn.datasets.twenty_newsgroups" might be printed, but this is not an error. new...
InsightSoftwareConsortium/SimpleITK-Notebooks
Python/300_Segmentation_Overview.ipynb
apache-2.0
%matplotlib inline import matplotlib.pyplot as plt from ipywidgets import interact, FloatSlider import SimpleITK as sitk # Download data to work on %run update_path_to_download_script from downloaddata import fetch_data as fdata from myshow import myshow, myshow3d img_T1 = sitk.ReadImage(fdata("nac-hncma-atlas2013-S...