repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
dcavar/python-tutorial-for-ipython
notebooks/Document Classification Tutorial.ipynb
apache-2.0
data = open('data/corpus').read() labels, texts = [], [] for line in data.split("\n"): content = line.split(' ', 1) labels.append(content[0]) texts.append(content[1]) print(texts[:3]) """ Explanation: Document Classification Tutorial 1 (C) 2019 by Damir Cavar Amazon Reviews See for more details the sourc...
deculler/DataScienceTableDemos
Census.ipynb
bsd-2-clause
# HIDDEN from datascience import * %matplotlib inline import matplotlib.pyplot as plots plots.style.use('fivethirtyeight') """ Explanation: Wrangling data in Tables David Culler This notebook illustrates several of the datascience tables methods for wrangling typical data. Here we use some simple census data. Even th...
aKumpan/hse-shad-ml
03-svm_and_logistic_regression/statement-svm/statement-svm.ipynb
apache-2.0
df_train = pd.read_csv('../data/svm-data.csv', header=None) X_train = df_train[df_train.columns[1:3]] y_train = df_train[df_train.columns[0]] """ Explanation: 1. Загрузите выборку из файла svm-data.csv. В нем записана двумерная выборка (целевая переменная указана в первом столбце, признаки — во втором и третьем). End...
planet-os/notebooks
api-examples/PlanetOS_WAve_Models.ipynb
mit
%matplotlib notebook import urllib.request import numpy as np import simplejson as json import pandas as pd from netCDF4 import Dataset, date2num, num2date import ipywidgets as widgets from IPython.display import display, clear_output import dateutil.parser import matplotlib.pyplot as plt from mpl_toolkits.basemap impo...
eggie5/UCSD-MAS-DSE230
hmwk3/1.PCA_analysis-HW-Copy.ipynb
mit
%pylab inline data_dir = "./Data/Weather/" """ Explanation: Homework 3 You will have to submit the following two completed ipython notebooks for this homework. PCA_analysis Reconstruction End of explanation """ !curl -o $data_dir/STAT.pickle http://mas-dse-open.s3.amazonaws.com/Weather/STAT.pickle """ Explanation:...
pjpmarques/Modelling-the-World
Archimedes and Pi.ipynb
mit
from math import sqrt, pi def side_next(side): return sqrt(2. - sqrt(4. - side**2.0)) """ Explanation: Archimedes and Pi by Paulo Marques, 2014/03/09 (Adapted in 2018/10/15 to Python from Julia) Since high school I've been fascinated with $\pi$ -- this infinite non-repeating irrational transcendent number. In fa...
mne-tools/mne-tools.github.io
dev/_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_path(...
amirziai/learning
machine-learning/decision-trees.ipynb
mit
import numpy as np """ Explanation: Decision Trees End of explanation """ def entropy(x): _, counts = np.unique(x, return_counts=True) p = counts / np.sum(counts) return -np.sum(p * np.log2(p)) def entropy_binary(x): trues = np.sum(x) percentage_true = trues / len(x) if percentage_true == 1:...
JAmarel/Phys202
Numpy/NumpyEx01.ipynb
mit
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import antipackage import github.ellisonbg.misc.vizarray as va """ Explanation: Numpy Exercise 1 Imports End of explanation """ def checkerboard(size): """Return a 2d checkboard of 0.0 and 1.0 as a NumPy array""" arr...
planetlabs/notebooks
jupyter-notebooks/udm2/udm2_clouds_aoi.ipynb
apache-2.0
import datetime import json import os import time from planet import api from planet.api import filters import rasterio from rasterio.plot import show """ Explanation: Usable Data Map (UDM2) Cloud Detection within an AOI This guide is a follow up to the UDM2 Cloud Detection notebook. Please refer to that notebook for...
astroumd/GradMap
notebooks/Lectures2021/Lecture1/L1_challenge_problem_stars_instructor.ipynb
gpl-3.0
# These are your stellar temperatures, you're welcome! temp = [5809, 16589, 4698, 1869, 37809, 8634] """ Explanation: Stellar Classification Background The Harvard Spectral Classification system for stars classifies stars based on their spectral type - where the type of a star is designated as a letter that correspon...
moble/PostNewtonian
PNTerms/Variables_Q.ipynb
mit
# Make sure division of integers does not round to the nearest integer from __future__ import division import sys sys.path.insert(0, '..') # Look for modules in directory above this one # Make everything in python's symbolic math package available from sympy import * # Make sure sympy functions are used in preference...
azhurb/deep-learning
sentiment-rnn/Anna_KaRNNa.ipynb
mit
import time from collections import namedtuple import numpy as np import tensorflow as tf """ Explanation: Anna KaRNNa In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book. This network is base...
qinwf-nuan/keras-js
notebooks/layers/convolutional/UpSampling2D.ipynb
mit
data_in_shape = (3, 3, 3) L = UpSampling2D(size=(2, 2), data_format='channels_last') layer_0 = Input(shape=data_in_shape) layer_1 = L(layer_0) model = Model(inputs=layer_0, outputs=layer_1) # set weights to random (use seed for reproducibility) np.random.seed(250) data_in = 2 * np.random.random(data_in_shape) - 1 res...
corochann/chainer-hands-on-tutorial
src/02_mnist_mlp/mnist_dataset_introduction.ipynb
mit
import numpy as np import chainer # Load the MNIST dataset from pre-inn chainer method train, test = chainer.datasets.get_mnist() """ Explanation: MNIST dataset introduction MNIST dataset MNIST (Mixed National Institute of Standards and Technology) database is dataset for handwritten digits, distributed by Yann Lecun...
softEcon/course
lectures/basics/cloud_computing/lecture.ipynb
mit
# standard library import os import time import shutil # Load Python SDK from azure import * from azure.servicemanagement import * from azure.storage import * # Subscription details subscription_id = '1a61650c-ada5-4173-a8da-2a4ffcfab747' certificate_path = 'mycert.pem' # Initialize connection sms = ServiceManageme...
ES-DOC/esdoc-jupyterhub
notebooks/ncar/cmip6/models/sandbox-2/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncar', 'sandbox-2', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: NCAR Source ID: SANDBOX-2 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Balan...
SJSlavin/phys202-2015-work
assignments/assignment09/IntegrationEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from scipy import integrate """ Explanation: Integration Exercise 1 Imports End of explanation """ def trapz(f, a, b, N): """Integrate the function f(x) over the range [a,b] with N points.""" h = (b-a)/N xvals = np.linspace(a, b, N+1) ...
astroumd/GradMap
notebooks/Haiti2016/spectrum.ipynb
gpl-3.0
%matplotlib inline # python 2-3 compatibility from __future__ import print_function """ Explanation: Spectra in (optical) Astronomy Here we introduce a simple spectrum, the example taken from the optical, where it all started. To quote Roger Wesson, the author of this particular spectrum: The sample spectrum was extr...
kubeflow/pipelines
samples/contrib/mnist/03_Reusable_Components.ipynb
apache-2.0
import kfp import kfp.gcp as gcp import kfp.dsl as dsl import kfp.compiler as compiler import kfp.components as comp import datetime import kubernetes as k8s # Required Parameters PROJECT_ID='<ADD GCP PROJECT HERE>' GCS_BUCKET='gs://<ADD STORAGE LOCATION HERE>' """ Explanation: Reusable components This tutorial desc...
pmorissette/bt
examples/PTE.ipynb
mit
names = ['foo','bar','rf'] dates = pd.date_range(start='2015-01-01',end='2018-12-31', freq=pd.tseries.offsets.BDay()) n = len(dates) rdf = pd.DataFrame( np.zeros((n, len(names))), index = dates, columns = names ) np.random.seed(1) rdf['foo'] = np.random.normal(loc = 0.1/252,scale=0.2/np.sqrt(252),size=n) r...
DistrictDataLabs/yellowbrick
examples/zjpoh/stacked_feature_importance.ipynb
apache-2.0
import os import sys sys.path.insert(0, "../..") import importlib import numpy as np import pandas as pd import yellowbrick import yellowbrick as yb from yellowbrick.features.importances import FeatureImportances import matplotlib as mpl import matplotlib.pyplot as plt from sklearn import manifold, datasets from skle...
marc-moreaux/Deep-Learning-classes
notebooks/Intro_to_SNN.ipynb
mit
# Download the dataset in this directory (does that work on Windows OS ?) ! wget http://deeplearning.net/data/mnist/mnist.pkl.gz import cPickle, gzip, numpy import numpy as np # Load the dataset f = gzip.open('mnist.pkl.gz', 'rb') train_set, valid_set, test_set = cPickle.load(f) f.close() def to_one_hot(y, n_classes...
hktxt/MachineLearning
PageRank.ipynb
gpl-3.0
# Before we begin, let's load the libraries. %pylab notebook import numpy as np import numpy.linalg as la from readonly.PageRankFunctions import * np.set_printoptions(suppress=True) """ Explanation: PageRank In this notebook, you'll build on your knowledge of eigenvectors and eigenvalues by exploring the PageRank algo...
subutai/htmresearch
projects/grid_cell_learning/1D CAN Learning.ipynb
agpl-3.0
# Imports and notebook statements %load_ext autoreload %autoreload 2 %matplotlib notebook from htmresearch.frameworks.grid_cell_learning.CAN import CAN1DNetwork import numpy as np from scipy import stats import matplotlib import matplotlib.pyplot as plt import seaborn as sns from sklearn.linear_model import LinearRegr...
AllenDowney/ThinkBayes2
notebooks/chap12.ipynb
mit
# If we're running on Colab, install empiricaldist # https://pypi.org/project/empiricaldist/ import sys IN_COLAB = 'google.colab' in sys.modules if IN_COLAB: !pip install empiricaldist # Get utils.py from os.path import basename, exists def download(url): filename = basename(url) if not exists(filename...
plipp/informatica-pfr-2017
nbs/2/4-ADVANCED-Primer-Idiomatic Pandas.ipynb
mit
import pandas as pd df = pd.read_csv('../../data/census.csv') df[:5] """ Explanation: Primer: Idiomatic Pandas: Making Code Pandorable Original Source: Coursera Introduction to Data Science in Python: Week 3 Good Follow up/Exercises can be found in 5 Tips To Write Idiomatic Pandas Code End of explanation """ # good ...
menome/neo4j-data-integration-meetup
pp-viz-master/jupyter/PP_Viz.ipynb
mit
# !pip install neo4j-driver # !pip install pandas # !pip install bokeh from neo4j.v1 import GraphDatabase import matplotlib.pyplot as plt import pandas as pd %matplotlib inline plt.figure(dpi=300) """ Explanation: Visualing The Paradise Papers With Python And Neo4j Connect to Neo4j from Python Create some Pandas Da...
hhain/sdap17
notebooks/.ipynb_checkpoints/02_Classification-checkpoint.ipynb
mit
# imports from sklearn.datasets import make_classification from sklearn.ensemble import RandomForestClassifier import time import matplotlib.pyplot as plt import seaborn as sns """ Explanation: Aufgabe 2: Classification A short test to examine the performance gain when using multiple cores on sklearn's esemble classif...
gururajl/deep-learning
sentiment-rnn/Sentiment_RNN.ipynb
mit
import numpy as np import tensorflow as tf with open('./reviews.txt', 'r') as f: reviews = f.read() with open('./labels.txt', 'r') as f: labels = f.read() reviews[:2000] """ Explanation: Sentiment Analysis with an RNN In this notebook, you'll implement a recurrent neural network that performs sentiment analy...
google/applied-machine-learning-intensive
content/06_other_models/07_xgboost/colab.ipynb
apache-2.0
# 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 the L...
google/starthinker
colabs/email_cm_to_bigquery.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: CM360 Report Emailed To BigQuery Pulls a CM Report from a gMail powered email account into BigQuery. License Copyright 2020 Google LLC, Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance...
crocha700/qg_vertical_modes
eady_problem/wave_structure.ipynb
mit
from __future__ import division import numpy as np from numpy import pi, sqrt,cos import matplotlib.pyplot as plt plt.rcParams.update({'font.size': 25, 'legend.handlelength' : 1.25}) %matplotlib inline import seaborn as sns #sns.set(style="darkgrid") sns.set_context("paper", font_scale=5, rc={"lines.linewidth": 1.5...
sgrid/pysgrid
notebooks/SGrid_velocity_interpolation_demo.ipynb
bsd-3-clause
from netCDF4 import Dataset import numpy as np import pysgrid url = ('http://geoport-dev.whoi.edu/thredds/dodsC/clay/usgs/users/zdefne/run076/his/00_dir_roms_display.ncml') nc = Dataset(url) sgrid = pysgrid.load_grid(nc) sgrid # We need a better __repr__ and __str__ !!! """ Explanation: Scenario: Velocity heat/vect...
js1972/CarND-Behavioral-Cloning
data_processing.ipynb
mit
from keras.preprocessing.image import img_to_array, load_img plt.rcParams['figure.figsize'] = (12, 6) i = 0 for camera in ["left", "center", "right"]: image = load_img("data/"+data_frame.iloc[1090][camera].strip()) image = img_to_array(image).astype(np.uint8) plt.subplot(1, 3, i+1) plt.imshow(image) ...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a_eco/TD2A_eco_API_SNCF_corrige.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 2A.eco - Exercice API SNCF corrigé Manipulation d'une API REST, celle de la SNCF est prise comme exemple. Correction d'exercices. End of explanation """ # !!!!! Attention à bien mettre votre token ici !!!!! token_auth = 'XXXXXXXXXXXXX...
tensorflow/docs-l10n
site/en-snapshot/hub/tutorials/wav2vec2_saved_model_finetuning.ipynb
apache-2.0
#@title Copyright 2021 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 ...
jinzishuai/learn2deeplearn
deeplearning.ai/C1.NN_DL/week2/Python+Basics+With+Numpy+v3.ipynb
gpl-3.0
### START CODE HERE ### (≈ 1 line of code) test = "Hello World" ### END CODE HERE ### print ("test: " + test) """ Explanation: Python Basics with Numpy (optional assignment) Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will help fami...
WormLabCaltech/mprsq
src/2 Predicting Interactions.ipynb
mit
# important stuff: import os import pandas as pd import numpy as np import genpy import gvars import morgan as morgan # stats import sklearn.decomposition import statsmodels.api as stm # network graphics import networkx as nx # Graphics import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns ...
stefanbuenten/nanodegree
p3/P3_Analysis_and_Report.ipynb
mit
# file size of original OSM file: 376 MB !ls -lh cologne_germany.osm # !/usr/bin/env python # -*- coding: utf-8 -*- # #import xml.etree.ElementTree as ET # Use cElementTree or lxml if too slow # #OSM_FILE = "cologne_germany.osm" # Replace this with your osm file #SAMPLE_FILE = "cologne_germany_sample.osm" # #k = 10 ...
hankcs/HanLP
plugins/hanlp_demo/hanlp_demo/zh/ner_restful.ipynb
apache-2.0
pip install hanlp_restful -U """ Explanation: <h2 align="center">点击下列图标在线运行HanLP</h2> <div align="center"> <a href="https://colab.research.google.com/github/hankcs/HanLP/blob/doc-zh/plugins/hanlp_demo/hanlp_demo/zh/ner_restful.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.sv...
james-prior/cohpy
20180129-cohpy-or-operator.ipynb
mit
# meld is a great visual difference program # http://meldmerge.org/ # the following command relies on the directory structure on my computer # tdd-demo comes from https://github.com/james-prior/tdd-demo/ !cd ~/projects/tdd-demo;git difftool -t meld -y 389df2a^ 389df2a """ Explanation: "or" operator This presentation...
ccwang002/2015Talk-DeepLearn-CNN
code/01_softmax.ipynb
mit
import random import time import numpy as np import matplotlib.pyplot as plt from cs231n.data_utils import load_CIFAR10 from cs231n.gradient_check import grad_check_sparse # plotting setting %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rcParams['image.interpolation']...
JamesSample/icpw
correct_toc_elev.ipynb
mit
# Create db connection r2_func_path = r'C:\Data\James_Work\Staff\Heleen_d_W\ICP_Waters\Upload_Template\useful_resa2_code.py' resa2 = imp.load_source('useful_resa2_code', r2_func_path) engine, conn = resa2.connect_to_resa2() # Get example data sql = ("SELECT * FROM resa2.water_chemistry_values2 " "WHERE sample_...
mne-tools/mne-tools.github.io
0.23/_downloads/511c644e95ae48be8cf394cec24a1865/80_brainstorm_phantom_elekta.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import os.path as op import numpy as np import matplotlib.pyplot as plt import mne from mne import find_events, fit_dipole from mne.datasets.brainstorm import bst_phantom_elekta from mne.io import read_raw_fif print(__doc__) """ Explanatio...
srcole/qwm
burrito/Burrito_Coordinates.ipynb
mit
%config InlineBackend.figure_format = 'retina' %matplotlib inline import numpy as np import scipy as sp import matplotlib.pyplot as plt import pandas as pd import seaborn as sns sns.set_style("white") """ Explanation: San Diego Burrito Analytics: Coordinates Determine the longitude and latitude for each restaurant b...
mne-tools/mne-tools.github.io
0.20/_downloads/12e915738bb5b40ffcb1157f1c2dee72/plot_receptive_field.ipynb
bsd-3-clause
# Authors: Chris Holdgraf <choldgraf@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne.decoding import ReceptiveField, TimeDelayingRidge from scipy.stats import multivariate_normal from scipy.io import loadm...
ltiao/project-euler
problem-3-largest-prime-factor.ipynb
unlicense
from six.moves import filter, map, range, reduce factors = lambda n: list(filter(lambda x: not n % x, range(1, n+1))) factors(24) """ Explanation: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? Version 1 - Inefficient Trial Division First a function to g...
ml4a/ml4a-guides
examples/reinforcement_learning/q_learning.ipynb
gpl-2.0
class Environment(): def __init__(self, grid): self.grid = grid self.n_rows = len(grid) self.n_cols = len(grid[0]) self.positions = self._positions() self.starting_positions = [p for p in self.positions if not self.is_terminal_state(p)] ...
GoogleCloudPlatform/practical-ml-vision-book
09_deploying/09c_changesig.ipynb
apache-2.0
import tensorflow as tf print('TensorFlow version' + tf.version.VERSION) print('Built with GPU support? ' + ('Yes!' if tf.test.is_built_with_cuda() else 'Noooo!')) print('There are {} GPUs'.format(len(tf.config.experimental.list_physical_devices("GPU")))) device_name = tf.test.gpu_device_name() if device_name != '/devi...
AllenDowney/ModSimPy
notebooks/variables_r_strange.ipynb
mit
from modsim import System # If this doesn't work, move this file into your /code folder. # It needs to be in the same folder as modsim.py. """ Explanation: Hey friends. Variables r weird. Shift+Enter if you agree. by Jane Sieving End of explanation """ def func1(input1, input2): print("Input 1 = ", input1) p...
JanetMatsen/meta4_bins_janalysis
ipython_notebooks/160226_reads_mapped_to_genome_bins.ipynb
bsd-2-clause
mpl.rcParams.update({ 'font.size': 16, 'axes.titlesize': 17, 'axes.labelsize': 15, 'xtick.labelsize': 10, 'ytick.labelsize': 13, #'font.family': 'Lato', 'font.weight': 600, 'axes.labelweight': 600, 'axes.titleweight': 600 #'figure.autolayout': True }) regen_plots = False if regen_plots: ...
DSSatPitt/katz-python-workshop
intro-to-apis/index.ipynb
cc0-1.0
import requests """ Explanation: Introduction to APIs This tutorial introduces Application Programming Interfaces (APIs) using the Yelp API as an example. Key Terminology API: An Application Programming Interface is the mechanism by which computers can talk to other computers and share information. REST API: This is...
sot/image_reconstruction
asol_upper_limit_trend.ipynb
bsd-2-clause
from mica.vv import get_rms_data from astropy.table import Table import matplotlib.pyplot as plt from Ska.Matplotlib import plot_cxctime from astropy.time import Time %matplotlib inline # Get the mica table of V&V data dat = Table(get_rms_data()) # Filter table to select only useful and final data datm = dat['obsid i...
keras-team/keras-io
examples/graph/ipynb/gat_node_classification.ipynb
apache-2.0
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import numpy as np import pandas as pd import os import warnings warnings.filterwarnings("ignore") pd.set_option("display.max_columns", 6) pd.set_option("display.max_rows", 6) np.random.seed(2) """ Explanation: Graph attention ne...
mintcloud/deep-learning
gan_mnist/Intro_to_GANs_Solution.ipynb
mit
%matplotlib inline import pickle as pkl import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data') """ Explanation: Generative Adversarial Network In this notebook, we'll be building a generativ...
ES-DOC/esdoc-jupyterhub
notebooks/test-institute-2/cmip6/models/sandbox-1/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'test-institute-2', 'sandbox-1', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: TEST-INSTITUTE-2 Source ID: SANDBOX-1 Sub-Topics: Radiative Forcin...
ahkab/ahkab
doc/examples/PZ_Example.ipynb
gpl-2.0
%pylab inline figsize = (10, 7) # libraries we need import ahkab print "We're using ahkab %s" % ahkab.__version__ """ Explanation: Pole-Zero (PZ) simulation example In this short example we will simulate a simple RLC circuit with the ahkab simulator. In particular, we consider a series resonant RLC circuit. If you ne...
chseifert/tutorials
data-science/DBSCAN_Clustering.ipynb
apache-2.0
import sklearn.metrics as sm import pandas as pd import numpy as np import matplotlib.pyplot as plt import sklearn.metrics as sm from sklearn import datasets from sklearn.cluster import DBSCAN iris = datasets.load_iris() x = pd.DataFrame(iris.data) x.columns = ['SepalLength','SepalWidth','PetalLength','PetalWidth'] ...
bgroveben/python3_machine_learning_projects
airline_flight_data/predicting_flight_delays.ipynb
mit
import datetime, warnings, scipy import pandas as pd import numpy as np import seaborn as sns import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.patches import ConnectionPatch from collections import OrderedDict from matplotlib.gridspec import GridSpec # https...
harishkrao/DSE200x
Week-7-MachineLearning/European Soccer Regression Analysis using scikit-learn.ipynb
mit
import sqlite3 import pandas as pd from sklearn.tree import DecisionTreeRegressor from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error from math import sqrt """ Explanation: <p style="font-family: Arial; font-size:2.75em;...
jhillairet/scikit-rf
doc/source/tutorials/Plotting.ipynb
bsd-3-clause
%matplotlib inline import skrf as rf """ Explanation: Plotting Introduction This tutorial describes skrf's plotting features. If you would like to use skrf's matplotlib interface with skrf styling, start with this End of explanation """ from skrf import Network ring_slot = Network('data/ring slot.s2p') ring_slot....
Phlya/adjustText
figures/Examples.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt # Matplotlib 2.0 shown here from adjustText import adjust_text import numpy as np import pandas as pd """ Explanation: Examples Some usage examples and ways to make the figure better than what default options yield. First import stuff End of explanation """ np.rando...
pyoceans/python-ctd
notebooks/quick_intro.ipynb
bsd-3-clause
import io import requests from pathlib import Path def download_demo_file(url): if not Path("CTD-spiked-unfiltered.cnv.bz2").exists(): response = requests.get(url, allow_redirects=True) try: response.raise_for_status() except requests.exceptions.HTTPError as err: ra...
cosmodesi/desibgsdev
specsim/spectral-simulations-paper1.ipynb
bsd-3-clause
import os import numpy as np %matplotlib inline import matplotlib.pyplot as plt from astropy.io import fits from astropy.table import Table import yaml import desispec.io import desisim.io from desisim.scripts import quickgen from desispec.scripts import group_spectra from desispec.io.util import write_bintable, makep...
GoogleCloudPlatform/ai-platform-samples
notebooks/samples/optimizer/ai_platform_optimizer_conditional_parameters.ipynb
apache-2.0
! pip install -U google-cloud ! pip install -U google-cloud-storage ! pip install -U requests # Automatically restart kernel after installs import IPython app = IPython.Application.instance() app.kernel.do_shutdown(True) """ Explanation: <table align="left"> <td> <a href="https://colab.research.google.c...
FederatedAI/FATE
doc/tutorial/pipeline/pipeline_tutorial_match_id.ipynb
apache-2.0
!pipeline --help """ Explanation: Pipeline Match ID Tutorial Starting at version 1.7, FATE distinguishes sample id(sid) and match id. Sid are unique to each sample entry, while match id corresponds to individual sample source identity. This adaption allows FATE to perform private set intersection on samples with repea...
legacysurvey/obiwan
doc/nb/dr5_qa.ipynb
bsd-3-clause
# To support both python 2 and python 3 from __future__ import division, print_function, unicode_literals # Common imports import numpy as np import os import pandas as pd # To plot pretty figures %matplotlib inline import matplotlib import matplotlib.pyplot as plt plt.rcParams['axes.labelsize'] = 14 plt.rcParams['xt...
metpy/MetPy
v0.12/_downloads/7fd39302ff9f3fa4a7870d3c31b04722/cross_section.ipynb
bsd-3-clause
import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt import numpy as np import xarray as xr import metpy.calc as mpcalc from metpy.cbook import get_test_data from metpy.interpolate import cross_section """ Explanation: Cross Section Analysis The MetPy function metpy.interpolat...
KristianHolsheimer/tensorflow_training
build_your_own_lstm_cell.ipynb
gpl-3.0
n_features = 7 # input data (one single data point) x = np.random.random([1, n_features]) print x """ Explanation: Exercise: Build an LSTM cell In the sequence of transformations (see fig. above), $x$ is the input vector at the current timestep. Notice that the memory cell state vectors $m$ and $c$ are updated at e...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_clickable_image.ipynb
bsd-3-clause
# Authors: Christopher Holdgraf <choldgraf@berkeley.edu> # # License: BSD (3-clause) from scipy.ndimage import imread import numpy as np from matplotlib import pyplot as plt from os import path as op import mne from mne.viz import ClickableImage, add_background_image # noqa from mne.channels import generate_2d_layout ...
gaufung/Data_Analytics_Learning_Note
DesignPattern/StrategyPattern.ipynb
mit
class customer: def setPhone(self,phone): self.phone=phone def setEmail(self,mail): self.email=mail def getPhone(self): return self.phone def getEmail(self): return self.email def setInfo(self,info): self.info=info def setName(self,name): self.cust...
joseerlang/PySpark_docker
notebook/.ipynb_checkpoints/Contador de palabras-checkpoint.ipynb
apache-2.0
fileName='book.txt' """ Explanation: Leer texto Lo primero que tenemos que hacer es cargar el texto. Para nuestro ejemplo, cargaremos una obra del proyecto Gutenberg. End of explanation """ import re def removePunctuation(text): return re.sub('[^a-z| |0-9]', '', text.strip().lower()) """ Explanation: Ahora vam...
qutip/qutip-notebooks
examples/heom/heom-1c-spin-bath-model-underdamped-sd.ipynb
lgpl-3.0
%pylab inline import contextlib import time import numpy as np from qutip import * from qutip.nonmarkov.heom import HEOMSolver, HSolverDL, BosonicBath, UnderDampedBath def cot(x): """ Vectorized cotangent of x. """ return 1. / np.tan(x) def coth(x): """ Vectorized hyperbolic cotangent of x. """ ret...
szitenberg/ReproPhyloVagrant
notebooks/Tutorials/Basic/3.3 Reading data.ipynb
mit
from reprophylo import * pj = unpickle_pj('outputs/my_project.pkpj', git=False) """ Explanation: See quick reference at the bottom See full module reference section for full details This part will show methods by which to read data into the ReproPhylo Project 3.3.1 Reading data from GenBank or EMBL files GenBank or EM...
letsgoexploring/linearsolve-package
examples/nk_model.ipynb
mit
# Import numpy, pandas, linearsolve, matplotlib.pyplot import numpy as np import pandas as pd import linearsolve as ls import matplotlib.pyplot as plt plt.style.use('classic') %matplotlib inline """ Explanation: A New-Keynesian Model Consider the new-Keynesian business cycle model from Walsh (2017), chapter 8 expresse...
NathanYee/ThinkBayes2
code/.ipynb_checkpoints/report03-checkpoint.ipynb
gpl-2.0
from __future__ import print_function, division % matplotlib inline import warnings warnings.filterwarnings('ignore') import math import numpy as np from thinkbayes2 import Pmf, Cdf, Suite, Joint import thinkplot """ Explanation: Report03 - Nathan Yee This notebook contains report03 for computational baysian statis...
marco-olimpio/ufrn
EEC2006/1_CrimeProject/Finding crime patterns in Montgomery County-Copy1.ipynb
gpl-3.0
import pandas as pd import numpy as np from bokeh.io import push_notebook, show, output_notebook from bokeh.layouts import row from bokeh.plotting import figure from bokeh.models import ( GMapPlot, GMapOptions, ColumnDataSource, Circle, DataRange1d, PanTool, WheelZoomTool, BoxSelectTool ) output_notebook() """ Ex...
minxuancao/shogun
doc/ipython-notebooks/gaussian_process/gaussian_processes.ipynb
gpl-3.0
%matplotlib inline # import all shogun classes from modshogun import * import random import numpy as np import matplotlib.pyplot as plt import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') from math import exp """ Explanation: Gaussian Processes in Shogun By Heiko Strathmann - <a href="mailto:heiko....
tensorflow/docs-l10n
site/ko/guide/random_numbers.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...
arsenovic/clifford
docs/tutorials/cga/interpolation.ipynb
bsd-3-clause
from clifford.g3c import * blades """ Explanation: This notebook is part of the clifford documentation: https://clifford.readthedocs.io/. Example 1 Interpolating Conformal Objects In this example we will look at a few of the tools provided by the clifford package for (4,1) conformal geometric algebra (CGA) and see how...
quoniammm/happy-machine-learning
Udacity-DL/image_classification_2/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...
chinmaymk/machine-learning-experiments
01-iris.ipynb
mit
from sklearn import datasets import numpy as np from sklearn.cross_validation import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn.metrics import confusion_matrix, accuracy_score from sklearn.learning_curve import learning_curve import matplotlib.pyplot as plt """ Explanation: The qu...
keras-team/keras-io
examples/keras_recipes/ipynb/endpoint_layer_pattern.ipynb
apache-2.0
import tensorflow as tf from tensorflow import keras import numpy as np """ Explanation: Endpoint layer pattern Author: fchollet<br> Date created: 2019/05/10<br> Last modified: 2019/05/10<br> Description: Demonstration of the "endpoint layer" pattern (layer that handles loss management). Setup End of explanation """ ...
McDermott-Group/Simulation
Projects/fluxNoiseMaskDesignV1.ipynb
gpl-2.0
qubits = [] for i in range(3): q = qubit.Qubit('Transmon') q.C_g = 3.87e-15 q.C_q = 75.1e-15 q.C_resToGnd = 79.1e-15 qubits.append(q) q = qubit.Qubit('OCSQubit') q.C_g = 2.94e-15 q.C_q = 48.5e-15 q.C_resToGnd = 51.5e-15 qubits.append(q) """ Explanation: Flux Noise Mask Design General Notes: * Look...
KartikKannapur/Programming_Challenges
HackerRank/Intro_to_Statistics/Day_04.ipynb
mit
# #Distribution scipy.stats.norm(30, 4) scipy.stats.norm(30, 4).cdf(40) 1 - scipy.stats.norm(30, 4).cdf(21) scipy.stats.norm(30, 4).cdf(35) - scipy.stats.norm(30, 4).cdf(30) """ Explanation: Day 4: Normal Distribution #1 Objective In this challenge, we practice solving problems with normally distributed variables. ...
openclimatedata/pymagicc
notebooks/MAGICC7.ipynb
agpl-3.0
# NBVAL_IGNORE_OUTPUT import pandas as pd import pymagicc from pymagicc import MAGICC6, MAGICC7 from pymagicc.io import MAGICCData from pymagicc import rcp26, rcp45, rcp60, rcp85, scenarios # NBVAL_IGNORE_OUTPUT %matplotlib inline from matplotlib import pyplot as plt plt.style.use("ggplot") plt.rcParams["figure.fig...
ES-DOC/esdoc-jupyterhub
notebooks/mohc/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', 'mohc', 'sandbox-1', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: MOHC Source ID: SANDBOX-1 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Balan...
massimo-nocentini/oeis-tools
notebooks/oeis-interaction.ipynb
mit
from pprinting import search """ Explanation: <p> <img src="http://www.cerm.unifi.it/chianti/images/logo%20unifi_positivo.jpg" alt="UniFI logo" style="float: left; width: 20%; height: 20%;"> <div align="right"> Massimo Nocentini<br> <small> <br>January 30, 2017: refactoring <br>September 12, 2016: search hint...
fadeetch/Mastering-ML-Python
Chapters/Three/Feature Extraction.ipynb
mit
from sklearn.feature_extraction import DictVectorizer onehot_encoder = DictVectorizer() instances = [{'city':"New York"},{'city':"San Fransisco"},{'city':"Chapel Hill"}] print(onehot_encoder.fit_transform(instances).toarray()) """ Explanation: Walk through techniques to extract features Extract from categorical valu...
ES-DOC/esdoc-jupyterhub
notebooks/ipsl/cmip6/models/sandbox-3/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ipsl', 'sandbox-3', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: IPSL Source ID: SANDBOX-3 Sub-Topics: Radiative Forcings. Properties: 85 (42 ...
ocefpaf/folium
examples/Plugins.ipynb
mit
import folium from folium import plugins m = folium.Map([45, 3], zoom_start=4) plugins.ScrollZoomToggler().add_to(m) m """ Explanation: Examples of plugins usage in folium In this notebook we show a few illustrations of folium's plugin extensions. These are available after importing folium.plugins. ScrollZoomToggle...
mayankjohri/LetsExplorePython
Section 1 - Core Python/Chapter 11 - Exceptions/Chapter13_Exceptions.ipynb
gpl-3.0
print (10/0) """ Explanation: Chapter 13: Exceptions When a failure occurs in the program (such as division by zero, for example) at runtime, an exception is generated. If the exception is not handled, it will be propagated through function calls to the main program module, interrupting execution. End of explanation ...
anandha2017/udacity
nd101 Deep Learning Nanodegree Foundation/DockerImages/10_sirajs_sentiment_analysis/notebooks/02_Ludos_pure-numpy-feedfowardNN/example/Exploring_XOR_approximation.ipynb
mit
%matplotlib inline import numpy as np from matplotlib import cm import matplotlib.pyplot as plt import seaborn as sns from progress_bar import log_progress import FeedforwardNN """ Explanation: Pure numpy feedforward neural network The NeuralNetwork class in the FeedForwardNN file is a simple neural network class cod...
Justin-YueLiu/CarND-Projects
CarND-Traffic-Sign-Classifier-P2/.ipynb_checkpoints/Traffic_Sign_Classifier-checkpoint.ipynb
mit
# Load pickled data import pickle # TODO: Fill this in based on where you saved the training and testing data training_file = ? validation_file=? testing_file = ? with open(training_file, mode='rb') as f: train = pickle.load(f) with open(validation_file, mode='rb') as f: valid = pickle.load(f) with open(test...
poppy-project/community-notebooks
tutorials-education/poppy_ergo_jr__decouverte_du_robot/TP1_mouvement_et_fonctions_cor_prof.ipynb
lgpl-3.0
i = 0 pos_init = [0, -90, 30, 0, 60, 0] for m in poppy.motors: m.moving_speed = 60 m.compliant = False m.goal_position = pos_init[i] i = i + 1 """ Explanation: Initialisation Ecrire un jeu d'instructions permettant d'initialiser la vitesse de chacun des moteurs à 30°/s. de mettre les moteurs poppy....
dpiparo/swanExamples
notebooks/CppFromPython_pycpp.ipynb
lgpl-2.1
%%python code=''' #include <iostream> #include <typeinfo> /// A trivial class class A { public: A(); ~A(); }; /// A trivial function int CountCharacters(const std::string s); /// A trivial template template<class T> class B { public: B() { std::cout << "The typeid name of the template argument is "...
datadryad/dans-bagit
examples/10.5061_dryad.q447c/data/10.5061_dryad.q447c_2/ORIGINAL/Sci-Hub.ipynb
bsd-3-clause
import pandas as pd import numpy as np months = ("sep2015", "oct2015", "nov2015", "dec2015", "jan2016", "feb2016") %mkdir "scihub_data_temp" """ Explanation: Sci-Hub server log data analysis John Bohannon, Science magazine This Notebook will help you process the 6 months of raw server log data provided by Sci-Hub to...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch2-Example_2-05.ipynb
unlicense
%pylab notebook """ Explanation: Electric Machinery Fundamentals 5th edition Chapter 2 (Code examples) Example 2-5 Calculate and plot the voltage regulation of a transformer as a function of load for power factors of 0.8 lagging, 1.0, and 0.8 leading. Import the PyLab namespace (provides set of useful commands and c...
IST256/learn-python
content/lessons/04-Iterations/Slides.ipynb
mit
i,j,k = 1, 20, 1 while (i<j): n = k*(j-i) print(n) i = i + 1 j = j - 1 k = k * 5 """ Explanation: IST256 Lesson 04 Iterations Zybook Ch 4 P4E Ch5 Links Participation: https://poll.ist256.com In-Class Questions: Zoom Chat! Agenda Exam 1 this week Go over HW 03 Iterations Make our code execute...