repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
spacecowboy/article-annriskgroups-source | DataSetStratification.ipynb | gpl-3.0 | import datasets as ds
import pandas as pd
import numpy as np
"""
Explanation: Data set stratification
This script randomly assigns training/test labels to each entry in a data set.
One quarter (1/4) of the data is assigned as test, and rest as training. The labeling
is stratified for censoring so that both testing and... |
mne-tools/mne-tools.github.io | 0.23/_downloads/8fdd7a9ad9a4bab4331f7c5da5e3bb1a/define_target_events.ipynb | bsd-3-clause | # Authors: Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne import io
from mne.event import define_target_events
from mne.datasets import sample
import matplotlib.pyplot as plt
print(__doc__)
data_path = sample.data_path()
"""
Explanation: Define target events based on time ... |
joelagnel/lisa | ipynb/tests/Frequency_Invariance_Test.ipynb | apache-2.0 | %matplotlib inline
import pandas as pd
import json
from trace import Trace
from trappy.plotter import plot_trace
from trappy.stats.grammar import Parser
from trappy import ILinePlot
import logging
from conf import LisaLogging
LisaLogging.setup()
logging.getLogger('Analysis').setLevel(logging.ERROR)
logging.getLogger... |
WNoxchi/Kaukasos | FAI02_old/Lesson9/neural-style-GPU.ipynb | mit | %matplotlib inline
import importlib
import os, sys; sys.path.insert(1, os.path.join('../utils'))
from utils2 import *
import torch, torch.nn as nn, torch.nn.functional as F, torch.optim as optim
from torch.autograd import Variable
from torch.utils.serialization import load_lua
from torch.utils.data import DataLoader
f... |
bspalding/research_public | lectures/drafts/Trend models.ipynb | apache-2.0 | import numpy as np
import math
from statsmodels import regression
import statsmodels.api as sm
import matplotlib.pyplot as plt
start = '2010-01-01'
end = '2015-01-01'
asset = get_pricing('XLY', fields='price', start_date=start, end_date=end)
dates = asset.index
def linreg(X,Y):
# Running the linear regression
... |
whitead/numerical_stats | unit_17/lectures/lecture_2.ipynb | gpl-3.0 | %%HTML
<h3> A level-3 (smaller) heading</h3>
<p> This is a paragraph about HTML. HTML surprisingly only has about 5 elements you need to know: </p>
<ul>
<li> Paragraphs</li>
<li> breaks </li>
<li> lists </li>
<li> links </li>
<li> images </li>
<li> divs </li>
... |
Dans-labs/dariah | static/tools/country_compose/countries.ipynb | mit | EU_FILE = 'europe_countries.csv'
GEO_DIR = 'geojson'
COUNTRIES = 'all_countries.json'
OUTFILE = '../../../client/src/js/helpers/europe.geo.js'
CENTER_PRECISION = 1
import sys, collections, json
"""
Explanation: Building the country information files
The DARIAH app contains a visualization of the number of member coun... |
mne-tools/mne-tools.github.io | 0.23/_downloads/cf9b035ec9fdf9fb55b24e8c3a75ad55/psf_ctf_vertices.ipynb | bsd-3-clause | # Authors: Olaf Hauk <olaf.hauk@mrc-cbu.cam.ac.uk>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import mne
from mne.datasets import sample
from mne.minimum_norm import (make_inverse_resolution_matrix, get_cross_talk,
get_point_spread)
print(__do... |
flsantos/startup_acquisition_forecast | .ipynb_checkpoints/3_dataset_exploration-checkpoint.ipynb | mit | import pandas as pd
startups = pd.read_csv('data/startups_2.csv', index_col=0)
startups[:3]
"""
Explanation: Dataset Exploration
Here we'll be exploring how each of the features we have so far relates to the target variable "status"
Importing the dataset
End of explanation
"""
import seaborn as sns
import matplotlib... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_read_inverse.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
from mne.datasets import sample
from mne.minimum_norm import read_inverse_operator
print(__doc__)
data_path = sample.data_path()
fname = data_path
fname += '/MEG/sample/sample_audvis-meg-oct-6-meg-inv.fif'
inv = read_... |
MLKaufman/seq-annotator | seq_annotation.ipynb | mit | #load necessary modules
from Bio import SeqIO #reading and writing genbank files
from Bio import pairwise2 #alignments
#generation and output of .ape file
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import generic_dna
from Bio import SeqFeature
from Bio.SeqFeature import FeatureLocati... |
theislab/scanpy_usage | 180209_cell_cycle/cell_cycle.ipynb | bsd-3-clause | import scanpy.api as sc
sc.settings.verbosity = 3 # verbosity: errors (0), warnings (1), info (2), hints (3)
sc.settings.set_figure_params(dpi=80) # low dpi (dots per inch) yields small inline figures
sc.logging.print_version_and_date()
sc.logging.print_versions_dependencies_numerics()
"""
Explanation: Author: David... |
ITAM-DS/analisis-numerico-computo-cientifico | libro_optimizacion/temas/2.computo_matricial/2.1/Operaciones_y_transformaciones_basicas_del_Algebra_Lineal_Numerica.ipynb | apache-2.0 | import numpy as np
import math
np.set_printoptions(precision=3, suppress=True)
"""
Explanation: (OTBALN)=
2.1 Operaciones y transformaciones básicas del Álgebra Lineal Numérica
```{admonition} Notas para contenedor de docker:
Comando de docker para ejecución de la nota de forma local:
nota: cambiar <ruta a mi dire... |
phoebe-project/phoebe2-docs | 2.3/tutorials/constraints_custom.ipynb | gpl-3.0 | import phoebe
from phoebe import u
b = phoebe.default_binary()
"""
Explanation: Advanced: Custom Constraints
NOTE: support for custom constraints was fixed in PHOEBE 2.3.30. This notebook will fail to run on earlier versions.
Built-in Constraints are convenient as they automatically determine the correct expression ... |
krosaen/ml-study | basic-stats/birthday_problem.ipynb | mit | import random
from collections import defaultdict
def num_people_same_birthday(n):
bdays = defaultdict(int)
for i in range(n):
bdays[random.randrange(0, 365)] += 1
return len([k for (k, v) in bdays.items() if v > 1])
num_people_same_birthday(60)
"""
Explanation: Birthday problem simulated
Let... |
OSGeo-live/CesiumWidget | GSOC/notebooks/Access to Geospatial data/GDAL-OGR with Python.ipynb | apache-2.0 | from geographiclib.geodesic import Geodesic
lat1,lon1 = (40.7143528, -74.0059731) # New York, NY
lat2,lon2 = (1.359, 103.989) # Delhi, India
g = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2)
g
"""
Explanation: <h1><center>[Notebooks](../) - [Access to Geospatial data](../Access to Geospatial data)</center></h1>
... |
gth158a/NLP_event_classification | notebooks/DSCI 6003-6004 - Predicting top 3 categories.ipynb | mit | def multiplek(y_test, topk):
multik = []
for i, score in enumerate(y_test):
if y_test[i] in topk[i]:
multik.append(y_test[i])
else:
multik.append(topk[i][0])
return multik
"""
Explanation: Finalize model: Use Logistic Regression to recommend top 3 categories
After fi... |
kompgraf/course-material | notebooks/01-alapozas/01-alapozas.ipynb | mit | addScript("js/c0-parametric-continuity", "c0-parametric-continuity")
"""
Explanation: Alapozás
Görbék megadási módjai
Implicit alak
Az implicit alak a görbét alkotó pontokat egy teszt formájában adja meg, melynek segítségével el lehet dönteni, hogy egy adott pont rajta fekszik-e a görbén. Kétdimenziós esetben az impli... |
sbenthall/bigbang | examples/experimental_notebooks/Threads.ipynb | agpl-3.0 | url = "https://lists.wikimedia.org/pipermail/analytics/"
arx = Archive(url,archive_dir="../archives")
"""
Explanation: First, collect data from a public email archive.
End of explanation
"""
#threads = arx.get_threads()
len(arx.get_threads())
"""
Explanation: We can count the number of threads in the archive easily... |
ibm-cds-labs/pixiedust | notebook/data-load-samples/Load from S3 - Python.ipynb | apache-2.0 | import pixiedust
pixiedust.enableJobMonitor()
"""
Explanation: Loading data files from Amazon S3
You can load data files from Amazon S3 storage.
Prerequisites
Collect your Amazon S3 connection information:
access key
secret key
bucket name
file name
Import PixieDust and enable the Spark Job monitor
End of explan... |
martinjrobins/hobo | examples/toy/distribution-high-dimensional-gaussian.ipynb | bsd-3-clause | import pints
import pints.toy
import numpy as np
import matplotlib.pyplot as plt
# Create log pdf
log_pdf = pints.toy.HighDimensionalGaussianLogPDF(dimension=2)
# Contour plot of pdf
levels = np.linspace(-12, -1, 20)
x = np.linspace(-10, 10, 250)
y = np.linspace(-10, 10, 250)
X, Y = np.meshgrid(x, y)
Z = [[log_pdf([i... |
jhillairet/scikit-rf | doc/source/examples/circuit/Voltages and Currents in Circuits.ipynb | bsd-3-clause | %matplotlib inline
# standard imports
import numpy as np
import matplotlib.pyplot as plt
import skrf as rf
rf.stylely()
"""
Explanation: Voltages and Currents in Circuits
The scikit-rf Circuit object allows one to deduce the voltages and currents at all the intersections of the circuit for a given power (and phase) ... |
BrownDwarf/ApJdataFrames | notebooks/Grankin2008.ipynb | mit | import warnings
warnings.filterwarnings("ignore")
import pandas as pd
from astropy.io import ascii, votable, misc
"""
Explanation: ApJdataFrames
Grankin et al. 2008
Title: Results of the ROTOR-program
Authors: Grankin et al.
Data is from this paper:
http://www.aanda.org/articles/aa/full/2008/09/aa8476-07/aa8476... |
AllenDowney/ThinkBayes2 | examples/shower.ipynb | mit | def wait_time(x, other, lam, k):
term = (other / lam) ** k
total = lam * (x + term) ** (1/k)
return total
"""
Explanation: The Shower Problem
This notebook is one of the examples in the second edition of Think Bayes.
Click here to run this notebook on Colab.
Recently I posted an article about an optimal (m... |
karlstroetmann/Artificial-Intelligence | Python/1 Search/A-Star-Search-Path.ipynb | gpl-2.0 | import sys
sys.path.append('..')
import Set
"""
Explanation: A$^*$ Search
The module Set implements <em style="color:blue;">sets</em> as
<a href="https://en.wikipedia.org/wiki/AVL_tree">AVL trees</a>.
The API provided by Set offers the following functions and methods:
- Set() creates an empty set.
- S.isEmpty() check... |
ES-DOC/esdoc-jupyterhub | notebooks/bcc/cmip6/models/sandbox-2/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'bcc', 'sandbox-2', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: BCC
Source ID: SANDBOX-2
Topic: Ocean
Sub-Topics: Timestepping Framework, Advection, ... |
Open-Power-System-Data/conventional_power_plants | download_and_process_EU.ipynb | mit | import numpy as np
import pandas as pd
import os
import yaml
import json
import sqlite3
import hashlib
from download_and_process_functions import get_sha_hash
from download_and_process_functions import add_location_and_EIC
# create output folder if they do not exist
os.makedirs(os.path.join('output'), exist_ok=True)
... |
phoebe-project/phoebe2-docs | 2.0/tutorials/reflection_heating.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.0,<2.1"
"""
Explanation: Reflection and Heating
For a comparison between "Horvat" and "Wilson" methods in the "irad_method" parameter, see the tutorial on Lambert Scattering.
Setup
Let's first make sure we have the latest version of PHOEBE 2.0 installed. (You can comment out this line if you... |
NYUDataBootcamp/Projects | UG_S17/Luo-LeagueOfLegends.ipynb | mit | import os # to access system environment variables
import pandas as pd # data management
import seaborn as sns # for data visualization
import matplotlib.pyplot as plt # for plots
import s... |
nicoa/showcase | plotting/team_talk_170630_plots.ipynb | mit | """
Author: Piotr A. Zolnierczuk (zolnierczukp at ornl dot gov)
Based on a paper by:
Drawing an elephant with four complex parameters
Jurgen Mayer, Khaled Khairy, and Jonathon Howard,
Am. J. Phys. 78, 648 (2010), DOI:10.1119/1.3254017
"""
import numpy as np
import pylab
# elephant parameters
p1, p2, p3, p4 = (50 - ... |
LorenzoBi/courses | CQD/Project.ipynb | mit | from pylab import *
from copy import deepcopy
from matplotlib import animation, rc
from IPython.display import HTML
%matplotlib inline
rc('text', usetex=True)
font = {'family' : 'normal',
'weight' : 'bold',
'size' : 15}
matplotlib.rc('font', **font)
"""
Explanation: Computational Quantum Dynamics
(... |
gloriakang/vax-sentiment | jupyter_nbs/0_Gc.ipynb | mit | # 1_network_df
import networkx as nx
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import os
from glob import glob
plt.style.use('ggplot')
pd.set_option('display.width', 5000)
pd.set_option('display.max_columns', 60)
#gml_files = glob('../output/network/article_neg1.gml')... |
tuanavu/coursera-university-of-washington | machine_learning/2_regression/assignment/week4/week-4-ridge-regression-assignment-2-exercise.ipynb | mit | import sys
sys.path.append('C:\Anaconda2\envs\dato-env\Lib\site-packages')
import graphlab
"""
Explanation: Regression Week 4: Ridge Regression (gradient descent)
In this notebook, you will implement ridge regression via gradient descent. You will:
* Convert an SFrame into a Numpy array
* Write a Numpy function to com... |
StingraySoftware/notebooks | Powerspectrum/Powerspectrum_tutorial.ipynb | mit | %load_ext autoreload
%autoreload 2
import numpy as np
from stingray import Lightcurve, Powerspectrum, AveragedPowerspectrum
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
%matplotlib inline
font_prop = font_manager.FontProperties(size=16)
"""
Explanation: Power spectrum example
This tu... |
fermiPy/fermipy-extra | notebooks/gtools_customize.ipynb | bsd-3-clause | %matplotlib inline
import os
import numpy as np
from fermipy.gtanalysis import GTAnalysis
from fermipy.plotting import ROIPlotter, SEDPlotter
import matplotlib.pyplot as plt
import matplotlib
from IPython.display import Image
"""
Explanation: Configuring the model, running g-tools and output files and infos
This tuto... |
molgor/spystats | notebooks/.ipynb_checkpoints/Spatial Model Fitting using GLS-Copy2-checkpoint.ipynb | bsd-2-clause | # Load Biospytial modules and etc.
%matplotlib inline
import sys
sys.path.append('/apps')
sys.path.append('..')
sys.path.append('../spystats')
import django
django.setup()
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
## Use the ggplot style
plt.style.use('ggplot')
import tools
"""
Explanatio... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_time_frequency_multitaper_sensors.ipynb | bsd-3-clause | # Authors: Hari Bharadwaj <hari@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import numpy as np
import mne
from mne import io
from mne.time_frequency import tfr_multitaper
from mne.datasets import somato
print(__doc__)
"""
Explanation: Time-frequency analysis using multitaper method
This examples computes induc... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/feature_engineering/solutions/7_get_started_with_feature_store.ipynb | apache-2.0 | ONCE_ONLY = False
if ONCE_ONLY:
! pip3 install -U tensorflow==2.5 $USER_FLAG
! pip3 install -U tensorflow-data-validation==1.2 $USER_FLAG
! pip3 install -U tensorflow-transform==1.2 $USER_FLAG
! pip3 install -U tensorflow-io==0.18 $USER_FLAG
! pip3 install --upgrade google-cloud-aiplatform[tensorboa... |
EmuKit/emukit | notebooks/Emukit-tutorial-bayesian-optimization-context-variables.ipynb | apache-2.0 | from emukit.test_functions import branin_function
from emukit.core import ParameterSpace, ContinuousParameter, DiscreteParameter
from emukit.core.initial_designs import RandomDesign
from GPy.models import GPRegression
from emukit.model_wrappers import GPyModelWrapper
from emukit.bayesian_optimization.acquisitions impor... |
rb-roomba/ipython_notebook_practice | practice_notebook.ipynb | mit | print 1+2
"""
Explanation: IPython Notebookの練習
はじめに
IPython Notebookは、ブラウザ上でインタラクティブにPythonのプログラムを実行できる、ノートのようなものです。
10分で最低限を学びましょう。
セルについて
この領域も含めて、見出しや文章では基本的にMarkdown記法のセルを用いています。
リンク(Markdown-Wikipedia)
を挿入したり、強調したり、線をひいたり↓といったことが可能です。
「Code」のセルでは、Pythonをその場で実行することができます。
例えば、下のセルにカーソルを合わせた状態でShift-Enter(Shiftキーを押... |
nlauchande/panha | notebooks/minst/regularization.ipynb | mit | # Import TensorFlow and some other libraries we'll be using.
import datetime
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# Download the MNIST dataset onto the local machine.
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
"""
Explanation: DL Ind... |
davidthomas5412/PanglossNotebooks | MassLuminosityProject/SummerResearch/QuantifyingScalingAccuracy1_20170623.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from matplotlib import rc
from matplotlib import cm
import matplotlib.colors as colors
from bigmali.grid import Grid
from bigmali.likelihood import BiasedLikelihood
from bigmali.prior import TinkerPrior
from bigmali.hyperparameter... |
nwhidden/ND101-Deep-Learning | language-translation/dlnd_language_translation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
ChrisAndre/expsin | Exposin Project.ipynb | mit | '''
Plot an example transfer
'''
%matplotlib inline
from pylab import rcParams
rcParams['figure.figsize'] = 16, 12
import PyKEP
earth = PyKEP.planet.jpl_lp('earth')
mars = PyKEP.planet.jpl_lp('mars')
k2 = 0.6
n = -1
t0 = 250.0
tof = 520.0
lw = False
r1, v1 = earth.eph(PyKEP.epoch(t0,"mjd2000"))
r2, v2 = mars.eph(PyK... |
julienchastang/unidata-python-workshop | notebooks/NumPy/Intermediate NumPy.ipynb | mit | # Convention for import to get shortened namespace
import numpy as np
# Create an array for testing
a = np.arange(12).reshape(3, 4)
a
# This calculates the total of all values in the array
np.sum(a)
# Keep this in mind:
a.shape
# Instead, take the sum across the rows:
np.sum(a, axis=0)
# Or do the same and take th... |
Naereen/notebooks | Manual_implementation_of_some_hash_functions.ipynb | mit | class Hash(object):
""" Common class for all hash methods.
It copies the one of the hashlib module (https://docs.python.org/3.5/library/hashlib.html).
"""
def __init__(self, *args, **kwargs):
""" Create the Hash object."""
self.name = self.__class__.__name__ # https://docs.pyt... |
inkenbrandt/WellApplication | docs/.ipynb_checkpoints/UMAR_Chem_Compile-checkpoint.ipynb | mit | #rootname = "/media/p/5F5B-8FCB/PROJECTS/UMAR/Data/chem/" #thumb on ubuntu
rootname = "E:\\PROJECTS\\UMAR\\Data\\chem\\" #thumb on windows
WQPResultsFile = rootname + "result.csv"
WQPStationFile = rootname + "station.csv"
SDWISFile = rootname + "SDWIS_Cache.txt"
AGStationsFile = rootname + "AG_Stations_Cache.csv"
AGRe... |
dietmarw/EK5312_ElectricalMachines | Chapman/Ch1-Problem_1-19.ipynb | unlicense | %pylab notebook
%precision %.4g
"""
Explanation: Excercises Electric Machinery Fundamentals
Chapter 1
Problem 1-19
End of explanation
"""
V = 240 # [V]
Z1 = 10.0 * exp(1j* 30/180*pi)
Z2 = 10.0 * exp(1j* 45/180*pi)
Z3 = 10.0 * exp(1j*-90/180*pi)
"""
Explanation: Description
Figure P1-14 shows a simple single... |
dataventures/workshops | 2/Decision Trees and Random Forests.ipynb | mit | def breed(tail, height):
if tail > 25:
if height < 35:
return 'dachshund'
else:
return 'golden retriever'
elif tail < 15:
return 'poodle'
else:
return 'dunno'
"""
Explanation: Decision Trees and Random Forests
Suppose you're classifying dogs, and you ... |
uber-common/deck.gl | bindings/pydeck/examples/05 - Interacting with other Jupyter widgets.ipynb | mit | LIGHTS_URL = 'https://raw.githubusercontent.com/ajduberstein/lights_at_night/master/chengdu_lights_at_night.csv'
df = pd.read_csv(LIGHTS_URL)
df.head()
"""
Explanation: Plotting lights at night
NASA has collected global light emission data for over 30 years. The data set is a deeply fascinating one and has been used f... |
vbarua/PythonWorkshop | Code/Introduction To Python/4 - Conditionals and Looping.ipynb | mit | greek = ["Alpha", "Beta", "Gamma", "Delta"]
for element in greek:
print(element)
"""
Explanation: Looping and Conditionals
Looping
In Python the for keyword can be used to iterate over lists.
End of explanation
"""
for i, e in enumerate(greek):
print(e + " is at index: " + str(i))
"""
Explanation: Sometime... |
google-research/language | language/multiberts/multi_vs_original.ipynb | apache-2.0 | import json
import os
import re
import numpy as np
import pandas as pd
from tqdm.notebook import tqdm # for progress indicator
scratch_dir = "/tmp/multiberts_squad"
if not os.path.isdir(scratch_dir):
os.mkdir(scratch_dir)
preds_root = "https://storage.googleapis.com/multiberts/public/example-predictions/S... |
willettk/insight | notebooks/classifiers.ipynb | apache-2.0 | %matplotlib inline
# Setup - import some packages we'll need
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: IDX2016B - Week 2 presentations
Classifiers in machine learning - which should I choose and how do I use it?
Kyle Willett
14 June 2016
End of explanation
"""
from sklearn import datasets... |
eamanu/Titanic | Titanic Challenge.ipynb | gpl-2.0 | #%matplotlib inline
import warnings
warnings.filterwarnings("ignore")
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy import stats
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_cluster_stats_evoked.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.stats import permutation_cluster_test
from mne.datasets import sample
print(__doc__)
"""
Explanation: Permutation F-test on sensor data with 1D c... |
gaufung/Data_Analytics_Learning_Note | python-statatics-tutorial/advance-theme/Numpy-Advance.ipynb | mit | import numpy as np
x = np.array([1,2,3],dtype=np.int32)
x.data
str(x.data)
"""
Explanation: numpy 进阶
1 内存模块
End of explanation
"""
x.__array_interface__['data'][0]
"""
Explanation: 数值类型为np.int32,表明一个数字由四个字节表示,一个字节有8bit,而0x的十六进制中,一个数字代表了4个bit。
查看数据在内存中的位置
End of explanation
"""
x.__array_interface__
"""
Expla... |
nberliner/delveData | notebooks/Load migration data.ipynb | gpl-2.0 | %pylab inline
import sys
sys.path.insert(0,"../lib/")
import pandas as pd
from unhcrData import UNHCRdata
from oecdData import OECDdata
"""
Explanation: Loading the migration data
The Origin.
Migration data was obtained from two sources. The World Refugee Agency (UNHCR) and the Organisation for Economic Co-operatio... |
rreimche/infdiffusion | Diffusion of FAKE news.ipynb | mit | client = pymongo.MongoClient("46.101.236.181")
db = client.allfake
# get collection names
collections = sorted([collection for collection in db.collection_names()])
"""
Explanation: Init config
Select appropriate:
- database server (line 1): give pymongo.MongoClient() an appropriate parameter, else it is localhost
- ... |
ealogar/curso-python | sysadmin/0_Path_Management_Encoding.ipynb | apache-2.0 | import os
import os.path
import shutil
import errno
import glob
import sys
"""
Explanation: Path Management
Goal
Normalize paths on different platform
Create, copy and remove folders
Handle errors
Modules
End of explanation
"""
# Be python3 ready
from __future__ import unicode_literals, print_function
"""
Explana... |
steinam/teacher | jup_notebooks/data-science-ipython-notebooks-master/matplotlib/04.00-Introduction-To-Matplotlib.ipynb | mit | import matplotlib as mpl
import matplotlib.pyplot as plt
"""
Explanation: <!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png">
This notebook contains an excerpt from the Python Data Science Handbook by Jake VanderPlas; the content is available on GitHub.
The text is... |
phoebe-project/phoebe2-docs | 2.2/tutorials/eclipse.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: Eclipse Detection
Setup
Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""
%matplotlib inline
im... |
hanhanwu/Hanhan_Data_Science_Practice | Applied_Statistics/ABTest_Experiments/detailed_ABTest_Experiment.ipynb | mit | import pandas as pd
import math
import numpy as np
from scipy.stats import norm
"""
Explanation: Detailed A/B Test Experiment
Problem
There are 2 options for the landing page:
"start free trial"
If the visitor clicks this option, will be asked for credit card info, and after 14 days they will be charged automatically... |
yingchi/fastai-notes | deeplearning1/nbs/statefarm-sample-yc.ipynb | apache-2.0 | from theano.sandbox import cuda
cuda.use('gpu1')
%matplotlib inline
from __future__ import division, print_function
from importlib import reload
import utils; reload(utils)
from utils import *
from IPython.display import FileLink
path = 'data/state/sample/'
batch_size = 64
import os
"""
Explanation: Enter State Far... |
madsenmj/ml-introduction-course | Class07/Class07.ipynb | apache-2.0 | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("white")
#Note the new use of the dtype option here. We can directly tell pandas to use the Speed column as a category in one step.
speeddf = pd.read_csv("../Class04/Class04_speed_data.csv",dtype={'Speed':'category'})
#We'll use a... |
viblo/pymunk | examples/matplotlib_util_demo.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
#from matplotlib import animation
#from IPython.display import HTML
"""
Explanation: Import matplotlib.pyplot. Nothing special here
End of explanation
"""
import pymunk
from pymunk.vec2d import Vec2d
from shapes_for_draw_demos import fill_space
import pymunk.matplot... |
root-mirror/training | NCPSchool2021/Examples/TMVA_Higgs_Classification_py.ipynb | gpl-2.0 | import ROOT
from ROOT import TMVA
"""
Explanation: <img src="tmva_logo.gif" height="20%" width="20%">
TMVA Higgs Classification Example in Python
In this example we will still do Higgs classification but we will use together with the native TMVA methods also methods from Keras and scikit-learn.
End of explanation
"""
... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/09_sequence_keras/labs/temperatures.ipynb | apache-2.0 | import math
import sys
import time
import numpy as np
sys.path.insert(0, '../temperatures/utils/') #so python can find the utils_ modules
import utils_batching
import utils_args
import tensorflow as tf
from tensorflow.python.lib.io import file_io as gfile
print("Tensorflow version: " + tf.__version__)
from matplotli... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/gapic/custom/showcase_custom_image_classification_online_explain.ipynb | apache-2.0 | import os
import sys
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install -U google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex client library: Custom training image classification model for online prediction wit... |
jaduimstra/nilmtk | docs/manual/user_guide/elecmeter_and_metergroup.ipynb | apache-2.0 | from matplotlib import rcParams
import matplotlib.pyplot as plt
%matplotlib inline
rcParams['figure.figsize'] = (13, 6)
plt.style.use('ggplot')
from nilmtk import DataSet
redd = DataSet('/data/REDD/redd.h5')
elec = redd.buildings[1].elec
elec
"""
Explanation: MeterGroup, ElecMeter, selection and basic statistics
All... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/ols.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import statsmodels.api as sm
np.random.seed(9876789)
"""
Explanation: Ordinary Least Squares
End of explanation
"""
nsample = 100
x = np.linspace(0, 10, 100)
X = np.column_stack((x, x ** 2))
beta = np.array([1, 0.1, 10])
e = ... |
gwtsa/gwtsa | examples/notebooks/8_pastas_synthetic.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import gammainc, gammaincinv
import pandas as pd
import pastas as ps
"""
Explanation: Pastas Noise model
Developed by Stijn Klop and Mark Bakker
This Notebook contains a number of examples and tests with synthetic data. The purpos... |
JoaoFelipe/ipython-unittest | presentations/PyBR 2017.ipynb | mit | %load_ext ipython_unittest
def add(x, y):
return x + y
%%unittest
assert add(1, 1) == 2
assert add(1, 2) == 3
assert add(2, 2) == 4
%load_ext ipython_unittest
def fizzbuzz():
pass
%%unittest -p 1
assert fizzbuzz() == 0
import unittest
import sys
class JupyterTest(unittest.TestCase):
def test_add_1_1... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/discrete_choice_example.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import statsmodels.api as sm
from scipy import stats
from statsmodels.formula.api import logit
print(sm.datasets.fair.SOURCE)
print(sm.datasets.fair.NOTE)
dta = sm.datasets.fair.load_pandas().data
dta["affair"] = (dta["affair... |
jonathf/chaospy | docs/user_guide/fundamentals/descriptive_statistics.ipynb | mit | import chaospy
uniform = chaospy.Uniform(0, 4)
chaospy.E(uniform)
"""
Explanation: Descriptive statistics
Acknowledging that variables and models are uncertain assumes that we directly or indirectly can describe them through probability distributions.
However for most applications the distribution is a messy entity t... |
vrbala/vrbala.github.io | machine-learning-nanodegree/student_intervention/student_intervention/old/student_intervention.ipynb | mit | # Import libraries
import numpy as np
import pandas as pd
# Read student data
student_data = pd.read_csv("student-data.csv")
print "Student data read successfully!"
# Note: The last column 'passed' is the target/label, all other are feature columns
student_data.head()
"""
Explanation: Project 2: Supervised Learning
B... |
tensorflow/docs-l10n | site/ko/guide/tpu.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... |
AtmaMani/pyChakras | python_crash_course/python_cheat_sheet_3.ipynb | mit | def doubler(input_number):
return input_number*2
doubler(45)
temp_fn = lambda arg : arg*2
temp_fn(55)
type(temp_fn)
"""
Explanation: Productivity hacks for Python
These are good to know shortcuts and methods that will reduce the need for writing explicit loops and condition checks. The comprehensions explained... |
sebp/scikit-survival | doc/user_guide/survival-svm.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import pandas
import seaborn as sns
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sksurv.datasets import load_veterans_lung_cancer
from sksurv.column import encode_categorical
from sksurv.metrics import concordance_index_censor... |
jcornford/pyecog | documentation_notebooks/demo_loading_ndfs_notebook.ipynb | mit | %%time
ndf_file = pg.NdfFile(ndf_filepath, verbose = True, fs = 'auto')
ndf_file.load(read_ids='all',
auto_glitch_removal=True,
auto_resampling=True,
auto_filter=True)
"""
Explanation: Loading the file:
make a ndf_file object and then call load method
when making the calling ... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/building_production_ml_systems/solutions/1_training_at_scale.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
import os
from google.cloud import bigquery
"""
Explanation: Training at scale with AI Platform Training Service
Learning Objectives:
1. Learn how to organize your training code into a Python package
1. Train your model using cloud infrastructure... |
machlearn/ipython-notebooks | ML Algorithm - Ridge Regression.ipynb | mit | from sklearn import linear_model
clf = linear_model.Ridge(alpha = .5)
clf.fit([[0,0],[0,0],[1,1]], [0, .1, 1])
clf.coef_
clf.intercept_
"""
Explanation: Ridge regression addresses some of the problems of Oridnatry Least Squares by imposing a penalty on the size of coefficients. The ridge coefficients minimize a pen... |
TwistedHardware/mltutorial | notebooks/quick_tips/4. XPath.ipynb | gpl-2.0 | import requests
from lxml import html
%%HTML
<html>
<body>
<h1>Favorite Python Librarires</h1>
<ul>
<li>Numpy</li>
<li>Pandas</li>
<li>requests</li>
</ul>
</body>
</html>
"""
Explanation: XPath
XPath is short for XML Path Language which is a query language for selecting nodes in an X... |
delsner/dl-exploration | notebooks/09 - LSTM - Multivariate with Keras.ipynb | mit | from math import sqrt
from numpy import concatenate
from matplotlib import pyplot
from pandas import read_csv
from pandas import DataFrame
from pandas import concat
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import LabelEncoder
from sklearn.metrics import mean_squared_error
from keras.mod... |
broundy/udacity | nanodegrees/deep_learning_foundations/unit_2/lesson_24_intro_to_recurrent_neural_networks/.ipynb_checkpoints/Anna KaRNNa-checkpoint.ipynb | unlicense | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is base... |
ES-DOC/esdoc-jupyterhub | notebooks/ec-earth-consortium/cmip6/models/sandbox-3/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'sandbox-3', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: EC-EARTH-CONSORTIUM
Source ID: SANDBOX-3
Sub-Topics: Radiative ... |
QInfer/qinfer-examples | introduction_to_bayes_smc.ipynb | agpl-3.0 | from __future__ import division, print_function
import qinfer as qi
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
%matplotlib inline
# Use nice plotting defaults if available.
try: plt.style.use('ggplot')
except: pass
"""
Explanation: Intro to Bayes and QInfer
In this notebook, we will introd... |
google/pikov | python/samples/1_clips.ipynb | apache-2.0 | names = {}
for node in graph:
for edge in node:
if edge.guid == "169a81aefca74e92b45e3fa03c7021df":
value = node[edge].value
if value in names:
raise ValueError('name: "{}" defined twice'.format(value))
names[value] = node
names["ctor"]
def name_to_... |
daniel-koehn/Theory-of-seismic-waves-II | 02_Mesh_generation/4_Tri_mesh_delaunay_yigma_tepe.ipynb | gpl-3.0 | # Execute this cell to load the notebook's style sheet, then ignore it
from IPython.core.display import HTML
css_file = '../style/custom.css'
HTML(open(css_file, "r").read())
"""
Explanation: Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2018 D. Koehn, notebook style s... |
tensorflow/tpu | tools/colab/classification_iris_data_with_tpuestimator.ipynb | apache-2.0 | # Copyright 2018 The TensorFlow Hub Authors. 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 app... |
cloudmesh/book | notebooks/fingerprint/fingerprint_matching.ipynb | apache-2.0 | from __future__ import print_function
import urllib
import zipfile
import hashlib
"""
Explanation: Python Fingerprint Example
Python is a flexible and popular language for running data analysis pipelines. In this tutorial we will implement a solution for a fingerprint matching.
Overview
Fingerprint recognition refers... |
revspete/self-driving-car-nd | sem1/p1-lane-lines/p1-lane-lines.ipynb | mit | #importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import math
import os
%matplotlib inline
"""
Explanation: Self-Driving Car Engineer Nanodegree
Project: Finding Lane Lines on the Road
In this project, you will use the tools you learned abou... |
mromanello/SunoikisisDC_NER | participants_notebooks/Sunoikisis - Named Entity Extraction 1a-GB.ipynb | gpl-3.0 | 2 + 3
"""
Explanation: Plan of the lecture
Introduction: Information Extraction and Named Entity Recognition (NER)
NER: definitions and tasks (extraction, classification, disambiguation)
basic programming concepts in Python
Doing NER with existing libraries:
NER from Latin texts with CLTK
NER from journal articles wi... |
oscarmore2/deep-learning-study | gan_mnist/Intro_to_GANs_Exercises.ipynb | mit | %matplotlib inline
import pickle as pkl
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data')
"""
Explanation: Generative Adversarial Network
In this notebook, we'll be building a generativ... |
hongguangguo/shogun | doc/ipython-notebooks/regression/Regression.ipynb | gpl-3.0 | %pylab inline
%matplotlib inline
from cycler import cycler
# import all shogun classes
from modshogun import *
slope = 3
X_train = rand(30)*10
y_train = slope*(X_train)+random.randn(30)*2+2
y_true = slope*(X_train)+2
X_test = concatenate((linspace(0,10, 50),X_train))
#Convert data to shogun format features
feats_trai... |
googledatalab/notebooks | samples/TensorFlow/Basic RNN TensorFlow Model Trained on Simulated Data.ipynb | apache-2.0 | import numpy as np
import seaborn as sns
import pandas as pd
SEQ_LEN = 40
def create_time_series():
freq = (np.random.random() * 0.5) + 0.1 # 0.1 to 0.6
ampl = np.random.random() + 0.5 # 0.5 to 1.5
x = np.sin(np.arange(0, SEQ_LEN) * freq) * ampl
return x
for i in xrange(0, 5):
sns.tsplot( create_time_ser... |
GoogleCloudPlatform/training-data-analyst | quests/serverlessml/02_bqml/labs/first_model.ipynb | apache-2.0 | %%bash
export PROJECT=$(gcloud config list project --format "value(core.project)")
echo "Your current GCP Project Name is: "$PROJECT
%%bash
pip install tensorflow==2.6.0 --user
"""
Explanation: First BigQuery ML models for Taxifare Prediction
In this notebook, we will use BigQuery ML to build our first models for tax... |
empirical-org/WikipediaSentences | notebooks/Participle Phrase Fragment Detection.ipynb | agpl-3.0 | import pandas as pd
import numpy as np
import tensorflow as tf
import tflearn
from tflearn.data_utils import to_categorical
import spacy
nlp = spacy.load('en')
import re
from nltk.util import ngrams, trigrams
import csv
"""
Explanation: TFLearn [Participle Phrase] Fragment Detection
This notebook is based off the orig... |
sevamoo/SOMPY | sompy/examples/AirFlights_hexagonal_grid.ipynb | apache-2.0 | %matplotlib inline
import math
import glob
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import urllib3
from sklearn.externals import joblib
import random
import matplotlib
from sompy.sompy import SOMFactory
from sompy.visualization.plot_tools import plot_hex_map
import logging
"""
Explanatio... |
Nikea/scikit-xray-examples | demos/time_correlation/XPCS_fitting_with_lmfit.ipynb | bsd-3-clause | # analysis tools from scikit-beam (https://github.com/scikit-beam/scikit-beam/tree/master/skbeam/core)
import skbeam.core.roi as roi
import skbeam.core.correlation as corr
import skbeam.core.utils as utils
from lmfit import Model
# plotting tools from xray_vision (https://github.com/Nikea/xray-vision/blob/master/xray... |
ray-project/ray | doc/source/ray-air/examples/analyze_tuning_results.ipynb | apache-2.0 | !pip install -q "ray[all]" sklearn
"""
Explanation: Analyzing results from hyperparameter tuning
In this example, we will go through how you can use Ray AIR to run a distributed hyperparameter experiment to find optimal hyperparameters for an XGBoost model.
What we'll cover:
- How to load data from an Sklearn example ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.