repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
CPernet/LanguageDecision | notebooks/individuals/analysis_patients.ipynb | gpl-3.0 | """
Environment setup
"""
%matplotlib inline
%cd /lang_dec
import warnings; warnings.filterwarnings('ignore')
import hddm
import numpy as np
import matplotlib.pyplot as plt
from utils import model_tools
# Import patient data (as pandas dataframe)
patients_data = hddm.load_csv('/lang_dec/data/patients_clean.csv')
"""... |
mne-tools/mne-tools.github.io | 0.17/_downloads/e5dc759ac64748035446c9149fa0c4d3/plot_sensor_regression.ipynb | bsd-3-clause | # Authors: Tal Linzen <linzen@nyu.edu>
# Denis A. Engemann <denis.engemann@gmail.com>
# Jona Sassenhagen <jona.sassenhagen@gmail.com>
#
# License: BSD (3-clause)
import pandas as pd
import mne
from mne.stats import linear_regression, fdr_correction
from mne.viz import plot_compare_evokeds
from mne.da... |
erikdrysdale/erikdrysdale.github.io | _rmd/extra_auroc/auc_max.ipynb | mit | # Import the necessary modules
import numpy as np
from scipy.optimize import minimize
def sigmoid(x):
return( 1 / (1 + np.exp(-x)) )
def idx_I0I1(y):
return( (np.where(y == 0)[0], np.where(y == 1)[0] ) )
def AUROC(eta,idx0,idx1):
den = len(idx0) * len(idx1)
num = 0
for i in idx1:
num += sum( eta[i] > e... |
ARM-software/bart | docs/notebooks/thermal/Thermal.ipynb | apache-2.0 | import trappy
import numpy
config = {}
# TRAPpy Events
config["THERMAL"] = trappy.thermal.Thermal
config["OUT"] = trappy.cpu_power.CpuOutPower
config["IN"] = trappy.cpu_power.CpuInPower
config["PID"] = trappy.pid_controller.PIDController
config["GOVERNOR"] = trappy.thermal.ThermalGovernor
# Control Temperature
confi... |
mldbai/mldb | container_files/demos/Predicting Titanic Survival.ipynb | apache-2.0 | from pymldb import Connection
mldb = Connection("http://localhost")
#we'll need these also later!
import numpy as np
import pandas as pd, matplotlib.pyplot as plt, seaborn, ipywidgets
%matplotlib inline
"""
Explanation: Predicting Titanic Survival
From the description of a Kaggle Machine Learning Challenge at https:/... |
miykael/nipype_tutorial | notebooks/advanced_spmmcr.ipynb | bsd-3-clause | from nipype.interfaces import spm
matlab_cmd = '/opt/spm12-r7219/run_spm12.sh /opt/matlabmcr-2010a/v713/ script'
spm.SPMCommand.set_mlab_paths(matlab_cmd=matlab_cmd, use_mcr=True)
"""
Explanation: Using SPM with MATLAB Common Runtime (MCR)
In order to use the standalone MCR version of spm, you need to ensure that the ... |
bismayan/MaterialsMachineLearning | notebooks/old_ICSD_Notebooks/Exploring Ternaries.ipynb | mit | # Print periodic table to orient ourselves
Element.print_periodic_table()
# Generate list of non-radioactive elements (noble gases omitted)
def desired_element(elem):
omit = ['Po', 'At', 'Rn', 'Fr', 'Ra']
return not e.is_noble_gas and not e.is_actinoid and not e.symbol in omit
element_universe = [e for e in ... |
pauliacomi/pyGAPS | docs/examples/dr_da_plots.ipynb | mit | # import isotherms
%run import.ipynb
# import the characterisation module
import pygaps.characterisation as pgc
"""
Explanation: Dubinin-Radushkevich and Dubinin-Astakov plots
The Dubinin-Radushkevich (DR) and Dubinin-Astakov (DA) plots are often used to
determine the pore volume and the characteristic adsorption pot... |
oasis-open/cti-python-stix2 | docs/guide/filesystem.ipynb | bsd-3-clause | from stix2 import FileSystemStore
# create FileSystemStore
fs = FileSystemStore("/tmp/stix2_store")
# retrieve STIX2 content from FileSystemStore
ap = fs.get("attack-pattern--0a3ead4e-6d47-4ccb-854c-a6a4f9d96b22")
mal = fs.get("malware--92ec0cbd-2c30-44a2-b270-73f4ec949841")
# for visual purposes
print(mal.serialize... |
eblur/clarsach | notebooks/TestAthenaXIFU.ipynb | gpl-3.0 | %matplotlib notebook
import matplotlib.pyplot as plt
try:
import seaborn as sns
except ImportError:
print("Seaborn not installed. Oh well.")
import numpy as np
import astropy.io.fits as fits
import sherpa.astro.ui as ui
from clarsach.respond import RMF, ARF
"""
Explanation: Test Whether Clàrsach Works ... |
owlas/magpy | docs/source/notebooks/single-particle-equilibrium.ipynb | bsd-3-clause | import numpy as np
# anisotropy energy of the system
def anisotropy_e(theta, sigma):
return -sigma*np.cos(theta)**2
# numerator of the Boltzmann distribution
# (i.e. without the partition function Z)
def p_unorm(theta, sigma):
return np.sin(theta)*np.exp(-anisotropy_e(theta, sigma))
"""
Explanation: Thermal ... |
seifip/udacity-deep-learning-nanodegree | batch-norm/Batch_Normalization_Lesson.ipynb | mit | # Import necessary packages
import tensorflow as tf
import tqdm
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Import MNIST data so we have something for our experiments
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
"... |
kunaltyagi/SDES | notes/python/p_norvig/algo/ProbabilityParadox.ipynb | gpl-3.0 | from fractions import Fraction
class ProbDist(dict):
"A Probability Distribution; an {outcome: probability} mapping."
def __init__(self, mapping=(), **kwargs):
self.update(mapping, **kwargs)
# Make probabilities sum to 1.0; assert no negative probabilities
total = sum(self.values())
... |
CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter2_MorePyMC/Ch2_MorePyMC_PyMC2.ipynb | mit | import pymc as pm
parameter = pm.Exponential("poisson_param", 1)
data_generator = pm.Poisson("data_generator", parameter)
data_plus_one = data_generator + 1
"""
Explanation: Chapter 2
This chapter introduces more PyMC syntax and design patterns, and ways to think about how to model a system from a Bayesian perspect... |
jlandmann/oggm | docs/notebooks/wgms_refmbdata.ipynb | gpl-3.0 | import pandas as pd
import os
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: <img src="https://raw.githubusercontent.com/OGGM/oggm/master/docs/_static/logo.png" width="40%" align="left">
Processing WGMS mass-balance data for OGGM
In this notebook, we use the most recent lookup ... |
bosscha/alma-calibrator | notebooks/2mass/15_allsky-with_gaia-Copy1.ipynb | gpl-2.0 | cmd = "SELECT * FROM gaiadr2.gaia_source AS g, \
gaiadr2.tmass_best_neighbour AS tbest, \
gaiadr1.tmass_original_valid AS tmass \
WHERE g.source_id = tbest.source_id AND tbest.tmass_oid = tmass.tmass_oid \
AND pmra IS NOT NULL AND abs(pmra)<3 \
AND pmdec IS NOT NULL AND abs(pmdec)<3;"
print(cmd)
job1 = Gaia.launch_jo... |
jc091/deep-learning | first-neural-network/.ipynb_checkpoints/DLND Your first neural network-checkpoint.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... |
metpy/MetPy | v0.10/_downloads/56e68110d2faf6be8284d896c8f4cd23/Natural_Neighbor_Verification.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import ConvexHull, Delaunay, delaunay_plot_2d, Voronoi, voronoi_plot_2d
from scipy.spatial.distance import euclidean
from metpy.interpolate import geometry
from metpy.interpolate.points import natural_neighbor_point
"""
Explanation: Natural Neighbo... |
marcinofulus/teaching | Python4physicists_SS2017/numpy_analiza_matematyczna.ipynb | gpl-3.0 | import numpy as np
x = np.linspace(1,8,5)
x.shape
y = np.sin(x)
y.shape
for i in range(y.shape[0]-1):
print( (y[i+1]-y[i]),(y[i+1]-y[i])/(x[i+1]-x[i]))
y[1:]-y[:-1]
y[1:]
(y[1:]-y[:-1])/(x[1:]-x[:-1])
np.diff(y)
np.diff(x)
np.roll(y,-1)
y
np.gradient(y)
import sympy
X = sympy.Symbol('X')
expr ... |
anhiga/poliastro | docs/source/examples/Catch that asteroid!.ipynb | mit | import matplotlib.pyplot as plt
plt.ion()
from astropy import units as u
from astropy.time import Time
from astropy.utils.data import conf
conf.dataurl
conf.remote_timeout
"""
Explanation: Catch that asteroid!
End of explanation
"""
conf.remote_timeout = 10000
from astropy.coordinates import solar_system_epheme... |
james-prior/euler | euler-018-maximum-path-sum-i-20170902.ipynb | mit | t4 = [
[3],
[7, 4],
[2, 4, 6],
[8, 5, 9, 3],
]
t4
t15 = [
[75],
[95, 64],
[17, 47, 82],
[18, 35, 87, 10],
[20, 4, 82, 47, 65],
... |
batfish/pybatfish | docs/source/notebooks/configProperties.ipynb | apache-2.0 | bf.set_network('generate_questions')
bf.set_snapshot('generate_questions')
"""
Explanation: Configuration Properties
This category of questions enables you to retrieve and process the
contents of device configurations in a vendor-agnostic manner
(except where the question itself is vendor-specific). Batfish organizes... |
google/tf-quant-finance | tf_quant_finance/examples/jupyter_notebooks/Monte_Carlo_Euler_Scheme.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# 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, sof... |
gcgruen/homework | foundations-homework/12/homework-12-gruen-311timeseries.ipynb | mit | df = pd.read_csv("311-2014.csv", nrows=200000, low_memory = False)
df.head(3)
df.columns
type(df['Created Date'][0])
print(df['Created Date'][0])
dateutil.parser.parse(df['Created Date'][0])
def str_to_time(str_date):
datetype_date = dateutil.parser.parse(str_date)
return datetype_date
df['created_date'] = ... |
dsacademybr/PythonFundamentos | Cap03/Notebooks/DSA-Python-Cap03-04-Range.ipynb | gpl-3.0 | # Versão da Linguagem Python
from platform import python_version
print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version())
"""
Explanation: <font color='blue'>Data Science Academy - Python Fundamentos - Capítulo 3</font>
Download: http://github.com/dsacademybr
End of explanation
"""
# Impri... |
zhuanxuhit/deep-learning | embeddings/.ipynb_checkpoints/Skip-Grams-Solution-checkpoint.ipynb | mit | import time
import numpy as np
import tensorflow as tf
import utils
"""
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p... |
zrhans/python | exemplos/Pandas_and_Friends.ipynb | gpl-2.0 | import numpy as np
# np.zeros, np.ones
data0 = np.zeros((2, 4))
data0
# Make an array with 20 entries 0..19
data1 = np.arange(20)
# print the first 8
data1[0:8]
"""
Explanation: Pandas and Friends
Austin Godber
Mail: godber@uberhip.com
Twitter: @godber
Presented at DesertPy, Jan 2015.
What does it do?
Pandas is a ... |
probml/pyprobml | notebooks/misc/clip_make_dataset_tpu_jax.ipynb | mit | import os
assert os.environ["COLAB_TPU_ADDR"], "Make sure to select TPU from Edit > Notebook settings > Hardware accelerator"
import os
if "google.colab" in str(get_ipython()) and "COLAB_TPU_ADDR" in os.environ:
import jax
import jax.tools.colab_tpu
jax.tools.colab_tpu.setup_tpu()
print("Connected t... |
MingChen0919/learning-apache-spark | notebooks/02-data-manipulation/2.5-subset-dataframe-by-row.ipynb | mit | mtcars = spark.read.csv('../../data/mtcars.csv', inferSchema=True, header=True)
# correct first column name
mtcars = mtcars.withColumnRenamed('_c0', 'model')
mtcars.show(5)
"""
Explanation: Example dataset
End of explanation
"""
mtcars.rdd.zipWithIndex().take(5)
"""
Explanation: Select Rows by index
First, we need ... |
sysid/nbs | ts/ResidualErrors.ipynb | mit | import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
matplotlib.style.use('ggplot')
fn = '/data/daily-minimum-temperatures-in-me.csv'
df = pd.read_csv(fn, header=0, sep=';', decimal=',')
#df.info()
df.plot(figsize=(20,10));
"""
Explanation: Residual Error
http://machinelearningmastery.com/visualize-ti... |
mne-tools/mne-tools.github.io | 0.22/_downloads/90c71f0d36d740bc290fd9fa30bddd8c/plot_compute_covariance.ipynb | bsd-3-clause | import os.path as op
import mne
from mne.datasets import sample
"""
Explanation: Computing a covariance matrix
Many methods in MNE, including source estimation and some classification
algorithms, require covariance estimations from the recordings.
In this tutorial we cover the basics of sensor covariance computations... |
Meena-Mani/SECOM_class_imbalance | secomdata_gbm.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
from sklearn.preprocessing import Imputer
from sklearn.model_selection import train_test_split as tts
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import cross_val_score
fro... |
ProfessorKazarinoff/staticsite | content/code/unit_conversion/unit_conversion_table_in_Python.ipynb | gpl-3.0 | meters = [0, 10, 20, 30, 40, 50]
meters
centimeters = meters*0.01
centimeters
"""
Explanation: In this post, we are going to construct a unit conversion table in python. The table will have columns for meters (m), centimeter (cm), and inches (in). We will start off with a list of values that will be our meter collum... |
mne-tools/mne-tools.github.io | 0.19/_downloads/2677ee623a2aeff54fe63131444b1844/plot_channel_epochs_image.ipynb | bsd-3-clause | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
"""
Explanation: Visualize channel over epochs as an image
This will... |
dbenn/photometry_tools | LocalCoordAperturePhotometry.ipynb | mit | import os
from random import random
from collections import OrderedDict
import numpy as np
import pandas as pd
from astropy.io import fits
from astropy.visualization import astropy_mpl_style
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from matplotlib.patches import Circle
# TODO: why import... |
ES-DOC/esdoc-jupyterhub | notebooks/ncc/cmip6/models/noresm2-mh/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-mh', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: NCC
Source ID: NORESM2-MH
Topic: Ocean
Sub-Topics: Timestepping Framework, Advection... |
megbedell/wobble | notebooks/demo.ipynb | mit | data = wobble.Data('../data/51peg_e2ds.hdf5')
"""
Explanation: First, you'll need some data to load up.
You can download example HARPS data files (and results files) to play around with linked in the documentation.
Here we'll assume that you have the data 51peg_e2ds.hdf5 saved in the wobble/data directory.
By default,... |
palindromed/data-science | problem_set2/problem_set2.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
titanic_data = pd.read_csv('../knn/train.csv', header=0)
titanic_data.info()
titanic_data.Survived.mean()
"""
Explanation: PROBLEM SET 2
Find the Probability that a passenger survived.
End of explanation
"""
fem_sibsp = titanic_data[(titanic_da... |
florent-leclercq/borg_sdss_data_release | borg_sdss_tweb/borg_sdss_tweb.ipynb | gpl-3.0 | import numpy as np
tweb = np.load('borg_sdss_tweb.npz')
"""
Explanation: BORG SDSS data products
borg_sdss_tweb package
Authors: Florent Leclercq, Jens Jasche, Benjamin Wandelt
Last update: 09/10/2018
This package contains the maps obtained by Leclercq et al. (2015b), who performed a Bayesian analysis of the cosmic ... |
isendel/machine-learning | ml-regression/week 6/K-NN.ipynb | apache-2.0 | print(features_test[0])
print(features_train[9])
import math
def get_distance(vec1, vec2):
return math.sqrt(np.sum((vec1 - vec2)**2))
get_distance(features_test[0], features_train[9])
"""
Explanation: Quiz Question: What is the Euclidean distance between the query house and the 10th house of the training set?
E... |
mne-tools/mne-tools.github.io | 0.19/_downloads/d9e2f27df3a137317d331d3be6f3814d/plot_dics_source_power.ipynb | bsd-3-clause | # Author: Marijn van Vliet <w.m.vanvliet@gmail.com>
# Roman Goj <roman.goj@gmail.com>
# Denis Engemann <denis.engemann@gmail.com>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import mne
from mne.datasets import somato
from... |
UWSEDS/LectureNotes | Spring2018/MNIST_classification.ipynb | bsd-2-clause | import numpy as np;
import matplotlib
import matplotlib.pyplot as plt
mnist = np.load('mnist_data.npz')
X_train = mnist['X_train']
X_test = mnist['X_test']
y_train = mnist['y_train']
y_test = mnist['y_test']
"""
Explanation: MNIST classification
This lecture demonstrates an example of a classification instance u... |
Boussau/Notebooks | Notebooks/Viromics/analysis_CirSeqAndCloneSamples.ipynb | gpl-2.0 | from collections import Counter
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
from pylab import rcParams
import seaborn as sns
from array import array
import numpy as np
from scipy.stats import ttest_ind
from scipy.stats import linregress
from scipy.stats import mannwhitneyu
im... |
ijstokes/bokeh-blaze-tutorial | 1.1 Charts - Timeseries.ipynb | mit | import pandas as pd
from bokeh.charts import TimeSeries, output_notebook, show
output_notebook()
# Get data
be = pd.read_csv('data/Land_Ocean_Monthly_Anomaly_Average.csv',
parse_dates=[0])
be.head()
be.datetime[:10]
# Process data
be.datetime = pd.to_datetime(be.datetime)
be = be[['anomaly','dateti... |
simpeg/simpegmt | notebooks/MT Script-3D_layerTest-working.ipynb | mit | %%time
es_px = Ainv*rhs_px
es_py = Ainv*rhs_py
# Need to sum the ep and es to get the total field.
e_x = es_px #+ ep_px
e_y = es_py #+ ep_py
"""
Explanation: We are using splu in scipy package. This is bit slow, but on the cluster you can use mumps, which might a lot faster. We can think about having better iterative... |
tensorflow/examples | courses/udacity_intro_to_tensorflow_for_deep_learning/l05c01_dogs_vs_cats_without_augmentation.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... |
SlipknotTN/udacity-deeplearning-nanodegree | image-classification-project/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
class DLProgress(tqdm):
last_block = 0
def hoo... |
thom056/ada-parliament-ML | 02-NLP_Sentiment/01-nlp_Gensim.ipynb | gpl-2.0 | import pandas as pd
import glob
import os
import numpy as np
from time import time
import logging
import gensim
import bz2
"""
Explanation: 01. Topic Modelling using the Gensim Library
Usual imports come first.
End of explanation
"""
dataset = []
path = '../datas/treated_data/Transcript/'
#path = 'datas/Vote/'
allF... |
QinetiQ-datascience/Docker-Data-Science | WooWeb-Presentation/Workspace/Widgets/Widget List.ipynb | mit | import ipywidgets as widgets
"""
Explanation: Index - Back - Next
Widget List
End of explanation
"""
widgets.IntSlider(
value=7,
min=0,
max=10,
step=1,
description='Test:',
disabled=False,
continuous_update=False,
orientation='horizontal',
readout=True,
readout_format='i'
)
"... |
vravishankar/Jupyter-Books | pandas/05.Pandas - Combining and Reshaping Data.ipynb | mit | # import pandas, numpy and datetime
import numpy as np
import pandas as pd
import datetime
# set some pandas options for controlling output
pd.set_option('display.notebook_repr_html',False)
pd.set_option('display.max_columns',10)
pd.set_option('display.max_rows',10)
"""
Explanation: Combining and Reshaping Data
Combi... |
peteWT/cec_apl | Biomass/ReadFromDBv2.ipynb | mit | import pandas as pd
from sqlalchemy import create_engine
"""
Explanation: This notebook is intended to show how to use pandas, and sql alchemy to upload data into DB2-switch and create geospatial coordinate and indexes.
Install using pip or any other package manager pandas, sqlalchemy and pg8000. The later one is the ... |
jsnajder/StrojnoUcenje | notebooks/SU-2015-4-BayesovKlasifikator.ipynb | cc0-1.0 | import scipy as sp
import scipy.stats as stats
import matplotlib.pyplot as plt
import pandas as pd
%pylab inline
"""
Explanation: Sveučilište u Zagrebu<br>
Fakultet elektrotehnike i računarstva
Strojno učenje
<a href="http://www.fer.unizg.hr/predmet/su">http://www.fer.unizg.hr/predmet/su</a>
Ak. god. 2015./2016.
Bilje... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/03_tensorflow/c_dataset.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
# Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.5
from google.cloud import bigquery
import tensorflow as tf
import numpy as np
import shutil
print(tf.__version__)
"""
Explanation: <h1> 2c. Loading large dataset... |
mne-tools/mne-tools.github.io | 0.23/_downloads/1537c1215a3e40187a4513e0b5f1d03d/eeg_csd.ipynb | bsd-3-clause | # Authors: Alex Rockhill <aprockhill@mailbox.org>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
"""
Explanation: Transform EEG data using current source density (CSD)
This script shows an exam... |
StevenPeutz/myDataProjects | SQL/SQLquerySizeCalculator.ipynb | cc0-1.0 | # import the python helper package for bigqueey (thank you Rachael Tatman e.a.)
import bq_helper
# create the helper object
open_aq = bq_helper.BigQueryHelper(active_project="bigquery-public-data", dataset_name="openaq")
#print the tables in the dataset to check everthing went ok so far
open_aq.list_tables()
# print... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/3_keras_sequential_api.ipynb | apache-2.0 | # Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.0 || pip install tensorflow==2.0
"""
Explanation: Introducing the Keras Sequential API
Learning Objectives
1. Build a DNN model using the Keras Sequential API
1. Learn how to use feature columns in a Keras model
1. Learn how ... |
GoogleCloudPlatform/training-data-analyst | courses/ai-for-finance/solution/intro_tf_data_keras_sequential_solution.ipynb | apache-2.0 | # Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.1 || pip install tensorflow==2.1
from __future__ import absolute_import, division, print_function, unicode_literals
import pathlib
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
fr... |
DOV-Vlaanderen/pydov | docs/notebooks/search_quartaire_stratigrafie.ipynb | mit | %matplotlib inline
import os, sys
import inspect
# check pydov path
import pydov
"""
Explanation: Example of DOV search methods for quartaire stratigrafie
Use cases:
Select records in a bbox
Select records in a bbox with selected properties
Select records within a distance from a point
Select records in a municipal... |
MSeeker/Notebook-Collections | Monte Carlo Simulation of the Ising Model.ipynb | mit | def dice_samples(trials):
prob = {1: 1/2, 2: 1/4, 3: 1/8, 4: 1/16, 5: 1/32, 6: 1/32}
samples = np.zeros(trials + 1, dtype=int)
samples[0] = 1
for i in range(trials):
a = samples[i]
b = np.random.random_integers(1, 6) # uniform a priori distribution
pa = prob[a]
pb = prob[... |
WomensCodingCircle/CodingCirclePython | Lesson02_Conditionals/Conditional Execution.ipynb | mit | cleaned_room = True
took_out_trash = False
print(cleaned_room)
print(type(took_out_trash))
"""
Explanation: Conditional Execution
Boolean Expressions
We introduce a new value type, the boolean. A boolean can have one of two values: True or False
End of explanation
"""
print(5 == 6)
print("Coke" != "Pepsi")
# You ... |
AllenDowney/MarriageNSFG | survival.ipynb | mit | from __future__ import print_function, division
import marriage
import thinkstats2
import thinkplot
import pandas
import numpy
from lifelines import KaplanMeierFitter
from collections import defaultdict
import itertools
import math
import matplotlib.pyplot as pyplot
from matplotlib import pylab
%matplotlib inline
... |
flaviostutz/datascience-snippets | study/udacity-deep-learning/assignment2-neuralnetworks.ipynb | mit | # 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 numpy as np
import tensorflow as tf
from six.moves import cPickle as pickle
from six.moves import range
"""
Explanation: Deep Learning
Assignment 2
Previously in 1_n... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session13/Day0/LeastSquaresAssumptions.ipynb | mit | y = np.array([203, 58, 210, 202, 198, 158,
165, 201, 157, 131, 166, 160,
186, 125, 218, 146])
x = np.array([495, 173, 479, 504, 510, 416,
393, 442, 317, 311, 400, 337,
423, 334, 533, 344])
"""
Explanation: The Assumptions of Least Squares
========
Version 0.1... |
tensorflow/probability | tensorflow_probability/examples/jupyter_notebooks/Gaussian_Copula.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# 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, sof... |
google/jax | cloud_tpu_colabs/JAX_NeurIPS_2020_demo.ipynb | apache-2.0 | import jax
import jax.numpy as jnp
from jax import random
key = random.PRNGKey(0)
key, subkey = random.split(key)
x = random.normal(key, (5000, 5000))
print(x.shape)
print(x.dtype)
y = jnp.dot(x, x)
print(y[0, 0])
x
import matplotlib.pyplot as plt
plt.plot(x[0])
print(jnp.dot(x, x.T))
print(jnp.dot(x, 2 * x)[[0... |
xiaoxiaoyao/MyApp | jupyter_notebook/datascience.ipynb | unlicense | import pandas as pd
df = pd.read_csv("datascience.csv", encoding='gb18030') #注意它的编码是中文GB18030,不是Pandas默认设置的编码,所以此处需要显式指定编码类型,以免出现乱码错误。
# 之后看看数据框的头几行,以确认读取是否正确。
df.head()
#我们看看数据框的长度,以确认数据是否读取完整。
df.shape
"""
Explanation: 如何用Python从海量文本抽取主题?
你在工作、学习中是否曾因信息过载叫苦不迭?有一种方法能够替你读海量文章,并将不同的主题和对应的关键词抽取出来,让你谈笑间观其大略。本文使用Python对超... |
Jackporter415/phys202-2015-work | assignments/assignment09/IntegrationEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy import integrate
"""
Explanation: Integration Exercise 1
Imports
End of explanation
"""
def trapz(f, a, b, N):
"""Integrate the function f(x) over the range [a,b] with N points."""
h = (b - a)/N
k = np.arange(1,N)
I = h*... |
mdpiper/topoflow-notebooks | BMI-Meteorology-P-Scalar.ipynb | mit | %matplotlib inline
import numpy as np
"""
Explanation: Precipitation in the BMI-ed Meteorology component
Goal: In this example, I want to give the Meteorology component a constant scalar precipitation value and check whether it produces output when the model state is updated.
Start with an import and some magic:
End o... |
dereneaton/ipyrad | newdocs/API-analysis/cookbook-popgen-sumstats.ipynb | gpl-3.0 | !hostname
%load_ext autoreload
%autoreload 2
%matplotlib inline
import ipyrad
import ipyrad.analysis as ipa
import ipyparallel as ipp
from ipyrad.analysis.popgen import Popgen
from ipyrad import Assembly
from ipyrad.analysis.locus_extracter import LocusExtracter
ipyclient = ipp.Client(cluster_id="popgen")
print(len(... |
moble/PostNewtonian | Waveforms/TestTensors.ipynb | mit | from __future__ import division
import sympy
from sympy import *
from sympy import Rational as frac
import simpletensors
from simpletensors import Vector, TensorProduct, SymmetricTensorProduct, Tensor
init_printing()
var('vartheta, varphi')
var('nu, m, delta, c, t')
# These are related scalar functions of time
var('... |
karlstroetmann/Formal-Languages | ANTLR4-Python/Differentiator/Differentiator.ipynb | gpl-2.0 | !cat -n Differentiator.g4
"""
Explanation: Generating Abstract Syntax Trees
Our grammar is stored in the file Differentiator.g4. The grammar describes arithmetical expression that contain variables. Furthermore,
the function symbols ln (natural logarithm) and exp (exponential function) are supported.
End of explanat... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/introduction_to_tensorflow/labs/int_logistic_regression.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 unde... |
tensorflow/docs | site/en/guide/migrate/migrating_checkpoints.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... |
t-vi/candlegp | notebooks/upper_bound.ipynb | apache-2.0 | %matplotlib inline
import numpy
from matplotlib import pyplot
import pandas
import sys, os
sys.path.append(os.path.join(os.getcwd(),'..'))
pyplot.style.use('ggplot')
import IPython
import torch
from torch.autograd import Variable
import candlegp
if 0:
N = 20
X = torch.rand(N,1).double()
Y = (torch.sin(... |
leosartaj/scipy-2016-tutorial | tutorial_exercises/02-Solve-Subs-Plot.ipynb | bsd-3-clause | solveset(x**2 - 4, x)
"""
Explanation: Solveset
Equation solving is both a common need also a common building block for more complicated symbolic algorithms.
Here we introduce the solveset function.
End of explanation
"""
solveset(x**2 - 9 == 0, x)
"""
Explanation: Solveset takes two arguments and one optional ar... |
Kaggle/learntools | notebooks/embeddings/raw/4-exercises.ipynb | apache-2.0 | import os
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import matplotlib as mpl
from learntools.core import binder; binder.bind(globals())
from learntools.embeddings.ex4_tsne import *
#_RM_
input_dir = '.'
#_UNCOMMENT_
#input_dir = '../input/visualizing-embeddings-with-t-sne'
csv_path =... |
afronski/playground-notes | scalable-machine-learning/solutions/ML_lab3_linear_reg_student.ipynb | mit | labVersion = 'cs190_week3_v_1_2'
"""
Explanation: Linear Regression Lab
This lab covers a common supervised learning pipeline, using a subset of the Million Song Dataset from the UCI Machine Learning Repository. Our goal is to train a linear regression model to predict the release year of a song given a set of audio f... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_read_evoked.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
from mne import read_evokeds
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
fname = data_path + '/MEG/sample/sample_audvis-ave.fif'
# Reading
condition = 'Left Auditory'
evoked = read_e... |
theavey/ParaTemp | examples/paratemp_analysis_examples.ipynb | apache-2.0 | import collections
import errno
import sys, os, re, subprocess, glob
import time
import matplotlib.pyplot as plt
import MDAnalysis
import MDAnalysis.analysis
import MDAnalysis.analysis.rdf
import numpy as np
import pandas as pd
import six
from importlib import reload
import paratemp.coordinate_analysis as ca
import pa... |
eds-uga/csci1360e-su17 | lectures/L7.ipynb | mit | def our_function():
pass
def our_function():
pass
"""
Explanation: Lecture 7: Functions I
CSCI 1360E: Foundations for Informatics and Analytics
Overview and Objectives
In this lecture, we'll introduce the concept of functions, critical abstractions in nearly every modern programming language. Functions are im... |
saudijack/unfpyboot | Day_01/01_Advanced_Python/02_LambdaFunction.ipynb | mit | lambda argument_list: expression
# The argument list consists of a comma separated list of arguments and
# the expression is an arithmetic expression using these arguments.
f = lambda x, y : x + y
f(2,1)
"""
Explanation: Lambda Function and More
<font color='red'>Reference Documents</font>
<OL>
<LI> <A HREF="http:... |
ES-DOC/esdoc-jupyterhub | notebooks/cnrm-cerfacs/cmip6/models/cnrm-esm2-1/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cnrm-cerfacs', 'cnrm-esm2-1', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: CNRM-CERFACS
Source ID: CNRM-ESM2-1
Topic: Land
Sub-Topics: Soil, Snow, Vege... |
DJCordhose/ai | notebooks/talks/2017_intro_data2day.ipynb | mit | import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
%pylab inline
import matplotlib.pylab as plt
import numpy as np
from distutils.version import StrictVersion
import sklearn
print(sklearn.__version__)
assert StrictVersion(sklearn.__version__ ) >= StrictVersion('0.18.1')
# Evtl. hat Azure nur 0.1... |
adityamogadala/xLiMeSemanticIntegrator | examples/ExampleUsage.ipynb | gpl-3.0 | import sys
sys.path.insert(0, '../utils')
import rake
query = "From the engineering side, we've also been working on the ability to parallelize training of neural network"
rake1 = rake.Rake("../utils/SmartStoplist.txt")
vals = rake1.run(query)
print vals[0][0]
print vals[1][0]
print vals[2][0]
"""
Explanation: Using ... |
scoaste/showcase | machine-learning/regression/week-3-polynomial-regression-assignment-completed.ipynb | mit | import graphlab
"""
Explanation: Regression Week 3: Assessing Fit (polynomial regression)
In this notebook you will compare different regression models in order to assess which model fits best. We will be using polynomial regression as a means to examine this topic. In particular you will:
* Write a function to take a... |
sysid/kg | quora/LoadWeightsEasy.ipynb | mit | ### imports
from IPython.core.debugger import Tracer
#Tracer()()
import os, sys, time
### prevent the dying jupyter notebook
stdout = sys.stdout
#sys.stdout = sys.__stdout__ # did not work to restoure print -> console
#sys.stdout = open('keras_output.txt', 'a+')
#sys.stdout = stdout
import sys, os, argparse, loggin... |
d00d/quantNotebooks | Notebooks/quantopian_research_public/notebooks/lectures/Ranking_Universes_by_Factors/notebook.ipynb | unlicense | import numpy as np
import statsmodels.api as sm
import scipy.stats as stats
import scipy
from statsmodels import regression
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
"""
Explanation: Ranking Universes by Factors
By Delaney Granizo-Mackenzie and Gilbert Wassermann
Part of the Quantopian ... |
saudijack/unfpyboot | Day_02/00_Scipy/scipy-ODE-DoublePendulum.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
from IPython.display import Image
from scipy import *
"""
Explanation: SciPy - Ordinary differential equations (ODEs)
End of explanation
"""
from scipy.integrate import odeint, ode
"""
Explanation: SciPy provides two different ways to solve ODEs: An API based on t... |
spacecowboy/article-annriskgroups-source | RPartVariables.ipynb | gpl-3.0 | # import stuffs
%matplotlib inline
import numpy as np
import pandas as pd
from pyplotthemes import get_savefig, classictheme as plt
from lifelines.utils import k_fold_cross_validation
plt.latex = True
"""
Explanation: RPartVariables
This script runs repeated cross-validation as a search for suitable parameter values f... |
thesby/CaffeAssistant | tutorial/ipynb/02-fine-tuning.ipynb | mit | caffe_root = '../' # this file should be run from {caffe_root}/examples (otherwise change this line)
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
caffe.set_device(0)
caffe.set_mode_gpu()
import numpy as np
from pylab import *
%matplotlib inline
import tempfile
# Helper function for deprocessin... |
jhprinz/openpathsampling | examples/toy_model_mstis/toy_mstis_A3_new_analysis.ipynb | lgpl-2.1 | %%time
storage = paths.AnalysisStorage(filename)
network = storage.networks[0]
scheme = storage.schemes[0]
stateA = storage.volumes['A']
stateB = storage.volumes['B']
stateC = storage.volumes['C']
all_states = [stateA, stateB, stateC] # all_states gives the ordering
"""
Explanation: TIS Analysis Framework Examples
... |
DouglasLeeTucker/DECam_PGCM | notebooks/DESY6DeepFields_PhotomZPs_tied_to_fgcm.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
from scipy import interpolate
import glob
import math
import os
import subprocess
import sys
import gc
import glob
import pickle
import easyaccess as ea
#import AlasBabylon
import fitsio
from astropy.io import fits
import astropy.coordinates as coord
from astropy.coordinates i... |
SheffieldML/notebook | compbio/tSNE-over-interpretation.ipynb | bsd-3-clause | n = 200
m = 40
np.random.seed(1)
x = np.random.uniform(-1, 1, n)
c = np.digitize(x, np.linspace(-1,1,12))-1
cols = np.asarray(sns.color_palette('spectral_r',12))[c]
"""
Explanation: t-SNE structure in linear data
by Max Zwiessele
Recently a tweet https://twitter.com/mikelove/status/738021869341839360 shook data scien... |
Nathx/think_stats | resolved/chap02ex.ipynb | gpl-3.0 | %matplotlib inline
from operator import itemgetter
import chap01soln
"""
Explanation: Exercise from Think Stats, 2nd Edition (thinkstats2.com)<br>
Allen Downey
Read the female respondent file and display the variables names.
End of explanation
"""
import thinkstats2
hist = thinkstats2.Hist(resp.totincr)
resp = cha... |
tensorflow/docs-l10n | site/ja/probability/examples/Bayesian_Switchpoint_Analysis.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# 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, sof... |
TeamHG-Memex/eli5 | notebooks/TextExplainer.ipynb | mit | from sklearn.datasets import fetch_20newsgroups
categories = ['alt.atheism', 'soc.religion.christian',
'comp.graphics', 'sci.med']
twenty_train = fetch_20newsgroups(
subset='train',
categories=categories,
shuffle=True,
random_state=42,
remove=('headers', 'footers'),
)
twenty_test = f... |
ES-DOC/esdoc-jupyterhub | notebooks/nims-kma/cmip6/models/sandbox-2/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nims-kma', 'sandbox-2', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: NIMS-KMA
Source ID: SANDBOX-2
Topic: Ocnbgchem
Sub-Topics: Tracers.
Pro... |
peastman/deepchem | examples/tutorials/Multisequence_Alignments.ipynb | mit | !wget -c https://repo.anaconda.com/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh
!chmod +x Miniconda3-4.5.4-Linux-x86_64.sh
!bash ./Miniconda3-4.5.4-Linux-x86_64.sh -b -f -p /usr/local
"""
Explanation: Multisequence Alignment (MSA)
Proteins are made up of sequences of amino acids chained together. Their amino acid sequen... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/02_06/Final/Merge.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
starting_date = '20160701'
sample_numpy_data = np.array(np.arange(24)).reshape((6,4))
dates_index = pd.date_range(starting_date, periods=6)
sample_df = pd.DataFrame(sample_numpy_data, index=dates_index, columns=list('ABCD'))
sample_df_2 = sample_df.copy()
sample_df_2['Fruits'] =... |
mne-tools/mne-tools.github.io | stable/_downloads/a3f6a5e6550d5cc477c48007e697532b/ems_filtering.ipynb | bsd-3-clause | # Author: Denis Engemann <denis.engemann@gmail.com>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD-3-Clause
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import io, EvokedArray
from mne.datasets import sample
from mne.decoding import EMS, compute_ems
from sklearn.model_se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.