repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
tedunderwood/fiction | bert/interpret_results.ipynb | mit | # modules needed
import pandas as pd
from scipy.stats import pearsonr
import numpy as np
"""
Explanation: # Interpret results through aggregation
Since I'm working with long documents, I'm not really concerned with BERT's raw predictions about individual text chunks. Instead I need to know how good the predictions ar... |
ajaybhat/DLND | Project 1/Project-1.ipynb | apache-2.0 | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
"""
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 provi... |
spro/practical-pytorch | conditional-char-rnn/conditional-char-rnn.ipynb | mit | import glob
import unicodedata
import string
all_letters = string.ascii_letters + " .,;'-"
n_letters = len(all_letters) + 1 # Plus EOS marker
EOS = n_letters - 1
# Turn a Unicode string to plain ASCII, thanks to http://stackoverflow.com/a/518232/2809427
def unicode_to_ascii(s):
return ''.join(
c for c in ... |
eecs445-f16/umich-eecs445-f16 | lecture14_unsupervised-learning-pca-clustering/lecture14_unsupervised-learning-pca-clustering.ipynb | mit | from __future__ import division
# plotting
%matplotlib inline
from matplotlib import pyplot as plt;
import matplotlib as mpl;
from mpl_toolkits.mplot3d import Axes3D
# scientific
import numpy as np;
import sklearn as skl;
import sklearn.datasets;
import sklearn.cluster;
import sklearn.mixture;
# ipython
import IPyth... |
eroicaleo/LearningPython | HandsOnML/ch03/ex01.ipynb | mit | from scipy.io import loadmat
mnist = loadmat('./datasets/mnist-original.mat')
mnist
X, y = mnist['data'], mnist['label']
X = X.T
X.shape
y = y.T
y.shape
type(y)
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
"""
Explanation: 3.1 Problem description
Try to build a classifier for the MNIST da... |
junhwanjang/DataSchool | Lecture/11. 추정 및 검정/6) MLE 모수 추정의 예.ipynb | mit | theta0 = 0.6
x = sp.stats.bernoulli(theta0).rvs(1000)
N0, N1 = np.bincount(x, minlength=2)
N = N0 + N1
theta = N1/N
theta
"""
Explanation: MLE 모수 추정의 예
베르누이 분포의 모수 추정
각각의 시도 $x_i$에 대한 확률은 베르누이 분포
$$ P(x | \theta ) = \text{Bern}(x | \theta ) = \theta^x (1 - \theta)^{1-x}$$
샘플이 $N$개 있는 경우, Likelihood
$$ L = P(x_{1:N... |
hauser-tristan/heatwave-defcomp-examples | scripts/evaluate_definitions.ipynb | mit | #--- Libraries
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from pandas.tseries.offsets import *
from scipy.stats import beta
# place graphics in the notebook document
%matplotlib inline
# use 'casual' graphic style
_ = plt.xkcd()
# set more style defaults
sns.set_p... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/tensorflow_extended/solutions/penguin_tfdv.ipynb | apache-2.0 | # Install the TensorFlow Extended library
!pip install -U tfx
"""
Explanation: Data validation using TFX Pipeline and TensorFlow Data Validation
Learning Objectives
Understand the data types, distributions, and other information (e.g., mean value, or number of uniques) about each feature.
Generate a preliminary schem... |
Grzego/nn-workshop | 1-neural-networks-intro/neural-networks-empty.ipynb | mit | # skorzystamy z gotowej funkcji do pobrania tego zbioru
from sklearn.datasets import fetch_mldata
mnist = fetch_mldata('MNIST original')
"""
Explanation: Dane treningowe
Ponieważ będziemy potrzebowali na czymś wytrenować naszą sieć neuronową skorzystamy z popularnego zbioru w Machine Learningu czyli MNIST. Zbiór ten z... |
ivastar/clear | notebooks/forward_modeling/Extract_beam.ipynb | mit | from grizli import model
from grizli import multifit
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from shutil import copy
from astropy.table import Table
from astropy import wcs
from astropy.io import fits
from glob import glob
import os
## Seaborn is used to make plots loo... |
gfrubi/FM2 | Notebooks/Ejemplo-Difusion-Calor-1D.ipynb | gpl-3.0 | %matplotlib inline
from numpy import *
import matplotlib.pyplot as plt
from ipywidgets import interact
plt.style.use('classic')
"""
Explanation: Ecuación de difusión del calor 1D
Discutiremos la solución de la ecuación de difusión del calor unidimensional,
$$
\alpha \frac{\partial^2 \psi}{\partial^2 x}-\frac{\partial... |
unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/models/object_detection/object_detection_tutorial.ipynb | bsd-2-clause | import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
"""
Explanation: Object Detection Demo
Welcome to the object detection ... |
datactive/bigbang | examples/experimental_notebooks/Corr between centrality and community 0.1.ipynb | mit | %matplotlib inline
from bigbang.archive import Archive
import bigbang.parse as parse
import bigbang.analysis.graph as graph
import bigbang.ingress.mailman as mailman
import bigbang.analysis.process as process
import networkx as nx
import matplotlib.pyplot as plt
import pandas as pd
from pprint import pprint as pp
impo... |
idc9/law-net | vertex_metrics_experiment/chalboards/federal_tdidf.ipynb | mit | top_directory = '/Users/iaincarmichael/Dropbox/Research/law/law-net/'
import os
import sys
import time
from math import *
import copy
import cPickle as pickle
from glob import glob
import re
# data
import numpy as np
import pandas as pd
# viz
import matplotlib.pyplot as plt
# graph
import igraph as ig
# our code... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/statespace_forecasting.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
macrodata = sm.datasets.macrodata.load_pandas().data
macrodata.index = pd.period_range('1959Q1', '2009Q3', freq='Q')
"""
Explanation: Forecasting in statsmodels
This notebook describes forecasting u... |
biothings/biothings_explorer | jupyter notebooks/Multiomics + Service.ipynb | apache-2.0 | from biothings_explorer.query.predict import Predict
from biothings_explorer.query.visualize import display_graph
import nest_asyncio
nest_asyncio.apply()
%matplotlib inline
import warnings
warnings.filterwarnings("ignore")
"""
Explanation: Use case
Description: For a patient with disease X, what are some factors (suc... |
pombredanne/https-gitlab.lrde.epita.fr-vcsn-vcsn | doc/notebooks/automaton.determinize.ipynb | gpl-3.0 | import vcsn
lady4 = vcsn.context('lal_char(abc), b').ladybird(3)
lady4
lady4d = lady4.determinize()
lady4d
"""
Explanation: automaton.determinize
Compute the (accessible part of the) determinization of an automaton.
Preconditions:
- its labelset is free
- its weightset features a division operator (which is the case ... |
arviz-devs/arviz | doc/source/getting_started/WorkingWithInferenceData.ipynb | apache-2.0 | import arviz as az
import numpy as np
import xarray as xr
xr.set_options(display_expand_data=False, display_expand_attrs=False);
"""
Explanation: (working_with_InferenceData)=
Working with InferenceData
Here we present a collection of common manipulations you can use while working with InferenceData.
End of explanatio... |
relopezbriega/mi-python-blog | content/notebooks/DistStatsPy.ipynb | gpl-2.0 | # <!-- collapse=True -->
# importando modulos necesarios
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
import seaborn as sns
np.random.seed(2016) # replicar random
# parametros esteticos de seaborn
sns.set_palette("deep", desat=.6)
sns.set_context(rc={"figure.figsiz... |
astro4dev/OAD-Data-Science-Toolkit | Teaching Materials/Programming/Python/PythonISYA2018/02.BasicPythonII/01_control_structures.ipynb | gpl-3.0 | a = 1
b = 4
if a < b:
print('a is smaller than b')
elif a > b:
print('a is larger than b')
else:
print('a is equal to b')
"""
Explanation: If (elif, else)
This is probably the most used conditional structure in programming.
Here is the syntax in Python
End of explanation
"""
5 in [1, 2, 4]
3 in [1, 2,... |
metabolite-atlas/metatlas | notebooks/reference/Workflow_Notebook_VS_Auto_RT_Predict_V2.ipynb | bsd-3-clause | from IPython.core.display import Markdown, display, clear_output, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
%matplotlib notebook
%matplotlib inline
%env HDF5_USE_FILE_LOCKING=FALSE
import sys, os
#### add a path to your private code if not using production code ####
#print ('point pa... |
ioggstream/python-course | connexion-101/notebooks/04-01-connexion-writing-operationid.ipynb | agpl-3.0 | # connexion provides a predefined problem object
from connexion import problem
# Exercise: write a get_status() returning a successful response to problem.
help(problem)
def get_status():
return problem(
status=200,
title="OK",
detail="The application is working properly"
)
... |
tbphu/Fachkurs_Bachelor_WS1617 | general/ode/Introduction_ODEs.ipynb | mit | import numpy as np
# define ODE (y,t,p)
"""
Explanation: Introduction
What is an ODE
Differential equations can be used to describe the time-dependent behaviour of a variable.
$$\frac{\text{d}\vec{x}}{\text{d}t} = f(\vec{x}, t)$$
The variable stands for a concentration or a number of individuals in a population... |
karolaya/PDI | PS-01/problem_set_1.ipynb | mit | '''This is a definition script, so we do not have to rewrite code'''
import numpy as np
import cv2
import matplotlib.pyplot as mplt
# set matplotlib to print inline (Jupyter)
%matplotlib inline
# path prefix
pth = '../data/'
# files to be used as samples
# list *files* holds the names of the test images
files = ['... |
saashimi/CPO-datascience | superseded/Normalized Dataset - Comparison.ipynb | mit | #Import required packages
import pandas as pd
import numpy as np
import datetime
import matplotlib.pyplot as plt
def format_date(df_date):
"""
Splits Meeting Times and Dates into datetime objects where applicable using regex.
"""
df_date['Days'] = df_date['Meeting_Times'].str.extract('([^\s]+)', expand... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_forward_sensitivity_maps.ipynb | bsd-3-clause | # Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne.datasets import sample
import matplotlib.pyplot as plt
print(__doc__)
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
fwd_fname = data_path + '/MEG/sample/sample_audvis-meg-eeg-... |
Benedicto/ML-Learning | Linear_Regression_4_ridge_regression_assignment_1.ipynb | gpl-3.0 | import graphlab
"""
Explanation: Regression Week 4: Ridge Regression (interpretation)
In this notebook, we will run ridge regression multiple times with different L2 penalties to see which one produces the best fit. We will revisit the example of polynomial regression as a means to see the effect of L2 regularization.... |
aKumpan/hse-shad-ml | 01-titanic/pandas/pandas.ipynb | apache-2.0 | sex_counts = df['Sex'].value_counts()
print('{} {}'.format(sex_counts['male'], sex_counts['female']))
"""
Explanation: 1. Какое количество мужчин и женщин ехало на корабле? В качестве ответа приведите два числа через пробел
End of explanation
"""
survived_df = df['Survived']
count_of_survived = survived_df.value_cou... |
mne-tools/mne-tools.github.io | 0.23/_downloads/d418deb5d74ab4363c42409de6a8e6df/label_source_activations.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
import mne
from mne.datasets import sample
from mne.minimum_norm import read_inverse_operator, apply_in... |
suvofalcon/MLPY-DataAnalysisVisualizations | _03A_Matplotlib Exercises - Solutions.ipynb | gpl-3.0 | import numpy as np
x = np.arange(0,100)
y = x*2
z = x**2
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
Matplotlib Exercises - Solutions
Welcome to the exercises for reviewing matplotlib! Take your time with these, Matplotlib can be tricky to understand at first. The... |
bmeaut/python_nlp_2017_fall | course_material/07_Tagging/07_Scipy_lab_solutions.ipynb | mit | import numpy, scipy
import scipy.linalg
import scipy.sparse
import scipy.sparse.linalg
%matplotlib inline
import matplotlib.pyplot
"""
Explanation: Python for mathematics, science and engineering
https://scipy.org/
Scipy
(pronounced "Sigh Pie")
Higher level algorithms on top of numpy
numerical integration
optimizati... |
sebp/scikit-survival | doc/user_guide/random-survival-forest.ipynb | gpl-3.0 | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OrdinalEncoder
from sksurv.datasets import load_gbsg2
from sksurv.preprocessing import OneHotEncoder
from sksurv.ensemble import RandomSurviv... |
ES-DOC/esdoc-jupyterhub | notebooks/cmcc/cmip6/models/sandbox-2/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'sandbox-2', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: CMCC
Source ID: SANDBOX-2
Topic: Atmoschem
Sub-Topics: Transport, Emissions ... |
pombredanne/https-gitlab.lrde.epita.fr-vcsn-vcsn | doc/notebooks/automaton.delay_automaton.ipynb | gpl-3.0 | import vcsn
ctx = vcsn.context("lat<law_char, law_char>, b")
ctx
a = ctx.expression(r"'abc, \e''d,v'*'\e,wxyz'").standard()
a
"""
Explanation: automaton.delay_automaton
Create a new transducer, equivalent to the first one, with the states labeled with the delay of the state, i.e. the difference of input length on ea... |
NeuroDataDesign/pan-synapse | pipeline_1/background/Sparse_Arrays_Algorithms.md.ipynb | apache-2.0 | %matplotlib inline
import matplotlib.pyplot as plt
import sys
sys.path.insert(0,'../code/functions/')
import tiffIO as tIO
import connectLib as cLib
import plosLib as pLib
import time
import scipy.ndimage as ndimage
import numpy as np
import time
import clusterComponents
class SparseArray:
def genClusters(self, i... |
julienchastang/unidata-python-workshop | notebooks/XArray/XArray and CF.ipynb | mit | # Convention for import to get shortened namespace
import numpy as np
import xarray as xr
# Create some sample "temperature" data
data = 283 + 5 * np.random.randn(5, 3, 4)
data
"""
Explanation: <div style="width:1000 px">
<div style="float:right; width:98 px; height:98px;">
<img src="https://raw.githubusercontent.co... |
DBWangGroupUNSW/COMP9318 | L6 - GaussianNB, KNN, and Cross-Validation.ipynb | mit | import pandas as pd
import numpy as np
from sklearn.naive_bayes import GaussianNB
from sklearn.neighbors import KNeighborsClassifier
from sklearn.cross_validation import KFold
from sklearn import preprocessing
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Predict the Sun Hours using Naive Bayes ... |
mne-tools/mne-tools.github.io | 0.23/_downloads/aec45e1f20057e833cee12bb6bd292dc/10_evoked_overview.ipynb | bsd-3-clause | import os
import mne
"""
Explanation: The Evoked data structure: evoked/averaged data
This tutorial covers the basics of creating and working with :term:evoked
data. It introduces the :class:~mne.Evoked data structure in detail,
including how to load, query, subselect, export, and plot data from an
:class:~mne.Evoked ... |
LxMLS/lxmls-toolkit | labs/notebooks/linear_classifiers/exercises.ipynb | mit | %load_ext autoreload
%autoreload 2
import lxmls.readers.sentiment_reader as srs
scr = srs.SentimentCorpus("books")
"""
Explanation: Exercise 1.1
In this exercise we will use the Amazon sentiment analysis data (Blitzer et al., 2007), where the goal is to classify text documents as expressing a positive or negative sen... |
mmatera/qmnotebooks | Graficas 2 y 3d y gráficas de nivel con matplotlib.ipynb | gpl-3.0 | # Encabezado: cargar librerías
%matplotlib inline
import numpy as np # Librería para funciones matemáticas
import matplotlib.pyplot as plt # Librería para graficos
import matplotlib.cm as cm # Módulo para controlar mapas de colores
from mpl_toolkits.mplot3d import Axes3D # Módulo 3D
# Grafica... |
dbrattli/OSlash | notebooks/Reader.ipynb | apache-2.0 | from oslash import Reader
unit = Reader.unit
"""
Explanation: The Reader Monad
The Reader monad pass the state you want to share between functions. Functions may read that state, but can't change it. The reader monad lets us access shared immutable state within a monadic context. In the Reader monad this shared state ... |
anhaidgroup/py_entitymatching | notebooks/guides/end_to_end_em_guides/.ipynb_checkpoints/Basic EM Workflow Restaurants - 1-checkpoint.ipynb | bsd-3-clause | import sys
sys.path.append('/Users/pradap/Documents/Research/Python-Package/anhaid/py_entitymatching/')
import py_entitymatching as em
import pandas as pd
import os
# Display the versions
print('python version: ' + sys.version )
print('pandas version: ' + pd.__version__ )
print('magellan version: ' + em.__version__ ... |
hktxt/MachineLearning | Map,_Filter,_and_Reduce_Functions.ipynb | gpl-3.0 | # 计算一系列半径的圆的面积
import math
# 计算面积
def area(r):
"""area of a circle with radius 'r'."""
return math.pi * (r**2)
# 半径
radii = [2, 5, 7,1 ,0.3, 10]
# method 1
areas = []
for r in radii:
a = area(r)
areas.append(a)
areas
# method 2
[area(r) for r in radii]
# method 3, with map function, map take 2 ar... |
TomAugspurger/PracticalPandas | Practical Pandas 03 - EDA.ipynb | mit | %matplotlib inline
import os
import datetime
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_hdf(os.path.join('data', 'cycle_store.h5'), key='with_weather')
df.head()
"""
Explanation: Welcome back. As a reminder:
In part 1 we got dataset with my cycling data from last year me... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_brainstorm_phantom_ctf.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import fit_dipole
from mne.datasets.brainstorm import bst_phantom_ctf
from mne.io import read_raw_ctf
print(__doc__)
"""
Explanation: Brainstorm CT... |
maxentile/equilibrium-sampling-tinker | Bidirectional AIS for free energy computations tinker.ipynb | mit | import numpy as np
import numpy.random as npr
import matplotlib.pyplot as plt
plt.rc('font', family='serif')
%matplotlib inline
# initial system
def harmonic_osc_potential(x):
''' quadratic energy well '''
return np.sum(x**2)
# alchemical perturbation
def egg_crate_potential(x,freq=20):
''' bumpy potentia... |
scotthuang1989/Python-3-Module-of-the-Week | networking/Unix Domain Sockets.ipynb | apache-2.0 | # %load socket_echo_server_uds.py
import socket
import sys
import os
server_address = './uds_socket'
# Make sure the socket does not already exist
try:
os.unlink(server_address)
except OSError:
if os.path.exists(server_address):
raise
# Create a UDS socket
sock = socket.socket(socket.AF_UNIX, socket.... |
matsuyamax/Recipes | examples/ImageNet Pretrained Network (VGG_S).ipynb | mit | !wget https://s3.amazonaws.com/lasagne/recipes/pretrained/imagenet/vgg_cnn_s.pkl
"""
Explanation: Introduction
This example demonstrates using a network pretrained on ImageNet for classification. The model used was converted from the VGG_CNN_S model (http://arxiv.org/abs/1405.3531) in Caffe's Model Zoo.
For details o... |
GoogleCloudPlatform/analytics-componentized-patterns | retail/recommendation-system/bqml-scann/ann01_create_index.ipynb | apache-2.0 | import base64
import datetime
import logging
import os
import json
import pandas as pd
import time
import sys
import grpc
import google.auth
import numpy as np
import tensorflow.io as tf_io
from google.cloud import bigquery
from typing import List, Optional, Text, Tuple
"""
Explanation: Low-latency item-to-item rec... |
jordanopensource/data-science-bootcamp | session4/L0_Machine learning.ipynb | mit | import scipy.stats as st
def generateData(true_p, dataset_size):
return ['H' if i == 1 else 'T' for i in st.bernoulli.rvs(0.3 ,size=dataset_size)]
def estimate_p(data):
return sum([1.0 if observation == 'H' else 0.0 for observation in data]) / len(data)
#simulate data
true_p = 0.3
dataset_size = 20000
dat... |
taesiri/noteobooks | old:misc/object-detection/object_detection_virtual_camera.ipynb | mit | import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
import cv2
"""
Explanation: Object Detection Demo
Welcome to the objec... |
chinapnr/python_study | Python 基础课程/Python Basic 练习题A.ipynb | gpl-3.0 | a = 24
b = 16
for i in range(min(a,b), 0, -1):
if a % i == 0 and b % i ==0:
print(i)
break
while b:
a,b=b,a%b
print(a)
print(max([x for x in range(1,a+1) if a%x==0 and b%x==0]))
"""
Explanation: Python Basic 练习题 A
v1.1, 2020.4, 2020.5,2020.6, edit by David Yi
题目1:两个正整数a和b, 输出它们的最大公约数。
例如... |
esa-as/2016-ml-contest | HouMath/Face_classification_HouMath_XGB_04.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
import xgboost as xgb
import numpy as np
from sklearn.metrics import confusion_matrix, f1_score, accuracy_score, roc_... |
gansanay/datascience-theoryinpractice | machinelearning-theoryinpractice/01_Regression/01_LinearRegression.ipynb | mit | n = 100
x = np.random.normal(1, 0.5, n)
noise = np.random.normal(0, 0.25, n)
y = 0.75*x + 1 + noise
fig, ax = plt.subplots(1, 1, figsize=(6,4))
ax.scatter(x, y)
ax.set_xlim([0,2])
ax.set_ylim([0,3.1])
"""
Explanation: Introduction
Linear regression, like any model regression methods, is made of two parts:
* a regress... |
boland1992/SeisSuite | seissuite/ant/.ipynb_checkpoints/Stack_Example-checkpoint.ipynb | gpl-3.0 | from tools.stack import Stack
from obspy import read
%matplotlib inline
"""
Explanation: Stacking Waveforms Examples
The following notebook contains examples for using the stack.py toolbox for stacking raw and band-pass filtered seismic waveforms. Currently the script can only operate with MSEED formats, but additi... |
ES-DOC/esdoc-jupyterhub | notebooks/inm/cmip6/models/inm-cm5-h/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'inm', 'inm-cm5-h', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: INM
Source ID: INM-CM5-H
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radiat... |
LucaFoschini/UCSBDataScienceBootcamp2015 | Day01_ComputerBasics/notebooks/01 - Data Science.ipynb | cc0-1.0 | from IPython.display import Image
Image(url='http://static.squarespace.com/static/5150aec6e4b0e340ec52710a/t/51525c33e4b0b3e0d10f77ab/1364352052403/Data_Science_VD.png?format=750w')
"""
Explanation: Data Science
What's that?
End of explanation
"""
Image(url='https://upload.wikimedia.org/wikipedia/en/c/cb/Windows_Ex... |
5agado/data-science-learning | machine learning/Tensorflow - Intro.ipynb | apache-2.0 | import os
import sys
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from pathlib import Path
import tensorflow as tf
%matplotlib notebook
#%matplotlib inline
models_data_folder = Path.home() / "Documents/models/"
"""
Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1>
<... |
eshlykov/mipt-day-after-day | labs/term-5/lab-3-3.ipynb | unlicense | import pandas
nI1 = pandas.read_excel('lab-3-3.xlsx', 'tab-1', header=None)
nI.head(5)
nI2 = pandas.DataFrame(nI.values[[0, 5, 6, 7, 8], :])
nI2.head()
nI3 = pandas.DataFrame(nI.values[[0, 9, 10, 11, 12], :])
nI3.head()
import matplotlib.pyplot
r1, r500, r3000 = nI1.values, nI2.values, nI3.values
matplotlib.pyplot.f... |
schemaorg/schemaorg | software/scripts/dashboard.ipynb | apache-2.0 | # Import libraries
import unittest
import os
import pprint
from os import path, getenv
from os.path import expanduser
import logging # https://docs.python.org/2/library/logging.html#logging-levels
import glob
import argparse
import StringIO
import sys
# 3rd party, see e.g. http://pbpython.com/simple-graphing-pandas.h... |
krishnatray/data_science_project_portfolio | galvanize/TechnicalExcercise/Q3 Split Test Analysis_SS.ipynb | mit | # read data
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
# I have stored the data in a csv file. Let's load the data in pandas dataframe
split_test_df = pd.read_csv("split_test.csv")
split_test_df['conversion_rate'] = split_test_df['Quotes'] /split_te... |
Hasil-Sharma/Neural-Networks-CS231n | assignment1/two_layer_net.ipynb | gpl-3.0 | # A bit of setup
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.neural_net import TwoLayerNet
%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'
# for auto-reloadi... |
coolharsh55/advent-of-code | 2016/python3/Day10.ipynb | mit | with open('../inputs/day10.txt', 'r') as f:
data = [line.strip() for line in f.readlines()]
"""
Explanation: Day 10: Balance Bots
author: Harshvardhan Pandit
license: MIT
link to problem statement
You come upon a factory in which many robots are zooming around handing small microchips to each other.
Upon closer ex... |
sdpython/ensae_teaching_cs | _doc/notebooks/sklearn_ensae_course/00_introduction_machine_learning_and_data.ipynb | mit | # Start pylab inline mode, so figures will appear in the notebook
%matplotlib inline
# Import the example plot from the figures directory
from plot_sgd_separator import plot_sgd_separator
plot_sgd_separator()
"""
Explanation: 2A.ML101.0: What is machine learning?
Machine Learning is about building programs with tunab... |
dynaryu/rmtk | rmtk/vulnerability/derivation_fragility/equivalent_linearization/vidic_etal_1994/vidic_etal_1994.ipynb | agpl-3.0 | import vidic_etal_1994
from rmtk.vulnerability.common import utils
%matplotlib inline
"""
Explanation: Vidic, Fajfar and Fischinger (1994)
This procedure, proposed by Vidic, Fajfar and Fischinger (1994), aims to determine the displacements from an inelastic design spectra for systems with a given ductility factor. T... |
phoebe-project/phoebe2-docs | 2.3/tutorials/LC.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
"""
Explanation: 'lc' Datasets and Options
Setup
Let's first make sure we have the latest version of PHOEBE 2.3 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # units
logger = phoeb... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/plots_boxplots.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
"""
Explanation: Box Plots
The following illustrates some options for the boxplot in statsmodels. These include violin_plot and bean_plot.
End of explanation
"""
data = sm.datasets.anes96.load_pandas()
party_ID = np.a... |
sdpython/ensae_teaching_cs | _doc/notebooks/td1a_algo/td1a_quicksort_correction.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 1A.algo - quicksort - correction
Implémentation du quicksort façon graphe.
End of explanation
"""
class NoeudTri (object):
def __init__(self,s):
self.mot = s
NoeudTri("a")
"""
Explanation: Q1 : classe
End of explan... |
SnShine/aima-python | learning.ipynb | mit | from learning import *
from notebook import *
"""
Explanation: LEARNING
This notebook serves as supporting material for topics covered in Chapter 18 - Learning from Examples , Chapter 19 - Knowledge in Learning, Chapter 20 - Learning Probabilistic Models from the book Artificial Intelligence: A Modern Approach. This n... |
pombredanne/gensim | docs/notebooks/topic_coherence_tutorial.ipynb | lgpl-2.1 | import numpy as np
import logging
import pyLDAvis.gensim
import json
import warnings
warnings.filterwarnings('ignore') # To ignore all warnings that arise here to enhance clarity
from gensim.models.coherencemodel import CoherenceModel
from gensim.models.ldamodel import LdaModel
from gensim.models.wrappers import LdaV... |
kringen/IOT-Back-Brace | data_collection/ProcessSensorReadings.ipynb | apache-2.0 | import json
from pyspark.streaming import StreamingContext
from pyspark.streaming.kafka import KafkaUtils
from pyspark import SparkContext
from pyspark.sql import SQLContext
from pyspark.sql.functions import explode
from pyspark.ml.feature import VectorAssembler
from pyspark.mllib.tree import RandomForest, RandomForest... |
albahnsen/ML_SecurityInformatics | notebooks/09_EnsembleMethods_Bagging.ipynb | mit | import numpy as np
# set a seed for reproducibility
np.random.seed(1234)
# generate 1000 random numbers (between 0 and 1) for each model, representing 1000 observations
mod1 = np.random.rand(1000)
mod2 = np.random.rand(1000)
mod3 = np.random.rand(1000)
mod4 = np.random.rand(1000)
mod5 = np.random.rand(1000)
# each m... |
Geosyntec/pycvc | examples/medians/0 - Setup NSQD Median computation.ipynb | bsd-3-clause | import numpy
import wqio
import pynsqd
import pycvc
def get_cvc_parameter(nsqdparam):
try:
cvcparam = list(filter(
lambda p: p['nsqdname'] == nsqdparam, pycvc.info.POC_dicts
))[0]['cvcname']
except IndexError:
cvcparam = numpy.nan
return cvcparam
def fix_nsqd_bacteri... |
SlipknotTN/udacity-deeplearning-nanodegree | tv-script-generation/dlnd_tv_script_generation_deep_dante.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
data_dir = './data/divina_commedia.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 scripts using R... |
georgetown-analytics/machine-learning | archive/notebook/Clustering Flag Data.ipynb | mit | import os
import requests
import numpy as np
import pandas as pd
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from sklearn import manifold
from sklearn.cluster import KMeans, AgglomerativeClustering
from sklearn.decomposition import PCA
from sklearn.metrics import silhouette_samples, silhouette_score
f... |
NuGrid/NuPyCEE | DOC/Capabilities/Fitting_curves_to_STELLAB_data.ipynb | bsd-3-clause | # Import Python packages
%matplotlib inline
import matplotlib
import matplotlib.pyplot as pl
import numpy as np
# Import the STELLAB module
from NuPyCEE import stellab as st
"""
Explanation: Fitting Curves to STELLAB Data
Prepared by @Marco Pignatari
This notebooks shows how to extract observational data from the STE... |
KIPAC/StatisticalMethods | tutorials/missing_data.ipynb | gpl-2.0 | exec(open('tbc.py').read()) # define TBC and TBC_above
from io import StringIO
import numpy as np
from pygtc import plotGTC
import emcee
import incredible as cr
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Tutorial: Coping with Missing Information
O-ring failure rates prior to the Challenger shu... |
syednasar/datascience | deeplearning/sentiment-analysis/sentiment_network/.ipynb_checkpoints/Sentiment Classification - Mini Project 2-checkpoint.ipynb | mit | def pretty_print_review_and_label(i):
print(labels[i] + "\t:\t" + reviews[i][:80] + "...")
g = open('reviews.txt','r') # What we know!
reviews = list(map(lambda x:x[:-1],g.readlines()))
g.close()
g = open('labels.txt','r') # What we WANT to know!
labels = list(map(lambda x:x[:-1].upper(),g.readlines()))
g.close()... |
wtgme/labeldoc2vec | docs/notebooks/distance_metrics.ipynb | lgpl-2.1 | from gensim.corpora import Dictionary
from gensim.models import ldamodel
from gensim.matutils import kullback_leibler, jaccard, hellinger, sparse2full
import numpy
# you can use any corpus, this is just illustratory
texts = [['bank','river','shore','water'],
['river','water','flow','fast','tree'],
['b... |
GoogleCloudPlatform/tensorflow-without-a-phd | tensorflow-rnn-tutorial/old-school-tensorflow/tutorial/00_RNN_predictions_estimator_solution.ipynb | apache-2.0 | import numpy as np
import tensorflow as tf
from tensorflow.python.platform import tf_logging as logging
logging.set_verbosity(logging.INFO)
logging.log(logging.INFO, "Tensorflow version " + tf.__version__)
import utils_datagen
from matplotlib import pyplot as plt
import utils_display
"""
Explanation: An RNN for short... |
yingchi/fastai-notes | deeplearning1/nbs/statefarm-yc.ipynb | apache-2.0 | from theano.sandbox import cuda
cuda.use('gpu0')
%matplotlib inline
from __future__ import print_function, division
from importlib import reload
import utils; reload(utils)
from utils import *
from IPython.display import FileLink
LESSON_HOME_DIR='/home/ubuntu/fastai-notes/deeplearning1/nbs/'
path = LESSON_HOME_DIR+'d... |
mdeff/ntds_2016 | toolkit/02_ex_exploitation.ipynb | mit | import pandas as pd
import numpy as np
from IPython.display import display
import os.path
folder = os.path.join('..', 'data', 'social_media')
# Your code here.
"""
Explanation: A Python Tour of Data Science: Data Acquisition & Exploration
Michaël Defferrard, PhD student, EPFL LTS2
Exercise: problem definition
Theme ... |
skkandrach/foundations-homework | .ipynb_checkpoints/Homeowrk_3-checkpoint.ipynb | mit | from bs4 import BeautifulSoup
from urllib.request import urlopen
html_str = urlopen("http://static.decontextualize.com/widgets2016.html").read()
document = BeautifulSoup(html_str, "html.parser")
"""
Explanation: Homework assignment #3
These problem sets focus on using the Beautiful Soup library to scrape web pages.
Pr... |
CGATOxford/CGATPipelines | CGATPipelines/pipeline_docs/pipeline_peakcalling/notebooks/template_peakcalling_filtering_Report_insert_sizes.ipynb | mit | import sqlite3
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
#import CGATPipelines.Pipeline as P
import os
import statistics
#import collections
#load R and the R packages required
#%load_ext rpy2.ipython
#%R require(ggplot2)
# use the... |
nitin-cherian/LifeLongLearning | Python/Python_Morsels_Revised/11.lstrip/let_me_try/lstrip.ipynb | mit | def lstrip(iterable, obj):
stop = False
for item in iterable:
if stop:
yield item
elif item != obj:
yield item
stop = True
x = lstrip([0, 1, 2, 3, 0], 0)
x
list(x)
"""
Explanation: Bonus1: return an iterator (for example a generator) from... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/ml_ops/stage6/get_started_with_tf_serving_function.ipynb | apache-2.0 | import os
# The Vertex AI Workbench Notebook product has specific requirements
IS_WORKBENCH_NOTEBOOK = os.getenv("DL_ANACONDA_HOME")
IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(
"/opt/deeplearning/metadata/env_version"
)
# Vertex AI Notebook requires dependencies to be installed with '--user'
USER_FLAG = ... |
ProfessorKazarinoff/staticsite | content/code/functions/functions_in_python.ipynb | gpl-3.0 | out = sum([2, 3])
"""
Explanation: Functions are pieces of reusable code. Each function contains three descrete elements: name, input, and output. Functions take in input, called arguments or input arguments, and produce output. A function is called in Python by coding
output = function_name(input)
Note the output is ... |
ES-DOC/esdoc-jupyterhub | notebooks/bnu/cmip6/models/bnu-esm-1-1/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'bnu', 'bnu-esm-1-1', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: BNU
Source ID: BNU-ESM-1-1
Topic: Ocnbgchem
Sub-Topics: Tracers.
Propertie... |
SHDShim/pytheos | examples/6_p_scale_test_Dorogokupets2015_Pt.ipynb | apache-2.0 | %config InlineBackend.figure_format = 'retina'
"""
Explanation: For high dpi displays.
End of explanation
"""
import matplotlib.pyplot as plt
import numpy as np
from uncertainties import unumpy as unp
import pytheos as eos
"""
Explanation: 0. General note
This example compares pressure calculated from pytheos and o... |
Benedicto/ML-Learning | Linear_Regression_1_simple_regression.ipynb | gpl-3.0 | import graphlab
"""
Explanation: Regression Week 1: Simple Linear Regression
In this notebook we will use data on house sales in King County to predict house prices using simple (one input) linear regression. You will:
* Use graphlab SArray and SFrame functions to compute important summary statistics
* Write a functio... |
ES-DOC/esdoc-jupyterhub | notebooks/ncar/cmip6/models/sandbox-3/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncar', 'sandbox-3', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: NCAR
Source ID: SANDBOX-3
Topic: Aerosol
Sub-Topics: Transport, Emissions, Conce... |
vitojph/kschool-nlp | notebooks-py2/nltk-analyzers.ipynb | gpl-3.0 | from __future__ import print_function
from __future__ import division
import nltk
"""
Explanation: Resumen de NLTK: Análisis sintáctico
Este resumen se corresponde con el capítulo 8 del NLTK Book Analyzing Sentence Structure. La lectura del capítulo es muy recomendable.
En este resumen vamos a repasar cómo crear gram... |
oliverlee/pydy | examples/chaos_pendulum/chaos_pendulum.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import sympy as sm
import sympy.physics.mechanics as me
from pydy.system import System
from pydy.viz import Cylinder, Plane, VisualizationFrame, Scene
%matplotlib nbagg
me.init_vprinting(use_latex='mathjax')
"""
Explanation: Introduction
This example gives a simple ... |
sbenthall/bigbang | examples/experimental_notebooks/Assortativity Study.ipynb | agpl-3.0 | from bigbang.archive import Archive
urls = [#"analytics",
"conferences",
"design",
"education",
"gendergap",
"historic",
"hot",
"ietf-privacy",
"ipython-dev",
"ipython-user",
"languages",
"maps-l",
"numpy-discussion",
... |
wdbm/Psychedelic_Machine_Learning_in_the_Cenozoic_Era | Keras_convolutional_MNIST.ipynb | gpl-3.0 | %autosave 120
import numpy as np
np.random.seed(1337)
import datetime
import graphviz
from IPython.display import SVG
import keras
from keras import activations
from keras import backend as K
from keras.datasets import mnist
from keras.layers import (
concatenate,
Concatenate,
... |
karlstroetmann/Artificial-Intelligence | Python/7 Neural Networks/Reverse-Mode-AD.ipynb | gpl-2.0 | def f(x1, x2):
return sin(x1 + x2) * cos(x1 - x2) + (x1 + x2) * (x1 - x2)
"""
Explanation: Reverse Mode Automatic Differentiation
We demonstrate reverse mode AD with the function
$$ f(x_1, x_2) = \sin(x_1 + x_2) \cdot \cos(x_1 - x_2) + (x_1 + x_2) \cdot (x_1 - x_2) $$
To compute the function step by step, we intro... |
abulbasar/machine-learning | Scikit - 21 Kaggle House price prediction (regression).ipynb | apache-2.0 | lasso = Lasso(random_state=1, max_iter=10000)
lasso.fit(X_train_std, y_train)
rmse(y_test, lasso.predict(X_test_std))
"""
Explanation: Seems that Linear regression model performed very poorly. Most likely it is because model finds a lot of collinearity in the data due to the categorical columns.
Test lasso, which is m... |
arcyfelix/Courses | 17-09-17-Python-for-Financial-Analysis-and-Algorithmic-Trading/01-Python-Crash-Course/Python Crash Course Exercises - Solved .ipynb | apache-2.0 | price = 300
import math
math.sqrt(price)
"""
Explanation: Python Crash Course Exercises
This is an optional exercise to test your understanding of Python Basics. The questions tend to have a financial theme to them, but don't look to deeply into these tasks themselves, many of them don't hold any significance and ar... |
zhmz90/CS231N | assign/assignment1/.ipynb_checkpoints/knn-checkpoint.ipynb | mit | %matplotlib
# Run some setup code for this notebook.
import random
import numpy as np
from cs231n.data_utils import load_CIFAR10
import matplotlib.pyplot as plt
# This is a bit of magic to make matplotlib figures appear inline in the notebook
# rather than in a new window.
%matplotlib inline
plt.rcParams['figure.fig... |
ProfessorKazarinoff/staticsite | content/code/periodic_table/seaborn_violin_plot.ipynb | gpl-3.0 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Title: Violin plot with python, matplotlib and seaborn
Date: 2017-10-19 10:42
Modified: 2017-10-19 10:42
Slug: violin-plot-with-python-matplotlib-seaborn
Import the necessary packages
End of explanation
"""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.