repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
smorton2/think-stats
code/chap04soln.ipynb
gpl-3.0
from __future__ import print_function, division %matplotlib inline import numpy as np import nsfg import first import thinkstats2 import thinkplot """ Explanation: Examples and Exercises from Think Stats, 2nd Edition http://thinkstats2.com Copyright 2016 Allen B. Downey MIT License: https://opensource.org/licenses/...
bashtage/statsmodels
examples/notebooks/discrete_choice_overview.ipynb
bsd-3-clause
import numpy as np import statsmodels.api as sm """ Explanation: Discrete Choice Models Overview End of explanation """ spector_data = sm.datasets.spector.load() spector_data.exog = sm.add_constant(spector_data.exog, prepend=False) """ Explanation: Data Load data from Spector and Mazzeo (1980). Examples follow Gree...
AkshanshChahal/BTP
Satellite/Data Cleaning.ipynb
mit
cols = list(rice.columns.values) """ Explanation: 334 = 10 + 216 + 108 End of explanation """ l = rice.shape[0] b = rice.shape[1] for row in range(0,l): vals = np.zeros(18) bx = False for col in range(10,b-108,18): if pd.isnull(rice.iloc[row,col]): s = cols[col] #print s ...
quoniammm/mine-tensorflow-examples
fastAI/deeplearning1/nbs/lesson3.ipynb
mit
from theano.sandbox import cuda %matplotlib inline import utils; reload(utils) from utils import * from __future__ import division, print_function #path = "data/dogscats/sample/" path = "data/dogscats/" model_path = path + 'models/' if not os.path.exists(model_path): os.mkdir(model_path) batch_size=64 """ Explanati...
swails/mdtraj
examples/hbonds.ipynb
lgpl-2.1
t = md.load_pdb('http://www.rcsb.org/pdb/files/2EQQ.pdb') print(t) """ Explanation: Load up some example data. This is a little 28 residue peptide End of explanation """ hbonds = md.baker_hubbard(t, periodic=False) label = lambda hbond : '%s -- %s' % (t.topology.atom(hbond[0]), t.topology.atom(hbond[2])) for hbond i...
Danghor/Algorithms
Python/Chapter-09/Dijkstra.ipynb
gpl-2.0
%run Set.ipynb """ Explanation: Dijkstra's Shortest Path Algorithm The notebook Set.ipynb implements <em style="color:blue">sets</em> as <a href="https://en.wikipedia.org/wiki/AVL_tree">AVL trees</a>. The API provided by Set offers the following API: - Set() creates an empty set. - S.isEmpty() checks whether the set ...
UWashington-Astro300/Astro300-A16
03_Units_In_Python.ipynb
mit
import numpy as np from astropy.table import QTable from astropy import units as u from astropy import constants as const from astropy.units import imperial imperial.enable() """ Explanation: Units in Python The Astropy package includes a powerful framework that allows users to attach units to scalars and arrays, a...
landlab/landlab
notebooks/tutorials/network_sediment_transporter/network_sediment_transporter_NHDPlus_HR_network.ipynb
mit
import warnings warnings.filterwarnings( "ignore", category=UserWarning, module=".*network_sediment_transporter" ) import functools import matplotlib.pyplot as plt import numpy as np import xarray as xr from tqdm import tqdm from landlab.components import FlowDirectorSteepest, NetworkSedimentTransporter from lan...
GoogleCloudPlatform/asl-ml-immersion
notebooks/text_models/solutions/keras_for_text_classification.ipynb
apache-2.0
import os import pandas as pd from google.cloud import bigquery %load_ext google.cloud.bigquery """ Explanation: Keras for Text Classification Learning Objectives 1. Learn how to create a text classification datasets using BigQuery 1. Learn how to tokenize and integerize a corpus of text for training in Keras 1. Lea...
BeatHubmann/17F-U-DLND
embeddings/Skip-Gram_word2vec.ipynb
mit
import time import numpy as np import tensorflow as tf import utils """ Explanation: Skip-gram word2vec In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p...
oasis-open/cti-python-stix2
docs/guide/custom.ipynb
bsd-3-clause
from stix2 import Identity Identity(name="John Smith", identity_class="individual", x_foo="bar") """ Explanation: Custom STIX Content Custom Properties Attempting to create a STIX object with properties not defined by the specification will result in an error. Try creating an Identity object with a ...
rsterbentz/phys202-2015-work
assignments/assignment06/InteractEx05.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.html import widgets from IPython.display import Image, HTML, SVG, display """ Explanation: Interact Exercise 5 Imports Put the standard imports for Matplotlib, Numpy and the ...
t--wagner/python_in_the_lab
.ipynb_checkpoints/00_overview-checkpoint.ipynb
gpl-3.0
import IPython IPython.__version__ """ Explanation: <center> <h1>Python in the Lab</h1> </center> Topics Python Control Flow Data Structures Modules and Packages Object-oriented programming Iterators, Generators Decorators Magic Methods Context Manager All the other cool stuff Science Plotting Numerical Calcul...
djgroen/student-resources
programming/python/python-tutorials/abm-tut.ipynb
bsd-3-clause
import random """ Explanation: What is agent-based modelling? Types of agents When thinking about refugee movements, there are a few basic elements: - The refugees themselves. - The locations where the refugees reside - And possibly the paths (or routes) that interconnect the locations In its simplest form, this agent...
mauroalberti/geocouche
pygsf/docs/notebooks/Rasters - geotransform.ipynb
gpl-2.0
from pygsf.spatial.rasters.geotransform import * gt1 = GeoTransform(1500, 3000, 10, 10) gt1 """ Explanation: Geotransforms May-June, 2018, Mauro Alberti, alberti.m65@gmail.com 1. Examples End of explanation """ ijPixToxyGeogr(gt1, 0, 0) xyGeogrToijPix(gt1, 1500, 3000) ijPixToxyGeogr(gt1, 1, 1) xyGeogrToijPix(gt...
rsignell-usgs/notebook
ROMS/.ipynb_checkpoints/sandy_sgrid-checkpoint.ipynb
mit
from netCDF4 import Dataset url = ('http://geoport.whoi.edu/thredds/dodsC/clay/usgs/users/' 'jcwarner/Projects/Sandy/triple_nest/00_dir_NYB05.ncml') nc = Dataset(url) """ Explanation: pysgrid only works with raw netCDF4 (for now!) End of explanation """ import pysgrid # The object creation is a lit...
ES-DOC/esdoc-jupyterhub
notebooks/csiro-bom/cmip6/models/sandbox-1/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'csiro-bom', 'sandbox-1', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: CSIRO-BOM Source ID: SANDBOX-1 Topic: Aerosol Sub-Topics: Transport, Emissi...
phoebe-project/phoebe2-docs
2.2/examples/binary_spots.ipynb
gpl-3.0
!pip install -I "phoebe>=2.2,<2.3" """ Explanation: Binary with Spots Setup Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release). End of explanation """ %matplotlib inline im...
ajul/zerosum
python/examples/pokemon.ipynb
bsd-3-clause
import _initpath import numpy import dataset.pokemon import zerosum.balance import zerosum.nash import matplotlib import matplotlib.pyplot as plt type_chart = dataset.pokemon.pokemon_6 # Vector of color codes for the types. colors = [dataset.pokemon.pokemon_type_colors[name] for name in type_chart.row_names] """ Exp...
kuo77122/deep-learning-nd
Lesson15-TFLearn/Sentiment Analysis with TFLearn - Solution.ipynb
mit
import pandas as pd import numpy as np import tensorflow as tf import tflearn from tflearn.data_utils import to_categorical """ 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 network w...
TuKo/brainiak
examples/utils/fmrisim_multivariate_example.ipynb
apache-2.0
%matplotlib notebook from pathlib import Path from brainiak.utils import fmrisim import nibabel import numpy as np import matplotlib.pyplot as plt import scipy.spatial.distance as sp_distance import sklearn.manifold as manifold import scipy.stats as stats import sklearn.model_selection import sklearn.svm """ Explanat...
alexandrnikitin/workshops
automated-feature-engineering-selection/notebooks/1-featuretools-intro.ipynb
mit
Image(url= "../img/max-order-size.svg", width=600, height=600) """ Explanation: Featuretools a python library/ framework for automated feature engineering based on "Deep Feature Synthesis" paper/ research by Featurelabs https://www.featurelabs.com/ Website: https://www.featuretools.com/ Documentation: https://docs.fe...
uber/ludwig
examples/titanic/model_training_results.ipynb
apache-2.0
from ludwig.utils.data_utils import load_json from ludwig.visualize import learning_curves import pandas as pd import numpy as np import os.path import matplotlib.pyplot as plt import seaborn as sns """ Explanation: Custom Analysis of Training Results Notebook demonstrates two methods for plotting training results. F...
tensorflow/docs-l10n
site/ja/hub/tutorials/retrieval_with_tf_hub_universal_encoder_qa.ipynb
apache-2.0
# Copyright 2019 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...
cuttlefishh/emp
methods/figure-data/fig-4/Fig4_data_files.ipynb
bsd-3-clause
# read in exported table for genus fig4a_genus = pd.read_csv('../../../data/07-entropy-and-covariation/genus-level-distribution.csv', header=0) # read in exported table for otu fig4a_otu = pd.read_csv('../../../data/07-entropy-and-covariation/otu-level-distribution-400.csv', header=0) """ Explanation: Figure 4 csv ...
jpn--/larch
larch/doc/example/201_exville_mode_choice.ipynb
gpl-3.0
import larch, numpy, pandas, os from larch import P, X larch.__version__ """ Explanation: 201: Exampville Mode Choice Welcome to Exampville, the best simulated town in this here part of the internet! Exampville is a demonstration provided with Larch that walks through some of the data and tools that a transportation...
therealAJ/python-sandbox
data-science/learning/ud2/Part 2 Exercise Solutions/Linear Regression/Linear Regression - Project Exercise .ipynb
gpl-3.0
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> Linear Regression - Project Exercise Congratulations! You just got some contract work with an Ecommerce com...
achave11/bioapi-examples
python_notebooks/pileup.ipynb
apache-2.0
#Widget() """ Explanation: Query for pile-up allignments at region "X" We can query the API services to obtain reads from a given readgroupset such that we are able to make a pileup for any specified region NOTE: Under the "Kernel" tab above, do "Restart & Run All" then uncomment the first cell and run it individually...
dinrker/PredictiveModeling
Session 4 - Features_I_Transformations_DimensionalityReduction.ipynb
mit
from IPython.display import Image import matplotlib.pyplot as plt import numpy as np import pandas as pd import time %matplotlib inline """ Explanation: Feature Engineering |Session | Session | |-----------|---------| |Feature Engineering I | Feature Transformation and Dimension Reduction (PCA)| |Feature Engineeri...
simpleblob/ml_algorithms_stepbystep
algo_example_K_nearest_neighbour.ipynb
mit
from sklearn.datasets import make_blobs df = pd.DataFrame(columns=['X0','X1','Y']) X, Y = make_blobs(n_samples=1000, n_features=2, centers=3, cluster_std=1.5) train_test_split = 0.7 train_size = int(X.shape[0]*train_test_split) test_size = X.shape[0] - train_size X_train,Y_train,X_test,Y_test = X[0:train_size],Y[0:tr...
jaehyuk/kaggle_submissions
colab_for_Keras.ipynb
mit
!pip install -U -q PyDrive from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials # 1. Authenticate and create the PyDrive client. auth.authenticate_user() gauth = GoogleAuth() gauth.credentials = GoogleCredentials.get_...
buckleylab/Buckley_Lab_SIP_project_protocols
sequence_analysis_walkthrough/QIIME2_Merging_and_Processing.ipynb
mit
import os, re # Provide the directory where files are located directory = '/home/roli/FORESTs_BHAVYA/Combined_Libraries/ITS/' #directory = '/home/roli/FORESTs_BHAVYA/Combined_Libraries/16S/' # Provide a list of all the FeatureTables you will merge # Produced by QIIME2 in STEP 7 (i.e. DADA2 Denoising/Merging/FeatureT...
VVard0g/ThreatHunter-Playbook
docs/notebooks/windows/08_lateral_movement/WIN-190511223310.ipynb
mit
from openhunt.mordorutils import * spark = get_spark() """ Explanation: PowerShell Remote Session Metadata | Metadata | Value | |:------------------|:---| | collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] | | creation date | 2019/05/11 | | modification date | 2020/09/20 | | playbook related | ['WI...
kubeflow/kfp-tekton-backend
samples/tutorials/Data passing in python components.ipynb
apache-2.0
# Put your KFP cluster endpoint URL here if working from GCP notebooks (or local notebooks). ('https://xxxxx.notebooks.googleusercontent.com/') kfp_endpoint='https://XXXXX.{pipelines|notebooks}.googleusercontent.com/' # Install Kubeflow Pipelines SDK. Add the --user argument if you get permission errors. !PIP_DISABLE_...
synthicity/activitysim
activitysim/examples/example_estimation/notebooks/11_joint_tour_composition.ipynb
agpl-3.0
import os import larch # !conda install larch -c conda-forge # for estimation import pandas as pd """ Explanation: Estimating Joint Tour Composition This notebook illustrates how to re-estimate a single model component for ActivitySim. This process includes running ActivitySim in estimation mode to read household t...
mayank-johri/LearnSeleniumUsingPython
Section 1 - Core Python/Chapter 09 - Classes & OOPS/OOPs Fundamentals - ABC.ipynb
gpl-3.0
from abc import ABCMeta, abstractmethod class Mammal(metaclass=ABCMeta): ## version 2.x ## __metaclass__=ABCMeta @abstractmethod def eyes(self, val): pass # @abstractmethod # def hand(self): # pass def hair(self): print("hair") def neocortex(self): ...
tensorflow/docs-l10n
site/ja/guide/keras/functional.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...
ageron/tensorflow
tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb
apache-2.0
from __future__ import absolute_import, division, print_function # Import TensorFlow >= 1.10 and enable eager execution import tensorflow as tf tf.enable_eager_execution() import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split import unicodedata import re import numpy as np import os i...
georgetown-analytics/classroom-occupancy
models/GaussianNB_model_KM.ipynb
mit
%matplotlib inline import os import json import time import pickle import requests import numpy as np import pandas as pd import matplotlib.pyplot as plt import yellowbrick as yb import seaborn as sns sns.set_palette('RdBu', 10) """ Explanation: GaussianNB Model Dataset Information No. of Features: 12 No. of Instanc...
MTG/essentia
src/examples/python/tutorial_tonal_hpcpkeyscale.ipynb
agpl-3.0
import essentia.streaming as ess import essentia audio_file = '../../../test/audio/recorded/dubstep.flac' # Initialize algorithms we will use. loader = ess.MonoLoader(filename=audio_file) framecutter = ess.FrameCutter(frameSize=4096, hopSize=2048, silentFrames='noise') windowing = ess.Windowing(type='blackmanharris62...
rescu/brainstorm
Random_walk_1D.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: <h1>Random motion in 1D</h1> End of explanation """ p = 0.5 q = 1. - p """ Explanation: <p>Many processes in physics and chemistry happen randomly or stochastically, whic. This is in contrast to deterministic problems where we ca...
timothydmorton/usrp-sciprog
day2/numpy-intro.ipynb
mit
# Let's first import the package import numpy as np #Tadaaaa now we have all the power of the mighty numpy at our disposal. #Let's use it responsibly """ Explanation: Introduction to numpy Numpy is a package that contains types and functions for mathematical calculations on arrays. The numpy library is vast and encap...
google/jax-md
notebooks/neural_networks.ipynb
apache-2.0
#@title Imports & Utils !pip install -q git+https://www.github.com/deepmind/haiku !pip install -q git+https://www.github.com/deepmind/optax !pip install -q --upgrade git+https://www.github.com/google/jax-md # Imports import os import numpy as onp import pickle import jax from jax import lax from jax import jit, vma...
keras-team/keras-io
examples/timeseries/ipynb/timeseries_traffic_forecasting.ipynb
apache-2.0
import pandas as pd import numpy as np import os import typing import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers """ Explanation: Traffic forecasting using graph neural networks and LSTM Author: Arash Khodadadi<br> Date created: 2021/12/28<br> Las...
AllenDowney/ModSimPy
notebooks/chap23.ipynb
mit
# Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an assignment %config InteractiveShell.ast_node_interactivity='last_expr_or_assign' # import functions from the modsim.py module from modsim import * """ Explanation: Modeling and Simulati...
AntArch/Presentations_Github
20160202_Nottingham_GIServices_Lecture3_Beck_InteroperabilitySemanticsAndOpenData/.ipynb_checkpoints/20151008_OpenGeo_Reuse_under_licence-checkpoint.ipynb
cc0-1.0
from IPython.display import YouTubeVideo YouTubeVideo('F4rFuIb1Ie4') ## PDF output using pandoc import os ### Export this notebook as markdown commandLineSyntax = 'ipython nbconvert --to markdown 20151008_OpenGeo_Reuse_under_licence.ipynb' print (commandLineSyntax) os.system(commandLineSyntax) ### Export this not...
jdhp-docs/python-notebooks
python_scipy_optimize_global_optimization_en.ipynb
mit
# Init matplotlib %matplotlib inline import matplotlib matplotlib.rcParams['figure.figsize'] = (8, 8) # Setup PyAI import sys sys.path.insert(0, '/Users/jdecock/git/pub/jdhp/pyai') import numpy as np import time import warnings from scipy import optimize # Plot functions from pyai.optimize.utils import plot_conto...
ES-DOC/esdoc-jupyterhub
notebooks/nasa-giss/cmip6/models/sandbox-3/landice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nasa-giss', 'sandbox-3', 'landice') """ Explanation: ES-DOC CMIP6 Model Properties - Landice MIP Era: CMIP6 Institute: NASA-GISS Source ID: SANDBOX-3 Topic: Landice Sub-Topics: Glaciers, Ice. P...
NicolasHemidy/udacity-data-nanodegree
P0/Bay_Area_Bike_Share_Analysis.ipynb
apache-2.0
# import all necessary packages and functions. import csv from datetime import datetime import numpy as np import pandas as pd from babs_datacheck import question_3 from babs_visualizations import usage_stats, usage_plot from IPython.display import display %matplotlib inline # file locations file_in = '201402_trip_da...
jeffakolb/Data-Science-45min-Intros
comparing-collections/CollectionComparison_PartOne.ipynb
unlicense
import random import collections import operator import time import numpy as np import scipy import matplotlib.pyplot as plt import seaborn as sns from sklearn import datasets import twitter %matplotlib inline import count_min # some matplotlib color-mapping cmap = plt.get_cmap('viridis') c_space = np.linspace(0,99...
Kaggle/learntools
notebooks/embeddings/raw/4-tsne.ipynb
apache-2.0
#$HIDE$ %matplotlib inline import random import os import numpy as np import pandas as pd from matplotlib import pyplot as plt import tensorflow as tf from tensorflow import keras #_RM_ input_dir = '../input/movielens_preprocessed' #_UNCOMMENT_ #input_dir = '../input/movielens-preprocessing' #_RM_ model_dir = '.' #_U...
jaidevd/inmantec_fdp
notebooks/day3/04_clustering.ipynb
mit
import numpy as np from sklearn.datasets import load_iris, load_digits from sklearn.metrics import f1_score from sklearn.cluster import KMeans from sklearn.decomposition import PCA import matplotlib.pyplot as plt plt.style.use('ggplot') %matplotlib inline iris = load_iris() X = iris.data y = iris.target print(X.shape...
google/starthinker
colabs/dcm_to_bigquery.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: CM360 Report To BigQuery Move existing CM report into a BigQuery table. 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 ob...
Ironlors/SmartIntersection-Ger
Journal/.ipynb_checkpoints/Introduction to Python for Data Science-checkpoint.ipynb
apache-2.0
list = [1,2,3,4,5] list """ Explanation: Introduction to Python For Data Science Autor: Kay Kleinvogel Dies ist mein Lerndokument für Python. Die Hauptsächliche Informationsquelle ist das EdX Programm: (https://courses.edx.org/courses/course-v1:Microsoft+DAT208x+3T2017/course/) Lists Eine Liste ist eine Sammlung von v...
jdhp-docs/python-notebooks
python_scipy_io_wave_en.ipynb
mit
%matplotlib inline import numpy as np import matplotlib matplotlib.rcParams['figure.figsize'] = (12, 9) # Import Jupyter's sound player widget # See: https://ipython.org/ipython-doc/dev/api/generated/IPython.display.html#IPython.display.Audio from IPython.display import Audio """ Explanation: Read and write audio w...
ES-DOC/esdoc-jupyterhub
notebooks/thu/cmip6/models/ciesm/atmoschem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'thu', 'ciesm', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: THU Source ID: CIESM Topic: Atmoschem Sub-Topics: Transport, Emissions Concentrat...
KECB/learn
machine_learning/Machine Learning Notebook.ipynb
mit
from sklearn import tree features = [[140, 1], [130, 1], [150, 0], [170, 0]] labels = [0, 0, 1, 1] clf = tree.DecisionTreeClassifier() clf = clf.fit(features, labels) print(clf.predict([[120, 0]])) """ Explanation: Machine Learning Recipes with Jsh Gordon Note Video list this is a note for watching Machine Learning...
nilmtk/nilmtk
docs/manual/user_guide/elecmeter_and_metergroup.ipynb
apache-2.0
%matplotlib inline from matplotlib import rcParams import matplotlib.pyplot as plt import pandas as pd import nilmtk from nilmtk import DataSet, MeterGroup plt.style.use('ggplot') rcParams['figure.figsize'] = (13, 10) redd = DataSet('/data/redd.h5') elec = redd.buildings[1].elec elec """ Explanation: MeterGroup, El...
napsternxg/ipython-notebooks
Monte Carlo Integration.ipynb
apache-2.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from numba import jit # Use it for speed from scipy import stats """ Explanation: Introduction to Monte Carlo Integration Inspired from the following posts: http://nbviewer.jupyter.org/github/cs109/content/blob/master/labs/lab7/GibbsSampler.ipyn...
jhillairet/scikit-rf
doc/source/examples/networktheory/Renormalizing S-parameters.ipynb
bsd-3-clause
import skrf as rf %matplotlib inline from pylab import * rf.stylely() # this is just for plotting junk kw = dict(draw_labels=True, marker = 'o', markersize = 10) """ Explanation: Renormalizing S-parameters This example demonstrates how to use skrf to renormalize a Network's s-parameters to new port impedances. Alt...
kubeflow/code-intelligence
Issue_Triage/notebooks/metrics.ipynb
mit
import altair as alt import collections import importlib import logging import sys import os import datetime from dateutil import parser as dateutil_parser import glob import json import numpy as np import pandas as pd from pandas.io import gbq # A bit of a hack to set the path correctly sys.path = [os.path.abspath(os...
InsightSoftwareConsortium/SimpleITK-Notebooks
Python/36_Microscopy_Colocalization_Distance_Analysis.ipynb
apache-2.0
import SimpleITK as sitk import numpy as np import pandas as pd %matplotlib notebook import gui %run update_path_to_download_script from downloaddata import fetch_data as fdata from IPython.core.display import display, HTML # Always write output to a separate directory, we don't want to pollute the source director...
ThunderShiviah/code_guild
interactive-coding-challenges/stacks_queues/stack/stack_solution.ipynb
mit
%%writefile stack.py class Node(object): def __init__(self, data): self.data = data self.next = None class Stack(object): def __init__(self, top=None): self.top = top def push(self, data): node = Node(data) node.next = self.top self.top = node def po...
nproctor/phys202-2015-work
assignments/assignment03/NumpyEx02.ipynb
mit
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns """ Explanation: Numpy Exercise 2 Imports End of explanation """ def np_fact(n): if n == 0: return 1 else: #This puts the numbers 1 to n in steps of one in an array numbers = np.arange(1.0...
wanderer2/pymc3
docs/source/notebooks/gaussian-mixture-model-advi.ipynb
apache-2.0
%matplotlib inline import theano theano.config.floatX = 'float64' import pymc3 as pm from pymc3 import Normal, Metropolis, sample, MvNormal, Dirichlet, \ DensityDist, find_MAP, NUTS, Slice import theano.tensor as tt from theano.tensor.nlinalg import det import numpy as np import matplotlib.pyplot as plt import se...
ericmjl/be-stats-iap2016
Inferential Statistics.ipynb
mit
null_flips = binom.rvs(n=20, p=0.5, size=10000) plt.hist(null_flips) plt.axvline(16) alpha = 5 / 100 null_flips = binom.rvs(n=20, p=0.5, size=10000) plt.hist(null_flips) plt.axvline(16) sum(null_flips >=16) / 10000 """ Explanation: Administrative Stuff Connect to the Jupyter server that I have created on Amazon EC2...
anandha2017/udacity
nd101 Deep Learning Nanodegree Foundation/DockerImages/31_dcgan_svhn/notebooks/DCGAN.ipynb
mit
%matplotlib inline import pickle as pkl import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat import tensorflow as tf !mkdir data """ Explanation: Deep Convolutional GANs In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a De...
KshitijT/fundamentals_of_interferometry
1_Radio_Science/1_10_limits_of_single_dishes.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt %matplotlib inline from IPython.display import HTML HTML('../style/course.css') #apply general CSS """ Explanation: Outline Glossary 1. Radio Science using Interferometric Arrays Previous: 1.9 A brief introduction to interferometry Next: 1.11 Modern Interferometric...
llclave/Springboard-Mini-Projects
data_wrangling_json/.ipynb_checkpoints/sliderule_dsi_json_exercise-checkpoint.ipynb
mit
import pandas as pd """ Explanation: JSON examples and exercise get familiar with packages for dealing with JSON study examples with JSON strings and files work on exercise to be completed and submitted reference: http://pandas-docs.github.io/pandas-docs-travis/io.html#json data source: http://jsonstudio.com/re...
matthewljones/computingincontext
Simple document term matrix example.ipynb
gpl-2.0
from sklearn.metrics.pairwise import cosine_similarity similarity=cosine_similarity(document_term_matrix) pd.DataFrame(similarity) """ Explanation: Similarity among documents End of explanation """ similarity=cosine_similarity(document_term_matrix.T) pd.DataFrame(similarity, index=vocab, columns=vocab) """ Expla...
quantopian/research_public
notebooks/data/eventvestor.share_repurchases/notebook.ipynb
apache-2.0
# import the dataset from quantopian.interactive.data.eventvestor import share_repurchases # or if you want to import the free dataset, use: # from quantopian.interactive.data.eventvestor import share_repurchases_free # import data operations from odo import odo # import other libraries we will use import pandas as pd...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/cmip6/models/nicam16-9d-l78/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'nicam16-9d-l78', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: MIROC Source ID: NICAM16-9D-L78 Sub-Topics: Radiative Forcings. Propert...
setiQuest/ML4SETI
tutorials/Step_2_reading_SETI_code_challenge_data.ipynb
apache-2.0
#The ibmseti package contains some useful tools to faciliate reading the data. #The `ibmseti` package version 1.0.5 works on Python 2.7. # !pip install --user ibmseti #A development version runs on Python 3.5. # !pip install --user ibmseti==2.0.0.dev5 # If running on DSX, YOU WILL NEED TO RESTART YOUR SPARK K...
ogoann/StatisticalMethods
examples/SDSScatalog/CorrFunc.ipynb
gpl-2.0
%load_ext autoreload %autoreload 2 import numpy as np import SDSS import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import copy # We want to select galaxies, and then are only interested in their positions on the sky. data = pd.read_csv("downloads/SDSSobjects.csv",usecols=['ra','dec','u','g',\ ...
mbeyeler/opencv-machine-learning
notebooks/03.04-Applying-Lasso-and-Ridge-Regression.ipynb
mit
import numpy as np import cv2 from sklearn import datasets from sklearn import metrics from sklearn import model_selection from sklearn import linear_model %matplotlib inline import matplotlib.pyplot as plt plt.style.use('ggplot') plt.rcParams.update({'font.size': 16}) """ Explanation: <!--BOOK_INFORMATION--> <a hre...
hanezu/cs231n-assignment
assignment2/FullyConnectedNets.ipynb
mit
# As usual, a bit of setup import time import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.fc_net import * from cs231n.data_utils import get_CIFAR10_data from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array from cs231n.solver import Solver %matplotlib inline ...
enbanuel/phys202-2015-work
assignments/assignment06/InteractEx05.ipynb
mit
# YOUR CODE HERE %matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.html import widgets from IPython.display import SVG, display """ Explanation: Interact Exercise 5 Imports Put the standard imports for Matplotlib, Numpy and ...
MarioPerezEsteso/Python-Machine-Learning
20newsgroup/20newsgroup.ipynb
apache-2.0
%pylab inline from sklearn import datasets """ Explanation: 20 NEWS GROUPS Antes de nada, hay que importar los paquetes necesarios. End of explanation """ def loadDataset(directory): dataset = datasets.load_files(directory) print "Loaded %d documents" % len(dataset.data) print "Loaded %d categories"...
sgkang/DamGeophysics
notebook/Kalman Filters_LIM-Waterlevel-EKF.ipynb
mit
from SimPEG import * %pylab inline # Import a Kalman filter and other useful libraries from pykalman import KalmanFilter import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy import poly1d """ Explanation: Kalman Filters By Evgenia "Jenny" Nitishinskaya, Dr. Aidan O'Mahony, and Delaney Gran...
ClementPhil/deep-learning
intro-to-tflearn/TFLearn_Sentiment_Analysis_Solution.ipynb
mit
import pandas as pd import numpy as np import tensorflow as tf import tflearn from tflearn.data_utils import to_categorical """ 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 network w...
piraces/Trabajo_Python_Odoo
Trabajo_Python_Odoo.ipynb
mit
client = erppeek.Client(server=SERVER) for database in client.db.list(): print('Base de datos: %r' % (database,)) """ Explanation: La documentación necesaria para poder superar este ejercicio se encuentra en la documentación de ERPpeek Tarea 1 - Conexión Demuestra que sabes conectarte a una instancia de Odoo y li...
google/TensorNetwork
colabs/Tensor_Networks_in_Neural_Networks.ipynb
apache-2.0
!pip install tensornetwork import numpy as np import matplotlib.pyplot as plt import tensorflow as tf # Import tensornetwork import tensornetwork as tn # Set the backend to tesorflow # (default is numpy) tn.set_default_backend("tensorflow") """ Explanation: TensorNetworks in Neural Networks. Here, we have a small toy...
pymir3/pymir3
doc/spectrogram_demo.ipynb
mit
import mir3.modules.tool.wav2spectrogram as spec converter = spec.Wav2Spectrogram() s = converter.convert(open("examples/157447__nengisuls__solo-loops-2.wav"), window_length=1024, dft_length=1024, window_step=512, spectrum_type='magnitude', save_metadata=True) #s = converter.convert(open("example...
Islast/BrainNetworksInPython
tutorials/introductory_tutorial.ipynb
mit
import matplotlib.pylab as plt %matplotlib inline import networkx as nx import numpy as np import seaborn as sns sns.set(context="notebook", font_scale=1.5, style="white") import scona as scn import scona.datasets as datasets from scona.scripts.visualisation_commands import view_corr_mat """ Explanati...
eshlykov/mipt-day-after-day
optimizaion/eshlykov-met-opt-lab-1.ipynb
unlicense
import numpy as np import matplotlib.pyplot as plt %matplotlib inline EPS = 1e-6 MAXITER = 100000 """ Explanation: Практикум 1 по курсу "Методы оптимизации" Автор: Евгений Шлыков Группа: 596 Семинарист: Алексей Глибичук End of explanation """ def find_entering_leaving(st, phase, method='blend'): """ Находит...
dipanjank/ml
data_analysis/balance_scale_classification.ipynb
gpl-3.0
import pandas as pd import numpy as np %pylab inline pylab.style.use('ggplot') url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/balance-scale/balance-scale.data' balance_df = pd.read_csv(url, header=None) balance_df.columns = ['class_name', 'left_weight', 'left_distance', 'right_weight', 'right_dist...
rvernagus/data-science-notebooks
Data Science From Scratch/10 - Working With Data.ipynb
mit
def bucketize(point, bucket_size): """floor the point to the next lower multiple of bucket size""" return bucket_size * math.floor(point / bucket_size) def make_histogram(points, bucket_size): return Counter(bucketize(point, bucket_size) for point in points) def plot_histogram(points, bucket_size, title='...
nbokulich/short-read-tax-assignment
ipynb/cross-validated/taxonomy-assignment.ipynb
bsd-3-clause
from os import system from os.path import join, expandvars from joblib import Parallel, delayed from glob import glob from tax_credit.framework_functions import (recall_novel_taxa_dirs, parameter_sweep, move_results_to_repository) ...
ericmjl/graph-fingerprint
notebooks/20160526-inspect_weights_and_biases.ipynb
mit
import pickle as pkl from pprint import pprint def open_wb(path): with open(path, 'rb') as f: wb = pkl.load(f) return wb wb = open_wb('../experiments/wbs/fp_linear-cf.score_sum-5000_iters-10_wb.pkl') pprint(wb) """ Explanation: 26 May 2016 I trained a simple fp_linear network (FingerprintLayer ...
NeuPhysics/aNN
ipynb/vacuum-Copy2.ipynb
mit
# This line configures matplotlib to show figures embedded in the notebook, # instead of opening a new window for each figure. More about that later. # If you are using an old version of IPython, try using '%pylab inline' instead. %matplotlib inline %load_ext snakeviz import numpy as np from scipy.optimize import mi...
tbarrongh/cosc-learning-labs
src/notebook/01_device_connect.ipynb
apache-2.0
%run ../learning_lab/01_inventory_dismount_atomic.py from basics.odl_http import http_history_clear http_history_clear() """ Explanation: COSC Learning Lab 01_device_connect.py Related Scripts: * 03_management_interface.py Table of Contents Table of Contents Preamble Documentation Implementation Execution HTTP Pream...
xxPeterxx/RelaunchedFunds
Version 1.0.ipynb
gpl-2.0
import pandas as pd from datetime import timedelta # ****************** Program Settings ****************** Folder = "" # Location of program scripts Data = "temp/" # Location to which temporary files are generated DataSource = "data/" # Location of the original data files (ASCII) Gap_Days = 60 # To b...
fluffy-hamster/A-Beginners-Guide-to-Python
A Beginners Guide to Python/25. Introduction to Testing.ipynb
mit
def divide(a, b): """"a, b are ints or floats. Returns a/b""" return a / b """ Explanation: Introduction to Testing Testing is an easy thing to understand but there is also an art to it as well; writing good tests often requires you to try to figure out what input(s) are most likely to break your program. In ...
HrantDavtyan/Data_Scraping
Week 2/Intro_2.ipynb
apache-2.0
print("Imagine all the people living life in peace... John Lennon") """ Explanation: Introductino to Python (part II) This notebook provides introduction to python and includes material covered during the lecture. Printing End of explanation """ print("Imagine all the people \nliving life in peace... \nJohn Lennon")...
tlake/bikeshare
bikeshare.ipynb
mit
from pandas import Series, DataFrame import pandas as pd import numpy as np weather = pd.read_table('data/daily_weather.tsv') weather type(weather) weather.groupby('season_desc')['temp'].mean() weather.loc[weather['season_code'] == 1, 'season_desc'] = 'winter' weather weather.loc[weather['season_code'] == 2, '...
hashiprobr/redes-sociais
encontro06/simulacao.ipynb
gpl-3.0
import sys sys.path.append('..') import socnet as sn """ Explanation: Encontro 06: Simulação de Negociações Importando a biblioteca: End of explanation """ sn.graph_width = 360 sn.graph_height = 360 sn.node_size = 25 def load_graph(path): g = sn.load_graph(path, has_pos=True) for n, m in g.edges(): ...
ImAlexisSaez/deep-learning-specialization-coursera
course_1/week_3/assignment_1/planar_data_classification_with_one_hidden_layer_v1.ipynb
mit
# Package imports import numpy as np import matplotlib.pyplot as plt from testCases import * import sklearn import sklearn.datasets import sklearn.linear_model from planar_utils import plot_decision_boundary, sigmoid, load_planar_dataset, load_extra_datasets %matplotlib inline np.random.seed(1) # set a seed so that t...
meduz/ipython_magics
tikzmagic_test.ipynb
mit
%tikz \draw (0,0) rectangle (1,1); %%tikz --scale 2 --size 300,300 -f jpg \draw (0,0) rectangle (1,1); \filldraw (0.5,0.5) circle (.1); %%tikz --scale 2 --size 300,300 -f svg \draw (0,0) rectangle (1,1); \filldraw (0.5,0.5) circle (.1); """ Explanation: a MWE End of explanation """ %%tikz -s 400,400 -sc 1.2 -f png...
Kaggle/learntools
notebooks/feature_engineering_new/raw/ex4.ipynb
apache-2.0
# Setup feedback system from learntools.core import binder binder.bind(globals()) from learntools.feature_engineering_new.ex4 import * import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from sklearn.cluster import KMeans from sklearn.model_selection import cross_val_score from...
fierval/retina
Notebooks/Publish/Custom Filter Banks with OpenCV.ipynb
mit
# Auxillary stuff %matplotlib inline from matplotlib import pyplot as plt from matplotlib import cm import numpy as np import cv2 import pandas as pd from math import exp, pi, sqrt from numbapro import vectorize def show_images(images,titles=None, scale=1.3): """Display a list of images""" n_ims = len(images)...