repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
kiritisai/deep-learning-udacity
image-classification/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' # Use Floyd's cifar-10 dataset if present floyd_cifar10...
google-research/robustness_metrics
robustness_metrics/projects/revisiting_calibration/revisiting_calibration.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); # 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 ap...
DavidQiuChao/CS231nHomeWorks
assignment1/two_layer_net.ipynb
mit
# A bit of setup import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.neural_net import TwoLayerNet from __future__ import print_function %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['im...
feststelltaste/software-analytics
prototypes/Linux Git Log Performance.ipynb
gpl-3.0
first_commit = git_log.index[-1] first_commit today = pd.to_datetime('today') type(today) """ Explanation: Note: We are using the UNIX timestamp here because it's superfast to convert it to a real datatime64 data type. Cleaning up wrong timestamps _Note: 'today'is suboptimal End of explanation """ git_log[(git_log ...
mne-tools/mne-tools.github.io
0.22/_downloads/ff83425ee773d1d588a6994e5560c06c/plot_mne_dspm_source_localization.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.minimum_norm import make_inverse_operator, apply_inverse """ Explanation: Source localization with MNE/dSPM/sLORETA/eLORETA The aim of this tutorial is to teach you how to compute and apply a linear minimum-norm inv...
prihandoko/prihandoko.github.io
_pages/learn/python/4. Data Structure.ipynb
mit
import sys fishes = ["teri", "kakap", "tongkol"] items = (" sword"," halberd"," axe"," knife"," blade") for fish in fishes: print("ini ikan "+fish) for item in items: print(item) print(fishes[0]) print(items[-1]) del(fishes[-1]) for fish in fishes: print("ini ikan "+fish) """ Explanation: Data Structur...
quantumlib/Cirq
docs/tutorials/pasqal/getting_started.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...
wuafeing/Python3-Tutorial
01 data structures and algorithms/01.15 group records based on field.ipynb
gpl-3.0
rows = [ {'address': '5412 N CLARK', 'date': '07/01/2012'}, {'address': '5148 N CLARK', 'date': '07/04/2012'}, {'address': '5800 E 58TH', 'date': '07/02/2012'}, {'address': '2122 N CLARK', 'date': '07/03/2012'}, {'address': '5645 N RAVENSWOOD', 'date': '07/02/2012'}, {'address': '1060 W ADDISON'...
eldritchideen/weekly-trend-trader
Trend-Trader.ipynb
mit
import pandas as pd import pandas.io.data as web import datetime """ Explanation: Weekend Trend Trader This notebook outlines experiments in getting my weekend trend trader code implemented. End of explanation """ # date ranges end = datetime.date(2015, 1, 26) start = end + datetime.timedelta(weeks=-21) start # Get...
neuro-ml/reskit
tutorials/.ipynb_checkpoints/Getting Started-checkpoint.ipynb
bsd-3-clause
from sklearn.datasets import make_classification X, y = make_classification() data = {'X': X, 'y': y} """ Explanation: Let's say we want to prepare data and try some scalers and classifiers for prediction in a classification problem. We will tune paramaters of classifiers by grid search technique. Data preparing: En...
mne-tools/mne-tools.github.io
0.19/_downloads/b44431cb3a9d20511482e4da8b41ff49/plot_gamma_map_inverse.ipynb
bsd-3-clause
# Author: Martin Luessi <mluessi@nmr.mgh.harvard.edu> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.inverse_sparse import gamma_map, make_stc_from_dipoles from mne.viz import (plot_sparse_source_estimate...
sarahmid/programming-bootcamp-v2
lab7_exercises_ANSWERS.ipynb
mit
import imp my_utils = imp.load_source('my_utils', '../utilities/my_utils.py') #CHANGE THIS PATH # test that this worked print "Test my_utils.gc():", my_utils.gc("ATGGGCCCAATGG") print "Test my_utils.reverse_compl():", my_utils.reverse_compl("GGGGTCGATGCAAATTCAAA") print "Test my_utils.read_fasta():", my_utils.read_fas...
elsuizo/Charlas_presentaciones
Python_scientific/.ipynb_checkpoints/numpy_matplot_ejemplos-checkpoint.ipynb
gpl-2.0
#Importamos el modulo numpy con el alias np import numpy as np #Creo un array a = np.array([1,0,0]) a type(a) """ Explanation: <img src="files/Images/Numpylogo.png" style="float: left;"/> <div style="clear: both;"> ## Numpy ### Biblioteca(modulo) numérico de Python * Arrays multimensionales (ndarray) * Más cerca...
QuLogic/folium
examples/MarkerCluster.ipynb
mit
icon_create_function = """\ function(cluster) { return L.divIcon({ html: '<b>' + cluster.getChildCount() + '</b>', className: 'marker-cluster marker-cluster-large', iconSize: new L.Point(20, 20) }); }""" from folium.plugins import MarkerCluster m = folium.Map( location=[np.mean(lats), np.mean...
datawagovau/harvesters
Implicit Georeferencing.ipynb
mit
import ckanapi from harvest_helpers import * from secret import CKAN ckan = ckanapi.RemoteCKAN(CKAN["dpaw-internal"]["url"], apikey=CKAN["dpaw-internal"]["key"]) print("Using CKAN {0}".format(ckan.address)) """ Explanation: Implicit Georeferencing This workbook sets explicit georeferences from implicit georeferencing...
kubeflow/code-intelligence
Issue_Embeddings/notebooks/04b_Inference-Batch.ipynb
mit
from inference import InferenceWrapper, pass_through from IPython.display import display, Markdown import pandas as pd from torch.nn.utils.rnn import pad_sequence from torch import Tensor, cat, device from torch.cuda import empty_cache from typing import List from tqdm import tqdm from numpy import concatenate as cat i...
dpiparo/swanExamples
notebooks/CMSDimuon_py.ipynb
lgpl-2.1
import ROOT """ Explanation: Dimuon spectrum <hr style="border-top-width: 4px; border-top-color: #34609b;"> This ROOTbook produces a plot of the dimuon spectrum starting from a subset of the CMS collision events of Run2010B. Dataset Reference:<br> McCauley, T. (2014). Dimuon event information derived from the Run2010...
jerrythomas/data-science-at-scale
People most likely to go missing in Mission District between 10am & 11am on Fridays.ipynb
mit
import vincent import pandas as pd from vincent import AxisProperties, PropertySet, ValueRef from vincent import Map vincent.core.initialize_notebook() """ Explanation: People most likely to go missing in Mission district between 10am & 11am on Fridays Summary of findings Mission district has highest rate of missing...
sdpython/ensae_teaching_cs
_doc/notebooks/td1a/td1a_correction_session1.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.0 - Premiers pas en Python (correction) La partie 1 ne nécessite pas de correction. End of explanation """ a = 5 a = a + 4 # a + 4 print (a) """ Explanation: Partie 2 Les erreurs sont corrigées de telle sorte que la ligne fautive e...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_compute_mne_inverse_raw_in_label.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.minimum_norm import apply_inverse_raw, read_inverse_operator print(__doc__) data_path = sample.data_path() fname_inv = data_path + '/...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/tensorflow_extended/labs/Vertex_AI_Training_and_Serving_with_TFX_and_Vertex_Pipelines.ipynb
apache-2.0
# Use the latest version of pip. !pip install --upgrade pip !pip install --upgrade "tfx[kfp]<2" """ Explanation: Training and Serving with TFX and Vertex Pipelines Learning objectives Prepare example data. Create a pipeline. Run the pipeline on Vertex Pipelines. Test with a prediction request. Introduction In this n...
gmonce/datascience
src/2. - Matrices for data scientists.ipynb
gpl-3.0
%matplotlib inline import numpy as np, scipy as sp, matplotlib.pyplot as plt """ Explanation: <a href="https://colab.research.google.com/github/gmonce/datascience/blob/master/src/2.%20-%20Matrices%20for%20data%20scientists.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt=...
liang-chen/my-notes
miscellaneous/python_generator.ipynb
mit
def firstn(n): num = 0 while num < n: yield num num += 1 print(sum(firstn(1000000))) """ Explanation: A genertor function, which acts as an iterator, provides memory-efficient way to generate a large sequence of data, such as an array with size of 100,000. We have 3 different methods t...
arcyfelix/Courses
17-09-17-Python-for-Financial-Analysis-and-Algorithmic-Trading/.ipynb_checkpoints/3 - Pandas Exercises-checkpoint.ipynb
apache-2.0
import pandas as pd df = pd.read_csv('./data/banklist.csv') """ Explanation: Pandas Exercises Time to test your new pandas skills! Use the two csv files in this folder to complete the tasks in bold below! NOTE: ALL TASKS MUST BE DONE IN ONE LINE OF PANDAS CODE. GOT STUCK? NO PROBLEM! CHECK OUT THE SOLUTIONS LECTURE!...
AstroHackWeek/AstroHackWeek2014
day1/ipython/Converting Notebooks With nbconvert.ipynb
bsd-3-clause
!ipython nbconvert 'Working With Markdown Cells.ipynb' """ Explanation: NbConvert Command line usage NbConvert is the library, and the command line tool that allow to convert from notebook to other formats. It is a technological preview in 1.0 but is already usable and highly configurable. It ships already with many ...
phoebe-project/phoebe2-docs
2.1/tutorials/pblum.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" """ Explanation: Passband Luminosity Setup Let's first make sure we have the latest version of PHOEBE 2.1 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 ...
spacedrabbit/PythonBootcamp
Objects and Data Structures Assessment Test-Copy1.ipynb
mit
((((10 + 10) * 5) / 10)**2) + 5.00 - 4.75 """ Explanation: Objects and Data Structures Assessment Test Test your knowledge. Answer the following questions Write a brief description of all the following Object Types and Data Structures we've learned about: Numbers: represent a whole or floating point value, pos/neg....
JoeriHermans/dist-keras
examples/kafka_spark_high_throughput_ml_pipeline.ipynb
gpl-3.0
!(date +%d\ %B\ %G) """ Explanation: Kafka and Spark High Throughput Deep Learning Production Pipeline Joeri Hermans (Technical Student, IT-DB-SAS, CERN) Departement of Knowledge Engineering Maastricht University, The Netherlands End of explanation """ import json from keras.models import Sequenti...
dianafprieto/SS_2017
01_NB_IntroductionPython.ipynb
mit
print('Hello World') """ Explanation: <!-- <img src="files/images/python-screenshot.jpg" width="600"> --> <img src="imgs/header.png"> A first glance at Python and Jupyter 1. Hello World End of explanation """ help(random) """ Explanation: 2. Print the 'help' for a particular function (try also using the IPython she...
slundberg/shap
notebooks/tabular_examples/tree_based_models/tree_shap_paper/Figure 1 - Simple Inconsistency Example.ipynb
mit
import matplotlib.pyplot as pl import numpy as np import shap import xgboost as xgb """ Explanation: Figure 1 - Simple Inconsistency Example Here we create synthetic data to make XGBoost build the Model A and Model B from Figure 1 of the Tree SHAP paper. We then compute both individualized feature importances using Tr...
tensorflow/docs-l10n
site/ko/xla/tutorials/compile.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...
AllenDowney/ModSimPy
notebooks/chap24.ipynb
mit
# Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an assignment %config InteractiveShell.ast_node_interactivity='last_expr_or_assign' # import functions from the modsim.py module from modsim import * """ Explanation: Modeling and Simulati...
paris-saclay-cds/python-workshop
Day_1_Scientific_Python/scikit-learn/14-Model-Complexity-and-GridSearchCV.ipynb
bsd-3-clause
from sklearn.model_selection import cross_val_score, KFold from sklearn.neighbors import KNeighborsRegressor # generate toy dataset: x = np.linspace(-3, 3, 100) rng = np.random.RandomState(42) y = np.sin(4 * x) + x + rng.normal(size=len(x)) X = x[:, np.newaxis] cv = KFold(shuffle=True) # for each parameter setting do...
mdda/fossasia-2016_deep-learning
notebooks/2-CNN/5-TransferLearning/5-ImageClassifier-keras.ipynb
mit
import os from tensorflow import keras # Works with TF 1.12 #import keras import numpy as np import scipy import matplotlib.pyplot as plt %matplotlib inline import time CLASS_DIR='./images/cars' #CLASS_DIR='./images/seefood' # for HotDog vs NotHotDog """ Explanation: Re-Purposing a Pretrained Network Since a la...
Contiamo/contiamo-client-python
demo-notebooks/customer-segmentation.ipynb
mit
import pandas as pd import contiamo import datetime import seaborn as sns import numpy as np from sklearn.cluster import KMeans from sklearn import datasets """ Explanation: Customer segmentation _Suppose we want to cluster our customers according to their buying behavior, e.g. their purchase frequency. The Kmeans f...
RadoslawDryzner/LeRepoDuGuerrier
project/project.ipynb
mit
# Explore the Million Song Dataset directory structure to grab the filenames of the songs all_files = [] for (dirpath, dirnames, filenames) in os.walk("million-song/data"): all_files.extend([dirpath + "/" + filename for filename in filenames if filename.endswith(".h5")]) all_files_num = len(all_files) all_files_num...
DataFighter/Lasagne-tutorial
examples/tutorial.ipynb
mit
# Lasagne is pre-release, so it's interface is changing. # Whenever there's a backwards-incompatible change, a warning is raised. # Let's ignore these for the course of the tutorial import warnings warnings.filterwarnings('ignore', module='lasagne') import theano import theano.tensor as T import lasagne import numpy a...
ashwindeo/dataschoolers
6_VisualizationSchoolGrouping.ipynb
apache-2.0
%matplotlib inline import numpy as np import scipy as sp import matplotlib as mpl import matplotlib.cm as cm import matplotlib.pyplot as plt import pandas as pd pd.set_option('display.width', 500) pd.set_option('display.max_columns', 100) pd.set_option('display.notebook_repr_html', True) import seaborn as sns sns.set_s...
pastas/pastas
concepts/pastas_synthetic.ipynb
mit
import numpy as np import matplotlib.pyplot as plt from scipy.special import gammainc, gammaincinv import pandas as pd import pastas as ps ps.show_versions() """ Explanation: Synthetic Data Developed by Stijn Klop and Mark Bakker This Notebook contains a number of examples and tests with synthetic data. The purpose o...
navierula/Research-Fall-2017
minMaxCalc/dataExploration.ipynb
mit
# append data from time column to list time = [] for item in df.index: time.append(df["Time"][item]) # append data from load column to list load = [] for item in df.index: load.append(df["Load"][item]) # convert time array to np array for further processing np_time = array(time) # for local maxima max = argr...
bashtage/statsmodels
examples/notebooks/statespace_concentrated_scale.ipynb
bsd-3-clause
import numpy as np import pandas as pd import statsmodels.api as sm dta = sm.datasets.macrodata.load_pandas().data dta.index = pd.date_range(start='1959Q1', end='2009Q4', freq='Q') """ Explanation: State space models - concentrating the scale out of the likelihood function End of explanation """ class LocalLevel(sm...
infilect/ml-course1
keras-notebooks/RNN/7.1 RNN and LSTM.ipynb
mit
%matplotlib inline import numpy as np import pandas as pd #import theano #import theano.tensor as T import keras import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split # -...
GoogleCloudPlatform/asl-ml-immersion
notebooks/feature_engineering/solutions/2_bqml_adv_feat_eng.ipynb
apache-2.0
PROJECT = !gcloud config get-value project PROJECT = PROJECT[0] %env PROJECT=$PROJECT """ Explanation: Advanced Feature Engineering in BQML Learning Objectives Evaluate the model Extract temporal features, feature cross temporal features Apply ML.FEATURE_CROSS to categorical features Create a Euclidian feature colum...
voytekresearch/psd_fit
voytek_PSD_peak_finding_code_3.5.15.ipynb
mit
%pylab inline from __future__ import division import scipy as sp import numpy as np import matplotlib.pyplot as plt import random import os import scipy.io import scipy.signal from sklearn.metrics import r2_score from sklearn import cross_validation from sklearn import cluster import sys import warnings warnings.filte...
mne-tools/mne-tools.github.io
0.23/_downloads/141ddce18e923e8220337b357ba3dc45/ssd_spatial_filters.ipynb
bsd-3-clause
# Author: Denis A. Engemann <denis.engemann@gmail.com> # Victoria Peterson <victoriapeterson09@gmail.com> # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne import Epochs from mne.datasets.fieldtrip_cmc import data_path from mne.decoding import SSD """ Explanation: Compute Spectro-...
johanvdw/niche_vlaanderen
docs/getting_started.ipynb
mit
import niche_vlaanderen as nv """ Explanation: Getting started Interactive usage Niche Vlaanderen can be used interactively in Python. For interactive use, we recommend using the Jupyter notebook. This allows one to save documentation, code and results in the same file. This file itself is a notebook, and if you want ...
trsumit/sumit-udacity
nanodegree/c-ud032-nd/FinalProject/OpenstreetMapData.ipynb
mit
OSM_FILE = 'data/map.osm' """ Explanation: OpenStreetMap is an open project, which means it's free and everyone can use it and edit as they like. OpenStreetMap is direct competitor of Google Maps. How OpenStreetMap can compete with the giant you ask? It's depend completely on crowd sourcing. There's lot of people will...
ES-DOC/esdoc-jupyterhub
notebooks/cnrm-cerfacs/cmip6/models/cnrm-esm2-1/atmoschem.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', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: CNRM-CERFACS Source ID: CNRM-ESM2-1 Topic: Atmoschem Sub-Topics: T...
drabastomek/learningPySpark
Chapter02/LearningPySpark_Chapter02.ipynb
gpl-3.0
data = sc.parallelize( [('Amber', 22), ('Alfred', 23), ('Skye',4), ('Albert', 12), ('Amber', 9)]) """ Explanation: Chapter 3 - Learning PySpark Resilient Distributed Datasets Creating RDDs There are two ways to create an RDD in PySpark. You can parallelize a list End of explanation """ data_from_file = sc....
bashtage/statsmodels
examples/notebooks/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 = ...
ES-DOC/esdoc-jupyterhub
notebooks/pcmdi/cmip6/models/sandbox-1/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'pcmdi', 'sandbox-1', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: PCMDI Source ID: SANDBOX-1 Topic: Ocean Sub-Topics: Timestepping Framework, Advecti...
ralphhaygood/sklearn-gbmi
example.ipynb
mit
import numpy as np import pandas as pd from sklearn.ensemble import GradientBoostingRegressor from sklearn.inspection import plot_partial_dependence from sklearn_gbmi import * DATA_COUNT = 10000 RANDOM_SEED = 137 TRAIN_FRACTION = 0.9 """ Explanation: Example A complete example of how to use the sklearn_gbmi mod...
haanjack/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...
bjshaw/phys202-2015-work
days/day19/FittingModels.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from scipy import optimize as opt from IPython.html.widgets import interact """ Explanation: Fitting Models Learning Objectives: learn to fit models to data using linear and non-linear regression. This material is licensed under the MIT license and...
deepfield/ibis
docs/source/notebooks/tutorial/7-Advanced-Topics-ComplexFiltering.ipynb
apache-2.0
import ibis import os hdfs_port = os.environ.get('IBIS_WEBHDFS_PORT', 50070) hdfs = ibis.hdfs_connect(host='quickstart.cloudera', port=hdfs_port) con = ibis.impala.connect(host='quickstart.cloudera', database='ibis_testing', hdfs_client=hdfs) ibis.options.interactive = True """ Explanation: A...
karlstroetmann/Formal-Languages
Exercises/Grammar2HTML-Antlr/Grammar-2-HTML.ipynb
gpl-2.0
!cat Grammar.g4 !type Grammar.g4 """ Explanation: Converting a Grammar into <span style="font-variant:small-caps;">Html</span> You should store the grammar in the file Grammar.g4. This grammar should describe the lexical structure of the grammar for the language C that is contained in the file <a href="https://git...
jakevdp/sklearn_tutorial
notebooks/04.1-Dimensionality-PCA.ipynb
bsd-3-clause
from __future__ import print_function, division %matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy import stats plt.style.use('seaborn') """ Explanation: <small><i>This notebook was put together by Jake Vanderplas. Source and license info is on GitHub.</i></small> Dimensionality Reducti...
mne-tools/mne-tools.github.io
0.12/_downloads/plot_compute_covariance.ipynb
bsd-3-clause
import os.path as op import mne from mne.datasets import sample """ Explanation: .. _tut_compute_covariance: Computing covariance matrix End of explanation """ data_path = sample.data_path() raw_empty_room_fname = op.join( data_path, 'MEG', 'sample', 'ernoise_raw.fif') raw_empty_room = mne.io.read_raw_fif(raw_e...
WomensCodingCircle/CodingCirclePython
Lesson13_GUIs/GUI.ipynb
mit
import tkinter """ Explanation: GUI Python has a few options for creating GUIs (Graphical User Interfaces). We will learn Tkinter because it is part of the standard library and easy to use. GUIs are a type of user interface that allows users to run your program using viusal indicators like buttons, text boxes, and sc...
HarshaDevulapalli/foundations-homework
05/05-Homework-Devulapalli-Spotify_graded.ipynb
mit
import requests lil_response = requests.get('https://api.spotify.com/v1/search?query=lil&type=artist&type=track&market=US&limit=50') #print(response.text) lil_data = lil_response.json() lil_data.keys() #print(lil_data) lil_data['artists'].keys() lil_artists = lil_data['artists']['items'] for artist in lil_artists:...
open-forcefield-group/openforcefield
examples/using_smirnoff_in_amber_or_gromacs/convert_to_amber_gromacs.ipynb
mit
from simtk.openmm.app import PDBFile from openff.toolkit.topology import Molecule, Topology from openff.toolkit.typing.engines.smirnoff import ForceField ethanol = Molecule.from_smiles("CCO") cyclohexane = Molecule.from_smiles("C1CCCCC1") # Obtain the OpenMM Topology object from the PDB file. pdbfile = PDBFile('1_cyc...
ryneches/SuchTree
examples.ipynb
bsd-3-clause
%pylab inline %config InlineBackend.figure_format='retina' from SuchTree import SuchTree, SuchLinkedTrees import seaborn import pandas from scipy.cluster.hierarchy import ClusterWarning warnings.simplefilter( 'ignore', UserWarning ) warnings.simplefilter( 'ignore', FutureWarning ) """ Explanation: SuchTree There are...
jlawman/jlawman.github.io
content/numpy/Basics - Attributes, array creation, and basic operations on arrays.ipynb
mit
#"NumPy's main object is the homogeneous multidimensional array" import numpy as np arr = np.array([[0,1,2],[3,4,5]]) arr """ Explanation: Some Basic NumPy functionality (attributes, array creation, basic operations between arrays, and basic operations on one array). Adapted from https://docs.scipy.org/doc/numpy-dev...
ryanpdwyer/teensyio
examples/LED testing.ipynb
mit
np.std(df.y_scaled[np.logical_and(df.x_scaled < 1, df.x_scaled > 0.5)], ddof=1)*1000 """ Explanation: Tiny offset from zero here, but overall it looks pretty good. End of explanation """ (4./10000)**-1 """ Explanation: With default analogRead settings, 12-bit resolution, we see 4 µA measured current noise on 10 mA ...
texaspse/blog
media/f16-scientific-python/week2/Scientific Python Workshop 2.ipynb
mit
import pandas as pd import numpy as np #Dont import matplotlib until we get to histogram example import matplotlib.pyplot as plt #This next line tells jupyter to plot it in the same space %matplotlib inline """ Explanation: First import pandas and numpy End of explanation """ table = pd.read_excel("GASISData.xls") ...
tensorflow/docs
site/en/r1/tutorials/eager/custom_training.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...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session12/Day2/TellingStoriesWithData.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import cm %matplotlib notebook """ Explanation: Telling Stories With Data Version 0.1 By Kalina Borkiewicz 8 Jan 2021 Find a dataset of your choice. This can be one you have visualized before, one you found online, or the sample d...
nelson-liu/lectures
2016-2017.Meetings/fall/05.DIY_naive_bayes/naive_bayes_classifier_solution/naive_bayes_tweet_classifier.ipynb
mit
# setting up some imports and some miscellaneous helper methods we'll be using import re import string from math import log from __future__ import print_function # our default smoothing value, we pretend we see each word at # least once so all our probabilities are well-formed # (so no multiplying by 0 if a word isn'...
edhenry/notebooks
Algorithms Toolbox - Week 2.ipynb
mit
def ex_run_time(coef, n): rt = [] for i in range(n): rt.append((i, (coef*(i**2)))) return rt def decomp_run_time(coef_a, coef_b, n): rt = [] for i in range(n): rt.append((i, ((coef_a*i) + coef_b))) return rt ex_rt = ex_run_time(6, 100) decomp_rt = decomp_run_time(100, 300, 100...
ethen8181/machine-learning
keras/cnn_image_keras.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...
debsankha/network_course_python
exercises/02-exercise-graphs-basic-sol.ipynb
gpl-2.0
AG.nodes() AG.edges() nx.draw(AG) """ Explanation: E1.1 Explore the graph AG using the methods: * AG.nodes() * AG.edges() * AG.number_of_nodes() etc. Draw the graph using nx.draw End of explanation """ np.average([nx.shortest_path_length(AG, source=u, target=v) for u in AG.nodes() for v in AG.nodes() if u!=v]) ...
evangelistalab/forte
tutorials/Tutorial_02.01_mo_localization.ipynb
lgpl-3.0
import psi4 import forte import forte.utils """ Explanation: Forte Tutorial 2.02: Orbital localization In this tutorial we are going to explore how to localize orbitals and visualize them in Jupyter notebooks using the Python API. Let's import the psi4 and forte modules, including the forte.utils submodule End of exp...
QuantEcon/econometrics
Notebook_02_asymptotics/asymptotic_analysis_code.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import scipy as sp import scipy.stats as stats import seaborn as sns import pandas as pd import matplotlib.pyplot as plt from matplotlib.patches import ConnectionPatch import warnings warnings.filterwarnings('ignore') colors = sns.color_palette("Blues") plt.rc('text', usetex=Tr...
foreignOwl/data-analysis-notebooks
thanksgivingSurvey.ipynb
mit
# this line is required to see visualizations inline for Jupyter notebook %matplotlib inline # importing modules that we need for analysis import matplotlib.pyplot as plt import pandas as pd import numpy as np # read the data from file and print out first few rows and columns thanksgiving = pd.read_csv("thanksgiving....
lpsinger/healpy
doc/healpy_tutorial.ipynb
gpl-2.0
import matplotlib.pyplot as plt %matplotlib inline import numpy as np import healpy as hp """ Explanation: healpy tutorial See the Jupyter Notebook version of this tutorial at https://github.com/healpy/healpy/blob/master/doc/healpy_tutorial.ipynb See a executed version of the notebook with embedded plots at https://...
nanoos-pnw/ioos-ws
SensorMLparsing_IOOSSOS.ipynb
mit
from datetime import datetime from urllib import urlencode from collections import OrderedDict import numpy as np import pandas as pd from shapely.geometry import Point import geopandas as gpd from owslib.sos import SensorObservationService from owslib.swe.sensor.sml import SensorML, Contact, Documentation from owsli...
tobydriscoll/fnc-extras
python/Chapter03.ipynb
mit
year = arange(1955,2005,5) y = array([ -0.0480, -0.0180, -0.0360, -0.0120, -0.0040, 0.1180, 0.2100, 0.3320, 0.3340, 0.4560 ]) fig,ax = subplots() ax.scatter(year,y,color="k",label="data") xlabel("year") ylabel("anomaly (degrees C)") title("World temperature anomaly"); """ Explanation: Example 3.1.1 Here are 5-yea...
mne-tools/mne-tools.github.io
0.18/_downloads/ac6935fd2f56d2a7d16c589c65a46140/plot_artifacts_correction_maxwell_filtering.ipynb
bsd-3-clause
import mne from mne.preprocessing import maxwell_filter data_path = mne.datasets.sample.data_path() """ Explanation: Artifact correction with Maxwell filter This tutorial shows how to clean MEG data with Maxwell filtering. Maxwell filtering in MNE can be used to suppress sources of external interference and compensat...
greg-ashby/deep-learning-nanodegree
image-classification/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' # Use Floyd's cifar-10 dataset if present floyd_cifar10...
rileyrustad/pdxapartmentfinder
analysis/.ipynb_checkpoints/Munge-checkpoint.ipynb
mit
with open('../pdxapartmentfinder/data/MasterApartmentData.json') as f: my_dict = json.load(f) dframe = DataFrame(my_dict) dframe = dframe.T dframe.shape """ Explanation: Load the data from our JSON file. The data is stored as a dictionary of dictionaries in the json file. We store it that way beacause it's easy t...
klin90/missinglink
Analysis.ipynb
gpl-3.0
from collections import Counter from ast import literal_eval import pandas as pd import numpy as np # import and cleaning rests = pd.read_csv('cleaned.csv') rests['categories'] = rests['categories'].apply(literal_eval) # American cities only rests = rests[rests['state'].isin(['PA', 'NC', 'IL', 'AZ', 'NV', 'WI', 'OH']...
ichbinjakes/CodeExamples
Road_fatalities.ipynb
gpl-3.0
data = pd.read_csv(r'data/Fatalities_July_2016_II.csv') filter_age = data['Age']>=0 data = data[filter_age] data.head() """ Explanation: Federal Office of Road Saftey: THE HISTORY OF ROAD FATALITIES IN AUSTRALIA https://www.monash.edu/__data/assets/pdf_file/0020/216452/muarc237.pdf THE VICTORIAN PARLIAMENTARY ROAD SA...
turbomanage/training-data-analyst
self-paced-labs/tensorflow-2.x/synthetic_features_and_outliers.ipynb
apache-2.0
!pip install tensorflow==2.0.0-beta1 from matplotlib import cm from matplotlib import gridspec from matplotlib import pyplot as plt import numpy as np import pandas as pd import logging from packaging import version from IPython.display import display pd.options.display.max_rows = 10 pd.options.display.float_format =...
phanrahan/magmathon
notebooks/tutorial/icestick/Getting Started.ipynb
mit
import magma as m m.set_mantle_target("ice40") """ Explanation: Getting Started Magma is a hardware construction language written in Python 3. The central abstraction in Magma is a Circuit, which is analagous to a verilog module. A circuit is a set of functional units that are wired together. Magma is designed to work...
mne-tools/mne-tools.github.io
0.22/_downloads/6f729e8febc223b1d7003304f207eea9/plot_40_epochs_to_data_frame.ipynb
bsd-3-clause
import os import seaborn as sns import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_filt-0-40_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False) """ Explanation...
drcgw/IPython-Big-Data
Project-2/Project-2-Master/Project-2-Master.ipynb
bsd-3-clause
from Bio import SeqIO, AlignIO from Bio.Align.Applications import ClustalwCommandline from Bio.SeqFeature import SeqFeature, FeatureLocation from Bio.Graphics import GenomeDiagram from reportlab.lib import colors as rlc from reportlab.lib.units import cm #Make a variable point to where ClustalW2 is on your computer cl...
samstav/scipy_2015_sklearn_tutorial
notebooks/03.1 Case Study - Supervised Classification of Handwritten Digits.ipynb
cc0-1.0
from sklearn.datasets import load_digits digits = load_digits() """ Explanation: Supervised Learning: Classification of Handwritten Digits In this section we'll apply scikit-learn to the classification of handwritten digits. This will go a bit beyond the iris classification we saw before: we'll discuss some of the me...
mliu49/RMG-stuff
Thermo/sdata134k_large_polycyclic.ipynb
mit
from rmgpy.data.rmg import RMGDatabase from rmgpy import settings from rmgpy.species import Species from rmgpy.molecule import Group from rmgpy.rmg.main import RMG from IPython.display import display import numpy as np import os import pandas as pd from pymongo import MongoClient import logging logging.disable(logging....
mne-tools/mne-tools.github.io
0.16/_downloads/plot_mne_solutions.ipynb
bsd-3-clause
# Author: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import mne from mne.datasets import sample from mne.minimum_norm import make_inverse_operator, apply_inverse print(__doc__) data_path = sample.data_path() subjects_dir = data_path + '/subjects' # Read data fname_evoked = data_path + '/MEG/s...
khalido/nd101
nd101_wk2.ipynb
gpl-3.0
y = np.array([0.72*i*np.random.randint(1,20) + 2*i for i in range(50)]) x = np.array([i for i in range(len(y))]) plt.scatter(x,y); """ Explanation: Linear Regression refresher Some random data End of explanation """ from sklearn.linear_model import LinearRegression a = LinearRegression() #putting the input data int...
mne-tools/mne-tools.github.io
0.23/_downloads/99798f35196ac117a93fa936a5c48a93/20_visualize_evoked.ipynb
bsd-3-clause
import os import numpy as np import mne """ Explanation: Visualizing Evoked data This tutorial shows the different visualization methods for ~mne.Evoked objects. As usual we'll start by importing the modules we need: End of explanation """ sample_data_folder = mne.datasets.sample.data_path() sample_data_evk_file = o...
hyperion-rt/paper-2017-sed-models
notebook_raw/reading_raw_files.ipynb
bsd-2-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from hyperion.model import ModelOutput from hyperion.util.constants import au """ Explanation: Using the Hyperion files from the Robitaille (2017) YSO SED models This notebook demonstrates how to use the Hyperion files for the YSO SED models publi...
ES-DOC/esdoc-jupyterhub
notebooks/cccma/cmip6/models/sandbox-1/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cccma', 'sandbox-1', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: CCCMA Source ID: SANDBOX-1 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Bal...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/.ipynb_checkpoints/n11_results-checkpoint.ipynb
mit
# Basic imports import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import sys from time import time import pickle %matplotlib inline %pylab inline pylab.rcParams['figure.figsize'] = (20.0, 10.0) %load_ext autoreload %autoreload 2 sys.path.append('../../') """ Explanation: This noteboo...
DaveBackus/Data_Bootcamp
Projects/Summer_15/Employment-Population-Ratio_DavidCai_Jul_15.ipynb
mit
""" Creates a figure using FRED data Uses pandas Remote Data Access API Documentation can be found at http://pandas.pydata.org/pandas-docs/stable/remote_data.html """ %matplotlib inline import pandas as pd import pandas.io.data as web import matplotlib.pyplot as plt import numpy as np import datetime as dt from dateut...
chris1610/pbpython
notebooks/Pandas_Data_Types.ipynb
bsd-3-clause
import pandas as pd import numpy as np df = pd.read_csv("https://github.com/chris1610/pbpython/blob/master/data/sales_data_types.csv?raw=True") df """ Explanation: Pandas Data Types Accompanying the PB Python article here End of explanation """ df.info() """ Explanation: Use df.info and df.dtypes to look at the t...
irockafe/revo_healthcare
notebooks/MTBLS315/exploratory/Old_notebooks/MTBLS315_uhplc_pos_classifer-4.5ppm.ipynb
mit
import time import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np from sklearn import preprocessing from sklearn.ensemble import RandomForestClassifier from sklearn.cross_validation import StratifiedShuffleSplit from sklearn.cross_validation import cross_val_score #from sklearn....
astroumd/GradMap
notebooks/Lectures2021/Lecture2/challenge_problem2_instructor_version.ipynb
gpl-3.0
#Helper function def projection(t, v0, g): return v0*t - 0.5*g*(t**2) def projectile_X(t, v0, theta, g): vx0 = v0*np.cos(theta) return projection(t, vx0, 0) def projectile_Y(t,v0, theta, g): vy0 = v0*np.sin(theta) return projection(t, vy0, g) """ Explanation: Welcome to your projectile motion cha...
aleph314/K2
Data Mining/Association Rules/assoc_mining_problems.ipynb
gpl-3.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline with open('itemsets.dat') as f: transactions = [] for row in f: transactions.append(row.strip().split(',')) transactions[0:5] """ Explanation: Association Mining The goal in this problem set is to design and cod...
quantopian/research_public
notebooks/lectures/Means/questions/notebook.ipynb
apache-2.0
# Useful Functions def mode(l): # Count the number of times each element appears in the list counts = {} for e in l: if e in counts: counts[e] += 1 else: counts[e] = 1 # Return the elements that appear the most times maxcount = 0 modes = {} ...