repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
mne-tools/mne-tools.github.io
0.15/_downloads/plot_sensors_decoding.ipynb
bsd-3-clause
import numpy as np import matplotlib.pyplot as plt from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression import mne from mne.datasets import sample from mne.decoding import (SlidingEstimator, GeneralizingEstimator, ...
FirebaseExtended/codelab-digitclassifier-android
improve_accuracy_and_upload.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...
pysal/spaghetti
notebooks/network-spatial-autocorrelation.ipynb
bsd-3-clause
%config InlineBackend.figure_format = "retina" %load_ext watermark %watermark import esda import libpysal import matplotlib import matplotlib_scalebar from matplotlib_scalebar.scalebar import ScaleBar import numpy import spaghetti import splot %matplotlib inline %watermark -w %watermark -iv """ Explanation: If any ...
dalonlobo/GL-Mini-Projects
TweetAnalysis/Final/Q1/Dalon_4_RTD_MiniPro_Tweepy_Q1.ipynb
mit
import logging # python logging module # basic format for logging logFormat = "%(asctime)s - [%(levelname)s] (%(funcName)s:%(lineno)d) %(message)s" # logs will be stored in tweepy.log logging.basicConfig(filename='tweepy.log', level=logging.INFO, format=logFormat, datefmt="%Y-%m-%d %H:%M:%S") ""...
johnhw/sqlexperiment
notebooks/ExperimentLog_Doc.ipynb
mit
# import sqlexperiment as sqle # from sqlexperiment import experimentlog from explogger import ExperimentLog # log some JSON data e = ExperimentLog(":memory:", ntp_sync=False) e.log("mouse", data={"x":0, "y":0}) e.log("mouse", data={"x":0, "y":1}) e.log("mouse", data={"x":0, "y":2}) e.close() # from experimentlog imp...
fastai/course-v3
nbs/dl2/05b_early_stopping.ipynb
apache-2.0
x_train,y_train,x_valid,y_valid = get_data() train_ds,valid_ds = Dataset(x_train, y_train),Dataset(x_valid, y_valid) nh,bs = 50,512 c = y_train.max().item()+1 loss_func = F.cross_entropy data = DataBunch(*get_dls(train_ds, valid_ds, bs), c) #export class Callback(): _order=0 def set_runner(self, run): self.ru...
peterdalle/mij
Projects/newsrobot-moviereview.ipynb
gpl-3.0
# Install libraries. Try pip3 instead if it doesn't work. !pip install BeautifulSoup4 !pip install lxml # Import libraries. from urllib import request from lxml import html from bs4 import BeautifulSoup import ssl # Function to scrape HTML from web page. def scrapewebpage(url): UseSSL = True # If you get SSLErro...
brunorpinho/ufpel-python
modulos/Modulo 1.ipynb
mit
print 'bem vindos!' a = 2 + 3 print a """ Explanation: Table of Contents <p><div class="lev1 toc-item"><a href="#Módulo-1---O-Básico" data-toc-modified-id="Módulo-1---O-Básico-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Módulo 1 - O Básico</a></div><div class="lev2 toc-item"><a href="#Atalhos-do-Jupyter-Notebo...
ComputationalModeling/spring-2017-danielak
past-semesters/fall_2016/day-by-day/day22-econophysics/Econophysics.ipynb
agpl-3.0
# Put your code here! """ Explanation: Econophysics Names of group members // put your names here! Goals of this assignment Witness what we call "emergent behavior"; large patterns manifesting from the simple interactions of individual agents Develop a graphical way to show the dispersion of money across a society...
Serulab/Py4Bio
notebooks/Chapter 10 - Web Applications.ipynb
mit
!wget https://github.com/Serulab/Py4Bio/archive/master.zip !unzip master.zip !mv Py4Bio-master/code/ch10/* ./ !apt-get -y install apache2 !pip install bottle !wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip !unzip ngrok-stable-linux-amd64.zip """ Explanation: <a href="https://colab.research.g...
opengeostat/pygslib
pygslib/Ipython_templates/.ipynb_checkpoints/nscore_data_raw-checkpoint.ipynb
mit
#general imports import matplotlib.pyplot as plt import pygslib from matplotlib.patches import Ellipse import numpy as np import pandas as pd #make the plots inline %matplotlib inline """ Explanation: Testing the nscore transformation table End of explanation """ #get the data in gslib format into a pandas...
mabevillar/rmtk
rmtk/plotting/damage_dist/plot_damage_dist.ipynb
agpl-3.0
%matplotlib inline import plot_damage_dist as plotdd """ Explanation: Plot Damage Distribution This IPython notebook allows the user to create bar plots of the damage distribution results obtained from a scenario damage analysis, and to export the plots as png files. Damage distribution per taxonomy as well as total d...
mne-tools/mne-tools.github.io
0.19/_downloads/0769ca8628a53983ff9f3abc675c424e/plot_head_positions.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) from os import path as op import mne print(__doc__) data_path = op.join(mne.datasets.testing.data_path(verbose=True), 'SSS') pos = mne.chpi.read_head_pos(op.join(data_path, 'test_move_anon_raw.pos')) """ Explanation: Visualize subject he...
chseifert/tutorials
nlp-ie/Text-Classification.ipynb
apache-2.0
simple_train = ['call you tonight', 'Call me a cab', 'please call me... PLEASE!'] # import and instantiate CountVectorizer (with the default parameters) from sklearn.feature_extraction.text import CountVectorizer vect = CountVectorizer() # learn the 'vocabulary' of the training data vect.fit(simple_train) # examine...
mholtrop/Phys605
Python/Signal/Solving_RC_low_pass_with_ODE.ipynb
gpl-3.0
%matplotlib inline import numpy as np from scipy import signal import matplotlib.pyplot as plt # # Setup an input square wave signal. # F = 50. # Frequency of the square wave. T = .05 # Amount of time to simulate N = 2**10 # Number of time steps. Choose small to see a diff...
JasonSanchez/w261
week1/MIDS-W261-HW-01-Sanchez.ipynb
mit
!wc -w < bio """ Explanation: MIDS - w261 Machine Learning At Scale Course Lead: Dr James G. Shanahan (email Jimi via James.Shanahan AT gmail.com) Assignment - HW1 Name: Jason Sanchez (26989981) Class: MIDS w261 (Section Fall 2016 Group 2) Email: jason.sanchez@iSchool.Berkeley.edu Week: 1 Due Time: HW is...
thalesians/tsa
src/jupyter/python/kde.ipynb
apache-2.0
%matplotlib inline import os, sys sys.path.append(os.path.abspath('../../main/python')) import matplotlib.pyplot as plt import numpy as np from scipy import stats import thalesians.tsa.distrs as distrs import thalesians.tsa.kde as kde import importlib importlib.reload(distrs) importlib.reload(kde) """ Explanation:...
balarsen/pymc_learning
BayesianNetwork/Neural Networks in PyMC3.ipynb
bsd-3-clause
%matplotlib inline import theano floatX = theano.config.floatX import pymc3 as pm import theano.tensor as T import sklearn import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style('white') from sklearn import datasets from sklearn.preprocessing import scale from sklearn.cross_validation im...
QuLogic/folium
examples/WidthHeight.ipynb
mit
width, height = 480, 350 fig = Figure(width=width, height=height) m = folium.Map( location=location, tiles=tiles, width=width, height=height, zoom_start=zoom_start ) fig.add_child(m) fig.save(os.path.join('results', 'WidthHeight_0.html')) fig """ Explanation: Using same width and height trigge...
adico-somoto/deep-learning
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...
wanderer2/pymc3
docs/source/notebooks/discrete_find_MAP.ipynb
apache-2.0
import pymc3 as mc """ Explanation: Using find_MAP on models with discrete variables Maximum a posterior(MAP) estimation, can be difficult in models which have discrete stochastic variables. Here we demonstrate the problem with a simple model, and present a few possible work arounds. End of explanation """ alpha = 4...
borja876/Thinkful-DataScience-Borja
Challenge+Preparing+a+dataset+for+modeling+%28Feature+Selection%29.ipynb
mit
df['horsepower'].unique() df['cylinders'].unique() df['origin'].unique() df['modelyear'].unique() df['mpg'].unique() """ Explanation: Getting a grasp of the data set. Which variables are continuous and which ones are categorical End of explanation """ df = df.drop( df[(df.horsepower == '?')].index ) df[["mpg", "...
ueapy/ueapy.github.io
content/notebooks/2017-11-13-building-classes.ipynb
mit
class MyDescriptiveError(Exception): pass """ Explanation: First, let's refresh the terminology of object-oriented programming. class Tell Python to make a new type of thing. object Two meanings: the most basic type of thing, and any instance of some thing. instance What you get when you tell Python to create a cl...
sdpython/ensae_teaching_cs
_doc/notebooks/td1a_dfnp/td1a_cenonce_session_12_plot.ipynb
mit
%matplotlib inline """ Explanation: 1A.data - Visualisation des données Les tableaux et les graphes sont deux outils incontournables des statisticiens. Petite revue des graphes. End of explanation """ import matplotlib matplotlib.get_backend() import matplotlib.pyplot as plt import matplotlib matplotlib.get_backend...
kenfeldmann/6_12_16_carpentry_class
titanic_walkthrough.ipynb
mit
df = pd.read_csv("data/train.csv") df.head() df.tail() """ Explanation: Lets load in the dataset End of explanation """ df.dtypes df.info() df.describe() """ Explanation: Lets see the types that were imported on our behalf End of explanation """ df.shape """ Explanation: See the shape of the dataset End of ex...
planetlabs/notebooks
jupyter-notebooks/udm2/udm2_clouds.ipynb
apache-2.0
from planet import api import time import os import rasterio from rasterio.plot import show client = api.ClientV1() # build a filter for the AOI filter = api.filters.range_filter("clear_percent", gte=90) # show the structure of the filter print(filter) # we are requesting PlanetScope 4 Band imagery item_types = ['PS...
statsmodels/statsmodels.github.io
v0.13.1/examples/notebooks/generated/statespace_forecasting.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt macrodata = sm.datasets.macrodata.load_pandas().data macrodata.index = pd.period_range('1959Q1', '2009Q3', freq='Q') """ Explanation: Forecasting in statsmodels This notebook describes forecasting u...
jonbruner/ezgan
EZGAN.ipynb
mpl-2.0
import tensorflow as tf import numpy as np import datetime import matplotlib.pyplot as plt %matplotlib inline from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/") """ Explanation: This is an illustration of a very simple generative adversarial network, built with...
jinzekid/codehub
python/day6/.ipynb_checkpoints/2.3 Python语言基础-checkpoint.ipynb
gpl-3.0
a = 5; b = 6; c = 7 """ Explanation: 2.3 Python语言基础 1 语言语义(Language Semantics) 缩进,而不是括号 Python使用空格(tabs or spaces)来组织代码结构,而不是像R,C++,Java那样用括号。 建议使用四个空格来作为默认的缩进,设置tab键为四个空格 另外可以用分号隔开多个语句: End of explanation """ result = f(x, y, z) """ Explanation: 所有事物都是对象(object) 在python中,number,string,data structure,function,class...
GoogleCloudPlatform/mlops-on-gcp
continuous_training/kubeflow/labs/multiple_frameworks_lab.ipynb
apache-2.0
REGION = 'us-central1' PROJECT_ID = !(gcloud config get-value core/project) PROJECT_ID = PROJECT_ID[0] BUCKET = 'gs://' + PROJECT_ID """ Explanation: Lab: Continuous Training with TensorFlow, PyTorch, XGBoost, and Scikit-learn Models with KubeFlow and AI Platform Pipelines In this lab we will create containerized tra...
oscarmore2/deep-learning-study
transfer-learning/Transfer_Learning_Solution.ipynb
mit
from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm vgg_dir = 'tensorflow_vgg/' # Make sure vgg exists if not isdir(vgg_dir): raise Exception("VGG directory doesn't exist!") class DLProgress(tqdm): last_block = 0 def hook(self, block_num=1, block_size=1, total_s...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/noresm2-hh/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-hh', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: NCC Source ID: NORESM2-HH Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Balan...
mne-tools/mne-tools.github.io
0.24/_downloads/a786781c3c54739f0be7add5b76a068f/50_ssvep.ipynb
bsd-3-clause
# Authors: Dominik Welke <dominik.welke@web.de> # Evgenii Kalenkovich <e.kalenkovich@gmail.com> # # License: BSD-3-Clause import matplotlib.pyplot as plt import mne import numpy as np from scipy.stats import ttest_rel """ Explanation: Frequency-tagging: Basic analysis of an SSVEP/vSSR dataset In this tutoria...
mtasende/Machine-Learning-Nanodegree-Capstone
notebooks/prod/.ipynb_checkpoints/n08_simple_q_learner-checkpoint.ipynb
mit
# Basic imports import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime as dt import scipy.optimize as spo import sys from time import time from sklearn.metrics import r2_score, median_absolute_error from multiprocessing import Pool %matplotlib inline %pylab inline pylab.rcPar...
tensorflow/docs-l10n
site/ja/tfx/tutorials/tfx/template.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...
fantasycheng/udacity-deep-learning-project
tutorials/reinforcement/Q-learning-cart.ipynb
mit
import gym import tensorflow as tf import numpy as np """ Explanation: Deep Q-learning In this notebook, we'll build a neural network that can learn to play games through reinforcement learning. More specifically, we'll use Q-learning to train an agent to play a game called Cart-Pole. In this game, a freely swinging p...
dnc1994/MachineLearning-UW
ml-regression/blank/week-5-lasso-assignment-1-blank.ipynb
mit
import graphlab """ Explanation: Regression Week 5: Feature Selection and LASSO (Interpretation) In this notebook, you will use LASSO to select features, building on a pre-implemented solver for LASSO (using GraphLab Create, though you can use other solvers). You will: * Run LASSO with different L1 penalties. * Choose...
JamesSample/enviro_mod_notes
notebooks/01_Distributions.ipynb
mit
def gaussian_function(x, mu=0, sigma=1): """ Simple example function to return the probability density of a Gaussian with mean, mu, and standard deviation, sigma, evaluated at values in x. Note that a better function is available in scipy.stats.norm - this version is just for illu...
basp/aya
noise_old.ipynb
mit
v0 = 2 v1 = 5 plt.plot([0, 1], [v0, v1], '--') t = 1.0 / 3 vt = noise.lerp(v0, v1, t) plt.plot(t, vt, 'ro') """ Explanation: linear interpolation We need a function ${f}$ that, given values ${v_0}$ and ${v_1}$ and some interval ${t}$ where $0 \le {t} \le 1$, returns an interpolated value between ${v_0}$ and ${v_1}$. T...
mne-tools/mne-tools.github.io
0.23/_downloads/cc2f4b498fc65366ac39d017e939eec5/xdawn_denoising.ipynb
bsd-3-clause
# Authors: Alexandre Barachant <alexandre.barachant@gmail.com> # # License: BSD (3-clause) from mne import (io, compute_raw_covariance, read_events, pick_types, Epochs) from mne.datasets import sample from mne.preprocessing import Xdawn from mne.viz import plot_epochs_image print(__doc__) data_path = sample.data_pa...
gaufung/Data_Analytics_Learning_Note
Scikit_Learning/User_Guide/Support_Vector_Machine.ipynb
mit
from sklearn import svm X = [[0,0], [1,1]] y = [0, 1] clf = svm.SVC() clf.fit(X, y) clf.predict([[2,2]]) """ Explanation: Support Vector Machine SVMs are a set of supervised learning method used for classification, regression and outliers detection 1 Classification SVC, NuSVC and LinearSVC are classes capable of perf...
chapmanbe/nlm_clinical_nlp
IntroductionToPyConTextNLP.ipynb
mit
!pip install -U pycontextnlp==0.6.1.1 import pyConTextNLP.pyConTextGraph as pyConText import pyConTextNLP.itemData as itemData """ Explanation: Simple Clinical Natural Language Processing with pyConTextNLP In this notebook we introduce the basics of pyConTextNLP, a simple Python tool that we have used extensively for...
Soil-Carbon-Coalition/atlasdata
Length of green season from time-series Landsat NDVI.ipynb
mit
import pandas as pd, numpy as np from datetime import datetime, timedelta import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Length of green season from cloud-filtered Landsat SR This takes as input a time-series csv file generated by Google Earth Engine of cloud-filtered Landsat Surface Reflectance N...
thinkingmachines/deeplearningworkshop
codelab_4_tensorboard.ipynb
mit
# We really like this spiral dataset import numpy as np import matplotlib.pyplot as plt N = 1000 # points per class D = 2 # dimensionality at 2 so we can eyeball it K = 3 # number of classes X = np.zeros((N*K, D)) # generate an empty matrix to hold X features y = np.zeros(N*K, dtype='int32') # switching this to int3...
ebegoli/ErrorProne
sandbox/Crude+Error+Insertion.ipynb
apache-2.0
import pandas as pd import math import string import random from random import randint file = pd.read_csv("/Users/michaelbowie/Downloads/INPUTEVENTS_MV.csv") file = file.iloc[::30, :] file = file.reset_index(drop=True) file """ Explanation: Crude Error Insertion For insertion of errors, start with crude errors: a...
ronnydw/data-science-projects
class-central-survey-2016-17/Africa vs Rest of the World.ipynb
mit
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt sns.set(style="white") sns.set_context("talk") """ Explanation: Class Central Survey: compare target group 'Africa' with the rest of the sample End of explanation """ df = pd.read_csv('raw/2016-17-ClassCentral-Survey-data-noUserText.csv', deci...
SheffieldML/notebook
compbio/SingleCellDataWithGPyTutorial.ipynb
bsd-3-clause
import pods, GPy, itertools %matplotlib inline from matplotlib import pyplot as plt """ Explanation: Blastocyst Development in Mice: Single Cell TaqMan Arrays presented at the EBI BioPreDyn Course 'The Systems Biology Modelling Cycle' Max Zwiessele, Oliver Stegle, Neil Lawrence 12th May 2014 University of Sheffield an...
lionell/laboratories
num_methods/first/lab2+.ipynb
mit
RTOL = 0. ATOL = 1e-6 """ Explanation: import numpy as np import matplotlib.pyplot as plt import networkx as nx %matplotlib inline End of explanation """ def normalize(G): i = 0 n_to_i = {} i_to_n = G.nodes() for node in G.nodes(): n_to_i[node] = i i += 1 return (n_to_i, i_to_n) ...
keras-team/keras-io
examples/graph/ipynb/mpnn-molecular-graphs.ipynb
apache-2.0
import os # Temporary suppress tf logs os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import numpy as np import pandas as pd import matplotlib.pyplot as plt import warnings from rdkit import Chem from rdkit import RDLogger from rdkit.C...
GoogleCloudPlatform/asl-ml-immersion
notebooks/launching_into_ml/labs/supplemental/decision_trees_and_random_Forests_in_Python.ipynb
apache-2.0
import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns %matplotlib inline """ Explanation: Decision Trees and Random Forests in Python Learning Objectives Explore and analyze data using a Pairplot Train a single Decision Tree Predict and evaluate the Decision Tree Compare the De...
mne-tools/mne-tools.github.io
0.21/_downloads/dfd4175ec1a2c7f21de3596573c74301/plot_multidict_reweighted_tfmxne.ipynb
bsd-3-clause
# Author: Mathurin Massias <mathurin.massias@gmail.com> # Yousra Bekhti <yousra.bekhti@gmail.com> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD (3-clause) import os.path as op import mne from mne.datasets import somato...
ageron/ml-notebooks
04_training_linear_models.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 np.random.seed(42) # To plot pretty figures %matplotlib inline import matplotlib as mpl import matplotlib.pyplot ...
ryan-leung/PHYS4650_Python_Tutorial
notebooks/Jan2018/python-conditionals-and-loops.ipynb
bsd-3-clause
x = [1,2,3,4,5,6,7,8] for item in x: print item s = ['a','c','b','d','e','g','h',8] for item in s: print item """ Explanation: Python Conditionals And Loops Control Flow Control flow concerns how programs proceed in their execution to arrive a desired outcome. Programs can make choices depends on our program...
sclamons/murraylab_tools
examples/Utilities Usage Examples.ipynb
mit
import murraylab_tools.utilities as mt_utils import time mt_utils.set_credentials("put_your_username_here", "put_your_password_here") mt_utils.set_destination("sclamons@gmail.com") with mt_utils.notify_when_done("A block"): print("I'm doing a thing.") print("I'm doing a second thing.") time.sleep(3) p...
dipanjank/ml
text_classification_and_clustering/step_3_classification_of_full_dataset.ipynb
gpl-3.0
%matplotlib inline import matplotlib.pyplot as plt plt.style.use('ggplot') import pandas as pd import numpy as np import seaborn as sns """ Explanation: <h1 align="center">Level and Group Classification on Train and Test Datasets</h1> We have two classification tasks: Predict the level, which ranges from 1-16. Pre...
statsmodels/statsmodels.github.io
v0.12.2/examples/notebooks/generated/mediation_survival.ipynb
bsd-3-clause
import pandas as pd import numpy as np import statsmodels.api as sm from statsmodels.stats.mediation import Mediation """ Explanation: Mediation analysis with duration data This notebook demonstrates mediation analysis when the mediator and outcome are duration variables, modeled using proportional hazards regression....
estepona/PERCEIVE-freddie
TopicFlow_topicSimilarityTest_Zhang_09-14.ipynb
mit
file = 'topicflow/data/test/TopicSimilarity.json' with open(file, 'r') as ts_file: ts = ts_file.read() ts ts.split('\n') # 'var sim_data =' ts_body_pre = ts.split('\n')[1][:14] # care the last ';' ts_body = ts.split('\n')[1][14:-1] ts_body ts_body_dict = json.loads(ts_body) ts_body_dict old_value = np.array(...
beardeer/prediction-wrapper
run_example.ipynb
mit
import pandas as pd import numpy as np from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC from sklearn.ensemble import RandomForestClassifier from binary_classifier_wrappers import KfoldBinaryClassifierWrapper from metric_wrappers import RSquare, AUC, RMSE """ Explanation: 0. Introduction...
AstroHackWeek/AstroHackWeek2015
hacks/deep-learning/nolearn_tutorial.ipynb
gpl-2.0
import os import matplotlib.pyplot as plt %matplotlib inline import numpy as np from lasagne.layers import DenseLayer from lasagne.layers import InputLayer from lasagne.layers import DropoutLayer from lasagne.layers import Conv2DLayer from lasagne.layers import MaxPool2DLayer from lasagne.nonlinearities import softma...
HrantDavtyan/Data_Scraping
Week 5/Alternative_approach_(urllib_and_LXML).ipynb
apache-2.0
import urllib2 from lxml import html url = "https://careercenter.am/ccidxann.php" response = urllib2.urlopen(url) page = response.read() tree = html.document_fromstring(page) """ Explanation: Alternative libraries Before this, the two main libraries used for scraping a webpage were requests and BeautifulSoup. Howev...
Kaggle/learntools
notebooks/geospatial/raw/ex2.ipynb
apache-2.0
import pandas as pd import geopandas as gpd from shapely.geometry import LineString from learntools.core import binder binder.bind(globals()) from learntools.geospatial.ex2 import * """ Explanation: Introduction You are a bird conservation expert and want to understand migration patterns of purple martins. In your ...
tiagoantao/biopython-notebook
notebooks/10 - Swiss-Prot and ExPASy.ipynb
mit
import gzip handle = gzip.open("myswissprotfile.dat.gz") """ Explanation: Source of the materials: Biopython cookbook (adapted) <font color='red'>Status: Draft</font> Swiss-Prot and ExPASy {#chapter:swiss_prot} Parsing Swiss-Prot files Swiss-Prot (http://www.expasy.org/sprot) is a hand-curated database of protein seq...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/cmip6/models/nicam16-9d-l78/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'nicam16-9d-l78', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: MIROC Source ID: NICAM16-9D-L78 Topic: Atmos Sub-Topics: Dynamical Core, Radia...
urgedata/pythondata
compare_MLMethods/Comparing Machine Learning Methods.ipynb
mit
import pandas as pd import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (20,10) from sklearn import model_selection from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC from sklearn.neighbors import KNeighborsClassifier from sklearn.tree import DecisionTreeClassifier from sklear...
quole/gensim
docs/notebooks/Varembed.ipynb
lgpl-2.1
from gensim.models.wrappers import varembed vector_file = '../../gensim/test/test_data/varembed_leecorpus_vectors.pkl' model = varembed.VarEmbed.load_varembed_format(vectors=vector_file) """ Explanation: VarEmbed Tutorial Varembed is a word embedding model incorporating morphological information, capturing shared sub...
phoebe-project/phoebe2-docs
2.2/tutorials/grav_redshift.ipynb
gpl-3.0
!pip install -I "phoebe>=2.2,<2.3" """ Explanation: Gravitational Redshift (rv_grav) Setup Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release). End of explanation """ %matplo...
sz2472/foundations-homework
data and database/twitter_API_July5.ipynb
mit
response=twitter.search(q="data journalism",result_type="recent",count=20) first=response['statuses'][0] first.keys() first['entities'] for item in first['entities']['urls']: print(item['expanded_url']) for item in first['entities']['user_mentions']: print(item['screen_name']) cursor = twitter.cursor(twit...
ericmjl/Network-Analysis-Made-Simple
notebooks/01-introduction/02-networkx-intro.ipynb
mit
from IPython.display import YouTubeVideo YouTubeVideo(id='sdF0uJo2KdU', width="100%") """ Explanation: Introduction End of explanation """ import networkx as nx from datetime import datetime import matplotlib.pyplot as plt import numpy as np import warnings from nams import load_data as cf warnings.filterwarnings(...
PMEAL/OpenPNM
examples/contrib/predicting_effective_permeability_of_berea.ipynb
mit
import os import imageio import scipy as sp import numpy as np import openpnm as op import porespy as ps import matplotlib.pyplot as plt np.set_printoptions(precision=4) np.random.seed(10) %matplotlib inline """ Explanation: Predicting Permeability of Berea Berea Sandstone Simulation Using PoreSpy and OpenPNM The exam...
tensorflow/docs-l10n
site/ja/probability/examples/Bayesian_Gaussian_Mixture_Model.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...
buntyke/TRo2017
Experiments/Exp6/experiment2.ipynb
mit
# import the modules import GPy import csv import numpy as np import cPickle as pickle import scipy.stats as stats import sklearn.metrics as metrics import GPy.plotting.Tango as Tango from matplotlib import pyplot as plt %matplotlib notebook """ Explanation: Experiment 6: TRo Journal In this experiment, the generali...
statsmaths/stat665
lectures/lec22/.ipynb_checkpoints/notebook21-checkpoint.ipynb
gpl-2.0
%pylab inline import copy import numpy as np import pandas as pd import matplotlib.pyplot as plt from keras.datasets import imdb, reuters from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation, Flatten from keras.optimizers import SGD, RMSprop from keras.utils import np_utils fr...
Kaggle/learntools
notebooks/nlp/raw/tut3.ipynb
apache-2.0
import numpy as np import spacy # Need to load the large model to get the vectors nlp = spacy.load('en_core_web_lg') # Disabling other pipes because we don't need them and it'll speed up this part a bit text = "These vectors can be used as features for machine learning models." with nlp.disable_pipes(): vectors =...
csiu/100daysofcode
misc/day66_clustering-csvconfv3-nonkeynote-talks.ipynb
mit
from bs4 import BeautifulSoup import requests import pandas as pd website_to_parse = "https://csvconf.com/speakers/" # Save HTML to soup html_data = requests.get(website_to_parse).text soup = BeautifulSoup(html_data, "html5lib") doc = soup.find_all("table", attrs={"class", "speakers"})[1] names = doc.find_all("span...
minhhh/charts
pandas/Learn-Pandas-Completely.ipynb
mit
import pandas as pd from pandas import Series, DataFrame """ Explanation: Introduction to Pandas pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language. Our convention for importing pandas: End of explanation ""...
atlas-outreach-data-tools/notebooks
november_2017_v-1.0/ATLAS_OpenData_notebook_04.ipynb
gpl-3.0
import ROOT """ Explanation: <CENTER> <a href="http://opendata.atlas.cern" class="icons"><img src="http://opendata.atlas.cern/DataAndTools/pictures/opendata-top-transblack.png" style="width:40%"></a> </CENTER> A more difficult notebook in python In this notebook you can find a more difficult program that shows fur...
histogrammar/histogrammar-python
histogrammar/notebooks/histogrammar_tutorial_advanced.ipynb
apache-2.0
%%capture # install histogrammar (if not installed yet) import sys !"{sys.executable}" -m pip install histogrammar import histogrammar as hg import pandas as pd import numpy as np import matplotlib """ Explanation: Histogrammar advanced tutorial Histogrammar is a Python package that allows you to make histograms fr...
kongtiaowang/Loris
docs/notebooks/LORIS_API_Part2_Python-script.ipynb
gpl-3.0
import getpass # For input prompt hide what is entered import json # Provides convenient functions to handle json objects import re # For regular expression import requests # To handle http requests import warnings # To ignore warnings # Because the ssl certificates are unverified, warnings are thrown...
computational-class/computational-communication-2016
code/tutorials-scikit-learn-master/2. Robust and calibrated estimators with Scikit-Learn.ipynb
mit
# Global imports and settings # Matplotlib %matplotlib inline from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = (8, 8) plt.rcParams["figure.max_open_warning"] = -1 # Print options import numpy as np np.set_printoptions(precision=3) # Slideshow from notebook.services.config import ConfigManager cm...
EderSantana/seya
examples/NTM.ipynb
bsd-3-clause
%matplotlib inline from __future__ import absolute_import from __future__ import print_function import logging import numpy as np np.random.seed(124) import matplotlib.pyplot as plt import cPickle from theano import tensor, function from keras.datasets import mnist from keras.models import Graph, Sequential from kera...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a_eco/TD2A_eco_debuter_flask.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 2A.eco - Débuter avec Flask Pour aller vite, Flask est un framework de développement web en Python. Il en existe d'autres, le plus connu d'entre eux est Django. Ce notebook la création d'un site web à usage principalement privé. En allian...
sueiras/training
tensorflow_old/05-others/01_TF basic comands.ipynb
gpl-3.0
from __future__ import print_function import tensorflow as tf #Basic interactive session # Enter an interactive TensorFlow Session. sess = tf.InteractiveSession() # Define a var and a constant x = tf.Variable([1.0, 2.0]) a = tf.constant([3.0, 3.0]) # Initialize the var 'x' using the run() method x.initializer.run()...
ethen8181/machine-learning
deep_learning/seq2seq/huggingface_torch_transformer.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(css_style='custom2.css', plot_style=False) os.chdir(path) # 1. magic for inline plot...
MTgeophysics/mtpy
examples/notebooks/plot_resistivity_seismic.ipynb
gpl-3.0
# Add mtpy folder to python path. This may not be necessary # depending on how mtpy was installed. import sys #sys.path.append('/path/to/mtpy') sys.path.append('/media/data/work/GA/ausLAMP/codes/mtGeoMtpy/') %%capture # import modules import numpy as np import matplotlib import matplotlib.pyplot as plt from matplot...
EricKightley/sparsekmeans
plots/heuristic/.ipynb_checkpoints/heuristic-checkpoint.ipynb
mit
import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import numpy as np from scipy.linalg import hadamard from scipy.fftpack import dct %matplotlib inline n = 10 #dimension of data (rows in plot) K = 3 #number of centroids m = 4 #subsampling dimension p = 6 #number of observations (c...
obscode/bootcamp
IntroToPython.ipynb
mit
import antigravity """ Explanation: Carnegie Python Bootcamp Welcome to the python bootcamp. This thing you're reading is called an ipython notebook and will be your first introduction to the Python programming language. Notebooks are a combination of text markup and code that you can run in real time. Importing what ...
satishgoda/learning
python/libs/rxpy/support/Marble Diagrams.ipynb
mit
%run startup.py """ Explanation: Marble Diagrams with RxPY This is a fantastic feature to produce and visualize streams and to verify how various operators work on them. Have also a look at rxmarbles for interactive visualisations. ONE DASH IS <font size="40px">100</font> MILLISECONDS! End of explanation """ rst(O.f...
ceos-seo/data_cube_notebooks
notebooks/vegetation/NDVI_Thresholds.ipynb
apache-2.0
import sys import os sys.path.append(os.environ.get('NOTEBOOK_ROOT')) import numpy as np import pandas as pd import matplotlib.pyplot as plt import xarray as xr from dc_notebook_utilities import generate_metadata_report from utils.data_cube_utilities.dc_display_map import display_map from utils.data_cube_utilities.cl...
RadoslawDryzner/LeRepoDuGuerrier
Homework01/Homework 1.ipynb
mit
DATA_FOLDER = 'Data' # Use the data folder provided in Tutorial 02 - Intro to Pandas. %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import datetime from dateutil.parser import parse from os import listdir from os.path import isfile, join sns.set_context(...
aje/POT
docs/source/auto_examples/plot_otda_semi_supervised.ipynb
mit
# Authors: Remi Flamary <remi.flamary@unice.fr> # Stanislas Chambon <stan.chambon@gmail.com> # # License: MIT License import matplotlib.pylab as pl import ot """ Explanation: OTDA unsupervised vs semi-supervised setting This example introduces a semi supervised domain adaptation in a 2D setting. It explicits...
boffi/boffi.github.io
dati_2015/ha03/01_Impact.ipynb
mit
from math import atan2, cos, pi, sin, sqrt def format(desc, val, units): print("%-35s %9g %s"%(desc+":", val, units)) """ Explanation: Impact Preliminaries We have to import the mathematical functions used in the following. Also, we want to define a function to help with the formatting of our results. End of expla...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/sandbox-3/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'sandbox-3', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: NCC Source ID: SANDBOX-3 Topic: Ocean Sub-Topics: Timestepping Framework, Advection, ...
materialsvirtuallab/matgenb
notebooks/2018-01-01-ChemEnv - How to automatically identify coordination environments in a structure.ipynb
bsd-3-clause
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import LocalGeometryFinder import logging from pymatgen.ext.matproj import MPRester from pymatgen.analysis.chemenv.coordination_environments.chemenv_strategies import SimplestChemenvStrategy, MultiWeightsChemenvStrategy from pymatgen....
fastai/fastai
nbs/01a_losses.ipynb
apache-2.0
#|export class BaseLoss(): "Same as `loss_cls`, but flattens input and target." activation=decodes=noops def __init__(self, loss_cls, # Uninitialized PyTorch-compatible loss *args, axis:int=-1, # Class axis flatten:bool=True, # Flatten `inp` and `targ` before calculating los...
Ciaran1981/geospatial-learn
example_notebooks/.ipynb_checkpoints/PointCloudClassification-checkpoint.ipynb
gpl-3.0
from geospatial_learn import learning as ln incloud = "/path/to/Llandinam.ply" """ Explanation: A workflow for classifying a point cloud using point features The following example will run through the functions to classify a point cloud based on the point neighborhood attributes. This is a very simple example but thi...
DillmannFrench/Intro-PYTHON
Cours07-DILLMANN-ISEP2016.ipynb
gpl-3.0
def cube_positif( x ): if abs( x*x*x >= 0.0): return x*x*x print("Erreur") return cube_positif(-4) """ Explanation: Tant que ce n'est pas bien maîtrisé c'est ... La Guerre des Fonctions 1) Autes fonctions particulières à corriger 2) Exercices de Simplification du code des fonctions 3) Quelques E...
goerlitz/text-mining
python/Recipes - Doc2Vec Variations.ipynb
apache-2.0
import re # Regular Expressions import os.path # File Operations import pandas as pd # DataFrames & Manipulation from gensim.models.doc2vec import LabeledSentence, Doc2Vec # Model ...
darkomen/TFG
ipython_notebooks/06_regulador_experto/ensayo4.ipynb
cc0-1.0
#Importamos las librerías utilizadas import numpy as np import pandas as pd import seaborn as sns #Mostramos las versiones usadas de cada librerías print ("Numpy v{}".format(np.__version__)) print ("Pandas v{}".format(pd.__version__)) print ("Seaborn v{}".format(sns.__version__)) #Abrimos el fichero csv con los datos...
rob-dalton/dsi-alumni-lectures
neural_networks/Neural Networking.ipynb
mit
import os import tensorflow as tf # import tensorflow.python.platform from tensorflow.python.platform import gfile import numpy as np import pandas as pd """ Explanation: TensorFlow Inception-v3 Feature Extraction setup: Special thanks to KERNIX for their extremely helpful blog http://www.kernix.com/blog/image-classif...
BinRoot/TensorFlow-Book
ch09_cnn/Concept02_convolution.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import cifar_tools import tensorflow as tf names, data, labels = \ cifar_tools.read_data('./cifar-10-batches-py') def show_conv_results(data, filename=None): plt.figure() rows, cols = 4, 8 for i in range(np.shape(data)[3]): ...