repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
datastax-demos/Muvr-Analytics | ipython-analysis/exercise-mlp.ipynb | bsd-3-clause | %matplotlib inline
import shutil
import numpy as np
from os import remove
import cPickle as pkl
from os.path import expanduser, exists
import os
import sys
import logging
logging.basicConfig(level=10)
logger = logging.getLogger()
# Add the mlp python src director to the import search path
mlp_folder = "../mlp"
sys.p... |
karlstroetmann/Formal-Languages | Python/Test-DFA-2-RegExp.ipynb | gpl-2.0 | %run DFA-2-RegExp.ipynb
%run FSM-2-Dot.ipynb
delta = { (0, 'a'): 0,
(0, 'b'): 1,
(1, 'a'): 1
}
A = {0, 1}, {'a', 'b'}, delta, 0, {1}
g, _ = dfa2dot(A)
g
r = dfa_2_regexp(A)
r
"""
Explanation: Test DFA-2-RegExp
End of explanation
"""
%run Rewrite.ipynb
s = simplify(r, Rules)
s
"""
E... |
RomanSC/python-problems | notebooks/.ipynb_checkpoints/Coin Problem Take Two-checkpoint.ipynb | gpl-3.0 | import sys
sys.path.append('../')
from coins import *
"""
Explanation: <h1>Coin Problem:</h1>
<strong>The puzzle:</strong>
<i>You place 100 coins heads up in a row and number them by position, with the coin all the way on the left No. 1 and the one on the rightmost edge No. 100. Next, for every number N, from 1 to 10... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/02_tensorflow/b_tfstart_graph.ipynb | apache-2.0 | import tensorflow as tf
print(tf.__version__)
"""
Explanation: Getting started with TensorFlow (Graph Mode)
Learning Objectives
- Understand the difference between Tensorflow's two modes: Eager Execution and Graph Execution
- Get used to deferred execution paradigm: first define a graph then run it in a tf.Session... |
metpy/MetPy | v0.12/_downloads/6535033cff935ab2c434cdad6eb5b4f7/Wind_SLP_Interpolation.ipynb | bsd-3-clause | import cartopy.crs as ccrs
import cartopy.feature as cfeature
from matplotlib.colors import BoundaryNorm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from metpy.calc import wind_components
from metpy.cbook import get_test_data
from metpy.interpolate import interpolate_to_grid, remove_nan_obse... |
eds-uga/csci1360-fa16 | assignments/A6/A6_Q1.ipynb | mit | truth = "This is some text.\nMore text, but on a different line!\nInsert your favorite meme here.\n"
pred = read_file_contents("q1data/file1.txt")
assert truth == pred
retval = -1
try:
retval = read_file_contents("nonexistent/path.txt")
except:
assert False
else:
assert retval is None
"""
Explanation: Q1
... |
chunweixu/Deep-Learning | tv-script-generation/.ipynb_checkpoints/dlnd_tv_script_generation-checkpoint.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
data_dir = './data/simpsons/moes_tavern_lines.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
text = text[81:]
"""
Explanation: TV Script Generation
In this project, you'll generate your own Simpsons TV scrip... |
HsKA-ThermalFluiddynamics/NSS-1 | 3_1-Numerik_Iterative_Verfahren.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import math
%config InlineBackend.figure_format = 'svg'
%matplotlib inline
# linke Seite der Gleichung (left hand side)
def LHS(lamb):
return 1/np.sqrt(lamb)
# rechte Seite der Gleichung (right hand side)
def RHS(lamb, Re):
return 2.0 * np.log10(Re * np.sqrt(... |
dsacademybr/PythonFundamentos | Cap02/Notebooks/DSA-Python-Cap02-01-Numeros.ipynb | gpl-3.0 | # Versão da Linguagem Python
from platform import python_version
print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version())
"""
Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 2</font>
Download: http://github.com/dsacademybr
End of explanation
"""
# Soma
... |
scholer/cy-rest-python | basic/CytoscapeREST_Basic3.ipynb | mit | import requests
import json
import networkx as nx
from IPython.display import Image
from py2cytoscape import util as cy
import numpy as np
# Basic Setup
PORT_NUMBER = 1234
#IP = '192.168.1.1'
IP = 'localhost'
BASE = 'http://' + IP + ':' + str(PORT_NUMBER) + '/v1/'
# Header for posting data to the server as JSON
H... |
5agado/data-science-learning | deep learning/StyleGAN/StyleGAN - Latents Exploration.ipynb | apache-2.0 | from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import sys
import os
from datetime import datetime
from tqdm import tqdm
import imageio
from ipywidgets import interact, interact_manual
from IPython.display import display
import warnings
warnings.filterwarnings('ignore', category=FutureWarni... |
chongyangma/python-machine-learning-book | code/ch05/ch05.ipynb | mit | %load_ext watermark
%watermark -a 'Sebastian Raschka' -u -d -p numpy,scipy,matplotlib,sklearn
"""
Explanation: Copyright (c) 2015-2017 Sebastian Raschka
https://github.com/rasbt/python-machine-learning-book
MIT License
Python Machine Learning - Code Examples
Chapter 5 - Compressing Data via Dimensionality Reduction
No... |
google/starthinker | colabs/dataset.ipynb | apache-2.0 | !pip install git+https://github.com/google/starthinker
"""
Explanation: BigQuery Dataset
Create and permission a dataset in BigQuery.
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 obtain a cop... |
dotsdl/msmbuilder | examples/bayesian-msm.ipynb | lgpl-2.1 | %matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
from mdtraj.utils import timing
from msmbuilder.example_datasets import load_doublewell
from msmbuilder.cluster import NDGrid
from msmbuilder.msm import BayesianMarkovStateModel, MarkovStateModel
"""
Explanation: BayesianMarkovStateModel
This e... |
pycrystem/pycrystem | doc/demos/05 Simulate Data - Strain Mapping.ipynb | gpl-3.0 | %matplotlib inline
import pyxem as pxm
import numpy as np
import hyperspy.api as hs
import diffpy.structure
from matplotlib import pyplot as plt
from pyxem.generators.indexation_generator import IndexationGenerator
from diffsims.generators.diffraction_generator import DiffractionGenerator
"""
Explanation: Strain Mappi... |
psychemedia/parlihacks | notebooks/Text Scraping - Notes.ipynb | mit | from parse import parse
bigtext = '''\
From February 2016, as an author, payments from Head of Zeus Publishing; \
a client of Averbrook Ltd. Address: 45-47 Clerkenwell Green London EC1R 0HT, via Sheil Land, 52 Doughty Street. \
London WC1N 2LS. From October 2016 until July 2018, I will receive a regular payment \
of £... |
dolittle007/dolittle007.github.io | notebooks/GLM-robust.ipynb | gpl-3.0 | %matplotlib inline
import pymc3 as pm
import matplotlib.pyplot as plt
import numpy as np
import theano
"""
Explanation: GLM: Robust Linear Regression
Author: Thomas Wiecki
This tutorial first appeard as a post in small series on Bayesian GLMs on my blog:
The Inference Button: Bayesian GLMs made easy with PyMC3
Thi... |
guruucsd/EigenfaceDemo | python/Gini coefficient.ipynb | mit | target=array([1,4,8,5])
output=array([1,8,4,5])
"""
Explanation: Gini coefficient
Gini coefficient is a measure of statistical dispersion. For the Kaggle competition, the normalized Gini coefficient is used as a measure of comparing how much the ordering of the model prediction matches the actual output. The magnitu... |
evanmiltenburg/python-for-text-analysis | Assignments-colab/ASSIGNMENT_2.ipynb | apache-2.0 | %%capture
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Data.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/images.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Extra_Material.zip
!unzip Data.zip -d ../
!unzip images.zip -d ./
!unzip Ext... |
theoplatt/jupyter | multipletargets.ipynb | mit | targets = ['ENSG00000069696', 'ENSG00000144285']
targets_string = ', '.join('"{0}"'.format(t) for t in targets)
"""
Explanation: Our list of targets
End of explanation
"""
url = 'https://www.targetvalidation.org/api/latest/public/association/filter'
headers = {"Accept": "application/json"}
# There may be an easier w... |
tensorflow/docs-l10n | site/en-snapshot/tutorials/distribute/parameter_server_training.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... |
tombstone/models | official/colab/nlp/customize_encoder.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... |
SSQ/Coursera-UW-Machine-Learning-Classification | Programming Assignment 5/Implementing binary decision trees.ipynb | mit | loans = pd.read_csv('lending-club-data.csv')
loans.head(2)
# safe_loans = 1 => safe
# safe_loans = -1 => risky
loans['safe_loans'] = loans['bad_loans'].apply(lambda x : +1 if x==0 else -1)
#loans = loans.remove_column('bad_loans')
loans = loans.drop('bad_loans', axis=1)
features = ['grade', # grade of ... |
Kaggle/learntools | notebooks/bqml/raw/ex1.ipynb | apache-2.0 | # Set up code checking
from learntools.core import binder
binder.bind(globals())
from learntools.bqml.ex1 import *
# Set your own project id here
PROJECT_ID = ____ # a string, like 'kaggle-bigquery-240818'
from google.cloud import bigquery
client = bigquery.Client(project=PROJECT_ID, location="US")
dataset = client.c... |
vikashvverma/machine-learning | mladvanced/Project/Capstone/kernel.ipynb | mit | # This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
from glob import glob
import numpy as np # linear algebra
import pandas as pd # data p... |
lewisamarshall/ionize | new_tutorial.ipynb | gpl-2.0 | # Setup
from __future__ import print_function, absolute_import, division
import ionize
import pprint
from matplotlib import pyplot as plot
%matplotlib inline
import numpy as np
np.set_printoptions(precision=3)
"""
Explanation: ionize Tutorial
ionize is a Python module for calculating the properties of ions and elect... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/mixed_lm_example.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
from statsmodels.tools.sm_exceptions import ConvergenceWarning
"""
Explanation: Linear Mixed Effects Models
End of explanation
"""
data = sm.datasets.get_rdataset('dietox', 'geepack').data
md... |
Naereen/notebooks | Generer_des_fausses_citations_latines_du_Roi_Loth.ipynb | mit | citation = citation_aleatoire(italic=True)
display(Markdown("> {}".format(citation)))
"""
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#Générer-des-fausses-citations-latines-du-Roi-Loth,-avec-Python,-Wikiquote-et-des-chaînes-de-Markov" data-toc-modified-id="Générer-des-fausses-citations-latine... |
lesley2958/lesley2958.github.io | blog/2018/denoising.ipynb | mit | import numpy as np
import math, random
import matplotlib.pyplot as plt
%matplotlib inline
np.random.seed(0)
"""
Explanation: Signal denoising using RNNs in PyTorch
In this post, I'll use PyTorch to create a simple Recurrent Neural Network (RNN) for denoising a signal. I started learning RNNs using PyTorch. However, I... |
ajhenrikson/phys202-2015-work | assignments/assignment05/InteractEx03.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 3
Imports
End of explanation
"""
def soliton(x, t, c, a):
"""Return phi(x, t) for a soliton wave with co... |
statsmodels/statsmodels.github.io | v0.13.0/examples/notebooks/generated/regression_diagnostics.ipynb | bsd-3-clause | %matplotlib inline
from statsmodels.compat import lzip
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
import statsmodels.stats.api as sms
import matplotlib.pyplot as plt
# Load data
url = "https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/HistData/Guerry.csv"
dat... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/preprocessing_layers.ipynb | apache-2.0 | !pip install -q sklearn
"""
Explanation: Classifying Structured Data using Keras Preprocessing Layers
Learning Objectives
Load a CSV file using Pandas.
Build an input pipeline to batch and shuffle the rows using tf.data.
Map from columns in the CSV to features used to train the model using Keras Preprocessing layers.... |
lcharleux/argiope | doc/notebooks/mesh/mesh_tutorial.ipynb | gpl-3.0 | %load_ext autoreload
%autoreload 2
import argiope as ag
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
from string import Template
%matplotlib nbagg
"""
Explanation: Mesh tutorial
End of explanation
"""
geom_template = """
lc = $lc;
Point(1) = {0,0,0,lc};
Point(2) = ... |
pyro-ppl/numpyro | notebooks/source/bayesian_hierarchical_stacking.ipynb | apache-2.0 | !pip install -q numpyro@git+https://github.com/pyro-ppl/numpyro
import os
from IPython.display import set_matplotlib_formats
import arviz as az
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.interpolate import BSpline
import seaborn as sns
import jax
import jax.numpy as jnp
import... |
sorig/shogun | doc/ipython-notebooks/classification/MKL.ipynb | bsd-3-clause | %pylab inline
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
# import all shogun classes
from shogun import *
"""
Explanation: Multiple Kernel Learning
By Saurabh Mahindre - <a href="https://github.com/Saurabh7">github.com/Saurabh7</a>
This notebook is about multiple kernel ... |
hamzamerzic/ml-playground | notebooks/two-layer-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://... |
AllenDowney/ThinkStats2 | examples/groupby_example.ipynb | gpl-3.0 | %matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style='white')
from thinkstats2 import Pmf, Cdf
import thinkstats2
import thinkplot
decorate = thinkplot.config
"""
Explanation: GroupBy examples
Allen Downey
MIT License
End of explanation
"""
... |
wuafeing/Python3-Tutorial | 01 data structures and algorithms/01.06 map keys to multiple values in dict.ipynb | gpl-3.0 | d = {
"a" : [1, 2, 3],
"b" : [4, 5]
}
e = {
"a" : {1, 2, 3},
"b" : {4, 5}
}
"""
Explanation: Previous
1.6 字典中的键映射多个值
问题
怎样实现一个键对应多个值的字典(也叫 multidict )?
解决方案
一个字典就是一个键对应一个单值的映射。如果你想要一个键映射多个值,那么你就需要将这多个值放到另外的容器中, 比如列表或者集合里面。比如,你可以像下面这样构造这样的字典:
End of explanation
"""
from collections import defaultdict... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session04/Day2/GPLecture1.ipynb | mit | def gauss1d(x,mu,sig):
return np.exp(-(x-mu)**2/sig*2/2.)/np.sqrt(2*np.pi)/sig
def pltgauss1d(sig=1):
mu=0
x = np.r_[-4:4:101j]
pl.figure(figsize=(10,7))
pl.plot(x, gauss1d(x,mu,sig),'k-');
pl.axvline(mu,c='k',ls='-');
pl.axvline(mu+sig,c='k',ls='--');
pl.axvline(mu-sig,c='k',ls='--');
... |
Weenkus/Machine-Learning-University-of-Washington | Regression/assignments/Ridge Regression Programming Assignment 1.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_model
import numpy as np
from math import ceil
"""
Explanation: Initialise the libs
End of explanation
"""
dtype_dict = {'bathrooms':float, 'waterfront':int, 'sqft_above':int, 'sqft_living15':float, 'grade':int, 'yr_renovated':int, 'pric... |
mne-tools/mne-tools.github.io | dev/_downloads/cfbef36033f8d33f28c4fe2cfa35314a/30_cluster_ftest_spatiotemporal.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
# License: BSD-3-Clause
import numpy as np
from scipy import stats as stats
import mne
from mne import spatial_src_adjacency
from mne.stats import spatio_temporal_cluster_test, summarize_clusters_stc
from mne.... |
nicoguaro/notebooks_examples | Perturbation methods.ipynb | mit | eq = (1 + eps*u(t)**2)*diff(u(t), t, 2) + omega**2*u(t)
eq
ode_order(eq, u)
"""
Explanation: <div class="alert alert-warning">
**Note:** This notebook requires SymPy 1.5 to work.
</div>
Consider the following system
$$\ddot{u} + 4 u + \varepsilon u^2 \ddot{u} = 0 \enspace .$$
This system can be rewritten as
$$(1 + ... |
StingraySoftware/notebooks | CrossCorrelation/cross_correlation_notebook.ipynb | mit | import numpy as np
from stingray import Lightcurve
from stingray.crosscorrelation import CrossCorrelation
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
%matplotlib inline
font_prop = font_manager.FontProperties(size=16)
"""
Explanation: CrossCorrelation
This Tutorial is intended to gi... |
mitliagkas/dshs | 21. Zipcode Visualization.ipynb | mit | import os.path
if not os.path.exists('zipdata/zt06_d00_ascii.zip'):
!wget -P zipdata ftp://ftp.cs.brown.edu/u/spr/zipdata/zt06_d00_ascii.zip
!unzip -d zipdata zipdata/zt06_d00_ascii.zip
if not os.path.exists('zipdata/zt48_d00_ascii.zip'):
!wget -P zipdata ftp://ftp.cs.brown.edu/u/spr/zipdata/zt48_d00_ascii... |
5agado/data-science-learning | graphics/heartbeat/Heartbeat.ipynb | apache-2.0 | # Basic libraries import
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib notebook
import os
import sys
import itertools
import collections
# project specific libraries
import scipy.signal as signal
%load_ext autoreload
%autoreload 2
import heartbeat_utils
... |
sk-rai/Network-Analysis_made-Simple | 2. Network(X) Basics (Instructor).ipynb | mit | G = nx.read_gpickle('Synthetic Social Network.pkl') #If you are Python 2.7, read in Synthetic Social Network 27.pkl
nx.draw(G)
"""
Explanation: Nodes and Edges: How do we represent relationships between individuals using NetworkX?
As mentioned earlier, networks, also known as graphs, are comprised of individual entiti... |
Neuroglycerin/neukrill-net-work | notebooks/model_run_and_result_analyses/Analyse models-Copy1.ipynb | mit | m.layer_names
channel = m.monitor.channels["valid_y_nll"]
hl.Curve(zip(channel.epoch_record, channel.val_record),label="valid_y_nll")
channel = m.monitor.channels["valid_y_nll"]
plt.plot(channel.epoch_record, channel.val_record)
"""
Explanation: The train_y_nll, valid_y_nll and valid_objective show massive overfitti... |
digital-humanities-data-curation/hilt2015 | 3-csvkit-intro.ipynb | mit | import tarfile
import re
import os
from itertools import count
# You have a copy of this file in your `data` directory. Tate provides the data in a single TAR (tape archive) file
DATA_PATH = '../data/tate-collection-1.2.tar.gz'
DATA_FOBJ = tarfile.open(DATA_PATH)
# We can use Python's tools for working with tar file... |
johnnyliu27/openmc | examples/jupyter/mg-mode-part-i.ipynb | mit | import os
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import numpy as np
import openmc
%matplotlib inline
"""
Explanation: This Notebook illustrates the usage of OpenMC's multi-group calculational mode with the Python API. This example notebook creates and executes the 2-D C5G7 benchmark mode... |
metpy/MetPy | v0.4/_downloads/Natural_Neighbor_Verification.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import ConvexHull, Delaunay, delaunay_plot_2d, Voronoi, voronoi_plot_2d
from scipy.spatial.distance import euclidean
from metpy.gridding import polygons, triangles
from metpy.gridding.interpolation import nn_point
plt.rcParams['figure.figsize'] = (... |
riddhishb/ipython-notebooks | Adaboost/Adaboost_Final note.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import time
start_time = time.time()
"""
Explanation: This is an jupyter notebook.
Lectures about Python, useful both for beginners and experts, can be found at http://scipy-lectures.github.io.
Open the notebook by (1) copying this file into a di... |
encima/Comp_Thinking_In_Python | Session_2/2_Coding.ipynb | mit | # Does this make sense without comments?
with open('myfile.csv', 'rb') as opened_csv:
spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
for row in spamreader:
print (', '.join(row))
# How about this?
#open csv file in readable format
with open('myfile.csv', 'rbU') as opened_csv:
# rea... |
ctk3b/imolecule | examples/ipython.ipynb | mit | import imolecule
imolecule.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C")
"""
Explanation: imolecule in the IPython notebook
I created imolecule to fix a deficiency in my workflow. While my chemical simulations were entirely in notebooks, I had to use external programs like mercury to visually debug chemical ... |
csaladenes/csaladenes.github.io | present/gtk/test.ipynb | mit | import pandas as pd
import html5lib
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: GTK adatvizualizációs kurzus
Bővítőcsomagok importálása:
End of explanation
"""
csv_path='http://www.csaladen.es/present/sapientia1/exportPivot_POP105A.csv' #SAJAT HELY CSV FILE
df=pd.read_csv(csv_path)
df.hea... |
4dsolutions/Python5 | Dates3.ipynb | mit | import pandas as pd
from pandas import DataFrame, Series
import numpy as np
rng = pd.date_range('3/9/2012 9:30', periods=6, freq='D')
rng
type(rng)
rng2 = pd.date_range('3/9/2012 9:30', periods=6, freq='M')
rng2
ts = Series(np.random.randn(len(rng)), index=rng)
type(ts)
ts
ts.index.tz
rng.tz
ts_utc = ts.tz_lo... |
CalPolyPat/phys202-2015-work | assignments/assignment05/InteractEx03.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 3
Imports
End of explanation
"""
def soliton(x, t, c, a):
return .5*c*(1/np.cos(c**.5*.5*(x-c*t-a)))**2
... |
GoogleCloudPlatform/vertex-pipelines-end-to-end-samples | pipelines/schema_creation.ipynb | apache-2.0 | !pip install tensorflow-data-validation==1.3.0
import tensorflow_data_validation as tfdv
from google.cloud import bigquery
"""
Explanation: Requirements
End of explanation
"""
# GCP project id
PROJECT_ID = '<project_id>'
# BQ dataset id
DATASET_ID = '<dataset_id>'
# dataset location
DATA_LOCATION = '<location>' # ... |
atulsingh0/MachineLearning | scikit-learn/Matplotlib_Tutorial_01.ipynb | gpl-3.0 | # import
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
"""
Explanation: Matplotlib tutorial 01
End of explanation
"""
X = [1, 2.4, 5, 7, 3.2]
plt.plot(X)
plt.show()
"""
Explanation: Simple Plot
By default, matplotlib is plotting line which joins all the points
End of explanation
"""... |
chi-hung/notebooks | Docker_Basics.ipynb | mit | instead running an interactive shell, one can initiaa
"""
Explanation: I use this notebook to learn the basic usage of Docker & Vagrant.
28.11.2016
Let's first take a look of the usage of some commands:
docker run
bash
!docker run -it ubuntu /bin/bash
remark: -i:interactive;
-t:tty(teletypewriter, i.e. text-only con... |
calroc/joypy | docs/Advent of Code 2017 December 3rd.ipynb | gpl-3.0 | k = 4
"""
Explanation: Advent of Code 2017
December 3rd
You come across an experimental new kind of memory stored on an infinite two-dimensional grid.
Each square on the grid is allocated in a spiral pattern starting at a location marked 1 and then counting up while spiraling outward. For example, the first few square... |
dnc1994/MachineLearning-UW | ml-classification/module-4-linear-classifier-regularization-solution.ipynb | mit | from __future__ import division
import graphlab
"""
Explanation: Logistic Regression with L2 regularization
The goal of this second notebook is to implement your own logistic regression classifier with L2 regularization. You will do the following:
Extract features from Amazon product reviews.
Convert an SFrame into a... |
psychemedia/parlihacks | notebooks/RegisterOfInterests.ipynb | mit | url='http://downloads.membersinterests.org.uk/register/170707.zip'
!mkdir -p tmp/
!mkdir -p data/
!wget {url} -O tmp/temp.zip; unzip tmp/temp.zip -d data/ ; rm tmp/temp.zip
#Preview the data
!head -n 3 data/170707.csv
#View data in datatable
import pandas as pd
df=pd.read_csv('data/170707.csv',header=None)
df.colu... |
psyllost/02819 | Question_Answering_System_using_BERT_+_SQuAD_2_0_on_Colab_TPU.ipynb | apache-2.0 | !git clone https://github.com/google-research/bert.git
"""
Explanation: <a href="https://colab.research.google.com/github/psyllost/02819/blob/master/Question_Answering_System_using_BERT_%2B_SQuAD_2_0_on_Colab_TPU.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In C... |
volodymyrss/3ML | docs/notebooks/Minimization_tutorial.ipynb | bsd-3-clause | from threeML import *
import matplotlib.pyplot as plt
%matplotlib inline
from threeML.minimizer.tutorial_material import *
"""
Explanation: Minimization
When using a Maximum Likelihood analysis we want to find the maximum of the likelihood $L(\vec{\theta})$ given one or more datasets (i.e., plugin instances) and o... |
HazyResearch/metal | tutorials/Visualization.ipynb | apache-2.0 | import sys
sys.path.append('../../metal')
import metal
%load_ext autoreload
%autoreload 2
%matplotlib inline
"""
Explanation: Visualization Tutorial
Inside metal/contrib/visualization are a number of simple helper methods for visualizing label matrices.
For example, you can generate heat maps of the label matrix or o... |
NKhan121/Portfolio | Model Evaluation/Model Evaluation .ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
%matplotlib inline
df = pd.read_csv("car.csv")
df.head()
"""
Explanation: This Notebook will go through multiple models (KNN, Logistic Regression, Decision Trees, Support Vector Machines and Random Forest) to asses... |
nproctor/phys202-2015-work | assignments/assignment10/ODEsEx03.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
"""
Explanation: Ordinary Differential Equations Exercise 3
Imports
End of explanation
"""
g = 9.81 # m/s^2
l = 0.5 # length of pendulum... |
SRI-CSL/libpoly | examples/cad/SMT 2017 (Intro).ipynb | lgpl-3.0 | import polypy
"""
Explanation: Import the library.
End of explanation
"""
x = polypy.Variable('x')
[y, z] = [polypy.Variable(s) for s in ['y', 'z']]
"""
Explanation: Create variables $x$, $y$, $z$.
End of explanation
"""
order = polypy.variable_order
order.push(z)
order.push(y)
order
order.pop()
order.push(... |
eugeniopacceli/ComputerVision | quiz3/Quiz3 - Harris and SIFT.ipynb | mit | %matplotlib inline
import numpy as np
import cv2
import matplotlib.pyplot as plt
import os
import glob
import random as rnd
from scipy.ndimage import filters
from PIL import Image
from numpy import *
from pylab import *
from pandas import *
np.seterr(divide='ignore', invalid='ignore')
"""
Explanation: Quiz 3a - Imple... |
hbutler/InverseCCP | 5 - Generate coupon probabilities - part 3.ipynb | mit | %matplotlib inline
import numpy as np
from numpy.random import beta as npbeta
from random import betavariate as pybeta
from scipy.stats import beta as scibeta
from matplotlib import pyplot as plt
from numpy import arange, vectorize
import timeit
start = timeit.default_timer()
for i in np.arange(1000000):
t = np.ra... |
jdossgollin/CWC_ANN | Week02/00-Sandbox.ipynb | mit | import numpy as np
import keras
from keras.datasets import mnist # load up the training data!
from keras.models import Sequential # our model
from keras.layers import Dense, Dropout, Flatten # layers we've seen
from keras.layers import Conv2D, MaxPooling2D # new layers
from keras import backend as K # see later
"""
Ex... |
aaronvincent/nuFATE | examples/notebook.ipynb | mit | # gamma = 2 #spectral index of incoming neutrino flux
gamma = '../resources/phiHGextrap.dat' #this is how you would specify an incoming flux from a file. Needs to be 200x1, on the same energy grid as below
flavor = 3 # 1 = nu_e, 2= nu_mu, 3= nu_tau. Negative for antineutrinos
Na = 6.0221415e23
def get_avg_attn(flavor,... |
FavioVazquez/practical_introduction_to_functional_programming | PracticalFunctionalProgramming-Python.ipynb | mit | a = 0
def increment1():
global a
a += 1
"""
Explanation: A practical introduction to functional programming
Many functional programming articles teach abstract functional techniques. That is, composition, pipelining, higher order functions. This one is different. It shows examples of imperative, unfunctional c... |
bblais/Classy | examples/Example Text Classification.ipynb | mit | count,feature_names=text.count_letters('data/languages/E3.txt')
print((count,feature_names))
count,feature_names=text.count_letters('data/languages/E3.txt')
print((count,feature_names))
p=text.letter_freq('English',feature_names)
print(p)
print((sum(count*log10(p))))
C=text.LanguageFileClassifier()
result=C.loglik... |
FluVigilanciaBR/fludashboard | Notebooks/historical_estimated_values.ipynb | gpl-3.0 | # local
from fludashboard.libs.flu_data import prepare_keys_name
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
"""
Explanation: Table of Contents
Detailed panel
Weekly incidence curve with typical intensity and thresholds
Function for incidence plot:
State example
Regional example
... |
rvernagus/data-science-notebooks | scikit-learn/Recipes - Preparing Data.ipynb | mit | from sklearn import datasets
import numpy as np
datasets.*?
boston = datasets.load_boston()
print(boston.DESCR)
X, y = boston.data, boston.target
"""
Explanation: The dataset Module
End of explanation
"""
datasets.make_*?
X, y = datasets.make_regression(n_samples=1000, n_features=1,
... |
junhwanjang/DataSchool | Lecture/23. PCA/2) 고유분해와 특이값 분해.ipynb | mit | w, V = np.linalg.eig(np.array([[1, -2], [2, -3]]))
w
V
"""
Explanation: 고유분해와 특이값 분해
정방 행렬 $A$에 대해 다음 식을 만족하는 단위 벡터 $v$, 스칼라 $\lambda$을 여러 개 찾을 수 있다.
$$ Av = \lambda v $$
$ A \in \mathbf{R}^{M \times M} $
$ \lambda \in \mathbf{R} $
$ v \in \mathbf{R}^{M} $
이러한 실수 $\lambda$를 고유값(eigenvalue), 단위 벡터 $v$ 를 고유벡터(... |
DakotaNelson/msf-stats | Exploit Payload Sizes.ipynb | mit | %matplotlib inline
import os
import re
import sys
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
# Set up a path to the Metasploit project's code.
basepath = os.path.join('/', 'home', 'dnelson', 'projects', 'msf-stats')
rootdir = os.path.join(basepath, 'metasploit-frame... |
diegocavalca/Studies | programming/Python/tensorflow/exercises/Neural_Network_Part1_Solutions.ipynb | cc0-1.0 | from __future__ import print_function
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
from datetime import date
date.today()
author = "kyubyong. https://github.com/Kyubyong/tensorflow-exercises"
tf.__version__
np.__version__
"""
Explanation: Neural Network
End of expla... |
arcyfelix/Courses | 17-08-31-Zero-to-Deep-Learning-with-Python-and-Keras/3 Machine Learning.ipynb | apache-2.0 | %matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
df = pd.read_csv('./data/weight-height.csv')
df.head()
df.plot(kind = 'scatter',
figsize = (7, 7),
x = 'Height',
y = 'Weight',
title = 'Weight and Height in adults')
df.plot(kind = 'scatter',
... |
stonebig/winpython_afterdoc | docs/Winpython_checker.ipynb | mit | import warnings
#warnings.filterwarnings("ignore", category=DeprecationWarning)
#warnings.filterwarnings("ignore", category=UserWarning)
#warnings.filterwarnings("ignore", category=FutureWarning)
# warnings.filterwarnings("ignore") # would silence all warnings
%matplotlib inline
# use %matplotlib widget for the adven... |
ProfessorKazarinoff/staticsite | content/code/matplotlib_plots/stress_strain_curves/stress_strain_curve_with_python.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
print("NumPy version:",np.__version__)
print("Pandas version:",pd.__version__)
"""
Explanation: In this post, we'll use data from a tensile test to build a stress strain curve with Python and Matplotlib.
A tensile test is a type... |
tensorflow/tensorrt | tftrt/examples/image_classification/NGC-TFv2-TF-TRT-inference-from-Keras-saved-model.ipynb | apache-2.0 | # Copyright 2019 NVIDIA Corporation. 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 applicable ... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/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... |
neoscreenager/JupyterNotebookWhirlwindTourOfPython | .ipynb_checkpoints/whirlwind-checkpoint.ipynb | gpl-3.0 | # set the midpoint
midpoint = 25
# make two empty lists
lower = []; upper = []
# split the numbers into lower and upper
for i in range(50):
if (i < midpoint):
lower.append(i)
# print("i lower = ",i)
else:
upper.append(i)
# print("i upper = ",i)
print "lower:", lower
pr... |
cehbrecht/demo-notebooks | esgf-opendap.ipynb | apache-2.0 | from pyesgf.search import SearchConnection
conn = SearchConnection('http://esgf-data.dkrz.de/esg-search', distrib=False)
"""
Explanation: Prepare esgf search connection
See also http://esgf-pyclient.readthedocs.io/en/latest/examples.html
End of explanation
"""
ctx = conn.new_context(project='CORDEX', query='temperat... |
liganega/Gongsu-DataSci | previous/y2017/W10-stats-correlation/.ipynb_checkpoints/GongSu22_Statistics_Population_Variance-checkpoint.ipynb | gpl-3.0 | from GongSu21_Statistics_Averages import *
"""
Explanation: 자료 안내: 여기서 다루는 내용은 아래 사이트의 내용을 참고하여 생성되었음.
https://github.com/rouseguy/intro2stats
모집단 분산 점추정
안내사항
지난 시간에 다룬 21장 내용을 활용하고자 한다.
따라서 아래와 같이 21장 내용을 모듈로 담고 있는 파이썬 파일을 임포트 해야 한다.
주의: GongSu21_Statistics_Averages.py 파일이 동일한 디렉토리에 있어야 한다.
End of explanation
"""
p... |
robertoalotufo/ia898 | master/tutorial_numpy_1_8.ipynb | mit | import numpy as np
a = np.array([0, 1, 2])
print('a = \n', a)
print()
print('Resultado da operação np.tile(a,2): \n',np.tile(a,2))
"""
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#Tile" data-toc-modified-id="Tile-1"><span class="toc-item-num">1 </span>Tile</a></div><div class="le... |
jmhsi/justin_tinker | data_science/courses/temp/courses/ml1/lesson5-nlp.ipynb | apache-2.0 | PATH='data/aclImdb/'
names = ['neg','pos']
%ls {PATH}
%ls {PATH}train
%ls {PATH}train/pos | head
trn,trn_y = texts_from_folders(f'{PATH}train',names)
val,val_y = texts_from_folders(f'{PATH}test',names)
"""
Explanation: IMDB dataset and the sentiment classification task
The large movie review dataset contains a col... |
maxis42/ML-DA-Coursera-Yandex-MIPT | 4 Stats for data analysis/Homework/15 project genom cancer/Genom cancer.ipynb | mit | from __future__ import division
import numpy as np
import pandas as pd
from scipy import stats
from statsmodels.sandbox.stats.multicomp import multipletests
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_i... |
tensorflow/docs-l10n | site/en-snapshot/quantum/tutorials/quantum_data.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... |
RadoslawDryzner/LeRepoDuGuerrier | Homework02/Homework 2.ipynb | mit | # Import libraries
import requests
from bs4 import BeautifulSoup
import json
import math
import time
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: First, we import all the needed librairies.
End of explanation
"""
r = requests.get('https://www.topuniver... |
swirlingsand/deep-learning-foundations | image-classification-project-2/dlnd_image_classification.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_size=None):
self.t... |
xclxxl414/rqalpha | docs/source/notebooks/run-rqalpha-in-ipython.ipynb | apache-2.0 | %load_ext rqalpha
"""
Explanation: IPython 与 RQAlpha
加载 RQAlpha magic
End of explanation
"""
%%rqalpha -h
""
"""
Explanation: 查看 RQAlpha magic 帮助
我们可以通过 %%rqalpha 直接在 cell 中运行回测代码。 %%rqalpha 后面的参数等价于在 CLI 中后面的 rqalpha run 的参数
End of explanation
"""
%%rqalpha -s 20100101 -e 20170505 -p -bm 000001.XSHG --account st... |
Jesusomar97/Simulacion2017 | Modulo1/Clase8_MembranaCircular.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
from scipy import special
import numpy as np
from ipywidgets import *
r = np.linspace(0, 10,100)
for n in range(5):
plt.plot(r, special.jn(n, r), label = '$J_{%s}(r)$'%n)
plt.xlabel('$r$', fontsize = 18)
plt.ylabel('$J_{n}(r)$', fontsize = 18)
plt.axhline(y = 0, c... |
rsterbentz/phys202-2015-work | assignments/assignment08/InterpolationEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.interpolate import interp1d, interp2d
"""
Explanation: Interpolation Exercise 1
End of explanation
"""
f = np.load('trajectory.npz')
x = f['x']
y = f['y']
t = f['t']
assert isinstance(x, np.ndarray) and len(x)==... |
ES-DOC/esdoc-jupyterhub | notebooks/cmcc/cmip6/models/sandbox-3/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'sandbox-3', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: CMCC
Source ID: SANDBOX-3
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbul... |
jon-young/medicalimage | Liver Segmentation.ipynb | mit | sliceNum = 42
dicomPath = join(expanduser('~'), 'Documents', 'SlicerDICOMDatabase', 'TCIALocal', '0', 'images', '')
reader = sitk.ImageSeriesReader()
seriesIDread = reader.GetGDCMSeriesIDs(dicomPath)[1]
dicomFilenames = reader.GetGDCMSeriesFileNames(dicomPath, seriesIDread)
reader.SetFileNames(dicomFilenames)
imgSerie... |
sevo/higher_order_functions | Immutable a Higher order functions.ipynb | mit | x = 'foo'
print(id(x))
print(id(x.upper()))
print(id(x + 'bar'))
"""
Explanation: Sutaz
Project Euler
Vyriesit co najviac uloh funkcionalne
Najlepsi dostanu plny pocet bodov z Python casti zaverecnej skusky
Nemenne objekty a funkcie vyssej urovne
Nemenné (Immutable) objekty
Nemenný objekt sa po vytvorení už nemôže ... |
JaviMerino/lisa | ipynb/android/workloads/Android_YouTube.ipynb | apache-2.0 | import logging
reload(logging)
log_fmt = '%(asctime)-9s %(levelname)-8s: %(message)s'
logging.basicConfig(format=log_fmt)
# Change to info once the notebook runs ok
logging.getLogger().setLevel(logging.INFO)
%pylab inline
import os
import pexpect as pe
from time import sleep
# Support to access the remote target
im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.