repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
tensorflow/tpu
tools/colab/profiling_tpus_in_colab.ipynb
apache-2.0
import os IS_COLAB_BACKEND = 'COLAB_GPU' in os.environ # this is always set on Colab, the value is 0 or 1 depending on GPU presence if IS_COLAB_BACKEND: from google.colab import auth # Authenticates the Colab machine and also the TPU using your # credentials so that they can access your private GCS buckets. au...
kevinracso/01Tarea
Copia_de_Copia_de_Preprocesamiento_y_Red_test.ipynb
mit
from google.colab import drive drive.mount('/content/drive') """ Explanation: <a href="https://colab.research.google.com/github/kevinracso/01Tarea/blob/master/Copia_de_Copia_de_Preprocesamiento_y_Red_test.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/><...
mne-tools/mne-tools.github.io
0.17/_downloads/c5956ed7b8d9cbc581fc863a3aba47e1/plot_mne_inverse_coherence_epochs.ipynb
bsd-3-clause
# Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.minimum_norm import (apply_inverse, apply_inverse_epochs, read_inverse_operator) from mne.connectivity import seed_target_indices, spec...
edarin/ENSAE_projects
SemiParametricTilting/implementation.ipynb
gpl-3.0
from ols import ols from logit import logit from att import att %pylab inline import warnings warnings.filterwarnings('ignore') # Remove pandas warnings import numpy as np import pandas as pd import statsmodels.api as sm from statsmodels.nonparametric.kde import KDEUnivariate import seaborn as sns from __future__...
sibirbil/HesKit
Fonksiyonlar.ipynb
gpl-2.0
meyva = "ARMUT" print meyva.lower() """ Explanation: Fonksiyonlar Şu ana kadar zengin Python kütüphaneleri sayesinde pek çok fonksiyonu kolayca kullandık. Öte yandan bazı durumlarda kendi fonksiyonlarımızı yazmak isteyebiliriz. Mesela Python'da kullanılan standart dize fonksiyonları Türkçe harfler ile başa çıkamıyorla...
UWSEDS/short-course
LectureNotes/ProceduralPython/Completed-ProceduralPython.ipynb
mit
import this """ Explanation: Procedural Python and Unit Tests In this section, our main goal will be to outline how to go from the kind of trial-and-error exploratory data analysis we explored this morning, into a nice, linear, reproducible analysis. End of explanation """ URL = "https://s3.amazonaws.com/pronto-data...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/structured/solutions/5a_train_keras_ai_platform_babyweight.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst !pip3 install cloudml-hypertune """ Explanation: LAB 5a: Training Keras model on Cloud AI Platform Learning Objectives Setup up the environment Create trainer module's task.py to hold hyperparameter argparsing code Create trainer module's model.py t...
ShantanuKamath/PythonWorkshop
1. Python Basics.ipynb
mit
print("This is an example of Python code.") print() a = int(input("Enter a value for a: ")) b = int(input("Enter a value for b: ")) print("The sum of a & b is: " + str(a + b)) # print the sum of a & b """ Explanation: Python Basics Disclaimer - This document is only meant to serve as a reference for the attendees of ...
icaoberg/falcon
examples/human_protein_atlas/human_protein_atlas.ipynb
gpl-3.0
import cPickle as pickle from IPython.display import Image import halcon data = pickle.load( open( 'dataset.pkl', 'r' ) ) """ Explanation: Human Protein Atlas Notebook This notebook uses a fraction of the content database built for OMERO.searcher Local client http://murphylab.web.cmu.edu/software/searcher/ The databa...
bhargavchippada/randomfun
NeuralEquationFinder/NeuralEquationFinder_Part_1.ipynb
mit
# Let's try to find the equation y = 2 * x # We have 6 examples:- (x,y) = (0.1,0.2), (1,2), (2, 4), (3, 6), (-4, -8), (25, 50) # Let's assume y is a linear combination of the features x, x^2, x^3 # We know that Normal Equation gives us the exact solution so let's first use that N = 6 x = np.array([0.1, 1, 2, 3, -4, 2...
NYUDataBootcamp/Projects
UG_S16/Ou-GDP Predictor.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import pandas as pd import pandas.io.data as web import datetime import numpy as np from scipy import stats from patsy import dmatrices from sklearn.linear_model import LogisticRegression from sklearn.cross_validation import train_test_split from sklearn import metrics...
atcemgil/notes
fe588/Pandas Examples.ipynb
mit
import pandas as pd ids = [100, 200, 300, 301, 308] names = ['Ali', 'Veli', 'Ayse', 'Fatma', 'Gamze'] surnames = ['Yilmaz', 'Gorali', 'Tasci', 'Bakkaloglu', 'Yilmaz'] ages = [27,32,19,28,32] gender = ['M','M','F','F','F'] city = ['Istanbul', 'Istanbul', 'Ankara', 'Istanbul', 'Izmir'] number_plate = [('Adana','01'...
InsightLab/data-science-cookbook
2020/05-geographic-information-system/Notebook_Geopandas_Basics.ipynb
mit
# Import necessary modules import geopandas as gpd # Set filepath fp = "data/limitebairro.json" # Read file using gpd.read_file() data = gpd.read_file(fp, driver='GeoJSON') """ Explanation: 1. Introdução a Geopandas Fonte: este material é uma tradução e adaptação do notebook: <br/> https://github.com/Automating-GIS...
ES-DOC/esdoc-jupyterhub
notebooks/mpi-m/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', 'mpi-m', 'sandbox-2', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: MPI-M Source ID: SANDBOX-2 Topic: Ocnbgchem Sub-Topics: Tracers. Propertie...
shaunharker/DSGRN
Tutorials/PatternMatchTutorial.ipynb
mit
from DSGRN import * """ Explanation: DSGRN Pattern Match Tutorial This tutorial presents the pattern matching features in DSGRN. Functions demonstrated In this tutorial the following classes/functions are demonstrated: Network DrawGraph ParameterGraph ParameterGraph::parameter DomainGraph SearchGraph PosetOfExtrema P...
drrelyea/SPGL1_python_port
examples/Official_demo.ipynb
lgpl-2.1
%load_ext autoreload %autoreload 2 %matplotlib inline import warnings warnings.filterwarnings('ignore') import numpy as np import matplotlib.pyplot as plt from scipy.sparse import spdiags from scipy.sparse.linalg import lsqr as splsqr from spgl1.lsqr import lsqr from spgl1 import spgl1, spg_lasso, spg_bp, spg_bpdn, ...
mne-tools/mne-tools.github.io
0.12/_downloads/plot_read_noise_covariance_matrix.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) from os import path as op import mne from mne.datasets import sample print(__doc__) data_path = sample.data_path() fname_cov = op.join(data_path, 'MEG', 'sample', 'sample_audvis-cov.fif') fname_evo = op.join(data_path,...
jseabold/statsmodels
examples/notebooks/predict.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import statsmodels.api as sm plt.rc("figure", figsize=(16,8)) plt.rc("font", size=14) """ Explanation: Prediction (out of sample) End of explanation """ nsample = 50 sig = 0.25 x1 = np.linspace(0, 20, nsample) X = np.column_stack((x1, np.sin(x1...
JanetMatsen/Neo4j_meta4
jupyter/old/neo4j_test.ipynb
gpl-3.0
# http://neo4j.com/docs/developer-manual/current/cypher/#query-load-csv command = """ LOAD CSV WITH HEADERS FROM "https://gist.githubusercontent.com/jexp/d788e117129c3730a042/raw/1bd8c19bf8b49d9eb7149918cc11a34faf996dd8/people.tsv" AS line FIELDTERMINATOR '\t' CREATE (:Artist) """ #CREATE (:Artist ...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_run_ica.ipynb
bsd-3-clause
# Authors: Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import mne from mne.preprocessing import ICA, create_ecg_epochs from mne.datasets import sample print(__doc__) """ Explanation: Compute ICA components on epochs ICA is fit to MEG raw data. We assume that the non-stationary EOG artifacts...
ajgpitch/qutip-notebooks
examples/piqs_superradiance.ipynb
lgpl-3.0
import matplotlib as mpl from matplotlib import cm import matplotlib.pyplot as plt from qutip import * from qutip.piqs import * #TLS parameters N = 6 ntls = N nds = num_dicke_states(ntls) [jx, jy, jz] = jspin(N) jp = jspin(N,"+") jm = jp.dag() w0 = 1 gE = 0.1 gD = 0.01 h = w0 * jz #photonic parameters nphot = 20 wc =...
ethen8181/machine-learning
python/logging.ipynb
mit
# code for loading the format for the notebook import os # path : store the current path to convert back to it later path = os.getcwd() os.chdir(os.path.join('..', 'notebook_format')) from formats import load_style load_style(plot_style=False) os.chdir(path) # 1. magic to print version # 2. magic so that the notebo...
phronesis-mnemosyne/census-schema-alignment
wit/wit/notebooks/simple-forum-notebook.ipynb
apache-2.0
import keras import urllib2 import pandas as pd from hashlib import md5 from pprint import pprint from bs4 import BeautifulSoup from sklearn.cluster import DBSCAN import sys sys.path.append('/Users/BenJohnson/projects/what-is-this/wit/') from wit import * """ Explanation: Schema Alignment Example End of explanation...
gregcaporaso/short-read-tax-assignment
ipynb/mock-community/evaluate-classification-accuracy-nb-extra.ipynb
bsd-3-clause
%matplotlib inline from os.path import join, exists, expandvars import pandas as pd from IPython.display import display, Markdown import seaborn.xkcd_rgb as colors from tax_credit.plotting_functions import (pointplot_from_data_frame, boxplot_from_data_frame, ...
SN-Isotropy/Isotropy
doc/Maddi/Hubble+Diagram.ipynb
mit
import sys import gzip, pickle if sys.version.startswith('2'): snFits = pickle.load(gzip.GzipFile('snFits.p.gz')) else: snFits = pickle.load(gzip.GzipFile('snFits.p.gz'), encoding='latin1') print(len(snFits)) snf = [s for s in snFits.values() if s is not None] print(len(snf)) snf[0] """ E...
szitenberg/ReproPhyloVagrant
notebooks/Tutorials/Basic/3.6 Producing and accessing sequence alignment.ipynb
mit
mafft_linsi = AlnConf(pj, # The Project method_name='mafftLinsi', # Any unique method name, # 'mafftDefault' by default CDSAlign=True, ...
ematvey/tensorflow-seq2seq-tutorials
3-seq2seq-native-new.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf from tensorflow.contrib.rnn import LSTMCell, GRUCell from model_new import Seq2SeqModel, train_on_copy_task import pandas as pd import helpers import warnings warnings.filterwarnings("ignore") tf.__version__ """ Explanation: Playing with new 2017 tf.cont...
sofmonk/aima-python
learning.ipynb
mit
from learning import * """ Explanation: Learning This notebook serves as supporting material for topics covered in Chapter 18 - Learning from Examples , Chapter 19 - Knowledge in Learning, Chapter 20 - Learning Probabilistic Models from the book Artificial Intelligence: A Modern Approach. This notebook uses implementa...
JelleAalbers/xeshape
notebooks/extraction/extract_s1s.ipynb
mit
# Get SR1 krypton datasets dsets = hax.runs.datasets dsets = dsets[dsets['source__type'] == 'Kr83m'] dsets = dsets[dsets['trigger__events_built'] > 10000] # Want a lot of Kr, not diffusion mode dsets = hax.runs.tags_selection(dsets, include='sciencerun0') # Sample ten datasets randomly (with fixed seed, so the anal...
sameersingh/uci-statnlp
tutorials/intro_to_pytorch.ipynb
apache-2.0
import numpy as np import torch # Create a 3 x 2 array np.ndarray((3, 2)) # Create a 3 x 2 Tensor torch.Tensor(3, 2) """ Explanation: Introduction to PyTorch PyTorch is a Python package for performing tensor computation, automatic differentiation, and dynamically defining neural networks. It makes it particularly ea...
xiongzhenggang/xiongzhenggang.github.io
AI/ML/week5_code.ipynb
gpl-3.0
import numpy as np import scipy.io as sio import scipy.optimize as opt import pandas as pd import matplotlib.pyplot as plt import seaborn as sns data = sio.loadmat('../data/andrew_ml_ex55139/ex5data1.mat') X, y, Xval, yval, Xtest, ytest = map(np.ravel,[data['X'], data['y'], data['Xval'], data['yval'], data['Xtest'], d...
gfrubi/electrodinamica
notebooks/campo_electrico_disco_cargado-Vpython.ipynb
gpl-3.0
import vpython as vp #Code def charge_color(charge): if charge>0: charge_color = vp.color.red elif charge <0: charge_color = vp.color.blue else: charge_color = vp.color.white return charge_color # def getfield(position): r = position field = vp.vec(0,0,0) for charge ...
AeroPython/Taller-PyConEs-2015
Teoria I - Algoritmos geneticos.ipynb
mit
from IPython.core.display import HTML HTML('''<script> code_show=true; function code_toggle() { if (code_show){ $('div.input').hide(); } else { $('div.input').show(); } code_show = !code_show } $( document ).ready(code_toggle); </script> <form action="javascript:code_toggle()"><input type="submit" value="Click...
scienceguyrob/Docker
Images/music/samples/libROSA/LibROSA_Demo.ipynb
gpl-3.0
from __future__ import print_function # We'll need numpy for some mathematical operations import numpy as np # matplotlib for displaying the output import matplotlib.pyplot as plt import matplotlib.style as ms ms.use('seaborn-muted') %matplotlib inline # and IPython.display for audio output import IPython.display ...
sony/nnabla
tutorial/model_finetuning.ipynb
apache-2.0
!pip install nnabla-ext-cuda100 !git clone https://github.com/sony/nnabla.git %cd nnabla/tutorial """ Explanation: NNabla Models Finetuning Tutorial Here we demonstrate how to perform finetuning using nnabla's pre-trained models. End of explanation """ from nnabla.models.imagenet import ResNet18 model = ResNet18() ...
eyaltrabelsi/my-notebooks
Lectures/practical_optimisations_for_pandas/PyconIL2021-Optimizing Pandas.ipynb
mit
! pip install numba numexpr import math import time import warnings from dateutil.parser import parse import janitor import numpy as np import pandas as pd from numba import jit from sklearn import datasets from pandas.api.types import is_datetime64_any_dtype as is_datetime warnings.filterwarnings("ignore", category...
kwinkunks/rainbow
notebooks/Guessing_colourmaps_HULL.ipynb
apache-2.0
import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: App-ifying 'recovering data from images' See the other notebook for the grisly details and dead-ends. Requirements: numpy scipy scikit-learn pillow I recommend installing them with conda install. End of explanation """ from sci...
TESScience/FPE_Test_Procedures
HK_Variance_Frames_Running.ipynb
mit
from tessfpe.dhu.fpe import FPE from tessfpe.dhu.unit_tests import check_house_keeping_voltages fpe1 = FPE(1, debug=False, preload=True, FPE_Wrapper_version='6.1.1') print fpe1.version fpe1.cmd_start_frames() fpe1.cmd_stop_frames() if check_house_keeping_voltages(fpe1): print "Wrapper load complete. Interface volta...
tpin3694/tpin3694.github.io
machine-learning/visualize_a_decision_tree.ipynb
mit
# Load libraries from sklearn.tree import DecisionTreeClassifier from sklearn import datasets from IPython.display import Image from sklearn import tree import pydotplus """ Explanation: Title: Visualize A Decision Tree Slug: visualize_a_decision_tree Summary: How to visualize a decision tree regression in scikit-le...
mathLab/RBniCS
tutorials/17_navier_stokes/tutorial_navier_stokes_2_exact.ipynb
lgpl-3.0
from ufl import transpose from dolfin import * from rbnics import * """ Explanation: Tutorial 17 - Navier Stokes equations Keywords: exact parametrized functions, supremizer operator 1. Introduction In this tutorial, we will study the Navier-Stokes equations over the two-dimensional backward-facing step domain $\Omega...
mne-tools/mne-tools.github.io
stable/_downloads/9bd293f49554a21d68d4f2a842cc6cc2/59_head_positions.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # Richard Höchenberger <richard.hoechenberger@gmail.com> # Daniel McCloy <dan@mccloy.info> # # License: BSD-3-Clause from os import path as op import mne data_path = op.join(mne.datasets.testing.data_path(verbose=True), 'SSS') fname_raw = op.join(data...
daniestevez/jupyter_notebooks
dslwp/DSLWP GMSK SSDV 2.ipynb
gpl-3.0
%matplotlib inline import numpy as np import scipy.signal import matplotlib.pyplot as plt """ Explanation: Analysis of DSLWP-B 2018-08-12 SSDV transmission This notebook analyzes SSDV transmissions made by DSLWP-B from the Moon. End of explanation """ x = np.fromfile('/home/daniel/Descargas/DSLWP-B_PI9CAM_2018-08-1...
mne-tools/mne-tools.github.io
0.19/_downloads/6684371ec2bc8e72513b3bdbec0d3a9f/plot_20_events_from_raw.ipynb
bsd-3-clause
import os import numpy as np import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file) raw.crop(tmax=60).load_data() """ Explanati...
JeffAbrahamson/MLWeek
practicum/09_TensorFlow/TensorFlow_intro.ipynb
gpl-3.0
from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) """ Explanation: Ne pas faire un "execute all" : la dernière cellule est très lourde. Introduction à TensorFlow Ce code est basé sur des tutoriel à tensorflow.org. Nous allons utiliser _softmax ...
metpy/MetPy
v1.0/_downloads/62a1acd718d4c5b9717787544d4cf09f/Gradient.ipynb
bsd-3-clause
import numpy as np import metpy.calc as mpcalc from metpy.units import units """ Explanation: Gradient Use metpy.calc.gradient. This example demonstrates the various ways that MetPy's gradient function can be utilized. End of explanation """ data = np.array([[23, 24, 23], [25, 26, 25], ...
hetland/python4geosciences
materials/1_core.ipynb
mit
a = 5 b = a + 3.1415 c = a / b print(a, b, c) """ Explanation: Core language A. Variables Variables are used to store and modify values. End of explanation """ s = 'Ice cream' # A string f = [1, 2, 3, 4] # A list d = 3.1415928 # A floating point number i = 5 # ...
tensorflow/docs-l10n
site/en-snapshot/hub/tutorials/retrieval_with_tf_hub_universal_encoder_qa.ipynb
apache-2.0
# Copyright 2019 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...
gwtsa/gwtsa
examples/notebooks/1_basic_model.ipynb
mit
# First perform the necessary imports import pandas as pd import matplotlib.pyplot as plt import pastas as ps %matplotlib inline """ Explanation: A Basic Model In this example application it is shown how a simple time series model can be developed to simulate groundwater levels. The recharge (calculated as preciptatio...
AllenDowney/ThinkStats2
workshop/hypothesis_soln.ipynb
gpl-3.0
%matplotlib inline import numpy import scipy.stats import matplotlib.pyplot as plt import first """ Explanation: Hypothesis Testing Copyright 2016 Allen Downey License: Creative Commons Attribution 4.0 International End of explanation """ live, firsts, others = first.MakeFrames() """ Explanation: Part One Suppos...
PrairieLearn/PrairieLearn
exampleCourse/questions/demo/annotated/MarkovChainGroupActivity/MarkovChains-Intro/workspace/Markov-Chains-1.ipynb
agpl-3.0
x1 = M @ x x1 """ Explanation: Introduction to Markov Chains A Markov chain is a mathematical model used to describe a set of states and the probability of transitioning between them. In this simple example, we use Markov chain to model the weather. We have two states to represent the possible weather for a day: Sunny...
tensorflow/docs-l10n
site/ja/lattice/tutorials/custom_estimators.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...
jasonding1354/PRML_Notes
1.PROBABILITY_DISTRIBUTIONS/1.2 Multinomial_Variables.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D from scipy.stats import dirichlet import matplotlib.tri as tri from matplotlib import cm corners = np.array([[0, 0], [1, 0], [0.5, 0.75**0.5]]) triangle = tri.Triangulation(corners[:, 0], corners[:, 1]) refi...
CivicKnowledge/metatab-py
examples/Pandas Reporter Example.ipynb
bsd-3-clause
[e for e in b17001.columns if '65 to 74' in str(e) or '75 years' in str(e) ] # Now create a subset dataframe with just the columns we need. b17001s = b17001[['geoid', 'B17001015', 'B17001016','B17001029','B17001030']] b17001s.head() """ Explanation: B17001 Poverty Status by Sex by Age For the Poverty Status by Sex b...
vbarua/PythonWorkshop
Code/Introduction To Python/3 - Dictionaries.ipynb
mit
numbers = {1: "one", 2: "two", 3: "three"} numbers """ Explanation: Dictionaries A Python dictionary is a mutable data structure that can be used to associate keys with values. They are created using {} braces. You can think of dictionaries as lists, except that instead of extracting elements by their position you ext...
mlhy/ResNet-50-for-Cats.Vs.Dogs
Preprocessing train dataset.ipynb
apache-2.0
from sklearn.model_selection import train_test_split import seaborn as sns import os import shutil %matplotlib inline """ Explanation: Preprocessing train dataset Divide the train folder into two folders mytrain and myvalid mytrain ---- including two folders cat ---- including about 11250 cat images dog ---- incl...
phoebe-project/phoebe2-docs
development/tutorials/LC_estimators_tutorial.ipynb
gpl-3.0
b = phoebe.default_binary() # set parameter values b.set_value('q', value = 0.6) b.set_value('incl', component='binary', value = 84.5) b.set_value('ecc', 0.2) b.set_value('per0', 63.7) b.set_value('requiv', component='primary', value=1.) b.set_value('requiv', component='secondary', value=0.6) b.set_value('teff', compon...
brianoleary15/Hands-On-Machine-Learning-with-ScikitLearn-and-TensorFlow
11_deep_learning.ipynb
apache-2.0
# To support both python 2 and python 3 from __future__ import division, print_function, unicode_literals # Common imports import numpy as np import os # to make this notebook's output stable across runs def reset_graph(seed=42): tf.reset_default_graph() tf.set_random_seed(seed) np.random.seed(seed) # To...
mne-tools/mne-tools.github.io
0.24/_downloads/1abc74aa28d845859c3852be5f0bdd21/30_forward.ipynb
bsd-3-clause
import os.path as op import mne from mne.datasets import sample data_path = sample.data_path() # the raw file containing the channel location + types sample_dir = op.join(data_path, 'MEG', 'sample',) raw_fname = op.join(sample_dir, 'sample_audvis_raw.fif') # The paths to Freesurfer reconstructions subjects_dir = op.jo...
anhquan0412/deeplearning_fastai
deeplearning1/nbs/lesson5.ipynb
apache-2.0
from keras.datasets import imdb idx = imdb.get_word_index() """ Explanation: Setup data We're going to look at the IMDB dataset, which contains movie reviews from IMDB, along with their sentiment. Keras comes with some helpers for this dataset. End of explanation """ idx_arr = sorted(idx, key=idx.get) idx_arr[:10] ...
maxrose61/GA_DS
FInal_Project/Quantifying_Influence_Analysis_maxrose_DSFinal.ipynb
gpl-3.0
### Import as many items as possible to have available. ### Import data from CSV %matplotlib inline import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn import metrics from sklearn.linear_model import LinearRegression from sklearn.linear_model import LogisticRegres...
udacity/deep-learning
first-neural-network/Your_first_neural_network.ipynb
mit
%matplotlib inline %load_ext autoreload %autoreload 2 %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 ridersh...
quantumlib/Cirq
docs/tutorials/google/xeb_calibration_example.ipynb
apache-2.0
try: import cirq except ImportError: !pip install --quiet cirq --pre # The Google Cloud Project id to use. project_id = "" #@param {type:"string"} processor_id = "" #@param {type:"string"} from cirq_google.engine.qcs_notebook import get_qcs_objects_for_notebook device_sampler = get_qcs_objects_for_notebook(pr...
iagapov/ocelot
demos/ipython_tutorials/1_introduction.ipynb
gpl-3.0
from IPython.display import Image #Image(filename='gui_example.png') """ Explanation: This notebook was created by Sergey Tomin for Workshop: Designing future X-ray FELs. Source and license info is on GitHub. August 2016. An Introduction to Ocelot Ocelot is a multiphysics simulation toolkit designed for studying FEL a...
lfairchild/PmagPy
data_files/notebooks/Importing and using the 3.0 data model.ipynb
bsd-3-clause
# import req'd modules import json import os import pandas as pd from pandas import DataFrame, Series import numpy as np import pmagpy.builder2 as builder """ Explanation: This notebook was used to develop functionality that is now in pmagpy/data_model3.py. Examples of how to use the data_model3 module can be found i...
ktmud/deep-learning
intro-to-tensorflow/intro_to_tensorflow.ipynb
mit
import hashlib import os import pickle from urllib.request import urlretrieve import numpy as np from PIL import Image from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelBinarizer from sklearn.utils import resample from tqdm import tqdm from zipfile import ZipFile print('All m...
pycrystem/pycrystem
doc/demos/11 Accelerated orientation mapping with template matching.ipynb
gpl-3.0
%matplotlib notebook import numpy as np import matplotlib.pyplot as plt import hyperspy.api as hs """ Explanation: Fast template matching Background This notebook describes how the new accelerated orientation mapping facilities in Pyxem can be used. Orientation mapping with template matching is illustrated in example...
maartenbreddels/ipyvolume
docs/source/examples/lighting.ipynb
mit
import ipyvolume as ipv import numpy as np def scene(): f = ipv.figure() ipv.xyzlim(-1, 1) x = np.array([0.1, 0.5], dtype=np.float32) ipv.material_phong() s = ipv.scatter(x, x, x, marker="sphere", size=10); k = ipv.examples.klein_bottle(show=False) ipv.xyzlim(2) m = ipv.plot_plane('bott...
neutronimaging/imagingsuite
notebooks/MorphSpotCleanDemo.ipynb
gpl-3.0
import sys, os sys.path.insert(0, "/Users/kaestner/git/scripts/python/") sys.path.insert(0, "/Users/kaestner/git/install/lib/") if 'LD_LIBRARY_PATH' not in os.environ: os.environ['LD_LIBRARY_PATH'] = '/Users/kaestner/git/install/lib' os.environ['LD_LIBRARY_PATH'] = '/Users/kaestner/git/install/lib' os.environ['...
tensorflow/fairness-indicators
g3doc/tutorials/Fairness_Indicators_TensorBoard_Plugin_Example_Colab.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...
arnoldlu/lisa
ipynb/android/antutu/Android_antutu_hikey.ipynb
apache-2.0
import logging reload(logging) log_fmt = '%(asctime)-9s %(levelname)-8s: %(message)s' logging.basicConfig(format=log_fmt) # Change to info once the notebook runs ok logging.getLogger().setLevel(logging.INFO) %pylab inline import copy import os from time import sleep from subprocess import Popen import pandas as pd ...
justanr/notebooks
hexagonal/refactoring_and_interfaces.ipynb
mit
@app.route('/register', methods=['GET', 'POST']) def register(): form = RegisterUserForm() if form.validate_on_submit(): user = User() form.populate_obj(user) db.session.add(user) db.session.commit() return redirect('homepage') return render_template('regist...
tensorflow/docs-l10n
site/en-snapshot/tfx/tutorials/tfx/components_keras.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...
obulpathi/datascience
pandas/3. Data Wrangling with Pandas.ipynb
apache-2.0
%matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt # Set some Pandas options pd.set_option('display.notebook_repr_html', False) pd.set_option('display.max_columns', 20) pd.set_option('display.max_rows', 25) """ Explanation: Data Wrangling with Pandas Now that we have been expose...
LimeeZ/phys292-2015-work
assignments/assignment07/AlgorithmsEx02.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import seaborn as sns import numpy as np """ Explanation: Algorithms Exercise 2 Imports End of explanation """ def find_peaks(a): """Find the indices of the local maxima in a sequence.""" maxima = [] for x in range(0, len(a)): if(x==len(a)-1...
tensorflow/docs-l10n
site/zh-cn/tensorboard/migrate.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...
Amarchuk/2FInstability
notebooks/2f/photometry.ipynb
gpl-3.0
from IPython.display import Image import numpy as np import math %pylab %matplotlib inline """ Explanation: Фотометрия Ноутбук с функциями для работы с фотометрией. End of explanation """ Image('../Bell_2003.png') """ Explanation: Калибровки Bell et al. 2003 Калибровки Bell et al. (2003) https://ui.adsabs.harvard....
JaviMerino/lisa
ipynb/tutorial/05_TrappyUsage.ipynb
apache-2.0
import logging reload(logging) logging.basicConfig( format='%(asctime)-9s %(levelname)-8s: %(message)s', datefmt='%I:%M:%S') # Enable logging at INFO level logging.getLogger().setLevel(logging.INFO) """ Explanation: Tutorial Goal This tutorial aims to show some example of data analysis and visualization from a...
blua/deep-learning
tv-script-generation/olds_ipnbs/dlnd_tv_script_generation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper data_dir = './data/simpsons/moes_tavern_lines.txt' text = helper.load_data(data_dir) # Ignore notice, since we don't use it for analysing the data text = text[81:] """ Explanation: TV Script Generation In this project, you'll generate your own Simpsons TV scrip...
marcinofulus/teaching
ML_SS2017/zajecia_MJ_21.4.2017.ipynb
gpl-3.0
def read_data(filename_queue): reader = tf.TFRecordReader() _, se = reader.read(filename_queue) f = tf.parse_single_example(se,features={'image/encoded':tf.FixedLenFeature([],tf.string), 'image/class/label':tf.FixedLenFeature([],tf.int64), ...
intel-analytics/BigDL
apps/dogs-vs-cats/transfer-learning.ipynb
apache-2.0
import re from bigdl.dllib.nn.criterion import CrossEntropyCriterion from pyspark.ml import Pipeline from pyspark.sql.functions import col, udf from pyspark.sql.types import DoubleType, StringType from bigdl.dllib.nncontext import * from bigdl.dllib.feature.image import * from bigdl.dllib.keras.layers import Dense, I...
stefanseefeld/numba
examples/notebooks/LinearRegr.ipynb
bsd-2-clause
%pylab inline def gradient_descent_numpy(X, Y, theta, alpha, num_iters): m = Y.shape[0] theta_x = 0.0 theta_y = 0.0 for i in range(num_iters): predict = theta_x + theta_y * X err_x = (predict - Y) err_y = (predict - Y) * X theta_x = theta_x - alpha * (1.0 / m) * err_x....
gutouyu/cs231n
cs231n/assignment/assignment1/knn.ipynb
mit
# Run some setup code for this notebook. import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt # This is a bit of magic to make matplotlib figures appear inline in the notebook # rather than in a new window. %matplotlib inline plt.rcParams['figure.figsize'] = (10....
European-XFEL/h5tools-py
docs/dask_averaging.ipynb
bsd-3-clause
from karabo_data import open_run import dask.array as da from dask.distributed import Client, progress from dask_jobqueue import SLURMCluster import numpy as np """ Explanation: Averaging detector data with Dask We often want to average large detector data across trains, keeping the pulses within each train separate,...
kingsgeocomp/code-camp
notebook-05-truth-and-conditions.ipynb
mit
myBoolean = True print(myBoolean) print("This statement is: '" + str(myBoolean) + "'") """ Explanation: Notebook-5: Truth & Conditions Lesson Content Comparisons Booleans "Not equal" operator "< > <= >=" operators Conditions pt.1 IF ELSE ELIF Boolean Logic AND OR NOT In this lesson we'll learn how to c...
sussexwearlab/OpenEnded
preprocessing/JSI-preprocess2.ipynb
mit
import numpy as np import scipy import scipy.stats filename = 'raw_data_example.txt' """ Explanation: Preprocessing This notebook contains an example code for preprocessing raw acceleration data. It contains takes as input raw 3 axias acceleration signal, and outputs a file with extracted features. It uses overlapping...
carltoews/tennis
notebooks/extract_features.ipynb
gpl-3.0
import sqlalchemy # pandas-mysql interface library import sqlalchemy.exc # exception handling from sqlalchemy import create_engine # needed to define db interface import sys # for defining behavior under errors import numpy as np # numerical libraries import scipy as sp import pandas as pd # for data analysis import...
mzwiessele/topslam
notebooks/ExampleWorkflow.ipynb
bsd-3-clause
from topslam.simulation import qpcr_simulation seed_differentiation = 5001 seed_gene_expression = 0 Xsim, simulate_new, t, c, labels, seed = qpcr_simulation(seed=seed_differentiation) np.random.seed(seed_gene_expression) Y = simulate_new() """ Explanation: Example Workflow In this notebook we will look at an exampl...
seth2000/chinesepoem
PrepareData.ipynb
mit
# -*- coding: utf-8 -*- import os import re import time import codecs import argparse TIME_FORMAT = '%Y-%m-%d %H:%M:%S' BASE_FOLDER = os.getcwd() # os.path.abspath(os.path.dirname(__file__)) DATA_FOLDER = os.path.join(BASE_FOLDER, 'data') DEFAULT_FIN = os.path.join(DATA_FOLDER, '唐诗语料库.txt') DEFAULT_FOUT = os.path.jo...
rmsouza01/iamxt
jupyter-notebook/iamxt_getting_started.ipynb
bsd-2-clause
# This makes plots appear in the notebook %matplotlib inline import numpy as np # numpy is the major library in which iamxt was built upon # we like the array programming style =) # We are using PIL to read images from PIL import Image # and matplotlib to display images import matplotlib.pyp...
ellamil/bubblepopper
bubblepopper_2topicextraction.ipynb
mit
from gensim import corpora, models import gensim import numpy as np import random import pickle %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns """ Explanation: TOPIC EXTRACTION Topic Assignment Consistency End of explanation """ texts = pickle.load(open('pub_articles_cleaned_super.pkl','r...
ComputationalModeling/spring-2017-danielak
past-semesters/spring_2016/day-by-day/day21-monte-carlo-integration/MonteCarlo_Integration_SOLUTIONS.ipynb
agpl-3.0
# Put your code here! import random as rand import math def f(x): return 2.0*(x**2) + 3.0 # x min, max: -2, 4 (delta_x = 6) # y min, max: 0, 35 Area = (35-0)*(4+2) real_area = 66.0 samples = [] errors = [] for i in range(1,7): N_samples = 10**i N_below = 0 for j in range(N_samples):...
lia-statsletters/notebooks
mv_kecdf_frechet.ipynb
gpl-3.0
from __future__ import division import matplotlib.pyplot as plt import numpy as np import scipy.stats as spst import statsmodels.api as sm from scipy import optimize from statsmodels.nonparametric import kernels kernel_func = dict(wangryzin=kernels.wang_ryzin, aitchisonaitken=kernels.aitchison_ai...
dnstanciu/masters-project
sources/notebooks/testing_connectivity.ipynb
gpl-3.0
%load_ext pymatbridge %%matlab addpath /home/dragos/src/fieldtrip-20160526 addpath /home/dragos/Projects/SummerProject ft_defaults """ Explanation: Testing Connectivity Here we explore how different paddings of the MEG recordings affect the phase after applying the Hilbert transform. Start Matlab session: End of exp...
patrick-kidger/diffrax
examples/neural_ode.ipynb
apache-2.0
import time import diffrax import equinox as eqx # https://github.com/patrick-kidger/equinox import jax import jax.nn as jnn import jax.numpy as jnp import jax.random as jrandom import matplotlib.pyplot as plt import optax # https://github.com/deepmind/optax """ Explanation: Neural ODE This example trains a Neural ...
aphearin/AstroHackWeek2015
inference/straightline.ipynb
gpl-2.0
%load_ext autoreload %autoreload 2 from __future__ import print_function import numpy as np import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (6.0, 6.0) plt.rcParams['savefig.dpi'] = 100 from straightline_utils import * """ Explanation: Bayesian Inference II: Fitting a Straight Li...
GoogleCloudPlatform/training-data-analyst
quests/sparktobq/05_functions.ipynb
apache-2.0
%%bash wget http://kdd.ics.uci.edu/databases/kddcup99/kddcup.data_10_percent.gz gunzip kddcup.data_10_percent.gz BUCKET='cloud-training-demos-ml' # CHANGE gsutil cp kdd* gs://$BUCKET/ bq mk sparktobq """ Explanation: Migrating from Spark to BigQuery via Dataproc -- Part 5 Part 1: The original Spark code, now running...
tommytwoeyes/continuity
11_Infinite_Seq_and_Series/Lab_III__Infinite_Series.ipynb
gpl-3.0
import sympy as sp from matplotlib import pyplot as plt %matplotlib inline # Customize figure size plt.rcParams['figure.figsize'] = 25, 15 #plt.rcParams['lines.linewidth'] = 1 #plt.rcParams['lines.color'] = 'g' #plt.rcParams['font.family'] = 'monospace' plt.rcParams['font.size'] = '16.0' plt.rcParams['font.monospace'...
seanjmcm/TrafficSign
Traffic_Sign_Classifier.ipynb
mit
# Load pickled data import pickle import cv2 # for grayscale and normalize # TODO: Fill this in based on where you saved the training and testing data training_file ='traffic-signs-data/train.p' validation_file='traffic-signs-data/valid.p' testing_file = 'traffic-signs-data/test.p' with open(training_file, mode='rb'...
tensorflow/docs-l10n
site/ja/tutorials/load_data/numpy.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...
QinetiQ-datascience/Docker-Data-Science
WooWeb-Presentation/Workspace/Widgets/Lorenz Differential Equations.ipynb
mit
%matplotlib inline from ipywidgets import interact, interactive from IPython.display import clear_output, display, HTML import numpy as np from scipy import integrate from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import cnames from matplotlib import animation ""...