repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
google/skywater-pdk-libs-sky130_bag3_pr | workspace_setup/tutorial_files/6_MOSDBDiscrete.ipynb | apache-2.0 | %matplotlib inline
import os
import pprint
import numpy as np
import matplotlib.pyplot as plt
# noinspection PyUnresolvedReferences
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib import ticker
from verification_ec.mos.query import MOSDBDiscrete
interp_method = 'spline'
spec_file =... |
ecell/ecell4-notebooks | en/tutorials/tutorial05.ipynb | gpl-2.0 | %matplotlib inline
import math
from ecell4.prelude import *
"""
Explanation: 5. How to Log and Visualize Simulations
Here we explain how to take a log of simulation results and how to visualize it.
End of explanation
"""
def create_simulator(f=gillespie.Factory()):
m = NetworkModel()
A, B, C = Species('A', 0... |
thomasmeagher/DS-501 | 4/CaseStudy4.ipynb | mit | from IPython.display import YouTubeVideo
YouTubeVideo("mrSmaCo29U4")
YouTubeVideo("xIq8Sg59UdY")
"""
Explanation: Case Study 4 : Data Science Shark Tank: Pitch Your Ideas
Due Date: April 27, 6pm
<img src="https://cp.inkrefuge.com/images%5Cpressreleases/shark%20tank_large.jpg" width="400px">
After the previous 3 c... |
mdeff/ntds_2016 | algorithms/08_ass_graph_inpainting.ipynb | mit | import numpy as np
import scipy.io
import matplotlib.pyplot as plt
%matplotlib inline
import os.path
X = scipy.io.mmread(os.path.join('datasets', 'graph_inpainting', 'embedding.mtx'))
W = scipy.io.mmread(os.path.join('datasets', 'graph_inpainting', 'graph.mtx'))
N = W.shape[0]
print('N = |V| = {}, k|V| < |E| = {}'.fo... |
bmeaut/python_nlp_2017_fall | homeworks/homework3/homework3.ipynb | mit | import nltk
from nltk.tree import Tree
tree = Tree('__NOM_1', [
Tree('__NOM_2', [
Tree('__SUPL_ADJ_2', [
Tree('[Supl]', ['leg']),
Tree('[/Adj]', ['nagy']),
Tree('[_Comp/Adj]', ['obb']),
]),
Tree('[Pl]', ['ak']),
]),
Tree('[Acc]', ['at']),
])
disp... |
ptosco/rdkit | Docs/Notebooks/FingerprintGenerators.ipynb | bsd-3-clause | from rdkit import Chem
from rdkit.Chem import rdFingerprintGenerator
mol = Chem.MolFromSmiles('CC(O)C(O)(O)C')
generator = rdFingerprintGenerator.GetAtomPairGenerator()
fingerprint = generator.GetSparseCountFingerprint(mol)
non_zero = fingerprint.GetNonzeroElements()
print(non_zero)
"""
Explanation: Fingerprint Gene... |
PBrockmann/ipython_ferretmagic | notebooks/ferretmagic_02_PassDataFromPythonToFerret.ipynb | mit | %load_ext ferretmagic
"""
Explanation: <hr>
Patrick BROCKMANN - LSCE (Climate and Environment Sciences Laboratory)<br>
<img align="left" width="40%" src="http://www.lsce.ipsl.fr/Css/img/banniere_LSCE_75.png" ><br><br>
<hr>
Updated: 2019/11/13
Load the ferret extension
End of explanation
"""
import numpy as np
b = {... |
hmenke/pairinteraction | doc/sphinx/examples_python/wavefunctions.ipynb | gpl-3.0 | %matplotlib inline
"""
Explanation: Radial Wavefunctions and Quantum Defects
In this tutorial we show how to access quantum defects and wavefunctions, which are used for the computation of matrix elements, using the Python API. Some aspects of this are discussed in Appendix A of the pairinteraction paper J. Phys. B: ... |
franklinsales/udacity-data-analyst-nanodegree | project2/udacity-project2-titanic-data.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Abstract
In this work we will to take a look at a data visualization using Python and the Titanic dataset. It's not intended to be the most accurate Titanic dataset analysis about Titanic, it's a project resultant of the course Dat... |
divyanshusrivastava/NetworkBio | Coding_Asg_02/Assignment_2.ipynb | mit | import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
from IPython.display import Image
"""
Explanation: NETWORK BIOLOGY
Assignment 1
Submitted By:
Divyanshu Srivastava (MT16125)
End of explanation
"""
# Regular graph initialization
nodes = 1000
k = 10
adj = np.zeros([nodes, nodes])
for i in ran... |
jbwhit/jupyter-best-practices | notebooks/05-SQL-Example.ipynb | mit | %load_ext sql_magic
import sqlalchemy
import pandas as pd
import sqlite3
from sqlalchemy import create_engine
sqlite_engine = create_engine('sqlite://')
%config SQL.conn_name = "sqlite_engine"
%config SQL
%config SQL.output_result = False
"""
Explanation: SQL
Accessing data stored in databases is a routine exercis... |
jhillairet/scikit-rf | doc/source/examples/vectorfitting/vectorfitting_ex4_passivity.ipynb | bsd-3-clause | import skrf
import numpy as np
import matplotlib.pyplot as mplt
# load and fit the ring slot network with 3 poles
nw = skrf.data.ring_slot
vf = skrf.VectorFitting(nw)
vf.vector_fit(n_poles_real=3, n_poles_cmplx=0)
# plot fitting results
freqs = np.linspace(0, 200e9, 201)
fig, ax = mplt.subplots(2, 2)
fig.set_size_inc... |
mne-tools/mne-tools.github.io | dev/_downloads/08101c5685595d96337d701dc0603996/40_mne_fixed_free.ipynb | bsd-3-clause | # Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD-3-Clause
import mne
from mne.datasets import sample
from mne.minimum_norm import make_inverse_operator, apply_inverse
print(__doc__)
data_path = sample.data_path()
subjects_dir = data_path / 'subjects'
# Read data (just MEG here for speed, though we c... |
sbenthall/bigbang | examples/obsolete_notebooks/SummerSchoolSpecialWordsAnalysis.ipynb | agpl-3.0 | from bigbang.archive import Archive
from bigbang.archive import load as load_archive
import bigbang.parse as parse
import bigbang.graph as graph
import bigbang.mailman as mailman
import bigbang.process as process
import networkx as nx
import matplotlib.pyplot as plt
import pandas as pd
from pprint import pprint as pp
i... |
QuantCrimAtLeeds/PredictCode | examples/Networks/Case study Chicago/Grid Network Comparison.ipynb | artistic-2.0 | trainer = open_cp.network_hotspot.Trainer()
trainer.graph = graph
trainer.maximum_edge_length = 20
trainer.data = timed_points
predictor = trainer.compile()
tstart = np.datetime64("2013-01-01")
tend = np.datetime64("2013-01-01") + np.timedelta64(180, "D")
def score(predictor):
risks = dict()
for day in range(... |
gojomo/gensim | docs/notebooks/WMD_tutorial.ipynb | lgpl-2.1 | from time import time
start_nb = time()
# Initialize logging.
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s')
sentence_obama = 'Obama speaks to the media in Illinois'
sentence_president = 'The president greets the press in Chicago'
sentence_obama = sentence_obama.lower().split()... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/statespace_sarimax_stata.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
from scipy.stats import norm
import statsmodels.api as sm
import matplotlib.pyplot as plt
from datetime import datetime
import requests
from io import BytesIO
# Register converters to avoid warnings
pd.plotting.register_matplotlib_converters()
plt.rc("figure", ... |
khalido/nd101 | numpy.ipynb | gpl-3.0 | import numpy as np
# the below line outputs all variables, not just the last one
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
"""
Explanation: Numpy
for some reason, python is pretty slow at matrix math, so numpy was invented to fix it up. Matrix math and ... |
deep-learning-indaba/practicals2017 | practical2.ipynb | mit | # Import TensorFlow and some other libraries we'll be using.
import datetime
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# Download the MNIST dataset onto the local machine.
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
"""
Explanation: DL Ind... |
pfschus/fission_bicorrelation | methods/build_bicorr_hist_master.ipynb | mit | %%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')
"""
Explanation: <div id="toc"></div>
<div id="toc"></div>
End of explanation
"""
import matplotlib.pyplot as plt
import matplotlib.colors
import numpy as np
import os
import scipy.io as sio
import sys
import ti... |
pchmieli/h2o-3 | h2o-py/demos/kmeans_aic_bic_diagnostics.ipynb | apache-2.0 | import h2o
import imp
from h2o.estimators.kmeans import H2OKMeansEstimator
# Start a local instance of the H2O engine.
h2o.init();
"""
Explanation: Much data produced is unlabeled data, data where the target vale or class is unknown. Unsupervised learning gives us the tools to find hidden structure in unlabeled data... |
kern-lab/popGenMachineLearningExamples | sweepDetectionExample.ipynb | mit | #untar and compile sample_stats
!tar zxf ms.tar.gz; cd msdir; gcc -o sample_stats sample_stats.c tajd.c -lm
#now move the program into the current working dir
!mv msdir/sample_stats .
"""
Explanation: Using a support vector machine for sweep model selection
This example is similar to demographicModelSelectionExample.i... |
omoju/genderCSExperience | part2_featureImportance.ipynb | gpl-3.0 | from IPython.display import display
from IPython.display import HTML
import IPython.core.display as di # Example: di.display_html('<h3>%s:</h3>' % str, raw=True)
# This line will hide code by default when the notebook is exported as HTML
di.display_html('<script>jQuery(function() {if (jQuery("body.notebook_app").lengt... |
tclaudioe/Scientific-Computing | SC2/U4_EDP_elipticas.ipynb | bsd-3-clause | import numpy as np
from mpl_toolkits.mplot3d import axes3d
from matplotlib import pyplot as plt
from ipywidgets import interact
from ipywidgets import IntSlider
import sympy as sym
import matplotlib as mpl
mpl.rcParams['font.size'] = 14
mpl.rcParams['axes.labelsize'] = 20
mpl.rcParams['xtick.labelsize'] = 14
mpl.rcPara... |
brsaylor/atn-tools | notebooks/parameters.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
# This plot shows how mass-specific metabolic rate falls off with body size
x = np.arange(1, 100)
plt.plot(x, x**-.25)
plt.xlabel("body size")
plt.ylabel("metabolic rate")
"""
Explanation: Plot of allometrically-scaled mass-specific metabolic rate... |
zklgame/CatEyeNets | test/TensorFlow.ipynb | mit | import tensorflow as tf
import numpy as np
import math
import timeit
import matplotlib.pyplot as plt
%matplotlib inline
from cs231n.data_utils import load_CIFAR10
def get_CIFAR10_data(num_training=49000, num_validation=1000, num_test=10000):
"""
Load the CIFAR-10 dataset from disk and perform preprocessing to... |
zasdfgbnm/qutip-notebooks | examples/example-stinespring.ipynb | lgpl-3.0 | from __future__ import division, print_function
"""
Explanation: QuTiP Example: Stinespring Dilation of Quantum Channels
Christopher Granade <br>
University of Sydney
$\newcommand{\ket}[1]{\left|#1\right\rangle}$
$\newcommand{\bra}[1]{\left\langle#1\right|}$
$\newcommand{\cnot}{{\scriptstyle \rm CNOT}}$
$\newcommand{\... |
mabevillar/rmtk | rmtk/vulnerability/derivation_fragility/hybrid_methods/DBELA/DBELA.ipynb | agpl-3.0 | import DBELA
from rmtk.vulnerability.common import utils
%matplotlib inline
"""
Explanation: Displacement-based Earthquake Loss Assessment - Silva et al. 2013
In this fragility method, thousands of synthetic buildings can be produced considering probabilistic distributions for the variability in the geometrical and m... |
planetlabs/notebooks | jupyter-notebooks/vector/shapefile.ipynb | apache-2.0 | !pip install pyshp pyproj
"""
Explanation: Drawing Shapefiles in Python with Matplotlib
If you are using python for spatial processing, it is sometimes useful to plot your data. In these cases, it may also be helpful to render a simple map to help locate the data. This notebook will show you how plot a shapefile using... |
subramgo/Instacart | 01_Feature_Generation.ipynb | apache-2.0 | import numpy as np
import pandas as pd
import time
from tqdm import tqdm
import gc
print('loading prior')
priors = pd.read_csv('./data/order_products__prior.csv')
print('loading train')
train_all = pd.read_csv('./data/order_products__train.csv')
## Have split the trian data into two sets, train and eval
train = p... |
aloctavodia/SBioA | English/Optimizing Fortran and Python code/Optimizing Fortran and Python code.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from numba import jit
import math
import dbscanf2py # Import the extension module file dbscanf2py.so
"""
Explanation: Optimizing Fortran and Python code
“Premature optimization is the root of all evil” - Donald Knuth
Optimization is a program tra... |
ankurankan/pgmpy | examples/Creating a Discrete Bayesian Network.ipynb | mit | from IPython.display import Image
Image("images/cancer.png")
"""
Explanation: Creating discrete Bayesian Networks
In this section, we show an example for creating a Bayesian Network in pgmpy from scratch. We use the cancer model (http://www.bnlearn.com/bnrepository/#cancer) for the example. The model structure is sho... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/02_02/Begin/Selection.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
sample_numpy_data = np.array(np.arange(24)).reshape((6,4))
dates_index = pd.date_range('20160101', periods=6)
sample_df = pd.DataFrame(sample_numpy_data, index=dates_index, columns=list('ABCD'))
sample_df
"""
Explanation: Differences between interactive and production work
Note:... |
DAInamite/programming-humanoid-robot-in-python | kinematics/inverse_kinematics_2d_jax.ipynb | gpl-2.0 | %matplotlib notebook
from matplotlib import pylab as plt
from numpy import random, pi
from __future__ import division
from IPython import display
from ipywidgets import interact, fixed
import jax.numpy as np
from jax import grad, jit
"""
Explanation: Inverse Kinematics (2D)
with https://github.com/google/jax
note
* r... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/ukesm1-0-ll/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'ukesm1-0-ll', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: NERC
Source ID: UKESM1-0-LL
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Tu... |
AutuanLiu/Python | fastai_notes/LinearAlgebra/speech01.ipynb | mit | # 多行结果输出支持
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
"""
Explanation: note1
End of explanation
"""
import numpy as np
np.set_printoptions(precision=4)
# 导入视频
# from IPython.display import YouTubeVideo
# YouTubeVideo("8iGzBMboA0I")
# 制作切片(tuple 形式)
di... |
PyLCARS/PythonUberHDL | PYNQLearn/myHDL_PYNQ_AXI_Learn.ipynb | bsd-3-clause | #This notebook also uses the `(some) LaTeX environments for Jupyter`
#https://github.com/ProfFan/latex_envs wich is part of the
#jupyter_contrib_nbextensions package
from myhdl import *
from myhdlpeek import Peeker
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
from sympy im... |
jchowk/pyND | pyND/gbt/docs/GBTspec.usage.ipynb | gpl-3.0 | # Typical imports here
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
import astropy.constants as c
%load_ext autoreload
%autoreload 2
from pyND.gbt import GBTspec
"""
Explanation: Using pyND.gbt.GBTspec
This code reads individual datasets from a GBTIDL-style FITS file.
End of explanati... |
googleinterns/advertiser-quality-from-sites | source/generate_input_data.ipynb | apache-2.0 | depth = 4
label_colname='stars'
is_multicase = True if label_colname == 'categories' else False
test = tree_lib.add_encoded_trees_to_dataframe(test, label_colname=label_colname, max_depth=depth, is_multicase=is_multicase)
cnt = 0
for _, entry in test.iterrows():
if cnt == 10: break
cnt += 1
print(entry['e... |
GoogleCloudPlatform/training-data-analyst | courses/ai-for-time-series/notebooks/01-explore.ipynb | apache-2.0 | %pip install -U statsmodels scikit-learn --user
"""
Explanation: Overview
In this notebook, you will learn how to load, explore, visualize, and pre-process a time-series dataset. The output of this notebook is a processed dataset that will be used in following notebooks to build a machine learning model.
Dataset
CTA -... |
getsmarter/bda | module_1/M1_NB3_VisualCommunication.ipynb | mit | # Load relevant libraries.
import pandas as pd
import numpy as np
import matplotlib
import folium
import geocoder
from tqdm import tqdm
%pylab inline
pylab.rcParams['figure.figsize'] = (10, 8)
"""
Explanation: <div align="right">Python 3.6 Jupyter Notebook</div>
Visual communication
Geocoding and markdown examples
Yo... |
aselle/tensorflow | tensorflow/contrib/eager/python/examples/generative_examples/dcgan.ipynb | apache-2.0 | # to generate gifs
!pip install imageio
"""
Explanation: Copyright 2018 The TensorFlow Authors.
Licensed under the Apache License, Version 2.0 (the "License").
DCGAN: An example with tf.keras and eager
<table class="tfo-notebook-buttons" align="left"><td>
<a target="_blank" href="https://colab.research.google.com/git... |
jhconning/Dev-II | notebooks/DataAPIs.ipynb | bsd-3-clause | %matplotlib inline
import seaborn as sns
import warnings
import numpy as np
import statsmodels.formula.api as smf
import datetime as dt
from pandas_datareader import wb
"""
Explanation: Data APIs and pandas operations
Several of the notebooks we've already explored loaded datasets into a python pandas dataframe for a... |
kylepjohnson/notebooks | public_talks/2016_10_26_harvard/3.2c Classification, make models, fewer epithets, print tree.ipynb | mit | import os
from sklearn import preprocessing
from sklearn.tree import DecisionTreeClassifier
from sklearn.cross_validation import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.externals import joblib
from sklearn.feature_extraction.text import CountVectorizer
from sklearn import prepr... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_fdr_stats_evoked.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets import sample
from mne.stats import bonferroni_correction, fdr_correction
print(__doc__)
"""
... |
mbakker7/ttim | notebooks/circareasink_example.ipynb | mit | N = 0.001
R = 100
ml = ModelMaq(kaq=5, z=[10, 0], Saq=2e-4, tmin=1e-3, tmax=1e4)
ca = CircAreaSink(ml, 0, 0, 100, tsandN=[(0, 0.001)])
ml.solve()
ml.xsection(-200, 200, 0, 0, t=[0.1, 1, 10], figsize=(12, 4), sstart=-200)
x = np.linspace(-200, 200, 200)
qx = np.zeros_like(x)
for t in [0.1, 1, 10]:
for i in range(le... |
maxalbert/pandas-snippets | pandas-snippets.ipynb | unlicense | df = pd.DataFrame({
'colA': ['aaa', NaN, NaN, NaN, 'bbb', 'ccc'],
'colB': ['xxx', 'yyy', NaN, 'zzz', NaN, 'www'],
#'colC': [NaN, 3, NaN, 1, 0, 9]
})
df
"""
Explanation: Create a sample DataFrame with some missing values.
End of explanation
"""
cond = df.colA.isnull() & ~df.colB.isnull()
cond
"""
E... |
esa-as/2016-ml-contest | HouMath/Face_classification_HouMath_XGB_01.ipynb | apache-2.0 | %matplotlib inline
import pandas as pd
from pandas.tools.plotting import scatter_matrix
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
import matplotlib.colors as colors
filename = '../facies_vectors.csv'
training_data = pd.read_csv(filename)
training_data
training_data['Well Name'] = ... |
mohanprasath/Course-Work | numpy/numpy_exercises_from_kyubyong/Linear_algebra.ipynb | gpl-3.0 | import numpy as np
np.__version__
"""
Explanation: Linear algebra
End of explanation
"""
x = [1,2]
y = [[4, 1], [2, 2]]
print(np.dot(x, y)) # considrer the lists are taken as rows. So [8, 5]
print(np.dot(y, x)) # [6,6]
print(np.matmul(x, y)) # [8, 5]
print(np.inner(x, y))
print(np.inner(y, x))
"""
Explanation: Mat... |
feststelltaste/software-analytics | prototypes/Checking the modularization of software systems by analyzing co-changing source code files (Conway's law edition).ipynb | gpl-3.0 | from lib.ozapfdis.git_tc import log_numstat
GIT_REPO_DIR = "../../dropover_git/"
git_log = log_numstat(GIT_REPO_DIR)[['sha', 'file', 'author']]
git_log.head()
"""
Explanation: Introduction
In my previous blog post, we've seen how we can identify files that change together in one commit.
In this blog post, we take the... |
Diyago/Machine-Learning-scripts | general studies/learning python/learning pandas/pandas_lec_01.ipynb | apache-2.0 | import pandas as pd
import matplotlib.pyplot as plt
names1880 = pd.read_csv('/Users/kirill/Downloads/names/yob1880.txt',
names= ['name', 'sex', 'births'])
names1880
"""
Explanation: Загрузим файл о именах,поле и числе детей с сайта
https://www.ssa.gov/oact/babynames/limits.html
Соберем все д... |
NYUDataBootcamp/Materials | Code/notebooks/bootcamp_exam_practice.ipynb | mit | # import packages
import pandas as pd # data management
import matplotlib.pyplot as plt # graphics
# Jupyter command, puts plots in notebook
%matplotlib inline
# check Python version
import datetime as dt
import sys
print('Today is', dt.date.today())
print('What version of Python are we r... |
hamzamerzic/ml-playground | notebooks/keras-deep-net.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
# Data generation obtained from http://... |
wasit7/book_pae | pae/nb/.ipynb_checkpoints/parallel forest-checkpoint.ipynb | mit | import numpy as np
from matplotlib import pyplot as plt
import pickle
import os
%pylab inline
"""
Explanation: Parallel Forest Tutorial
This notebooke show the traing process of Parallel Randaom Forest. For cluster training please check https://github.com/wasit7/parallel_forest
import modules
Import all necessary modu... |
samirma/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... |
fmaguire/hansard_mining | Hansard mining.ipynb | gpl-2.0 | %matplotlib inline
import sys
#sys.path.append('/home/fin/Documents/datamining_hansard/dh/lib/python3.4/site-packages/')
import nltk
import nltk.tokenize
import itertools
import glob
import lxml
import lxml.html
import requests
import os
import csv
import wordcloud
import matplotlib.pyplot as plt
from scipy.misc imp... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/building_production_ml_systems/labs/1_training_at_scale.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
import os
from google.cloud import bigquery
"""
Explanation: Training at scale with AI Platform Training Service
Learning Objectives:
1. Learn how to organize your training code into a Python package
1. Train your model using cloud infrastructure... |
GoogleCloudPlatform/tensorflow-without-a-phd | tensorflow-mnist-tutorial/keras_04_mnist_convolutional.ipynb | apache-2.0 | BATCH_SIZE = 128
EPOCHS = 10
training_images_file = 'gs://mnist-public/train-images-idx3-ubyte'
training_labels_file = 'gs://mnist-public/train-labels-idx1-ubyte'
validation_images_file = 'gs://mnist-public/t10k-images-idx3-ubyte'
validation_labels_file = 'gs://mnist-public/t10k-labels-idx1-ubyte'
"""
Explanation... |
woobe/odsc_h2o_machine_learning | py_02_data_manipulation.ipynb | apache-2.0 | # Start and connect to a local H2O cluster
import h2o
h2o.init(nthreads = -1)
"""
Explanation: Machine Learning with H2O - Tutorial 2: Basic Data Manipulation
<hr>
Objective:
This tutorial demonstrates basic data manipulation with H2O.
<hr>
Titanic Dataset:
Source: https://www.kaggle.com/c/titanic/data
<hr>
Ful... |
niazangels/CADL | session-4/session-4.ipynb | apache-2.0 | # First check the Python version
import sys
if sys.version_info < (3,4):
print('You are running an older version of Python!\n\n',
'You should consider updating to Python 3.4.0 or',
'higher as the libraries built for this course',
'have only been tested in Python 3.4 and higher.\n')
... |
christoffkok/auxi.0 | src/examples/tools/materialphysicalproperties/core.Dataset.ipynb | lgpl-3.0 | from auxi.tools.materialphysicalproperties.core import DataSet
"""
Explanation: Working with auxi's Material Physical Property DataSets
Purpose
The purpose of this example is to introduce and demonstrate the DataSet class in auxi's material physical property tools package.
Background
Material physical property models ... |
ewulczyn/readers | src/analysis/Response Distributions.ipynb | mit | %load_ext autoreload
%autoreload 2
%matplotlib inline
import inspect, os
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
os.sys.path.insert(0,parentdir)
from data_generation.join_traces_and_survey import load_survey_dfs
from response_distr... |
slerch/ppnn | nn_postprocessing/notebooks/rnn.ipynb | mit | # Imports
import sys
sys.path.append('../') # This is where all the python files are!
from importlib import reload
import utils; reload(utils)
from utils import *
import keras_models; reload(keras_models)
from keras_models import *
import losses; reload(losses)
from losses import crps_cost_function, crps_cost_functio... |
IBMDecisionOptimization/docplex-examples | examples/cp/jupyter/scheduling_tuto.ipynb | apache-2.0 | import sys
from docplex.cp.model import *
mdl0 = CpoModel()
"""
Explanation: Tutorial: Getting started with Scheduling in CPLEX for Python
This notebook introduces the basic building blocks of a scheduling model that can be solved using Constraint Programming Optimizer (named CP Optimizer in the following) that is in... |
astroumd/GradMap | notebooks/Haiti2016/GradMap-Intro1.ipynb | gpl-3.0 | {1,2,3,"bingo"}
type({1,2,3,"bingo"})
type({})
type(set())
set("spamIam")
"""
Explanation: <CENTER>
<H1>
University of Maryland GRADMAP <BR>
Winter Workshop Python Boot Camp <BR>
</H1>
</CENTER>
More Data Structures, Control Statements, <BR> Functions, and Modules
Sets
End of explanation
"""
a = set("sp");... |
ScienceStacks/jupyter_scisheets_widget | test_notebooks/20170919_notebook_narrative_scisheets_widget.ipynb | bsd-3-clause | import json
import numpy as np
import pandas as pd
from jupyter_scisheets_widget import scisheets_widget
"""
Explanation: Demonstration of Use Case
Users can enter step by step explanations of changes made to a SciSheet in a Jupyter notebook
Load necessary packages
End of explanation
"""
import pandas_datareader... |
stanfordmlgroup/ngboost | examples/user-guide/content/3-interpretation.ipynb | apache-2.0 | import sys
sys.path.append('/Users/c242587/Desktop/projects/git/ngboost')
from ngboost import NGBClassifier, NGBRegressor
from ngboost.distns import k_categorical, Normal
from ngboost.scores import LogScore
from sklearn.datasets import load_breast_cancer, load_boston
from sklearn.model_selection import train_test_spl... |
radhikapc/foundation-homework | homework13/14 - TF-IDF Homework.ipynb | mit | # If you'd like to download it through the command line...
#!curl -O http://www.cs.cornell.edu/home/llee/data/convote/convote_v1.1.tar.gz
# And then extract it through the command line...
#!tar -zxf convote_v1.1.tar.gz
"""
Explanation: Homework 14 (or so): TF-IDF text analysis and clustering
Hooray, we kind of figure... |
Caranarq/01_Dmine | Datasets/EI2015/.ipynb_checkpoints/EI2015-checkpoint.ipynb | gpl-3.0 | # Librerias utilizadas
import pandas as pd
import sys
import urllib
import os
import numpy as np
# Configuracion del sistema
print('Python {} on {}'.format(sys.version, sys.platform))
print('Pandas version: {}'.format(pd.__version__))
import platform; print('Running on {} {}'.format(platform.system(), platform.release... |
GoogleCloudPlatform/training-data-analyst | blogs/babyweight_tft/babyweight_tft_keras_02.ipynb | apache-2.0 | pip install --ignore-installed tensorflow-transform==1.6.0
"""
Explanation: Babyweight Estimation with Transformed Data
1. Preparation
Install required packages
End of explanation
"""
!pip list | grep -E '(tensorflow|beam)'
"""
Explanation: You can ingnore the dependency resolver errors. Confirm the final message s... |
remenska/iSDM | notebooks/Salmo_trutta.ipynb | apache-2.0 | import logging
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
root = logging.getLogger()
root.addHandler(logging.StreamHandler())
%matplotlib inline
"""
Explanation: 0. Standard setup for logging and plotting inside a notebook
End of explanation
"""
# download from Google Drive: https://drive... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/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', 'mohc', 'sandbox-3', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: MOHC
Source ID: SANDBOX-3
Topic: Atmoschem
Sub-Topics: Transport, Emissions ... |
jinntrance/MOOC | coursera/ml-classification/assignments/module-9-precision-recall-assignment-blank.ipynb | cc0-1.0 | import graphlab
from __future__ import division
import numpy as np
graphlab.canvas.set_target('ipynb')
"""
Explanation: Exploring precision and recall
The goal of this second notebook is to understand precision-recall in the context of classifiers.
Use Amazon review data in its entirety.
Train a logistic regression m... |
InsightLab/data-science-cookbook | 2020/02-python-bibliotecas-manipulacao-dados/Pandas.ipynb | mit | import numpy as np
import pandas as pd
"""
Explanation: Pandas
Pandas é um pacote bastante poderoso para a análise e processamento de dados tabulares, trazendo consigo estruturas de dados e operações muito eficientes
End of explanation
"""
a = pd.Series([20, 50, 190, 11, 76])
a
"""
Explanation: Series
Séries são es... |
stephank16/enes_graph_use_case | prov_templates/old/PROV-Templates-python.ipynb | gpl-3.0 | # Define the variable parts in the template as dictionary keys
# dictionary values are the prov template variable bindings in one case
# and correspond to the variable instance settings in the other case
import prov.model as prov
template_dict = {
'var_author':'var:author',
'var_value':'var:value',
'var_nam... |
molgor/spystats | notebooks/Sandboxes/TensorFlow/BiospytialGaussianEnvironment.ipynb | bsd-2-clause | run ../../../../traversals/tests.py
"""
Explanation: In this notebook I´ll create functions for easing the development of geostatistical models using the GPFlow (James H, et.al )the library for modelling gaussian processes in Tensor Flow (Google) (Great Library, btw).
Requirements
Inputs
Design Matrix X composed of c... |
eggie5/UCSD-MAS-DSE230 | hmwk4/HW4-k-means-plus-plus-s.ipynb | mit | ### Definition of some global parameters.
K = 5 # Number of centroids
RUNS = 25 # Number of K-means runs that are executed in parallel. Equivalently, number of sets of initial points
RANDOM_SEED = 60295531
converge_dist = 0.1 # The K-means algorithm is terminated when the change in the location
#... |
wdbm/abstraction | ttHbb_variables_preparation.ipynb | gpl-3.0 | import datetime
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
plt.rcParams["figure.figsize"] = (13, 6)
import pandas as pd
import seaborn as sns
sns.set(context = "paper", font = "monospace")
from sklearn.preprocessing import MinMaxScaler
import sqlite3
import warnings
warnings.filterwarnings("i... |
dewitt-li/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... |
goodwordalchemy/thinkstats_notes_and_exercises | code/chap05ex.ipynb | gpl-3.0 | from __future__ import division
import thinkstats2
import thinkplot
import numpy as np
%matplotlib inline
"""
Explanation: Exercise from Think Stats, 2nd Edition (thinkstats2.com)<br>
Allen Downey
End of explanation
"""
import scipy.stats
"""
Explanation: Exercise 5.1
In the BRFSS (see Section 5.4), the distribut... |
gale320/flexx | examples/notebooks/twente_temperature.ipynb | bsd-2-clause | from flexx import app, ui, react
app.init_notebook()
# A bit of boilerplate to import an example app
import sys
#sys.path.insert(0, r'C:\Users\almar\dev\flexx\examples\ui')
sys.path.insert(0, '/home/almar/dev/pylib/flexx/examples/ui')
from twente_temperature import Twente
"""
Explanation: This example demonstrated th... |
albermax/xcsvm | examples/examples.ipynb | mit | TRAIN_DATA = "../xcsvm/xcsvm/tests/data/lshtc1_dryrun_task1_tfidf_l2_norm_applied.train.libsvm"
TEST_DATA = "../xcsvm/xcsvm/tests/data/lshtc1_dryrun_task1_tfidf_l2_norm_applied.test.libsvm"
# The following python interpreter should have xcsvm installed.
# If not used the run.py script will try to run the source code d... |
aborgher/Main-useful-functions-for-ML | NLP/NLTK_in_a_Notebook.ipynb | gpl-3.0 | import nltk
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tnrange, tqdm_notebook
from math import *
import csv
%matplotlib inline
from nltk.book import *
text = "Machine learning is the science of getting computers to act without being explicitly programmed. In the past decad... |
epicf/ef | examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
from sympy import *
init_printing()
Bx, By, Bz, B = symbols("B_x, B_y, B_z, B")
x, y, z = symbols("x, y, z" )
x_0, y_0, z_0 = symbols("x_0, y_0, z_0")
vx, vy, vz, v = symbols("v_x, v_y, v_z, v")
vx_0, vy_0, vz_0 = symbols("v_x0, v_y0, v_z0")
t = symbols("t")
q, m = s... |
bonadio/bike-share-rnn | Bike-sharing-ported-to-RNN.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Porting Bike-Sharing project-1 to RNN
End of explanation
"""
data_path = 'Bike-Sharing-Dataset/hour.csv'
rides = pd.read_csv(data_path)
rides.head()
... |
bokeh-cookbook/bokeh-cookbook | content/articles/2016/06/Column layouts.ipynb | agpl-3.0 | from bokeh.plotting import figure
def make_plot(responsive=False):
p = figure(responsive=responsive, width=400, height=100)
p.scatter(x=[1, 2], y=[3, 4], size=20)
return p
"""
Explanation: When using the new layout Row & Column it's important that all responsive modes in a given layout are the same.
First ... |
guyk1971/deep-learning | first-neural-network/DLND Your first neural network.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
rsterbentz/phys202-2015-work | days/day12/Integration.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
"""
Explanation: Numerical Integration
Learning Objectives: Learn how to numerically integrate 1d and 2d functions that are represented as Python functions or numerical arrays of data using scipy.integrate.
This lesson was orgi... |
openconnectome/ndprojects | kasthuri2015_ramon_v1/Mitochondrion Count.ipynb | apache-2.0 | import ndio.remote.OCP as OCP
oo = OCP()
token = "kasthuri2015_ramon_v1"
"""
Explanation: A count of the total number of mitochondria within the bounds (694×1794, 1750×2460, 1004×1379).
End of explanation
"""
mito_cutout = oo.get_cutout(token, 'mitochondria', 694, 1794, 1750, 2460, 1004, 1379, resolution=3)
"""
Ex... |
ernestyalumni/CompPhys | crack/searchsort.ipynb | apache-2.0 | def binarySearch(arr,l,r,x):
"""
@details denote L = len(arr)
@param indices l,r=0,1...L-1
@note l <= r expected
base case is if l>r, then stop, nothing was found
"""
if (r<l):
return -1 # x was not found
else:
mid = l + (r-l)/2
if arr[... |
hparik11/Deep-Learning-Nanodegree-Foundation-Repository | 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[:2000]
"""
Explanation: Sentiment Analysis with an RNN
In this notebook, you'll implement a recurrent neural... |
danecollins/awrjs | notebooks/Analyze_User_Log.ipynb | mit | print("""
The log files analyzed contain data from {start} to {end}.
There are a total of {sub_cnt:,} jobs submitted of which {comp_cnt:,} completed.
There are {users} separate users that have run jobs for a total of {tot_hrs:,} hours of
of simulation on {machines} machines.
The largest job required {big} Gb of m... |
sandiegodata/age-friendly-communities | users/eric/Metatab Package Example.ipynb | mit | import pandas as pd
df = pd.read_csv('http://s3.amazonaws.com/library.metatab.org/sandiegocounty.gov-adod-2012-sra-3/data/adod-prevalence.csv')
df.head()
"""
Explanation: Using Metatab Resources In Pandas
There are two ways to use Metatab data package resources in Pandas. One is to use the CSV files directly, which... |
therealAJ/python-sandbox | data-science/learning/ud1/DataScience/KNN.ipynb | gpl-3.0 | import pandas as pd
r_cols = ['user_id', 'movie_id', 'rating']
ratings = pd.read_csv('e:/sundog-consult/udemy/datascience/ml-100k/u.data', sep='\t', names=r_cols, usecols=range(3))
ratings.head()
"""
Explanation: KNN (K-Nearest-Neighbors)
KNN is a simple concept: define some distance metric between the items in your... |
ChinmaiRaman/phys227-final | Final.ipynb | mit | ros = p1.Rossler(2)
ros.run()
ros.plotx()
ros.ploty()
ros.plotz()
ros.plotxy()
ros.plotyz()
ros.plotxz()
ros.plotxyz()
"""
Explanation: Final
Chinmai Raman
5/21/2016
Given three real-valued functions of time x(t), y(t), z(t), consider the following coupled first-order ODEs:
$x˙ = −y − z, y˙ = x + ay, z˙ = b + z... |
mbakker7/ttim | notebooks/pumpingtest_hypothetical.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from ttim import *
"""
Explanation: Calibrating TTim model to hypothetical pumping test
End of explanation
"""
drawdown = np.loadtxt('data/oudekorendijk_h30.dat')
tobs = drawdown[:,0] / 60 / 24
robs = 30
Q = 788
"""
Explanation: Use observation t... |
yevheniyc/Projects | 1j_NLP_Python/ex01.ipynb | mit | %sx ls html/
"""
Explanation: Exercise 01: extract text from HTML
The course repo has a subdirectory called html which includes some example HTML files.
End of explanation
"""
file = "html/article1.html"
print(open(file, "r").readlines())
"""
Explanation: Select one of those files to use as an example, and take a l... |
kkai/perception-aware | 3.analysis/.ipynb_checkpoints/MacAndPC-checkpoint.ipynb | mit | %pylab inline
import matplotlib.pyplot as plt
#use a nicer plotting style
plt.style.use(u'fivethirtyeight')
print(plt.style.available)
#change figure size
pylab.rcParams['figure.figsize'] = (10, 6)
"""
Explanation: Let's take a closer look again on our PC versus Mac menu bar example. Here are the measurements for th... |
scotthuang1989/Python-3-Module-of-the-Week | data_persistence_exchange/csv.ipynb | apache-2.0 | csv.list_dialects()
"""
Explanation: reader
csv.reader(
csvfile, dialect='excel', **fmtparams
)
return a reader object which will iterate over lines in the give csvfile
if csvfile is a file object, it should be opened with newline=''
writer
csv.writer(
csvfile, dialect='excel', **fmtparams
)
return a writer object r... |
JaeGyu/PythonEx_1 | 넘파이 연습.ipynb | mit | myarray = np.array([1,2,3])
print(myarray)
print(myarray.shape)
print(type(myarray))
l = [1,2,3]
print(type(l))
mybigarray = np.array([[3,2,4],[3,3,2],[4,5,2],[4,2,8,5]])
print(mybigarray.shape)
print(mybigarray)
"""
Explanation: <hr/>
넘파이에서 의 array
파이썬의 리스트와는 다르게 배열의 모든 값은 같은 타입(예를들어, Boolean, integer, real, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.