repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
karlstroetmann/Algorithms
Python/Chapter-08/Heapsort.ipynb
gpl-2.0
import graphviz as gv """ Explanation: This notebook implements an array-based version of Heapsort. Graphical Representation of Heaps as Trees End of explanation """ def toDot(A, f, g): n = len(A) dot = gv.Digraph(node_attr={'shape': 'record'}) for k, p in enumerate(A): if k < f: do...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a_eco/TD2A_eco_API_SNCF.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 2A.eco - Exercice API SNCF Manipulation d'une API REST, celle de la SNCF est prise comme exemple. Exercices. End of explanation """ import os from pyquickhelper.loghelper import get_password key = get_password("sncf", "ensae_teaching_cs...
google-research/tensorflow-coder
TF-Coder_Colab.ipynb
apache-2.0
#@title Run this cell after making your choices. allow_data_collection = True #@param {type: "boolean"} include_in_dataset = True #@param {type: "boolean"} if allow_data_collection: if include_in_dataset: print('Usage data may be collected and released in a public dataset.') else: print('Usage data may ...
IBM-Bluemix/BigInsights-on-Apache-Hadoop
examples/notebooks/WebHDFS.ipynb
apache-2.0
# Cluster number, e.g. 100000 cluster = '' # Cluster username username = '' # Cluster password password = '' # file path in HDFS webhdfs_filepath = 'yourpath/yourfile.txt' # where to save the file in the spark service file system local_filepath = 'yourfile.txt' """ Explanation: Also see: https://datascience.ibm....
AllenDowney/ProbablyOverthinkingIt
red_dice.ipynb
mit
from __future__ import print_function, division from thinkbayes2 import Pmf, Suite from thinkbayes2 import MakeMixture from fractions import Fraction """ Explanation: A dice problem This notebook demonstrates the use of Pmf and Suite objects, and explores a dice-rolling problem that turns out to be more complicated ...
tensorflow/workshops
extras/tensorflow_lattice/02_advanced_lattice_estimators.ipynb
apache-2.0
# import libraries !pip install tensorflow_lattice import pandas as pd import tensorflow as tf import tensorflow_lattice as tfl import tempfile import urllib import os def download_if_not_exists(train_data, test_data): """Maybe downloads training data and returns train and test file names.""" train_file_name =...
BrainIntensive/OnlineBrainIntensive
resources/matplotlib/Examples/scatterplots.ipynb
mit
%load_ext watermark %watermark -u -v -d -p matplotlib,numpy """ Explanation: Sebastian Raschka back to the matplotlib-gallery at https://github.com/rasbt/matplotlib-gallery End of explanation """ %matplotlib inline """ Explanation: <font size="1.5em">More info about the %watermark extension</font> End of explanati...
rickiepark/tfk-notebooks
first-contact-with-tensorflow/chapter2_regression.py.ipynb
mit
import numpy as np """ Explanation: numpy 패키지를 임포트합니다. End of explanation """ num_points = 1000 vectors_set = [] for i in range(num_points): x1 = np.random.normal(0.0, 0.55) y1 = x1 * 0.1 + 0.3 + np.random.normal(0.0, 0.03) vectors_set.append([x1, y1]) """ Explanation: 1000개의 데이터 포인트를 만듭니...
ccasotto/rmtk
rmtk/vulnerability/derivation_fragility/NLTHA_on_SDOF/NLTHA_on_SDOF.ipynb
agpl-3.0
import NLTHA_on_SDOF from rmtk.vulnerability.common import utils %matplotlib inline """ Explanation: Non-Linear Time History Analysis (NLTHA) for Single Degree of Freedom (SDOF) Oscillators In this method, a single degree of freedom (SDOF) model of each structure is subjected to non-linear time history analysis (NLTHA...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/n05_day56_model_choosing_close_feat_all_syms_equal.ipynb
mit
# Basic imports import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime as dt import scipy.optimize as spo import sys from time import time from sklearn.metrics import r2_score, median_absolute_error %matplotlib inline %pylab inline pylab.rcParams['figure.figsize'] = (20.0, 10...
flsantos/startup_acquisition_forecast
exploratory_code/3_dataset_exploration.ipynb
mit
import pandas as pd startups = pd.read_csv('data/startups_2.csv', index_col=0) startups[:3] """ Explanation: Dataset Exploration Here we'll be exploring how each of the features we have so far relates to the target variable "status" Importing the dataset End of explanation """ import seaborn as sns import matplotlib...
tiagoantao/biopython-notebook
notebooks/17 - Graphics including GenomeDiagram.ipynb
mit
#Lets load notebook's Image from IPython.core.display import Image from reportlab.lib import colors from reportlab.lib.units import cm from Bio.Graphics import GenomeDiagram from Bio import SeqIO """ Explanation: Source of the materials: Biopython cookbook (adapted) End of explanation """ record = SeqIO.read("data...
oyamad/theory16
support_enumeration/support_enumeration_py.ipynb
mit
import numpy as np """ Explanation: Implementing Support Enumeration in Python: Solutions Exercises on NumPy arrays First follow the lecture on NumPy. Import NumPy: End of explanation """ n = 5 a = np.arange(n) a """ Explanation: Consider the following 1-dimensional array: End of explanation """ a[-1] """ Expla...
vangj/py-bbn
jupyter/generate-bbn.ipynb
apache-2.0
import numpy as np import networkx as nx import matplotlib.pyplot as plt import warnings from pybbn.generator.bbngenerator import generate_singly_bbn, generate_multi_bbn, convert_for_exact_inference from pybbn.generator.bbngenerator import convert_for_drawing from pybbn.pptc.inferencecontroller import InferenceControl...
gcgruen/homework
foundations-homework/08/homework-08-gruen-dataset3-refugees.ipynb
mit
# datasource: https://data.humdata.org/dataset/unhcr-refugee-pop-stats/resource/fbacbba3-1b20-4331-931b-6a21a4cb80f5 # dataset is labeled "Group of concern to UNHCR" import pandas as pd import matplotlib.pyplot as plt % matplotlib inline df = pd.read_csv('refugee_data.csv') df.head(20) """ Explanation: Homework 8: ...
hektor-monteiro/curso-python
listas-arrays.ipynb
gpl-2.0
lista = [2, 3.4, 'teste'] # sintaxe para definir uma lista print lista x = 3.0 y = 5.3 lista = [x**2, x+y, x**y, 2*x+5*y] # usando expressões para definir listas print lista """ Explanation: Listas e arrays (vetores) até agora vimos variáveis que representam valores unicos de um dado tipo em física é comum querer...
gtrichards/PHYS_T480
MixtureModel.ipynb
mit
from IPython.display import YouTubeVideo YouTubeVideo("B36fzChfyGU") """ Explanation: Gaussian Mixture Models (GMM) KDE centers each bin (or kernel rather) at each point. In a mixture model we don't use a kernel for each data point, but rather we fit for the locations of the kernels--in addition to the width. So a m...
danresende/deep-learning
language-translation/dlnd_language_translation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: Language Translation In this project, you’re going...
BrownDwarf/ApJdataFrames
notebooks/Wilking2005.ipynb
mit
import warnings warnings.filterwarnings("ignore") from astropy.io import ascii import pandas as pd """ Explanation: ApJdataFrames Wilking2005 Title: Optical Spectroscopy of the Surface Population of the ρ Ophiuchi Molecular Cloud: The First Wave of Star Formation Authors: Wilking et al. Data is from this paper: http...
statsmodels/statsmodels.github.io
v0.13.1/examples/notebooks/generated/predict.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import statsmodels.api as sm plt.rc("figure", figsize=(16, 8)) plt.rc("font", size=14) """ Explanation: Prediction (out of sample) End of explanation """ nsample = 50 sig = 0.25 x1 = np.linspace(0, 20, nsample) X = np.column_stack((x1, np.sin(x...
mne-tools/mne-tools.github.io
dev/_downloads/8ea2bfc401dbdff70c284d271d62fa8c/label_from_stc.ipynb
bsd-3-clause
# Author: Luke Bloy <luke.bloy@gmail.com> # Alex Gramfort <alexandre.gramfort@inria.fr> # License: BSD-3-Clause import numpy as np import matplotlib.pyplot as plt import mne from mne.minimum_norm import read_inverse_operator, apply_inverse from mne.datasets import sample print(__doc__) data_path = sample.da...
ES-DOC/esdoc-jupyterhub
notebooks/ec-earth-consortium/cmip6/models/sandbox-1/landice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'sandbox-1', 'landice') """ Explanation: ES-DOC CMIP6 Model Properties - Landice MIP Era: CMIP6 Institute: EC-EARTH-CONSORTIUM Source ID: SANDBOX-1 Topic: Landice Sub-Topic...
mit-eicu/eicu-code
notebooks/diagnosis.ipynb
mit
# Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import psycopg2 import getpass import pdvega # for configuring connection from configobj import ConfigObj import os %matplotlib inline # Create a database connection using settings from config file config='../db/config.ini' #...
SubhankarGhosh/NetworkX
6. Network Statistical Inference (Student).ipynb
mit
# Read in the data. # Note from above that we have to skip the first two rows, and that there's no header column,and that the edges are # delimited by spaces in between the nodes. Hence the syntax below: G = cf.load_propro_network() """ Explanation: Introduction In this notebook, we will walk through a hacker's approa...
Mashimo/datascience
02-Classification/isomap-pca.ipynb
apache-2.0
import pandas as pd # # Load up the dataset into a variable called X. # X = pd.read_csv("../datasets/wheat.data", index_col='id') X.head() """ Explanation: Variance and eigenvalues We will tackle the first four steps of a principal component analysis: standardizing the data, constructing the covariance matrix, obta...
tensorflow/docs-l10n
site/ja/lite/performance/post_training_integer_quant_16x8.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...
cydcowley/Imperial-Visualizations
visuals_maths/3D Transformations (Cube)/CubeRotation.ipynb
mit
import plotly import plotly.offline as py import plotly.graph_objs as go py.init_notebook_mode(connected=True) import numpy as np from plotly.graph_objs import Surface import json """ Explanation: 3D Transformations Consider a point P, which, in cartesian coordinates is given by P(x,y,z). It can also be represented by...
weinbe58/QuSpin
examples/notebooks/BHM.ipynb
bsd-3-clause
from quspin.operators import hamiltonian # Hamiltonians and operators from quspin.basis import boson_basis_1d # Hilbert space boson basis import numpy as np # generic math functions """ Explanation: Coding the Bose-Hubbard Hamiltonian with QuSpin The purpose of this tutorial is to teach the interested user to construc...
RazerM/orbital
examples/ipython_notebook/maneuvers.ipynb
mit
%matplotlib inline from scipy.constants import kilo from orbital import earth, KeplerianElements, Maneuver, plot """ Explanation: Maneuvers End of explanation """ orbit1 = KeplerianElements.with_altitude(1000 * kilo, body=earth) man1 = Maneuver.set_apocenter_altitude_to(10000 * kilo) plot(orbit1, title='Maneuver ...
timothydmorton/usrp-sciprog
day3/Astropy-Demo.ipynb
mit
kpc_to_km = 3.086E16 distance = 1. # kpc distance * kpc_to_km type(distance) import astropy.units as u distance_q = 1 * u.kpc type(distance_q) distance_q.to(u.km) distance_q.to(u.jupiterRad) distance_M = 1 * u.Mpc distance_q + distance_M """ Explanation: Using variables with units We'll use astropy to unburden us...
tuanavu/coursera-university-of-washington
machine_learning/1_machine_learning_foundations/assignment/week6/Deep Features for Image Retrieval.ipynb
mit
import graphlab """ Explanation: Building an image retrieval system with deep features Fire up GraphLab Create End of explanation """ image_train = graphlab.SFrame('image_train_data/') """ Explanation: Load the CIFAR-10 dataset We will use a popular benchmark dataset in computer vision called CIFAR-10. (We've red...
mnschmit/LMU-Syntax-nat-rlicher-Sprachen
09-notebook-solution.ipynb
apache-2.0
from nltk.featstruct import FeatStruct """ Explanation: Übungsblatt 9 Präsenzaufgaben Aufgabe 1 &nbsp;&nbsp;&nbsp; Unifikation I End of explanation """ f1 = FeatStruct( '[Vorname=Max, Nachname=Mustermann,' + 'Privat=[Strasse=Hauptstrasse, Ort=[Muenchen]]]' ) f2 = FeatStruct( '[Arbeit=[Strasse="Oettingen...
bburan/psiexperiment
examples/notebooks/stimulus generation.ipynb
mit
from psi.controller.calibration.api import FlatCalibration """ Explanation: Calibration Several types of calibrations are supported. The simplest calibration assumes that frequency response is "flat". In other words, if you send a 1V RMS tone to the speaker, it will always produce the same output level regardless of f...
maptime/boulder
geopandas/plotting_with_geoplot.ipynb
bsd-2-clause
import geopandas path = geopandas.datasets.get_path('naturalearth_lowres') df = geopandas.read_file(path) # Add a column we'll use later df['gdp_pp'] = df['gdp_md_est'] / df['pop_est'] boroughs = geopandas.read_file(geopandas.datasets.get_path('nybb')).to_crs(epsg='4326') injurious_collisions = geopandas.read_file( ...
statsmodels/statsmodels
examples/notebooks/statespace_arma_0.ipynb
bsd-3-clause
%matplotlib inline import numpy as np from scipy import stats import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm from statsmodels.graphics.api import qqplot """ Explanation: Autoregressive Moving Average (ARMA): Sunspots data This notebook replicates the existing ARMA notebook using th...
tensorflow/decision-forests
documentation/tutorials/advanced_colab.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...
SamLau95/nbinteract
docs/notebooks/examples/examples_sampling_from_a_population.ipynb
bsd-3-clause
united = Table.read_table('http://inferentialthinking.com/notebooks/united_summer2015.csv') united """ Explanation: Sampling from a Population The law of averages also holds when the random sample is drawn from individuals in a large population. As an example, we will study a population of flight delay times. The tabl...
UOADataScience/machine-learning-tutorial
numpy_demo/tutorial_draft.ipynb
mit
import numpy as np my_vector = np.asarray([1,2,3]) my_matrix = np.asarray([[1,2,3],[10,10,10]]) print(my_matrix*my_vector) """ Explanation: Welcome to the Tutorial! First I'll introduce the theory behind neural nets. then we will implement one from scratch in numpy, (which is installed on the uni computers) - just typ...
pycrystem/pycrystem
doc/demos/07 Azimuthal Integration Using pyFAI Detector.ipynb
gpl-3.0
%matplotlib inline import hyperspy.api as hs import numpy as np import matplotlib.pyplot as plt """ Explanation: Azimuthal Integral Introduction This tutorial demonstrates how to acquire an azimuthal integral profile from a multidimensional data set in pyXem. The data set is a 10x10x256x256 data set of a polycrystall...
johnhw/summerschool2015
CrashCourse_Lecture2.ipynb
mit
# standard imports import numpy as np import pandas as pd import matplotlib.pyplot as plt import sklearn.preprocessing, sklearn.linear_model, sklearn.datasets import sklearn.svm, sklearn.cross_validation, sklearn.grid_search, sklearn.metrics, sklearn.decomposition import scipy.spatial import ipy_table import seaborn im...
dtamayo/reboundx
ipython_examples/EccAndIncDamping.ipynb
gpl-3.0
import rebound import reboundx import numpy as np sim = rebound.Simulation() ainner = 1. aouter = 10. e0 = 0.1 inc0 = 0.1 sim.add(m=1.) sim.add(m=1e-6,a=ainner,e=e0, inc=inc0) sim.add(m=1e-6,a=aouter,e=e0, inc=inc0) sim.move_to_com() # Moves to the center of momentum frame ps = sim.particles """ Explanation: Eccentri...
hanhanwu/Hanhan_Data_Science_Practice
Better4Industry/explore_features_fastai.ipynb
mit
%matplotlib inline from fastai.imports import * from fastai.structured import * from pandas_summary import DataFrameSummary from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier from IPython.display import display from sklearn import metrics from sklearn.preprocessing import LabelEncoder from skle...
fujii-team/GPinv
notebooks/Stochastic_approximation_demo.ipynb
apache-2.0
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import tensorflow as tf # Import GPinv import GPinv # Import GPflow as comparison import GPflow # import graphical things import seaborn as sns sns.set_context('poster') sns.set_style('ticks') import matplotlib fontprop = matplotlib.font_manager.F...
jArumugam/python-notes
P13Interactive Widgets.ipynb
mit
# Start with some imports! from __future__ import print_function from ipywidgets import interact, interactive, fixed import ipywidgets as widgets # Very basic function def f(x): return x help(interact) """ Explanation: Interactive Widgets Using interact Source Link End of explanation """ # Generate a slider t...
dipanjank/ml
statistics/hypothesis_testing_intro.ipynb
gpl-3.0
import numpy as np import pandas as pd %pylab inline pylab.style.use('ggplot') data = np.array([7.65, 7.60, 7.65, 7.70, 7.55, 7.55, 7.40, 7.40, 7.50, 7.50]) """ Explanation: The general idea of hypothesis testing involves: Making an initial assumption. Collecting evidence (data). Based on the available evidence (dat...
sertansenturk/tomato
demos/score_conversion_demo.ipynb
agpl-3.0
xml_output, ly_output, svg_output, txt_ly_mapping = symbTrConverter.convert( txt_filename, mu2_filename, symbtr_name=symbtr_name, mbid=work_mbid, render_metadata=render_metadata, xml_out=xml_filename, ly_out=ly_filename, svg_out=svg_filename_template, svg_paper_size=svg_paper_size) """ Explanation: You ...
kubeflow/examples
demos/recurring/recurring.ipynb
apache-2.0
import kfp host = 'http://localhost:3000' client = kfp.Client(host=host) """ Explanation: Recurring runs with the KFP SDK If you're running on a local cluster, expose the GUI and API, respectively, with the following commands: kubectl port-forward -n kubeflow svc/ml-pipeline-ui 8080:80 kubectl port-forward -n kubeflo...
ES-DOC/esdoc-jupyterhub
notebooks/cccma/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', 'cccma', 'sandbox-3', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: CCCMA Source ID: SANDBOX-3 Topic: Atmoschem Sub-Topics: Transport, Emission...
SimonBiggs/electroninserts_bundle
Update model data.ipynb
agpl-3.0
import os import dicom from glob import glob import zipfile import time import shutil import datetime import re import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline from IPython.core.display import display, Markdown from bokeh.io import output_notebook, output_file, reset_outpu...
weichetaru/weichetaru.github.com
notebook/machine-learning/deep_learning-neural-network-gradient-decent-part1.ipynb
mit
# Python imports import numpy as np # Matrix and vector computation package import matplotlib.pyplot as plt # Plotting library from matplotlib.colors import colorConverter, ListedColormap # some plotting functions from mpl_toolkits.mplot3d import Axes3D # 3D plots from matplotlib import cm # Colormaps # Allow matplot...
jayhetee/dask
notebooks/Using dask and anaconda-cluster to analyze data on an EC2 cluster.ipynb
bsd-3-clause
### cut me out import boto bucket = boto.connect_s3().get_bucket('githubarchive-data') # this is a public bucket from fnmatch import fnmatchcase keys = bucket.list() def data_size(key_str): """Check the size of all the keys in our bucket that match pattern that can contain ? and * for matching. """ ma...
mzohaib10/datascience-starters
visualization-in-matplotlib/visualization-in-matplotlib.ipynb
gpl-3.0
# Download data, unzip, etc. import pandas as pd import urllib import tempfile import shutil import zipfile temp_dir = tempfile.mkdtemp() data_source = 'http://archive.ics.uci.edu/ml/machine-learning-databases/00275/Bike-Sharing-Dataset.zip' zipname = temp_dir + '/Bike-Sharing-Dataset.zip' urllib.urlretrieve(data_sour...
statsmodels/statsmodels.github.io
v0.13.1/examples/notebooks/generated/statespace_fixed_params.ipynb
bsd-3-clause
%matplotlib inline from importlib import reload import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt from pandas_datareader.data import DataReader """ Explanation: Estimating or specifying parameters in state space models In this notebook we show how to fix specific val...
mne-tools/mne-tools.github.io
0.12/_downloads/plot_visualize_evoked.ipynb
bsd-3-clause
import os.path as op import numpy as np import matplotlib.pyplot as plt import mne """ Explanation: .. _tut_viz_evoked: Visualize Evoked data End of explanation """ data_path = mne.datasets.sample.data_path() fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif') evoked = mne.read_evokeds(fname, basel...
evangelistalab/forte
tutorials/Tutorial_01.04_forte_cc.ipynb
lgpl-3.0
import itertools import functools import time import psi4 import forte import forte.utils """ Explanation: Forte Tutorial 1.04: Implementing coupled cluster theory with Forte's sparse operator class In this tutorial we will implement coupled cluster theory using Forte's SparseOperator and StateVector classes. We wil...
dostrebel/working_place_ds_17
06_Python_Rückblick/01+Rückblick+02+For-Loop-Übungen+-Copy1.ipynb
mit
primzweibissieben = [2, 3, 5, 7] for prime in primzweibissieben: print(prime) """ Explanation: 10 For-Loop-Rückblick-Übungen In den Teilen der folgenden Übungen habe ich den Code mit "XXX" ausgewechselt. Es gilt in allen Übungen, den korrekten Code auszuführen und die Zelle dann auszuführen. 1.Drucke alle diese P...
tkzeng/molecular-design-toolkit
moldesign/_notebooks/Example 1. Build and simulate DNA.ipynb
apache-2.0
%matplotlib inline from matplotlib.pyplot import * try: import seaborn #optional, makes plots nicer except ImportError: pass import moldesign as mdt from moldesign import units as u """ Explanation: <span style="float:right"><a href="http://moldesign.bionano.autodesk.com/" target="_blank" title="About">About</a>&nbs...
radajin/datascience
PCA/vectorspace.ipynb
mit
%matplotlib inline %config InlineBackend.figure_formats = {'png', 'retina'} import numpy as np import seaborn as sns import matplotlib.pyplot as plt import matplotlib as mpl """ Explanation: Vector Space End of explanation """ import numpy as np a = np.array([1, 1]) np.linalg.norm(a) """ Explanation: 1. vector len...
turbomanage/training-data-analyst
courses/machine_learning/deepdive2/structured/solutions/4c_keras_wide_and_deep_babyweight.ipynb
apache-2.0
import datetime import os import shutil import matplotlib.pyplot as plt import numpy as np import tensorflow as tf print(tf.__version__) """ Explanation: LAB 4c: Create Keras Wide and Deep model. Learning Objectives Set CSV Columns, label column, and column defaults Make dataset of features and label from CSV files ...
oscarmore2/deep-learning-study
sentiment-rnn/Sentiment_RNN.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[:200] #labels[:2000] """ Explanation: Sentiment Analysis with an RNN In this notebook, you'll implement a re...
ueapy/enveast_python_course_materials
Day_2/17-Pandas-Intro.ipynb
mit
import pandas as pd """ Explanation: Introduction to pandas pandas is a Python package providing convenient data structures to work with labelled data. pandas is perfectly suited for observational / statistical data sets, having many similarities with Excel spreadsheets. Key features: easy handling of missing d...
park-python/course
lectures/04_OS_Debug_Tests_Threads_Async/notebook.ipynb
bsd-3-clause
import os os.mkdir("/tmp/park-python") try: os.rmdir("/tmp/park-python") except IOError as err: print(err) path = "/tmp/park-python/lectures/04" if not os.path.exists(path): os.makedirs(path) os.rmdir("/tmp/park-python") import shutil shutil.rmtree("/tmp/park-python") import pprint pprint.pprint(list(...
whitead/numerical_stats
unit_5/hw_2018/Homework_5_Key.ipynb
gpl-3.0
#2.1 #enter data Q = [-3, 0, 2, 3, 6] P = [1/10, 4/10, 1/10, 2/10, 2/10] #initialize psum psum = 0 #iterate over index i for i in range(len(Q)): #add up probabilities psum += P[i] #print result print(psum) #2.2 #initialize expectation value ex = 0 #iterate over index i for i in range(len(Q)): #add up pr...
mathemage/h2o-3
examples/deeplearning/notebooks/deeplearning_cifar10_vgg.ipynb
apache-2.0
%matplotlib inline import matplotlib import scipy.io import matplotlib.pyplot as plt import cPickle import numpy as np from scipy.misc import imsave from IPython.display import Image, display, HTML """ Explanation: Training on Cifar 10 Using MXNet and H2O https://www.cs.toronto.edu/~kriz/cifar.html The CIFAR-10 data...
jdsanch1/SimRC
02. Parte 2/12. Clase 12/12Class NB.ipynb
mit
#importar los paquetes que se van a usar import pandas as pd import pandas_datareader.data as web import numpy as np import datetime from datetime import datetime import scipy.stats as stats import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline #algunas opciones para Python pd.set_option('display.not...
PMEAL/OpenPNM
examples/getting_started/quick_plotting_networks.ipynb
mit
import warnings import scipy as sp import numpy as np import openpnm as op %config InlineBackend.figure_formats = ['svg'] import matplotlib.pyplot as plt %matplotlib inline np.random.seed(10) ws = op.Workspace() ws.settings['loglevel'] = 40 np.set_printoptions(precision=4) net = op.network.Cubic(shape=[5, 5, 1]) """ E...
phoebe-project/phoebe2-docs
2.3/tutorials/distribution_propagation.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" import phoebe from phoebe import u # units import numpy as np logger = phoebe.logger() """ Explanation: Advanced: Distribution Propagation NOTE: support for distribution propagation was improved in the 2.3.25 release. Please make sure you have at least 2.3.25 installed. Setup Let...
ivannz/study_notes
year_14_15/spring_2015/netwrok_analysis/notebooks/labs/prediction.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import scipy as sp import networkx as nx %matplotlib inline """ Explanation: Node Label Prediction \ Link Prediction End of explanation """ g = nx.read_gml('./data/ppi.CC.gml.txt') cc = list(nx.connected_components(g)) g = nx.subgraph(g,cc[0]) g = nx.relabel.convert...
slac207/cs207project
cs207rbtree/demo_RedBlackTree.ipynb
mit
import timeseries, TimeseriesDB, Similarity import cs207rbtree.RedBlackTree as Database dir(Database) """ Explanation: Package Installation At the console, within the cs207project directory, you can use python pip install -e . or equivalently python python setup.py install At this point, four subpackages will be ava...
ericmjl/bokeh
examples/howto/server_embed/notebook_embed.ipynb
bsd-3-clause
import yaml from bokeh.layouts import column from bokeh.models import ColumnDataSource, Slider from bokeh.plotting import figure from bokeh.themes import Theme from bokeh.io import show, output_notebook from bokeh.sampledata.sea_surface_temperature import sea_surface_temperature output_notebook() """ Explanation: E...
mne-tools/mne-tools.github.io
0.19/_downloads/96cdfef13f5475e2f32b862fa94904b7/plot_visualize_stc.ipynb
bsd-3-clause
import os import mne from mne.datasets import sample from mne.minimum_norm import apply_inverse, read_inverse_operator from mne import read_evokeds data_path = sample.data_path() sample_dir = os.path.join(data_path, 'MEG', 'sample') subjects_dir = os.path.join(data_path, 'subjects') fname_evoked = data_path + '/MEG/...
IanHawke/ET-NumericalMethods-2016
slides/02-horizon-finding.ipynb
mit
import numpy from matplotlib import pyplot %matplotlib inline def horizon_RHS(H, theta, z_singularities): """ The RHS function for the apparent horizon problem. Parameters ---------- H : array vector [h, dh/dtheta] theta : double angle z_singularities : array ...
mliesenberg/tf-bcgdv
SimpleNetworkLab.ipynb
mit
%matplotlib inline import os from urllib import urlretrieve import math import tensorflow as tf import matplotlib.pyplot as plt 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 zipfile ...
DOV-Vlaanderen/pydov
docs/notebooks/search_sonderingen.ipynb
mit
%matplotlib inline import inspect, sys import pydov """ Explanation: Example of DOV search methods for CPT measurements (sonderingen) Use cases explained below Get CPT measurements in a bounding box Get CPT measurements with specific properties Get CPT measurements in a bounding box based on specific properties Sel...
ES-DOC/esdoc-jupyterhub
notebooks/cccma/cmip6/models/canesm5/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cccma', 'canesm5', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: CCCMA Source ID: CANESM5 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Balance...
amccaugh/phidl
docs/tutorials/quickstart.ipynb
mit
from phidl import Device from phidl import quickplot as qp # Rename "quickplot()" to the easier "qp()" import phidl.geometry as pg """ Explanation: Quick start PHIDL allows you to create complex designs from simple shapes, and can output the result as GDSII files. The basic element of PHIDL is the Device, which is jus...
ipython/ipywidgets
docs/source/examples/Widget Asynchronous.ipynb
bsd-3-clause
%gui asyncio """ Explanation: Index - Back Asynchronous Widgets This notebook covers two scenarios where we'd like widget-related code to run without blocking the kernel from acting on other execution requests: Pausing code to wait for user interaction with a widget in the frontend Updating a widget in the background...
KasperPRasmussen/bokeh
examples/howto/charts/heatmap.ipynb
bsd-3-clause
df.head() """ Explanation: Auto MPG Data End of explanation """ hm = HeatMap(df, x=bins('mpg'), y=bins('displ')) show(hm) """ Explanation: 2D Binning Default behavior for 2d binning is to bin the dimensions provided, then count the rows that fall into each bin. This is visualizing how the source data represents all...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session11/Day4/VisualizingImages.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt from astropy.io import fits %matplotlib notebook """ Explanation: An Introduction to Visualizing Astronomical Images Version 0.1 This session has focused on image processing, with particular attention paid to how we make standard measurements (su...
Automating-GIS-processes/2017
source/codes/Lesson3-spatial-join.ipynb
mit
import geopandas as gpd # Filepath fp = r"/home/geo/Pop15/Vaestotietoruudukko_2015.shp" # Read the data pop = gpd.read_file(fp) # See the first rows print(pop.head()) """ Explanation: Spatial join Spatial join is yet another classic GIS problem. Getting attributes from one layer and transferring them into another l...
DTOcean/dtocean-core
notebooks/DTOcean Environmental Impact Example.ipynb
gpl-3.0
%matplotlib inline from IPython.display import display, HTML import matplotlib.pyplot as plt plt.rcParams['figure.figsize'] = (14.0, 8.0) import numpy as np from dtocean_core import start_logging from dtocean_core.core import Core from dtocean_core.menu import ModuleMenu, ProjectMenu, ThemeMenu from dtocean_core.pi...
JeanClaudeR/zikaViz
ShowOff_slides.ipynb
mit
Image("img/init.png") """ Explanation: Practical use of Jupyter notebook Second motivation : learning Python by web scraping Scraping data from the WHO End of explanation """ Image("img/target_result.png") """ Explanation: Expected results End of explanation """ # FOR WEB SCRAPING from lxml import html import req...
tuanavu/coursera-university-of-washington
machine_learning/1_machine_learning_foundations/assignment/week2/Predicting house prices.ipynb
mit
import graphlab """ Explanation: Fire up graphlab create End of explanation """ sales = graphlab.SFrame('home_data.gl/') sales """ Explanation: Load some house sales data Dataset is from house sales in King County, the region where the city of Seattle, WA is located. End of explanation """ graphlab.canvas.set_ta...
cojacoo/testcases_echoRD
echoRD2D_tests_prep_py3-Copy1.ipynb
gpl-3.0
import numpy as np import pandas as pd %pylab inline import scipy as sp import matplotlib.pyplot as plt import os, sys #connect echoRD Tools pathdir='../' #path to echoRD lib_path = os.path.abspath(pathdir) sys.path.append(lib_path) import vG_conv as vG from hydro_tools import plotparticles_t,hydroprofile,plotparticl...
chanceraine/nupic.research
projects/sdr_paper/sdr_math_neuron_paper.ipynb
agpl-3.0
oxp = Symbol("Omega_x'") b = Symbol("b") n = Symbol("n") theta = Symbol("theta") s = Symbol("s") a = Symbol("a") subsampledOmega = (binomial(s, b) * binomial(n - s, a - b)) / binomial(n, a) subsampledFpF = Sum(subsampledOmega, (b, theta, s)) subsampledOmegaSlow = (binomial(s, b) * binomial(n - s, a - b)) subsampledFp...
dariox2/CADL
session-3/.ipynb_checkpoints/lecture-3-checkpoint.ipynb
apache-2.0
# imports %matplotlib inline # %pylab osx import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cmx # Some additional libraries which we'll use just # to produce some visualizations of our training from libs.utils import montage from libs i...
gVallverdu/cookbook
puits_infini.ipynb
gpl-2.0
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from scipy.constants import h, m_e, elementary_charge %matplotlib inline """ Explanation: Particule dans une boîte uni-dimensionnelle Germain Salvato Vallverdu germain.vallverdu@univ-pau.fr End of explanation """ def phi(x, p=1, L=1): re...
gtzan/mir_book
Bayes Classification.ipynb
cc0-1.0
%matplotlib inline import matplotlib.pyplot as plt import pickle import numpy as np # load some lyrics bag of words data, binarize, separate matrix rows by genre data = np.load('data/data.npz') a = data['arr_0'] a[a > 0] = 1 labels = np.load('data/labels.npz') labels = labels['arr_0'] dictionary = pickle.load(open...
berkeley-dsc/purchasing
script/andrew/Pricing_Error.ipynb
isc
%pylab inline import pandas as pd import numpy as np #Read in the data RawData = pd.read_csv('/home/analyst/Desktop/invoices/all.csv', low_memory=False, thousands=',', converters={'Invoice System Created Date': lambda x: pd.to_datetime(x)} ) #The UCSF file has different hea...
dpiparo/ROOTaaS
NoteBooks/Howto-inherit-C++-classes-from-python.ipynb
lgpl-3.0
from ROOTaaS.iPyROOT import ROOT """ Explanation: Inheriting C++ classes from Python In this exercise we would like to demostrate the inheritance of a C++ class from Python. The base class in C++ is Base and we want to have an specialization of if in Python PyDerived End of explanation """ %%dcl #include "TObject.h"...
oxpeter/library_bioinformatics_service
Jupyter/Jupyter_Notebook_Demo.ipynb
apache-2.0
# this is a code cell with no output a=120 # this is a code cell with output # all output to stdout / stderr will be displayed below the cell. print(a) """ Explanation: Library Bioinformatics Service Jupyter Notebook Tutorial This tutorial was built in a Jupyter notebook! Various formats of this tutorial can be acces...
shngli/Data-Mining-Python
RSS feed/RSS Feed Parser.ipynb
gpl-3.0
# -*-coding: utf-8 -*- import feedparser import re import string # Create the regular expressions reg1 = re.compile(r'<br />') #Regex to replace <br /> with \n (see reg1.sub) reg2 = re.compile(r'(<!--.*?-->|<[^>]*>)') #Regex to clean all html tags (anything with <something>) #alternative reg2 #reg2 = re.compile(r'<[^...
Kaggle/learntools
notebooks/machine_learning/raw/ex4.ipynb
apache-2.0
# Code you have previously used to load data import pandas as pd from sklearn.tree import DecisionTreeRegressor # Path of the file to read iowa_file_path = '../input/home-data-for-ml-course/train.csv' home_data = pd.read_csv(iowa_file_path) y = home_data.SalePrice feature_columns = ['LotArea', 'YearBuilt', '1stFlrSF'...
ajrader/timeseries
notebooks/Prophet_retail_2.ipynb
apache-2.0
retail_datafile = '../datasets/example_retail_sales.csv' from fbprophet import Prophet import numpy as np import pandas as pd %matplotlib inline import matplotlib.pyplot as plt plt.rcParams['figure.figsize']=(20,10) plt.style.use('ggplot') sales_df = pd.read_csv(retail_datafile) sales_df['y_orig'] = sales_df['y'] # t...
NathanYee/ThinkBayes2
code/.ipynb_checkpoints/chap02mine-checkpoint.ipynb
gpl-2.0
% matplotlib inline from thinkbayes2 import Hist, Pmf, Suite """ Explanation: Think Bayes: Chapter 2 This notebook presents example code and exercise solutions for Think Bayes. Copyright 2016 Allen B. Downey MIT License: https://opensource.org/licenses/MIT End of explanation """ pmf = Pmf() for x in [1,2,3,4,5,6]: ...
jorisvandenbossche/geopandas
doc/source/gallery/plotting_with_geoplot.ipynb
bsd-3-clause
import geopandas import geoplot world = geopandas.read_file( geopandas.datasets.get_path('naturalearth_lowres') ) boroughs = geopandas.read_file( geoplot.datasets.get_path('nyc_boroughs') ) collisions = geopandas.read_file( geoplot.datasets.get_path('nyc_injurious_collisions') ) """ Explanation: Plotting ...
google-research/google-research
representation_similarity/Demo.ipynb
apache-2.0
import numpy as np def gram_linear(x): """Compute Gram (kernel) matrix for a linear kernel. Args: x: A num_examples x num_features matrix of features. Returns: A num_examples x num_examples Gram matrix of examples. """ return x.dot(x.T) def gram_rbf(x, threshold=1.0): """Compute Gram (kernel) m...
dib-lab/SSUsearch
notebooks-pc-linux/ssu-search.ipynb
bsd-3-clause
cd ~/Desktop/SSUsearch/ mkdir -p ./workdir #check seqfile files to process in data directory (make sure you still remember the data directory) !ls ./data/test/data """ Explanation: Set up working directory End of explanation """ Seqfile='./data/test/data/1c.fa' """ Explanation: README This part of pipeline search...
tpin3694/tpin3694.github.io
machine-learning/make_simulated_data_for_classification.ipynb
mit
from sklearn.datasets import make_classification import pandas as pd """ Explanation: Title: Make Simulated Data For Classification Slug: make_simulated_data_for_classification Summary: Make a simulated dataset for classification using scikit-learn. Date: 2017-01-16 12:00 Category: Machine Learning Tags: Basics Author...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/01_bigquery/labs/b_bqml.ipynb
apache-2.0
PROJECT = "cloud-training-demos" # Replace with your PROJECT REGION = "us-central1" # Choose an available region for Cloud MLE import os os.environ["PROJECT"] = PROJECT os.environ["REGION"] = REGION !pip freeze | grep google-cloud-bigquery==1.21.0 || pip install google-cloud-bigquery==1.21.0 %load_ext go...