repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
statkraft/shyft-doc
notebooks/grid-pp/kalman_updating.ipynb
lgpl-3.0
# first you should import the third-party python modules which you'll use later on # the first line enables that figures are shown inline, directly in the notebook %matplotlib inline import datetime import numpy as np import os from os import path import sys # once the shyft_path is set correctly, you should be able to...
ucsd-ccbb/Oncolist
notebooks/.ipynb_checkpoints/BasicCFNClusterSetup-checkpoint.ipynb
mit
import os import sys sys.path.append(os.getcwd().replace("notebooks", "cfncluster")) ## Input the AWS account access keys aws_access_key_id = "/**aws_access_key_id**/" aws_secret_access_key = "/**aws_secret_access_key**/" ## CFNCluster name your_cluster_name = "geo" ## The private key pair for accessing cluster. p...
jphall663/GWU_data_mining
02_analytical_data_prep/src/py_part_2_winsorize.ipynb
apache-2.0
import pandas as pd # pandas for handling mixed data sets import numpy as np # numpy for basic math and matrix operations from scipy.stats.mstats import winsorize # scipy for stats and more advanced calculations """ Explanation: License Copyright (C) 2017 J. Patrick Hall...
bbartoldson/examples
pong/pong.ipynb
mit
import gym import numpy as np import tensorflow as tf from IPython import display import matplotlib.pyplot as plt import time config = tf.ConfigProto() #config.gpu_options.allow_growth = True %matplotlib inline """ Explanation: Pong-Playing TensorFlow Neural Network Import modules needed to train neural network in P...
amueller/nyu_ml_lectures
Grid Searches for Hyper Parameters.ipynb
bsd-2-clause
from sklearn.grid_search import GridSearchCV from sklearn.svm import SVC from sklearn.datasets import load_digits from sklearn.cross_validation import train_test_split digits = load_digits() X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.targ...
AllenDowney/ProbablyOverthinkingIt
hierarchical.ipynb
mit
from __future__ import print_function, division from thinkbayes2 import Pmf, Suite from fractions import Fraction """ Explanation: Bayesian interpretation of medical tests This notebooks explores several problems related to interpreting the results of medical tests. Copyright 2016 Allen Downey MIT License: http://op...
ivannz/study_notes
year_15_16/machine_learning_course/ensemble_practicum/xgboost/XGBoost.ipynb
mit
import time, os, re, zipfile import numpy as np, pandas as pd %matplotlib inline import matplotlib.pyplot as plt """ Explanation: eXtreme Gradient Boosting library (XGBoost) <center>An unfocused introduction by Ivan Nazarov</center> Import the main toolkit. End of explanation """ import sklearn as sk, xgboost as xg ...
vitojph/2016progpln
notebooks/1-Intro-Python.ipynb
mit
print('Esto es un mensaje') """ Explanation: Introducción a Python Vamos a hacer una pequeña introducción al lenguaje de programación Python. Para ello, me voy a apoyar principalmente en dos excelentes recursos para aprender Python online que siempre recomiendo: el curso de Python en CodeCademy. el curso Python for ...
hannorein/rebound
ipython_examples/IntegratingArbitraryODEs.ipynb
gpl-3.0
import rebound import numpy as np import matplotlib.pyplot as plt """ Explanation: Integrating arbitrary ODEs Although REBOUND is primarily an N-body integrator, it can also integrate arbitrary ordinary differential equations (ODEs). Even better: it can integrate arbitrary ODEs in parallel with an N-body simulation. T...
kmorel/kmorel.github.io
images/vaccine-correlations/vaccinevislie.ipynb
mit
vaccine_data = pandas.read_csv( 'covid19_vaccinations_in_the_united_states.csv', header=2, index_col='State/Territory/Federal Entity', ) print(vaccine_data.columns) vaccine_data.head() """ Explanation: Data read from https://covid.cdc.gov/covid-data-tracker/#vaccinations_vacc-total-admin-rate-total on Octo...
Esri/gis-stat-analysis-py-tutor
notebooks/ExtendingArcGISDirectly.ipynb
apache-2.0
import arcpy as ARCPY import numpy as NUM import SSDataObject as SSDO import scipy as SCIPY import pandas as PANDA import pysal as PYSAL """ Explanation: Leveraging Open-Source Python Packages for Data Analysis within the ArcGIS Environment (Direct Integration Strategy) Using NumPy as the common denominator Could use...
kdestasio/online_brain_intensive
nipype_tutorial/notebooks/basic_joinnodes.ipynb
gpl-2.0
from nipype import JoinNode, Node, Workflow from nipype.interfaces.utility import Function, IdentityInterface def get_data_from_id(id): """Generate a random number based on id""" import numpy as np return id + np.random.rand() def merge_and_scale_data(data2): """Scale the input list by 1000""" imp...
fastai/course-v3
nbs/dl2/cyclegan_ws.ipynb
apache-2.0
#path = Config().data_path() #! wget https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/datasets/summer2winter_yosemite.zip -P {path} #! unzip -q -n {path}/summer2winter_yosemite.zip -d {path} #! rm {path}/summer2winter_yosemite.zip path = Config().data_path()/'summer2winter_yosemite' path.ls() """ Explanation:...
vberthiaume/vblandr
udacity/udacity/3_regularization.ipynb
apache-2.0
# These are all the modules we'll be using later. Make sure you can import them before proceeding further. from __future__ import print_function import numpy as np import tensorflow as tf from six.moves import cPickle as pickle """ Explanation: Deep Learning Assignment 3 Previously in 2_fullyconnected.ipynb, you train...
adrn/GaiaPairsFollowup
paper/figures/Create-tgas-fits.ipynb
mit
from os import path # Third-party from astropy.io import ascii from astropy.table import Table import astropy.coordinates as coord import astropy.units as u from astropy.constants import G, c import matplotlib.pyplot as plt from matplotlib.colors import Normalize import numpy as np plt.style.use('apw-notebook') %matpl...
liumengjun/cn-deep-learning
ipnd-neural-network/Your_first_neural_network.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
postBG/DL_project
weight-initialization/weight_initialization.ipynb
mit
%matplotlib inline import tensorflow as tf import helper from tensorflow.examples.tutorials.mnist import input_data print('Getting MNIST Dataset...') mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) print('Data Extracted.') """ Explanation: Weight Initialization In this lesson, you'll learn how to fin...
ledrui/Regression
week3/week-3-polynomial-regression-assignment-blank.ipynb
mit
import graphlab """ Explanation: Regression Week 3: Assessing Fit (polynomial regression) In this notebook you will compare different regression models in order to assess which model fits best. We will be using polynomial regression as a means to examine this topic. In particular you will: * Write a function to take a...
tuanavu/coursera-university-of-washington
machine_learning/2_regression/assignment/week1/week-1-simple-regression-assignment-blank.ipynb
mit
import graphlab """ Explanation: Regression Week 1: Simple Linear Regression In this notebook we will use data on house sales in King County to predict house prices using simple (one input) linear regression. You will: * Use graphlab SArray and SFrame functions to compute important summary statistics * Write a functio...
rueedlinger/machine-learning-snippets
notebooks/supervised/text_classification/text_classification.ipynb
mit
import re import urllib.request ''' with urllib.request.urlopen('http://www.gutenberg.org/cache/epub/22465/pg22465.txt') as response: txt_german = response.read().decode('utf-8') with urllib.request.urlopen('https://www.gutenberg.org/files/46/46-0.txt') as response: txt_english = response.read().decode('utf-8'...
darioizzo/d-CGP
doc/sphinx/notebooks/symbolic_regression_3.ipynb
gpl-3.0
# Some necessary imports. import dcgpy import pygmo as pg # Sympy is nice to have for basic symbolic manipulation. from sympy import init_printing from sympy.parsing.sympy_parser import * init_printing() # Fundamental for plotting. from matplotlib import pyplot as plt %matplotlib inline """ Explanation: Multi-objectiv...
florianwittkamp/FD_ACOUSTIC
JupyterNotebook/2D/FD_2D_DX4_DT2_fast.ipynb
gpl-3.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt """ Explanation: FD_2D_DX4_DT2_fast 2-D acoustic Finite-Difference modelling GNU General Public License v3.0 Author: Florian Wittkamp Finite-Difference acoustic seismic wave simulation Discretization of the first-order acoustic wave equation Tempora...
ES-DOC/esdoc-jupyterhub
notebooks/nims-kma/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', 'nims-kma', 'sandbox-1', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: NIMS-KMA Source ID: SANDBOX-1 Sub-Topics: Radiative Forcings. Properties:...
rahulk90/vae_sparse
expt/TrainingVAEsparse.ipynb
mit
import sys,os,glob from collections import OrderedDict import numpy as np from utils.misc import readPickle, createIfAbsent sys.path.append('../') from optvaedatasets.load import loadDataset as loadDataset_OVAE from sklearn.feature_extraction.text import TfidfTransformer """ Explanation: VAEs on sparse data The follo...
NorfolkDataSci/presentations
2017-10_class_imbalance/Class Imbalance.ipynb
mit
%matplotlib inline from sklearn import utils import matplotlib import warnings warnings.filterwarnings('ignore') import numpy as np import pandas as pd from imblearn.over_sampling import SMOTE import matplotlib.pyplot as plt plt.style.use('ggplot') from sklearn.linear_model import LogisticRegression #metrics to...
computational-class/computational-communication-2016
code/.ipynb_checkpoints/16&17 networkx-checkpoint.ipynb
mit
%matplotlib inline import networkx as nx import matplotlib.cm as cm import matplotlib.pyplot as plt import networkx as nx G=nx.Graph() # G = nx.DiGraph() # 有向网络 # 添加(孤立)节点 G.add_node("spam") # 添加节点和链接 G.add_edge(1,2) print(G.nodes()) print(G.edges()) # 绘制网络 nx.draw(G, with_labels = True) """ Explanation: 网络科学理论简介...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/gapic/custom/showcase_custom_image_classification_online_pipeline.ipynb
apache-2.0
import os import sys # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install -U google-cloud-aiplatform $USER_FLAG """ Explanation: Vertex client library: Custom training image classification model with pipeline for online ...
junhwanjang/DataSchool
Lecture/02. 파이썬 프로그래밍/6) Numpy 시작하기.ipynb
mit
import numpy as np a = np.array([0, 1, 2, 3]) a """ Explanation: NumPy NumPy란 수치해석용 Python 라이브러리 C로 구현 (파이썬용 C라이브러리) BLAS/LAPACK 기반 빠른 수치 계산을 위한 Structured Array 제공 Home http://www.numpy.org/ Documentation http://docs.scipy.org/doc/ Tutorial http://www.scipy-lectures.org/intro/numpy/index.html https://docs.scipy.org/...
awitney/2017
hic_workshop_2017/WD/Basic_HiC_analysis.ipynb
gpl-3.0
# This is regular Python comment inside Jupyter "Code" cell. # You can easily run "Hello world" in the "Code" cell (focus on the cell and press Shift+Enter): print("Hello world!") """ Explanation: <a id="navigation"></a> Hi-C data analysis Welcome to the Jupyter notebook dedicated to Hi-C data analysis. Here we will b...
maciejkula/lightfm
examples/stackexchange/hybrid_crossvalidated.ipynb
apache-2.0
import numpy as np from lightfm.datasets import fetch_stackexchange data = fetch_stackexchange('crossvalidated', test_set_fraction=0.1, indicator_features=False, tag_features=True) train = data['train'] test = data['test'] """ Explanat...
irockafe/revo_healthcare
notebooks/MTBLS315/exploratory/MTBLS315_uhplc_pos_classifer-4ppm.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....
yala/introdeeplearning
draft/rnn.ipynb
mit
import tensorflow as tf import cPickle as pickle from collections import defaultdict import re, random import numpy as np from sklearn.feature_extraction.text import CountVectorizer #Read data and do preprocessing def read_data(fn): with open(fn) as f: data = pickle.load(f) #Clean the text new...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session05/Day2/Introduction to Photometry-Solutions.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import astropy.io.fits as fits ## make matplotlib appear in the notebook rather than in a new window %matplotlib inline """ Explanation: Introduction to Photometry - Solutions Dora Föhring, University of Hawaii Institute for Astronomy Aim: Demonstrate photometry on a ...
ngovindaraj/Udacity_Projects
Data_Analysis/Data_Analysis.ipynb
mit
import pandas as pd import numpy as np from scipy import stats import matplotlib.pyplot as plt import seaborn as sns sns.set_style("whitegrid") %pylab inline titanic_data = pd.read_csv('./titanic_data.csv') titanic_data.head() # Checking data types by column titanic_data.dtypes # Checking for duplicate entries du...
ES-DOC/esdoc-jupyterhub
notebooks/cas/cmip6/models/fgoals-f3-l/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cas', 'fgoals-f3-l', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: CAS Source ID: FGOALS-F3-L Sub-Topics: Radiative Forcings. Properties: 85 (4...
mediagit2016/workcamp-maschinelles-lernen-grundlagen
01-grundlagen/pandas.ipynb
gpl-3.0
# Import der Bibliotheken import pandas as pd # Extra packages import numpy as np import matplotlib.pyplot as plt # für die grafische Darstellung import seaborn as sns # für grafische Darstellung. Muss vorher evtl. installiert werden # jupyter notebook magic Befehl %matplotlib inline plt.rcParams['figure.figsize'] ...
edhenry/notebooks
Sequential and Binary Search in Python.ipynb
mit
# Finding a single integer in an array of integers using Python's `in` # operator 15 in [3,5,6,9,12,11] """ Explanation: This notebook will include examples of searching and sorting algorithms implemented in python. It is both for my own learning, and for anyone else who would like to use this notebook for anything ...
hetaodie/hetaodie.github.io
assets/media/uda-ml/supervisedlearning/jc/为慈善机构寻找捐助者/.Trash-0/files/finding_donors-zh.ipynb
mit
# Import libraries necessary for this project import numpy as np import pandas as pd from time import time from IPython.display import display # Allows the use of display() for DataFrames # Import supplementary visualization code visuals.py import visuals as vs # Pretty display for notebooks %matplotlib inline # Loa...
diegocavalca/Studies
programming/Python/tensorflow/exercises/Neural_Network_Part2_Solutions.ipynb
cc0-1.0
from __future__ import print_function import numpy as np import tensorflow as tf import matplotlib.pyplot as plt %matplotlib inline from datetime import date date.today() author = "kyubyong. https://github.com/Kyubyong/tensorflow-exercises" tf.__version__ np.__version__ """ Explanation: Neural Network Part2 End of...
AhmetHamzaEmra/Deep-Learning-Specialization-Coursera
Neural Networks and Deep Learning/Building+your+Deep+Neural+Network+-+Step+by+Step+v3.ipynb
mit
import numpy as np import h5py import matplotlib.pyplot as plt from testCases_v2 import * from dnn_utils_v2 import sigmoid, sigmoid_backward, relu, relu_backward %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['imag...
ziky5/F4500_Python_pro_fyziky
lekce_07/Moduly.ipynb
mit
from os import path path.exists("data.csv") """ Explanation: Moduly moduly aneb O importování aliasy lze importovat jen jednu třídu/funkci/proměnnou, ale moduly mohou mit i více úrovní End of explanation """ from os.path import exists """ Explanation: lze naimportovat jednotlive funkce End of explanation """ from...
tpin3694/tpin3694.github.io
regex/match_a_unicode_character.ipynb
mit
# Load regex package import re """ Explanation: Title: Match A Unicode Character Slug: match_a_unicode_character Summary: Match A Unicode Character Date: 2016-05-01 12:00 Category: Regex Tags: Basics Authors: Chris Albon Based on: Regular Expressions Cookbook Preliminaries End of explanation """ # Create a variabl...
adolfoguimaraes/machinelearning
Introduction/Exercicio01_Titanic.ipynb
mit
import pandas as pd import numpy as np #Lendo a base de dados df = pd.read_csv('../datasets/titanic/train.csv') print("Tabela Original") df.head() df = df.drop(['Name', 'Ticket', 'Cabin'], axis=1) df = df.dropna() df['Gender'] = df['Sex'].map({'female': 0, 'male':1}).astype(int) df['Port'] = df['Embarked'].map({'C'...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch6-Problem_6-06.ipynb
unlicense
%pylab notebook """ Explanation: Excercises Electric Machinery Fundamentals Chapter 6 Problem 6-6 End of explanation """ R1 = 0.10 # [Ohm] R2 = 0.07 # [Ohm] Xm = 10.0 # [Ohm] X1 = 0.21 # [Ohm] X2 = 0.21 # [Ohm] Pmech = 500 # [W] Pmisc = 0 # [W] Pcore = 400 # [W] Vphi = 120 # [...
EFerriss/pynams
EXAMPLES_experimentation.ipynb
mit
import pynams """ Explanation: pynams functions that help when running experiments End of explanation """ from pynams import fO2 fO2 = fO2(celsius=1000, buffer_curve='NNO') print(fO2) """ Explanation: What is the log base 10 of the fO2 in bars for a given temperature and buffer? End of explanation """ from pynams...
IS-ENES-Data/submission_forms
test/Templates/.ipynb_checkpoints/Create_Submission_Form-checkpoint.ipynb
apache-2.0
from dkrz_forms import form_widgets form_widgets.show_status('form-generation') """ Explanation: Create your DKRZ data ingest request form To generate a data submission form for you, please edit the cell below to include your name, email as well as the project your data belogs to Then please press "Shift" + Enter to e...
sdpython/ensae_teaching_cs
_doc/notebooks/exams/td_note_2015.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.e - TD noté, 5 décembre 2014 Parcours de chemins dans un graphe acyclique (arbre). End of explanation """ def adjacence(N): # on crée uen matrice vide mat = [ [ 0 for j in range(N) ] for i in range(N) ] for i in range(0,N...
james-prior/cohpy
20150327-dojo-join.ipynb
mit
''.join(['hello', 'gnew', 'world']) ' '.join(['hello', 'gnew', 'world']) ','.join(['hello', 'gnew', 'world']) ', '.join(['hello', 'gnew', 'world']) ' and '.join(['hello', 'gnew', 'world']) """ Explanation: The join method for strings is confusing for many beginners, so here are some examples. The first one, that a...
lmoresi/UoM-VIEPS-Intro-to-Python
Notebooks/SolveMathProblems/3 - AdvancedFiniteDifferences.ipynb
mit
import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Advanced finite difference This notebook assumes that you have completed the finite difference operations notebook. End of explanation """ voxel = np.load('voxel_data.npz')['data'] voxel.shape fig = plt.figure(1, figsize=(20, 5))...
zomansud/coursera
ml-classification/week-5/module-8-boosting-assignment-2-blank.ipynb
mit
import graphlab import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Boosting a decision stump The goal of this notebook is to implement your own boosting module. Brace yourselves! This is going to be a fun and challenging assignment. Use SFrames to do some feature engineering. Modify the decision tree...
kdmurray91/kwip-experiments
bifurcating/TreeSimulation.ipynb
mit
import utils import gzip import random import string import math import ete3 as ete from skbio import Alignment, DNA, DistanceMatrix from skbio.tree import nj import numpy as np import skbio import sys seed = 1003 genome_size = 1 # mbp num_samples = 8 num_runs = 3 mean_n_reads = 5e5 sd_n_reads = mean_n_reads * 0.1 # ...
wallinm1/kaggle-facebook-bot
facebook_notebook.ipynb
mit
import pandas as pd import re import gc import numpy as np from scipy import sparse from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.preprocessing import MinMaxScaler from sklearn.feature_selection import SelectPercentile, chi2 from sklearn.externals import joblib import xgboost as xgb """ Expl...
fastai/course-v3
nbs/dl2/01_matmul.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline """ Explanation: Matrix multiplication from foundations The foundations we'll assume throughout this course are: Python Python modules (non-DL) pytorch indexable tensor, and tensor creation (including RNGs - random number generators) fastai.datasets Check import...
machinelearningnanodegree/stanford-cs231
solutions/levin/assignment2/FullyConnectedNets.ipynb
mit
# As usual, a bit of setup import sys import os sys.path.insert(0, os.path.abspath('..')) import time import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.fc_net import * from cs231n.data_utils import get_CIFAR10_data from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradie...
ajgpitch/qutip-notebooks
docs/guide/BasicOperations.ipynb
lgpl-3.0
from qutip import * """ Explanation: Basic Operations on Quantum Objects Contents First Things First The Qobj Class Functions Acting on the Qobj Class <a id='first'></a> First Things First <br> <div class="warn"> **Warning**: Do not run QuTiP from the installation directory. </div> In order to load the QuTiP librar...
jArumugam/python-notes
P09Advanced Functions Test.ipynb
mit
def word_lengths(phrase): # return map(lambda word: len(word), [word for word in phrase.split()]) return map(lambda word: len(word), phrase.split()) word_lengths('How long are the words in this phrase') """ Explanation: Advanced Functions Test For this test, you should use the built-in functions to be ab...
texib/deeplearning_homework
tensor-flow-exercises/2_fullyconnected.ipynb
mit
# These are all the modules we'll be using later. Make sure you can import them # before proceeding further. import cPickle as pickle import numpy as np import tensorflow as tf """ Explanation: Deep Learning with TensorFlow Credits: Forked from TensorFlow by Google Setup Refer to the setup instructions. Exercise 2 Pre...
carltoews/tennis
results/.ipynb_checkpoints/DI_plot1-checkpoint.ipynb
gpl-3.0
from IPython.display import display, HTML display(HTML('''<img src="image1.png",width=800,height=500">''')) """ Explanation: Plot 1: The predictive potential of rank difference End of explanation """ import numpy as np # numerical libraries import pandas as pd # for data analysis import matplotlib as mpl # a big lib...
n-witt/MachineLearningWithText_SS2017
tutorials/7 Principal Component Analysis.ipynb
gpl-3.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import seaborn as sns; sns.set() """ Explanation: Principal Component Analysis (PCA) Up until now we've only talked about supervised methods. What were these again? Now we want to discuss unsupervised methods that highlight aspects of data witho...
aaossa/Dear-Notebooks
Web scraping/Lessons learned in web scraping.ipynb
gpl-3.0
import requests """ Explanation: Lessons learned in web scraping End of explanation """ req = requests.head('http://www.google.com') print(req.headers['Content-Length']) req = requests.get('http://www.google.com') print(req.headers['Content-Length']) """ Explanation: Making requests Lesson 1 - Use the head! A head...
fluxcapacitor/source.ml
jupyterhub.ml/notebooks/train_deploy/zz_under_construction/zz_old/talks/DataWeekends/SparkMLDeployment/DataWeekends-Mar182017-SparkMLDeployment.ipynb
apache-2.0
# You may need to Reconnect (more than Restart) the Kernel to pick up changes to these sett import os master = '--master spark://spark-master-2-1-0:7077' conf = '--conf spark.cores.max=1 --conf spark.executor.memory=512m' packages = '--packages com.amazonaws:aws-java-sdk:1.7.4,org.apache.hadoop:hadoop-aws:2.7.1' jars ...
tensorflow/workshops
extras/tensorflow_lattice/04_lattice_basics.ipynb
apache-2.0
!pip install tensorflow_lattice import tensorflow as tf import tensorflow_lattice as tfl from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import numpy as np """ Explanation: Basics of lattice models In this...
LucaCanali/Miscellaneous
Spark_Physics/HEP_benchmark/ADL_HEP_Query_Benchmark_Q1_Q5_CERNSWAN_Version.ipynb
apache-2.0
# Start the Spark Session # When Using Spark on CERN SWAN, run this cell to get the Spark Session # Note: when running SWAN for this, do not select to connect to a CERN Spark cluster # If you want to use a cluster anyway, please copy the data to a cluster filesystem first from pyspark.sql import SparkSession spark = (...
hvillanua/deep-learning
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...
kmclaugh/fastai_courses
ai-playground/Keras_Linear_Regression_Example.ipynb
apache-2.0
%matplotlib inline import pandas as pd import numpy as np import seaborn as sns from keras.layers import Dense from keras.models import Model, Sequential from keras import initializers """ Explanation: Keras Model for a Simple Linear Function In this notebook, I've created a simple Keras model to approximate a linea...
aschaffn/phys202-2015-work
assignments/assignment04/MatplotlibEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 2 Imports End of explanation """ !head -n 30 open_exoplanet_catalogue.txt """ Explanation: Exoplanet properties Over the past few decades, astronomers have discovered thousands of extrasolar planets. The follo...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/theta-model.ipynb
bsd-3-clause
import matplotlib.pyplot as plt import numpy as np import pandas as pd import pandas_datareader as pdr import seaborn as sns plt.rc("figure", figsize=(16, 8)) plt.rc("font", size=15) plt.rc("lines", linewidth=3) sns.set_style("darkgrid") """ Explanation: The Theta Model The Theta model of Assimakopoulos & Nikolopoulo...
ucsdlib/python-novice-inflammation
1-intro-to-numpy-short.ipynb
cc0-1.0
import numpy """ Explanation: Analyzing patient data Words are useful, but what’s more useful are the sentences and stories we build with them. A lot of powerful tools are built into languages like Python, even more live in the libraries they are used to build We need to import a library called NumPy Use this library...
angelmtenor/data-science-keras
simple_stock_prediction.ipynb
mit
%matplotlib inline import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import keras import helper #helper.reproducible(seed=42) sns.set() """ Explanation: Simple Stock Prediction Predicting Alphabet Inc. stock price using a Recurrent Neural Network Dataset from Goog...
gevero/py_matrix
py_matrix/examples/Gold Circular Magnetic Dichroism.ipynb
gpl-3.0
# libraries import numpy as np # numpy import scipy as sp # scipy import scipy.constants as sp_c # scientific constants import sys # sys to add py_matrix to the path # matplotlib inline plots import matplotlib.pylab as plt %matplotlib inline # adding py_matrix parent folder to python path sys.path.append('../../') i...
matthewzimmer/traffic-sign-classification
Traffic_Signs_Recognition-WIP.ipynb
mit
import hashlib import os import pickle from urllib.request import urlretrieve import numpy as np from PIL import Image from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelBinarizer from sklearn.utils import resample from tqdm import tqdm from zipfile import ZipFile import math ...
gregorjerse/rt2
2015_2016/lab13/Extending values on vertices.ipynb
gpl-3.0
from itertools import combinations, chain def simplex_closure(a): """Returns the generator that iterating over all subsimplices (of all dimensions) in the closure of the simplex a. The simplex a is also included. """ return chain.from_iterable([combinations(a, l) for l in range(1, len(a) + 1)]) ...
statsmodels/statsmodels.github.io
v0.13.1/examples/notebooks/generated/pca_fertility_factors.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import statsmodels.api as sm from statsmodels.multivariate.pca import PCA plt.rc("figure", figsize=(16, 8)) plt.rc("font", size=14) """ Explanation: statsmodels Principal Component Analysis Key ideas: Principal component analysis, world bank data, fertility In this ...
rickiepark/tfk-notebooks
tensorflow_for_beginners/5. Fully Connected Neural Network.ipynb
mit
from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) """ Explanation: 텐서플로우 라이브러리를 임포트 하세요. 텐서플로우에는 MNIST 데이터를 자동으로 로딩해 주는 헬퍼 함수가 있습니다. "MNIST_data" 폴더에 데이터를 다운로드하고 훈련, 검증, 테스트 데이터를 자동으로 읽어 들입니다. one_hot 옵션을 설정하면 정답 레이블을 원핫벡터로 바꾸어 줍니다. End of explana...
squishbug/DataScienceProgramming
11-Similarity-Based-Learning/SimilarityBased.ipynb
cc0-1.0
import numpy as np import math as ma import matplotlib.pyplot as plt %matplotlib inline X = np.array([3.3, 1.2]) Y = np.array([2.1, -1.8]) plt.arrow(0,0,*X, head_width=0.2); plt.arrow(0,0,*Y, head_width=0.2); plt.xlim([0, 4]); plt.ylim([-2,2]); plt.show(); # Euclidean distance manually: ma.sqrt(np.sum((X-Y)**2)) # ...
Kaggle/learntools
notebooks/feature_engineering_new/raw/tut_bonus.ipynb
apache-2.0
#$HIDE_INPUT$ import os import warnings from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from IPython.display import display from pandas.api.types import CategoricalDtype from category_encoders import MEstimateEncoder from sklearn.cluster import KMe...
greenelab/GCB535
23_Prelab_Python-I/Python-I-Prelab.ipynb
bsd-3-clause
print "I am Python code! Press Shift+Enter to run me!" """ Explanation: Lesson 1: Introduction to Python Table of contents How to use this notebook Introduction Writing your first script The print statement Variables and data types Basic math Commenting code Test your understanding: practice set 1 1. How to use thi...
flohorovicic/pynoddy
docs/notebooks/Training_Set_3.ipynb
gpl-2.0
%matplotlib inline # here the usual imports. If any of the imports fails, # make sure that pynoddy is installed # properly, ideally with 'python setup.py develop' # or 'python setup.py install' import sys, os import matplotlib.pyplot as plt import numpy as np # adjust some settings for matplotlib from matplotlib imp...
AlphaGit/deep-learning
sentiment-rnn/Sentiment_RNN.ipynb
mit
import numpy as np import tensorflow as tf with open('../sentiment-network/reviews.txt', 'r') as f: reviews = f.read() with open('../sentiment-network/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...
bollwyvl/ip-bootstrap
docs/Icon.ipynb
bsd-3-clause
from IPython.html import widgets from ipbs.widgets import Icon import ipbs.bootstrap as bs from ipbs.icons import FontAwesome, Size """ Explanation: Icon End of explanation """ fa = FontAwesome() """ Explanation: First, grab a FontAwesome instance which knows about all of the icons. End of explanation """ fa.spac...
cstrelioff/ARM-ipynb
Chapter3/chptr3.1.ipynb
mit
from __future__ import print_function, division %matplotlib inline import matplotlib import numpy as np import pandas as pd import matplotlib.pyplot as plt # use matplotlib style sheet plt.style.use('ggplot') # import statsmodels for R-style regression import statsmodels.formula.api as smf """ Explanation: 3.1: One ...
antonpetkoff/learning
text-mining/TM_lab08_MLP_Reg.ipynb
gpl-3.0
import tensorflow as tf import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import fetch_20newsgroups from nltk import TweetTokenizer from tensorflow.keras import layers from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.utils import to_categorical...
phenology/infrastructure
applications/notebooks/examples/python/connect_to_spark.ipynb
apache-2.0
#Add all dependencies to PYTHON_PATH import sys sys.path.append("/usr/lib/spark/python") sys.path.append("/usr/lib/spark/python/lib/py4j-0.10.4-src.zip") sys.path.append("/usr/lib/python3/dist-packages") #Define environment variables import os os.environ["HADOOP_CONF_DIR"] = "/etc/hadoop/conf" os.environ["PYSPARK_PYTH...
jpilgram/phys202-2015-work
project/NeuralNetworks.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt from IPython.html.widgets import interact from sklearn.datasets import load_digits digits = load_digits() print(digits.data.shape) def show_digit(i): plt.matshow(digits.images[i]); interact(show_digit, i=(0,100)); """ Explanation: Neural Networks This project w...
ewulczyn/talk_page_abuse
src/analysis/Characterizing Context of Attacks.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline import warnings warnings.filterwarnings('ignore') import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd from load_utils import * d = load_diffs() df_events, df_blocked_user_text = load_block_events_and_users() """ Explanatio...
tpin3694/tpin3694.github.io
python/pandas_dataframe_count_values.ipynb
mit
import pandas as pd """ Explanation: Title: Count Values In Pandas Dataframe Slug: pandas_dataframe_count_values Summary: Count Values In Pandas Dataframe Date: 2016-05-01 12:00 Category: Python Tags: Data Wrangling Authors: Chris Albon Import the pandas module End of explanation """ year = pd.Series([1875, 1876, ...
sdpython/ensae_teaching_cs
_doc/notebooks/competitions/2017/prepare_data_2017.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 2A.ml - 2017 - Préparation des données Ce notebook explique comment les données de la compétation 2017 ont été préparées. On récupére d'abord les données depuis le site OpenFoodFacts. End of explanation """ import os os.stat("c:/temp/fr...
ML4DS/ML4all
C3.Classification_LogReg/RegresionLogistica_student.ipynb
mit
# To visualize plots in the notebook %matplotlib inline # Imported libraries import csv import random import matplotlib import matplotlib.pyplot as plt import pylab import numpy as np from mpl_toolkits.mplot3d import Axes3D from sklearn.preprocessing import PolynomialFeatures from sklearn import linear_model """ Ex...
GoogleCloudPlatform/tf-estimator-tutorials
Experimental/Movielens Recommendation.ipynb
apache-2.0
!pip install annoy import math import os import pandas as pd import numpy as np from datetime import datetime import tensorflow as tf from tensorflow import data print "TensorFlow : {}".format(tf.__version__) SEED = 19831060 """ Explanation: Recommendation Model with Approximate Item Matching This notebook shows h...
jmhsi/justin_tinker
data_science/courses/deeplearning2/seq2seq-translation.ipynb
apache-2.0
import unicodedata, string, re, random, time, math, torch, torch.nn as nn from torch.autograd import Variable from torch import optim import torch.nn.functional as F import keras, numpy as np from keras.preprocessing import sequence """ Explanation: Requirements End of explanation """ SOS_token = 0 EOS_token = 1 c...
mbeyeler/opencv-machine-learning
notebooks/04.01-Preprocessing-Data.ipynb
mit
from sklearn import preprocessing import numpy as np X = np.array([[ 1., -2., 2.], [ 3., 0., 0.], [ 0., 1., -1.]]) """ Explanation: <!--BOOK_INFORMATION--> <a href="https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-opencv" target="_blank"><img align="left" src...
nreimers/deeplearning4nlp-tutorial
2015-10_Lecture/Lecture2/code/3_Intro_Lasagne_Solution.ipynb
apache-2.0
import gzip import cPickle import numpy as np import theano import theano.tensor as T import lasagne # Load the pickle file for the MNIST dataset. dataset = 'data/mnist.pkl.gz' f = gzip.open(dataset, 'rb') train_set, dev_set, test_set = cPickle.load(f) f.close() #train_set contains 2 entries, first the X values, se...
SSDS-Croatia/SSDS-2017
Day-1/First day - Introduction to Machine Learning with Tensorflow [SOLVED].ipynb
mit
import tensorflow as tf """ Explanation: Summer School of Data Science - Split '17 1. Introduction to Machine Learning with TensorFlow This hands-on session serves as an introductory course for essential TensorFlow usage and basic machine learning with TensorFlow. This notebook is partly based on and follow the approa...
tedunderwood/changepoint
diagonal_permutation.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt from matplotlib.collections import LineCollection import csv, random import numpy as np from scipy import spatial pcafields = ['PC' + str(x) for x in range(1,15)] # Here we just create a list of strings that will # correspond to field names in the data provided # by M...
ioam/scipy-2017-holoviews-tutorial
solutions/04-working-with-tabular-data-with-solutions.ipynb
bsd-3-clause
import numpy as np import scipy.stats as ss import pandas as pd import holoviews as hv hv.extension('bokeh') %opts Curve Scatter [tools=['hover']] """ Explanation: <a href='http://www.holoviews.org'><img src="assets/hv+bk.png" alt="HV+BK logos" width="40%;" align="left"/></a> <div style="float:right;"><h2>04. Working ...
ericmjl/Network-Analysis-Made-Simple
archive/5-graph-input-output-student.ipynb
mit
import zipfile # This block of code checks to make sure that a particular directory is present. if "divvy_2013" not in os.listdir('datasets/'): print('Unzipping the divvy_2013.zip file in the datasets folder.') with zipfile.ZipFile("datasets/divvy_2013.zip","r") as zip_ref: zip_ref.extractall('datasets'...
pranavj1001/LearnLanguages
python/DataAnalysis/numpy/NumPy.ipynb
mit
import numpy as np """ Explanation: NumPy NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays. In this notebook we'll try various numpy methods and in the p...
xlbaojun/Note-jupyter
05其他/pandas文档-zh-master/数据合并、连接和拼接-Merge, join, and concat.ipynb
gpl-2.0
import pandas as pd import numpy as np df1 = pd.DataFrame({'A':['A0','A1','A2','A3'], 'B':['B0','B1','B2','B3'], 'C':['C0','C1','C2','C3'], 'D':['D0','D1','D2','D3']}, index=[0,1,2,3]) df1 df2 = pd.DataFrame({'A': ['A4', 'A5', 'A6', 'A7']...
arsenovic/galgebra
examples/ipython/colored_christoffel_symbols.ipynb
bsd-3-clause
from __future__ import print_function import sys from galgebra.printer import Format, xpdf Format() from sympy import symbols, sin, pi, latex, Array, permutedims from galgebra.ga import Ga from IPython.display import Math """ Explanation: This example is kindly contributed by FreddyBaudine for reproducing pygae/galg...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/sdk/SDK_Custom_Training_with_Unmanaged_Image_Dataset.ipynb
apache-2.0
!pip3 uninstall -y google-cloud-aiplatform !pip3 install google-cloud-aiplatform import IPython app = IPython.Application.instance() app.kernel.do_shutdown(True) """ Explanation: Feedback or issues? For any feedback or questions, please open an issue. Vertex SDK for Python: Custom Training Example with Unmanaged Imag...