repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
massimo-nocentini/PhD | notebooks/binomial-transform-applied-to-fibonacci-numbers.ipynb | apache-2.0 | import sympy
from sympy import *
from sympy.abc import x, n, z, t, k
init_printing() # for nice printing, a-la' TeX
%run "sums.py"
# duplicated code, put it into "sums.py"
def expand_sum_in_eq(eq_term):
lhs, rhs = eq_term.lhs, eq_term.rhs
return Eq(lhs, expand_Sum(rhs))
f = IndexedBase('f')
fibs = {f[i]... |
ocefpaf/intro_python_notebooks | 01-Jupyter-Basics.ipynb | mit | print("Olá alunos")
"""
Explanation: Aula 01 - IPython (e o notebook)
Objetivos
Introdução ao IPython e Jupyter Notebook
Navegação básica
Comandos "mágicos"
O que é IPython (e ~~IPython~~ Jupyter Notebook)?
Um ambiente para interagir com código
O notebook é uma ferramenta para literate computing
Combina narrativa, ... |
mmckerns/tutmom | solutions.ipynb | bsd-3-clause | import cvxopt as cvx
from cvxopt import solvers as cvx_solvers
Q = cvx.matrix([[0.,0.],[0.,0.]])
p = cvx.matrix([-1., 4.])
G = cvx.matrix([[-3., 1., 0.],[1., 2., -1.]])
h = cvx.matrix([6., 4., 3.])
sol = cvx_solvers.qp(Q, p, G, h)
print(sol['x'])
"""
Explanation: Solutions to exercises
EXERCISE: Solve the constrained ... |
edeno/Jadhav-2016-Data-Analysis | notebooks/2017_06_19_Test_Spectral_Multiple_Sessions.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import xarray as xr
from src.analysis import (decode_ripple_clusterless,
detect_epoch_ripples,
ripple_triggered_connectivity,
connectivity_by_ripple... |
robblack007/clase-dinamica-robot | Practicas/.ipynb_checkpoints/Practica 4 - Movimientos de cuerpos rigidos-checkpoint.ipynb | mit | from math import pi, sin, cos
from numpy import matrix
from matplotlib.pyplot import figure, plot, style
style.use("ggplot")
%matplotlib inline
τ = 2*pi
"""
Explanation: Matrices de Transformación
Las matrices de rotación y traslación nos sirven para transformar una coordenada entre diferentes sistemas coordenados, p... |
orbitfold/tardis | docs/notebooks/to_hdf.ipynb | bsd-3-clause | from tardis.io.config_reader import Configuration
from tardis.model import Radial1DModel
from tardis.simulation import Simulation
# Must have the tardis_example folder in the working directory.
config_fname = 'tardis_example/tardis_example.yml'
tardis_config = Configuration.from_yaml(config_fname)
model = Radial1DMod... |
gprMax/gprMax | tools/Jupyter_notebooks/example_Bscan_2D.ipynb | gpl-3.0 | %%writefile ../../user_models/cylinder_Bscan_2D.in
#title: B-scan from a metal cylinder buried in a dielectric half-space
#domain: 0.240 0.210 0.002
#dx_dy_dz: 0.002 0.002 0.002
#time_window: 3e-9
#material: 6 0 1 0 half_space
#waveform: ricker 1 1.5e9 my_ricker
#hertzian_dipole: z 0.040 0.170 0 my_ricker
#rx: 0.080 ... |
dsquareindia/gensim | docs/notebooks/sklearn_wrapper.ipynb | lgpl-2.1 | from gensim.sklearn_integration.sklearn_wrapper_gensim_ldaModel import SklearnWrapperLdaModel
"""
Explanation: Using wrappers for Scikit learn API
This tutorial is about using gensim models as a part of your scikit learn workflow with the help of wrappers found at gensim.sklearn_integration.sklearn_wrapper_gensim_ldaM... |
estnltk/episode-miner | docs/Winepi.ipynb | gpl-2.0 | from episode_miner import Event, EventSequence, EventSequences, Episode, Episodes
from pprint import pprint
sequence_of_events = (Event('a', 1), Event('b', 2), Event('a', 3), Event('a', 5), Event('b', 8))
event_sequences = EventSequences(sequence_of_events=sequence_of_events, start=0, end=9)
frequent_episodes = event... |
ivannz/study_notes | year_14_15/spring_2015/netwrok_analysis/notebooks/assignments/networks_ha1.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import numpy.linalg as la
from scipy.stats import rankdata
%matplotlib inline
## Construct a regression model
def lm_model( X, Y, intercept = True ) :
T = np.array( Y, dtype = float )
M = np.array( X, dtype = float )
if intercept is True :
M = np.v... |
aidiary/notebooks | pytorch/180209-dogs-vs-cats.ipynb | mit | mkdir
%matplotlib inline
"""
Explanation: Dogs vs Cats
https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html
https://www.kaggle.com/c/dogs-vs-cats-redux-kernels-edition
http://aidiary.hatenablog.com/entry/20170108/1483876657
http://aidiary.hatenablog.com/entry/20170603/14964... |
wavelets/pydata_ninja | PyData Ninja.ipynb | mit | 3 * 4
"""
Explanation: <center>
<h1>Introduction to Data Analysis with Python</h1>
<br>
<h3>Dr. Thomas Wiecki</h3>
<br>
<h3>Lead Data Scientist</h3>
<img width=40% src="http://i2.wp.com/stuffled.com/wp-content/uploads/2014/09/Quantopian-Logo-EPS-vector-image.png?resize=1020%2C680">
</center>
<img src="http://cdn.nutan... |
jegibbs/phys202-2015-work | assignments/assignment03/NumpyEx01.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import antipackage
import github.ellisonbg.misc.vizarray as va
"""
Explanation: Numpy Exercise 1
Imports
End of explanation
"""
def checkerboard(size):
a = np.zeros((size,size))
a[0::2,::2] = 1
a[1::2,1::2] = 1
... |
jtwhite79/pyemu | examples/errvarexample_freyberg.ipynb | bsd-3-clause | import flopy
# load the model
model_ws = os.path.join("Freyberg","extra_crispy")
ml = flopy.modflow.Modflow.load("freyberg.nam",model_ws=model_ws)
# Because this model is old -- it predates flopy's modelgrid implementation.
# And because modelgrid has been implemented without backward compatability
# the modelgrid ... |
qkitgroup/qkit | qkit/doc/notebooks/spectroscopy_measurement_basics.ipynb | gpl-2.0 | # start qkit and import the needed modules. we here assume an already configured qkit measurement environment
import qkit
qkit.start()
from qkit.measure.spectroscopy import spectroscopy
import qkit.measure.samples_class as sc
import numpy as np
# initialize instruments; as an example we here work with a Keysight VNA... |
mne-tools/mne-tools.github.io | stable/_downloads/98d9662291626be9c938eee7a8fcc9bd/sensor_noise_level.ipynb | bsd-3-clause | # Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import mne
data_path = mne.datasets.sample.data_path()
raw_erm = mne.io.read_raw_fif(op.join(data_path, 'MEG', 'sample',
'ernoise_raw.fif'), preload=True)
"""
Explanation: Show noise ... |
karlstroetmann/Artificial-Intelligence | Python/5 Linear Regression/Corona.ipynb | gpl-2.0 | num_cases = [16, 19, 24, 53, 66, 117, 150, 188, 240, 349, 534, 684, 847, 1112, 1565, 1966, 2745, 3675]
"""
Explanation: Predicting the Spread of Covid-19 with Linear Regression
The array num_cases contains the number of cases on successive days in the time period from February, the 25th up to the 13th of March 2020, i... |
mjcollin/ml_ocr | results/analize_results.ipynb | mit | df_test = df[(df["is_test"] == True)]
df_test["prediction"] = predictions
#print df_test.head()
# Compare the percent correct to the results from earlier to make sure things are lined up right
print "Calculated accuracy:", sum(df_test["label"] == df_test["prediction"]) / float(len(df_test))
print "Model accuracy:", bes... |
matmodlab/matmodlab2 | notebooks/UserMaterials.ipynb | bsd-3-clause | %pycat ../matmodlab2/materials/elastic3.py
%pylab inline
from matmodlab2 import *
"""
Explanation: User Defined Materials
Overview
Materials are implemented by subclassing the matmodlab.core.Material base class. The user material is called at each frame of every step. It is provided with the material state at the st... |
ALEXKIRNAS/DataScience | Coursera/Machine-learning-data-analysis/Course 1/Central-Limit-Theorem.ipynb | mit | def build_plot(n, subsets_num):
values = np.random.triangular(0, 0.5, 1, size = (subsets_num,n))
means = np.sort(np.sum(values, axis = 1) / n)
fit = norm.pdf(means, 0.5, np.sqrt(1./(24 * n))) # <=========== Theoretical distribution
plt.xlabel('x')
plt.ylabel('f(x)')
plt.plot(means, fi... |
tanghaibao/goatools | notebooks/parent_go_terms.ipynb | bsd-2-clause | from goatools.base import get_godag
godag = get_godag('go-basic.obo', optional_attrs='relationship')
"""
Explanation: How to extract information from parent GO terms
1) Load the GO DAG
2) Pick a GO term and visualize
2a) Print GO information
2b) Plot GO term
3. Find GO parents for numerous GO IDs
3a. Find GO parents ... |
mathcoding/Programmazione2 | Introduzione a Python - Prima parte.ipynb | mit | x=1
print(x)
type(x)
print(x, type(x))
y=2
z=(x+y)**2 * 3
print("x =", x, ", y =", y, ", z =", z)
"""
Explanation: NOTA: si consiglia di eseguire una riga alla volta di questo notebook, come fatto a lezione, cercando di capire sia cosa fa ciascuna funzione, sia soprattutto cercando di capire gli eventuali messaggi... |
JoseGuzman/myIPythonNotebooks | MachineLearning/KMC.ipynb | gpl-2.0 | %pylab inline
import matplotlib
#matplotlib.rc('xtick', labelsize=20)
#matplotlib.rc('ytick', labelsize=20)
from scipy.spatial import distance
"""
Explanation: <H1>K-means clustering (KMC) algorithm </H1>
<P>
Given a set $X$ of $n$ observations; $X = \{x_1, x_2, \cdots, x_n\}$, where every $i$ observation is a vec... |
arnau/blog | notes/sqlite-python/sqlite-python-basics.ipynb | unlicense | import sqlite3
import os
conn = sqlite3.connect("sqlite-python-basics.sqlite")
cur = conn.cursor()
"""
Explanation: SQLite with Python (Basics)
The standard Python distribution ships with a basic SQLite3 inteface.
Connect to a database
Import the sqlite3 module, create a connection and open a cursor to operate on the... |
NathanYee/ThinkBayes2 | bayesianLinearRegression/Final Report.ipynb | gpl-2.0 | from __future__ import print_function, division
% matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import math
import numpy as np
from thinkbayes2 import Pmf, Cdf, Suite, Joint, EvalNormalPdf
import thinkplot
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Computational Bayes... |
metpy/MetPy | v0.7/_downloads/Inverse_Distance_Verification.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import cKDTree
from scipy.spatial.distance import cdist
from metpy.gridding.gridding_functions import calc_kappa
from metpy.gridding.interpolation import barnes_point, cressman_point
from metpy.gridding.triangles import dist_2
plt.rcParams['figure.... |
stevetjoa/stanford-mir | dp.ipynb | mit | def min_coin_sum(val, coins=None):
if coins is None:
coins = [1, 5, 10, 25]
if val == 0:
return 0
return 1 + min(min_coin_sum(val-coin) for coin in coins if val-coin >= 0)
"""
Explanation: ← Back to Index
Dynamic Programming
Dynamic programming (Wikipedia; FMP, p. 137) is a method for ... |
cfjhallgren/shogun | doc/ipython-notebooks/classification/SupportVectorMachines.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
%matplotlib inline
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
import matplotlib.patches as patches
#To import all shogun classes
import shogun as sg
import numpy as np
#Generate some random data
X = 2 * np.random.randn(10,2)
traindata=np.r_[X + 3, X + 7].T
... |
darioizzo/d-CGP | doc/sphinx/notebooks/learning_constants.ipynb | gpl-3.0 | from dcgpy import expression_gdual_vdouble as expression
from dcgpy import kernel_set_gdual_vdouble as kernel_set
from pyaudi import gdual_vdouble as gdual
import pyaudi
from matplotlib import pyplot as plt
import numpy as np
from random import randint
%matplotlib inline
"""
Explanation: Learning constants in a symbol... |
joandamerow/lit-mining-occurrencedb | notebooks/classifiers_01_preprocess.ipynb | isc | import os
from os.path import join, basename, splitext
import subprocess
from glob import glob
from shutil import copy
from random import shuffle, seed
from pyzotero import zotero
from lib.secrets import CORRECTED_PAPERS_DATASET, USER_KEY
output_dir = join('data', 'pdf')
"""
Explanation: Get files from Zotero
End o... |
dsevilla/bdge | hbase/sesion5.ipynb | mit | from pprint import pprint as pp
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
matplotlib.style.use('ggplot')
"""
Explanation: NoSQL (HBase) (sesión 5)
Esta hoja muestra cómo acceder a bases de datos HBase y también a conectar la salida con Jupyter.
Se puede utilizar el shel... |
wangg12/caffe | examples/03-fine-tuning.ipynb | bsd-2-clause | import os
os.chdir('..')
import sys
sys.path.insert(0, './python')
import caffe
import numpy as np
from pylab import *
%matplotlib inline
# This downloads the ilsvrc auxiliary data (mean file, etc),
# and a subset of 2000 images for the style recognition task.
!data/ilsvrc12/get_ilsvrc_aux.sh
!scripts/download_model_... |
matthewfeickert/Behnke-Data-Analysis-in-HEP | Notebooks/Chapter01/Exercise-1.5-py.ipynb | mit | import math
import numpy as np
from scipy import special as special
%matplotlib inline
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from prettytable import PrettyTable
"""
Explanation: Data Analysis in High Energy Physics: Exercise 1.5 $p$-values
Find the number of standard deviations corresponding t... |
qutip/qutip-notebooks | examples/qip-processor-DJ-algorithm.ipynb | lgpl-3.0 | import numpy as np
from qutip_qip.device import OptPulseProcessor, LinearSpinChain, SpinChainModel, SCQubits
from qutip_qip.circuit import QubitCircuit
from qutip import sigmaz, sigmax, identity, tensor, basis, ptrace
qc = QubitCircuit(N=3)
qc.add_gate("X", targets=2)
qc.add_gate("SNOT", targets=0)
qc.add_gate("SNOT",... |
TomTranter/OpenPNM | examples/simulations/Capillary Pressure Curves.ipynb | mit | import numpy as np
import openpnm as op
np.random.seed(10)
ws = op.Workspace()
ws.settings["loglevel"] = 40
np.set_printoptions(precision=5)
"""
Explanation: Simulating capillary pressure curves using Porosimetry
Start by importing OpenPNM.
End of explanation
"""
pn = op.network.Cubic(shape=[20, 20, 20], spacing=0.0... |
benkoo/fast_ai_coursenotes | deeplearning1/nbs/statefarm.ipynb | apache-2.0 | from theano.sandbox import cuda
cuda.use('gpu0')
%matplotlib inline
from __future__ import print_function, division
path = "data/state/"
#path = "data/state/sample/"
import utils; reload(utils)
from utils import *
from IPython.display import FileLink
batch_size=64
"""
Explanation: Enter State Farm
End of explanation... |
agmarrugo/sensors-actuators | notebooks/Ex6_4_evaluation_force_sensor.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
F = np.array([50,100,150,200,250,300,350,400,450,500,550,600,650])
R = np.array([500,256.4,169.5,144.9,125,100,95.2,78.1,71.4,65.8,59.9,60,55.9])
plt.plot(R,F,'*')
plt.ylabel('R [Omega]')
plt.xlabel('Force [N]')
plt.show()
"""
Explanation: Evalu... |
DaveBackus/Data_Bootcamp | Code/Lab/Regression_statsmodels_LeBlanc.ipynb | mit | import pandas as pd #This is Pandas, we'll call it 'pd' for short
import statsmodels.formula.api as smf #This is the linear regression program
"""
The following reads in the .csv file and saves it as a dataframe we call 'df'. You can read in other files
besides .csv, too. For example, .xls can... |
MaxYousif/Data-Science-MSc-Projects | SVM Binary Classification.ipynb | mit | #Import Relevant Modules and Packages
import pandas as pd
import numpy as np
from sklearn.svm import SVC
from sklearn import metrics
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn import preprocessing
from sklearn.model_selection import GridSearch... |
NervanaSystems/neon_course | 06 Deep Residual Network.ipynb | apache-2.0 | # Start by generating the backend:
from neon.backends import gen_backend
be = gen_backend(backend='gpu',
batch_size=128)
"""
Explanation: Tutorial: Classifying tiny images with a Convolutional Neural Network
Outline
This interactive notebook shows how to do image classification with a Con... |
mdiaz236/DeepLearningFoundations | 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... |
karlstroetmann/Algorithms | Python/Chapter-09/Huffman.ipynb | gpl-2.0 | import graphviz as gv
"""
Explanation: Huffman's Algorithm for Lossless Data Compression
End of explanation
"""
class CodingTree:
sNodeCount = 0
def __init__(self):
CodingTree.sNodeCount += 1
self.mID = CodingTree.sNodeCount
def count(self):
"compute the number of ch... |
xmnlab/skdata | notebooks/SkDataWidget.ipynb | mit | from IPython.display import Image
from skdata.widgets import SkDataWidget
from skdata import SkData
"""
Explanation: # Table of Contents
<div class="toc" style="margin-top: 1em;"><ul class="toc-item" id="toc-level0"><li><span><a href="http://localhost:8888/notebooks/SkDataWidget.ipynb#Load-data-to-the-analysis-and-vis... |
magwenelab/mini-term-2016 | Bio311-ODE-modeling-network-motifs.ipynb | cc0-1.0 | # import statements to make numeric and plotting functions available
%matplotlib inline
from numpy import *
from matplotlib.pyplot import *
def hill_activating(X, B, K, n):
""" Hill function for an activator"""
return (B * X**n)/(K**n + X**n)
"""
Explanation: Modeling Gene Networks Using Ordinary Differentia... |
keras-team/keras-io | guides/ipynb/sequential_model.ipynb | apache-2.0 | import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
"""
Explanation: The Sequential model
Author: fchollet<br>
Date created: 2020/04/12<br>
Last modified: 2020/04/12<br>
Description: Complete guide to the Sequential model.
Setup
End of explanation
"""
# Define Sequential model wi... |
mne-tools/mne-tools.github.io | stable/_downloads/27d6cff3f645408158cdf4f3f05a21b6/30_eeg_erp.ipynb | bsd-3-clause | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_filt-0-40_raw.fif')
raw = mne.io.read_raw_fif(samp... |
gammapy/PyGamma15 | tutorials/analysis-stats/TutorialSolutions.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Tutorial about statistical methods
The following contains a sequence of simple exercises, designed to get familiar with using Minuit for maximum likelihood fits and emcee to determine parameters by MCMC. Commands are generally comme... |
drericstrong/Blog | 20161228_PointBuyVsRandomRolls.ipynb | agpl-3.0 | from tabulate import tabulate
# We will use the value mapping later as a lookup dictionary
vmap = {3:-16, 4:-12, 5:-9, 6:-6, 7:-4, 8:-2,
9:-1, 10:0, 11:1, 12:2, 13:3, 14:5,
15:7, 16:10, 17:13, 18:17}
# However, we want to actually display the mapping above, so let's
# convert the dictionary to a list ... |
statsmodels/statsmodels.github.io | v0.13.2/examples/notebooks/generated/statespace_varmax.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
dta = sm.datasets.webuse('lutkepohl2', 'https://www.stata-press.com/data/r12/')
dta.index = dta.qtr
dta.index.freq = dta.index.inferred_freq
endog = dta.loc['1960-04-01':'1978-10-01', ['dln_inv', 'dl... |
aliakbars/uai-ai | scripts/tugas3.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
plt.rcParams = plt.rcParamsOrig
"""
Explanation: Artificial Intelligence & Machine Learning
Tugas 3: Search & Reinforcement Learning
Mekanisme
Anda hanya diwajibkan untuk mengumpulkan file ini saja ke uploader yang disediakan... |
dipanjanS/BerkeleyX-CS100.1x-Big-Data-with-Apache-Spark | Week 2 - Introduction to Apache Spark/lab1_word_count_student.ipynb | mit | wordsList = ['cat', 'elephant', 'rat', 'rat', 'cat']
wordsRDD = sc.parallelize(wordsList, 4)
# Print out the type of wordsRDD
print type(wordsRDD)
"""
Explanation: +
Word Count Lab: Building a word count application
This lab will build on the techniques covered in the Spark tutorial to develop a simple word count app... |
badlands-model/BayesLands | Examples/regridInput.ipynb | gpl-3.0 | import sys
print(sys.version)
print(sys.executable)
%matplotlib inline
# Import badlands grid generation toolbox
import pybadlands_companion.resizeInput as resize
"""
Explanation: Regridding input data to higher resolution
The initial resolution of the input file is used as the higher resolution that Badlands model ... |
karlstroetmann/Algorithms | Python/Chapter-07/Binary-Tries-Frame.ipynb | gpl-2.0 | import graphviz as gv
"""
Explanation: Binary Tries
End of explanation
"""
class BinaryTrie:
sNodeCount = 0
def __init__(self):
BinaryTrie.sNodeCount += 1
self.mID = BinaryTrie.sNodeCount
def getID(self):
return self.mID # used only by graphviz
"""
Explanation: Thi... |
drericstrong/Blog | 20170204_FuzzyLogicLinearGaussian.ipynb | agpl-3.0 | import numpy as np
import skfuzzy as fuzz
import matplotlib.pyplot as plt
%matplotlib inline
x = np.arange(30, 100, 0.1)
## LINEAR
# Create the membership functions
x_cold_lin = fuzz.trimf(x, [30, 30, 50])
x_mild_lin = fuzz.trimf(x, [30, 50, 70])
x_warm_lin = fuzz.trimf(x, [50, 70, 100])
x_hot_lin = fuzz.trimf(x, [70,... |
ToqueWillot/M2DAC | FDMS/TME5/sklearn_t-SNE.ipynb | gpl-2.0 | from sklearn.manifold import TSNE
help(TSNE)
"""
Explanation: t-Distributed Stochastic Neighbor Embedding (t-SNE) in sklearn
t-SNE is a tool for data visualization. It reduces the dimensionality of data to 2 or 3 dimensions so that it can be plotted easily. Local similarities are preserved by this embedding.
t-SNE co... |
chetan51/nupic.research | projects/dynamic_sparse/notebooks/ExperimentAnalysis-Neurips-debug-hebbianGrowth.ipynb | gpl-3.0 | %load_ext autoreload
%autoreload 2
import sys
sys.path.append("../../")
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import glob
import tabulate
import pprint
import click
import numpy as np
import pandas as pd
from ray.tune.commands import *
... |
mathLab/RBniCS | tutorials/12_stokes/tutorial_stokes_2_pod.ipynb | lgpl-3.0 | from dolfin import *
from rbnics import *
from sampling import LinearlyDependentUniformDistribution
"""
Explanation: TUTORIAL 12 - Stokes Equations
Keywords: geometrical parametrization, POD-Galerkin method, mixed formulation, inf sup condition
1. Introduction
This tutorial addresses geometrical parametrization and th... |
irockafe/revo_healthcare | notebooks/HMDB/hmdb_isomers.ipynb | mit | # namespace - at the top of file. fucks with every tag.
# very annoying, so name all tags ns + tag
ns = '{http://www.hmdb.ca}'
nsmap = {None : ns}
# If you're within a metabolite tag
count = 0
seen_mass = 0
d = {}
for event, element in etree.iterparse(xml_file, tag=ns+'metabolite'):
tree = etree.ElementTree(element... |
petersaints/YanuX-Cruncher | YanuXCalculatorUserStudy.ipynb | gpl-3.0 | import numpy as np
from scipy import stats
import statsmodels.stats.proportion as smp
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Yanux Calculator
Imports
End of explanation
"""
def print_stats(data, hist_bins=10, hist_size=(8,4)):
print('--- Statistics ----')
display(data.describe()... |
ZwickyTransientFacility/ztf_sim | notebooks/plot_simulator_inputs.ipynb | bsd-3-clause | # hack to get the path right
import sys
sys.path.append('..')
import ztf_sim
from astropy.time import Time
import pandas as pd
import numpy as np
import astropy.units as u
import pylab as plt
import seaborn as sns
%matplotlib inline
sns.set_style('ticks')
sns.set_context('talk')
"""
Explanation: plot_simulator_input... |
PyladiesMx/Empezando-con-Python | 4. Lops/.ipynb_checkpoints/For Loops-checkpoint.ipynb | mit | #Obtén el cuadrado de 1
#Obtén el cuadrado de 2
#Obtén el cuadrado de 3
#Obtén el cuadrado de 4
#Obtén el cuadrado de 5
#Obtén el cuadrado de 6
#Obtén el cuadrado de 7
#Obtén el cuadrado de 8
#Obtén el cuadrado de 9
#Obtén el cuadrado de 10
"""
Explanation: Bienvenida a otra reunión de pyladies!!
Yo sé que de... |
vkuznet/rep | howto/04-howto-folding.ipynb | apache-2.0 | %pylab inline
"""
Explanation: About
This notebook demonstrates stacking machine learning algorithm - folding, which physicists use in their analysis.
End of explanation
"""
!cd toy_datasets; wget -O MiniBooNE_PID.txt -nc MiniBooNE_PID.txt https://archive.ics.uci.edu/ml/machine-learning-databases/00199/MiniBooNE_PID... |
dsacademybr/PythonFundamentos | Cap08/DesafioDSA_Solucao/Missao4/missao4.ipynb | gpl-3.0 | class SelectionSort(object):
def sort(self, data):
# Implemente aqui sua solução
"""
Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 7</font>
Download: http://github.com/dsacademybr
Missão 2: Implementar o Algoritmo de Ordenação "Selection sort".
Nível de Dificuldade: ... |
the-deep-learners/nyc-ds-academy | notebooks/point_by_point_intro_to_tensorflow.ipynb | mit | import numpy as np
np.random.seed(42)
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import tensorflow as tf
tf.set_random_seed(42)
"""
Explanation: Introduction to TensorFlow, fitting point by point
In this notebook, we introduce TensorFlow by fitting a line of the form y=m*x+b point by point.... |
BinRoot/TensorFlow-Book | ch02_basics/Concept09_queue.ipynb | mit | import tensorflow as tf
import numpy as np
"""
Explanation: Ch 02: Concept 09
Using Queues
If you have a lot of training data, you probably don't want to load it all into memory at once. The QueueRunner in TensorFlow is a tool to efficiently employ a queue data-structure in a multi-threaded way.
End of explanation
"""... |
statkclee/ThinkStats2 | code/chap01soln-kor.ipynb | gpl-3.0 | import nsfg
df = nsfg.ReadFemPreg()
df
"""
Explanation: 통계적 사고 (2판) 연습문제 (thinkstats2.com, think-stat.xwmooc.org)<br>
Allen Downey / 이광춘(xwMOOC)
End of explanation
"""
df.birthord.value_counts().sort_index()
"""
Explanation: <tt>birthord</tt>에 대한 빈도수를 출력하고 codebook 게시된 결과값과 비교하시오.
End of explanation
"""
df.prglng... |
pablovicente/python-tutorials | regular_expressions.ipynb | mit | import re
"""
Explanation: Regular Expressions
End of explanation
"""
# re.match(pattern, string, flags=0)
line = "Cats are smarter than dogs"
matchObj = re.match( r'(.*) are (.*?) .*', line, re.M|re.I)
if matchObj:
print "matchObj.group() : ", matchObj.group() #or matchObj.group(0)
print "matchObj.group... |
Vvkmnn/books | UdacityTensorflow/1_notmnist.ipynb | gpl-3.0 | # These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.line... |
ScoffM/ITESO-Word2Vec | Doc2Vec_PopCorn.ipynb | gpl-3.0 | import re
import random
import nltk.data
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
from nltk.corpus import stopwords
from gensim.models import Doc2Vec
from gensim.models.doc2vec import LabeledSentence
from sklearn.ensemble import RandomForestClassifier
#Loading the differents sets of data.
t... |
diging/tethne-notebooks | 7. A Closer Look at Corpora.ipynb | gpl-3.0 | from tethne.readers import wos
datapath = '/Users/erickpeirson/Downloads/datasets/wos'
corpus = wos.read(datapath)
"""
Explanation: 7. A Closer Look at Corpora
A Corpus is a collection of Papers with superpowers. Most importantly, it provides a consistent way of indexing bibliographic records. Indexing is important, b... |
interedition/paceofchange | defactoring-pace-of-change.ipynb | mit | ### DEFACTORING IMPORT
import os
import csv
import random
from collections import Counter
import numpy as np
import pandas as pd
#from multiprocessing import Pool
### Defactoring Import
from multiprocess import Pool
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.linear_model import Logist... |
migueldiascosta/pymatgen | examples/Plotting a Pourbaix Diagram.ipynb | mit | from pymatgen.matproj.rest import MPRester
from pymatgen.core.ion import Ion
from pymatgen import Element
from pymatgen.phasediagram.pdmaker import PhaseDiagram
from pymatgen.analysis.pourbaix.entry import PourbaixEntry, IonEntry
from pymatgen.analysis.pourbaix.maker import PourbaixDiagram
from pymatgen.analysis.pourb... |
massimo-nocentini/on-python | UniFiCourseSpring2020/numpy.ipynb | mit | __AUTHORS__ = {'am': ("Andrea Marino",
"andrea.marino@unifi.it",),
'mn': ("Massimo Nocentini",
"massimo.nocentini@unifi.it",
"https://github.com/massimo-nocentini/",)}
__KEYWORDS__ = ['Python', 'numpy', 'numerical', 'data',]
"""
Expla... |
rasbt/pattern_classification | data_viz/model-evaluation-articles/iris-random-dist.ipynb | gpl-3.0 | %matplotlib inline
"""
Explanation: This Jupyter notebook contains the code to create the data visualizations for the article "Model evaluation, model selection, and algorithm selection in machine learning - Part I"
at http://sebastianraschka.com/blog/2016/model-evaluation-selection-part1.html.
End of explanation
"""
... |
pacoqueen/ginn | extra/install/ipython2/ipython-5.10.0/examples/IPython Kernel/Animations Using clear_output.ipynb | gpl-2.0 | import sys
import time
from IPython.display import display, clear_output
for i in range(10):
time.sleep(0.25)
clear_output(wait=True)
print(i)
sys.stdout.flush()
"""
Explanation: Simple Animations Using clear_output
Sometimes you want to clear the output area in the middle of a calculation. This can ... |
unnati-xyz/intro-python-data-science | hard-disk/Explore.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
%matplotlib inline
plt.style.use('ggplot')
plt.rcParams['figure.figsize']=15,10
df = pd.read_csv('data/data.csv')
"""
Explanation: <img style="float:center" src="img/explore.jpg" width=300/>
Exploring the data
When we look a... |
sdpython/pyquickhelper | _unittests/ut_helpgen/data/TD_2A_Eco_Web_Scraping.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: Web-Scraping
Sous ce nom se cache une pratique très utile pour toute personne souhaitant travailler sur des informations disponibles en ligne, mais n'existant pas forcément sous la forme d'un tableau Excel ...
Le webscraping est une techn... |
ndanielsen/dc_parking_violations_data | notebooks/Top 15 Violations by Revenue And Total for VA.ipynb | mit | dc_df = df[(df.rp_plate_state.isin(['VA']))]
dc_fines = dc_df.groupby(['violation_code']).fine.sum().reset_index('violation_code')
fine_codes_15 = dc_fines.sort_values(by='fine', ascending=False)[:15]
top_codes = dc_df[dc_df.violation_code.isin(fine_codes_15.violation_code)]
top_violation_by_state = top_codes.groupby... |
akutuzov/gensim | docs/notebooks/Word2Vec_FastText_Comparison.ipynb | lgpl-2.1 | import nltk
nltk.download('brown')
# Only the brown corpus is needed in case you don't have it.
# Generate brown corpus text file
with open('brown_corp.txt', 'w+') as f:
for word in nltk.corpus.brown.words():
f.write('{word} '.format(word=word))
# Make sure you set FT_HOME to your fastText directory root... |
MadsJensen/intro_to_scientific_computing | src/00-Solutions-to-exercises.ipynb | bsd-3-clause | def my_power_func(base, pwr=2):
return(base**pwr)
"""
Explanation: Solutions to exercises
Building blocks
Function arguments
End of explanation
"""
import html # part of the Python 3 standard library
with open('nobel-prize-winners.csv', 'rt') as fp:
orig = fp.read() # read the entire file as a single hunk ... |
quiltdata/quilt-compiler | docs/Walkthrough/Editing a Package.ipynb | apache-2.0 | import quilt3
p = quilt3.Package()
"""
Explanation: Data in Quilt is organized in terms of data packages. A data package is a logical group of files, directories, and metadata.
Initializing a package
To edit a new empty package, use the package constructor:
End of explanation
"""
quilt3.Package.install(
"example... |
sot/aimpoint_mon | fit_aimpoint_drift-2018-11.ipynb | bsd-2-clause | import re
import tables
import matplotlib.pyplot as plt
import numpy as np
from astropy.time import Time
from astropy.table import Table
import Ska.engarchive.fetch_eng as fetch
from Ska.engarchive import fetch_sci
from Chandra.Time import DateTime
from Ska.Numpy import interpolate
from kadi import events
from sherpa ... |
ML4DS/ML4all | U2.SpectralClustering/SpecClustering_professor.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
# use seaborn plotting defaults
import seaborn as sns; sns.set()
from sklearn.cluster import KMeans
from sklearn.datasets.samples_generator import make_blobs, make_circles
from sklearn.utils import shuffle
from sklearn.metri... |
carltoews/tennis | results/DI_plot2.ipynb | gpl-3.0 | from IPython.display import display, HTML
display(HTML('''<img src="image2.png",width=800,height=500">'''))
"""
Explanation: Plot 1: Rate on investment under different betting strategies
End of explanation
"""
import numpy as np # numerical libraries
import pandas as pd # for data analysis
import matplotlib as mpl #... |
y2ee201/Deep-Learning-Nanodegree | sentiment_network/Sentiment Classification - How to Best Frame a Problem for a Neural Network (Project 2).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()... |
transcranial/keras-js | notebooks/layers/pooling/AveragePooling3D.ipynb | mit | data_in_shape = (4, 4, 4, 2)
L = AveragePooling3D(pool_size=(2, 2, 2), strides=None, padding='valid', data_format='channels_last')
layer_0 = Input(shape=data_in_shape)
layer_1 = L(layer_0)
model = Model(inputs=layer_0, outputs=layer_1)
# set weights to random (use seed for reproducibility)
np.random.seed(290)
data_in... |
dschick/udkm1Dsimpy | docs/source/examples/phonons.ipynb | gpl-3.0 | import udkm1Dsim as ud
u = ud.u # import the pint unit registry from udkm1Dsim
import scipy.constants as constants
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
u.setup_matplotlib() # use matplotlib with pint units
"""
Explanation: Phonons
In this example coherent acoustic phonon dynamics are... |
edeno/Jadhav-2016-Data-Analysis | notebooks/2017_06_14_Test_Spectral_Single_Session.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import xarray as xr
from src.data_processing import (get_LFP_dataframe, make_tetrode_dataframe,
make_tetrode_pair_info, reshape_to_segments)
from src.parameters import (ANIMALS, SAMPLING_FREQUE... |
mcocdawc/chemcoord | Tutorial/Advanced_customisation.ipynb | lgpl-3.0 | cc.configuration.settings
"""
Explanation: Settings
Settings can be seen here:
End of explanation
"""
cc.configuration.write_configuration_file('./example_configuration_file', overwrite=True)
%less example_configuration_file
"""
Explanation: A configuration file can be written with:
End of explanation
"""
!rm ex... |
albahnsen/CostSensitiveClassification | doc/tutorials/slides_edcs_fraud_detection.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
from costcla import datasets
from costcla.datasets.base import Bunch
def load_fraud(cost_mat_parameters=dict(Ca=10)):
# data_ = pd.read_pickle("trx_fraud_data.pk")
data_ = pd.read_pickle("/home/al/DriveAl/EasySol/Projects/DetectTA/Tests/trx_fraud_data_v3_agg.pk")
targ... |
intel-analytics/analytics-zoo | apps/recommendation-wide-n-deep/wide_n_deep.ipynb | apache-2.0 | from zoo.models.recommendation import *
from zoo.models.recommendation.utils import *
from zoo.common.nncontext import init_nncontext
import os
import sys
import datetime as dt
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
%pylab inline
"""
Explanation: Wide & Deep Recommender Demo
Wide and ... |
nick-youngblut/SIPSim | ipynb/bac_genome/OTU-level_variability/p5_NCBI_comp-gen_OTU-ampFrag-GC.ipynb | mit | import os
workDir = '/var/seq_data/ncbi_db/genome/Jan2016/ampFragsGC/'
ampFragFile = '/var/seq_data/ncbi_db/genome/Jan2016/ampFrags_KDE.pkl'
otuFile = '/var/seq_data/ncbi_db/genome/Jan2016/rnammer_aln/otusn_map_nonSingle.txt'
"""
Explanation: Goal
simulating amplicon fragments for genomes in non-singleton OTUs
Sett... |
AlJohri/DAT-DC-12 | notebooks/kobe.ipynb | mit | kobe = pd.read_csv('../data/kobe.csv')
"""
Explanation: Read in the Kobe Bryant shooting data [https://www.kaggle.com/c/kobe-bryant-shot-selection]
End of explanation
"""
[(col, dtype) for col, dtype in zip(kobe.columns, kobe.dtypes) if dtype != 'object']
num_columns = [col for col, dtype in zip(kobe.columns, kobe.d... |
tpin3694/tpin3694.github.io | regex/match_email_addresses.ipynb | mit | # Load regex package
import re
"""
Explanation: Title: Match Email Addresses
Slug: match_email_addresses
Summary: Match Email Addresses
Date: 2016-05-01 12:00
Category: Regex
Tags: Basics
Authors: Chris Albon
Based on: StackOverflow
Preliminaries
End of explanation
"""
# Create a variable containing a text string
... |
google/jax-md | notebooks/athermal_linear_elasticity.ipynb | apache-2.0 | #@title Imports and utility code
!pip install jax-md
import numpy as onp
import jax.numpy as jnp
from jax.config import config
config.update('jax_enable_x64', True)
from jax import random
from jax import jit, lax, grad, vmap
import jax.scipy as jsp
from jax_md import space, energy, smap, minimize, util, elasticity,... |
tensorflow/docs-l10n | site/zh-cn/quantum/tutorials/mnist.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... |
BadWizard/Inflation | Market-Based-Expectations/get-raw-data.ipynb | mit | df_raw.tail()
def getForward(v,t1=1,t2=2):
return (np.power(np.power(1+v[1]/100,t2)/np.power(1+v[0]/100,t1),1/(t2-t1))-1)*100
ind1 = 0
ind2 = 1
v2 = df_raw.iloc[-1,ind2]
v1 = df_raw.iloc[-1,ind1]
t1 = int(df_raw.columns[ind1].strip('y'))
t2 = int(df_raw.columns[ind2].strip('y'))
print('v1 is {}, v2 is {}'.format(... |
sdpython/ensae_teaching_cs | _doc/notebooks/td2a_ml/td2a_sentiment_analysis.ipynb | mit | %matplotlib inline
from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 2A.ml - Analyse de sentiments
C'est désormais un problème classique de machine learning. D'un côté, du texte, de l'autre une appréciation, le plus souvent binaire, positive ou négative mais qui pourrait être graduelle.... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/sandbox-1/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'sandbox-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: NERC
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Transport, Emissions, Conce... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_sensor_connectivity.ipynb | bsd-3-clause | # Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import numpy as np
from scipy import linalg
import mne
from mne import io
from mne.connectivity import spectral_connectivity
from mne.datasets import sample
print(__doc__)
"""
Explanation: Compute all-to-all connectivity in sensor spa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.