repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
pyemma/deeplearning | assignment1/knn.ipynb | gpl-3.0 | # Run some setup code for this notebook.
import random
import numpy as np
from cs231n.data_utils import load_CIFAR10
import matplotlib.pyplot as plt
# This is a bit of magic to make matplotlib figures appear inline in the notebook
# rather than in a new window.
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.... |
TickSmith/tickvault-python-api | examples/TickVault_NasdaqCx_Example1.ipynb | mit | from tickvaultpythonapi.nasdaqcxclient import NasdaqCxClient
nasdaq = NasdaqCxClient(user_name="<USER_NAME>",
secret_key="<API_KEY>")
nasdaq.datasets()
"""
Explanation: TickVault Python API Example Usage
Make sure to have registered and generated an API key on https://nasdaq-cx.ticksmith.co... |
aleph314/K2 | Foundations/Data Collection and Analysis/NumPy-Exercise.ipynb | gpl-3.0 | import numpy as np
"""
Explanation: NumPy Exercise
NumPy is the fundamental package for scientific computing in Python. It is a Python library that provides a multidimensional array object, various derived objects (such as masked arrays and matrices), and an assortment of routines for fast operations on arrays, includ... |
tensorflow/docs-l10n | site/en-snapshot/lite/performance/post_training_integer_quant_16x8.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... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/official/automl/sdk_automl_video_action_recognition_batch.ipynb | apache-2.0 | import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex SDK: AutoML training video action recognition model for batch prediction
<table align="l... |
Lstyle1/Deep_learning_projects | 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... |
jorisvandenbossche/DS-python-data-analysis | notebooks/00-jupyter_introduction.ipynb | bsd-3-clause | from IPython.display import Image
Image(url='http://python.org/images/python-logo.gif')
"""
Explanation: <p><font size="6"><b>Jupyter notebook INTRODUCTION </b></font></p>
© 2021, Joris Van den Bossche and Stijn Van Hoey (jorisvandenbossc&... |
mvaz/PyData-London2015 | notebooks/SparkScenarioAggregation.ipynb | mit | import os, sys
from pyspark.sql import SQLContext, Row
import datetime
from collections import namedtuple
import numpy as np
import pandas as pd
"""
Explanation: Launching
Using Spark 1.4 and Python 3.4. The way of launching the ipython notebook has changed
IPYTHON=1 IPYTHON_OPTS=notebook PYSPARK_PYTHON=python3 pyspa... |
xpharry/Udacity-DLFoudation | tutorials/sentiment_network/.ipynb_checkpoints/Sentiment Classification - How to Best Frame a Problem for a Neural Network (Project 1)-checkpoint.ipynb | mit | def pretty_print_review_and_label(i):
print(labels[i] + "\t:\t" + reviews[i][:80] + "...")
g = open('reviews.txt','r') # What we know!
reviews = list(map(lambda x:x[:-1],g.readlines()))
g.close()
g = open('labels.txt','r') # What we WANT to know!
labels = list(map(lambda x:x[:-1].upper(),g.readlines()))
g.close()... |
rainyear/pytips | Tips/2016-03-11-Arguments-and-Unpacking.ipynb | mit | def func(a, b = 1):
pass
func(a = "G", 20) # SyntaxError 语法错误
"""
Explanation: 函数调用的参数规则与解包
Python 的函数在声明参数时大概有下面 4 种形式:
不带默认值的:def func(a): pass
带有默认值的:def func(a, b = 1): pass
任意位置参数:def func(a, b = 1, *c): pass
任意键值参数:def func(a, b = 1, *c, **d): pass
在调用函数时,有两种情况:
没有关键词的参数:func("G", 20)
带有关键词的参数:func(a = "G... |
apagac/cfme_tests | notebooks/MultiProcessing.ipynb | gpl-2.0 | from os import getpid, getppid
from time import sleep
def printer(val, wait=0):
sleep(wait)
print('Pid: {}, PPid: {}, Value: {}'
.format(getpid(), getppid(), val))
"""
Explanation: Multiprocessing in Python 3
### Threads vs Processes
### Thread/Process execution, timing
### Direct Thread/Pr... |
BenLangmead/comp-genomics-class | notebooks/Minimizers.ipynb | gpl-2.0 | def string_to_kmers(s, length):
return [s[i:i+length] for i in range(len(s)-length+1)]
def minimizer(k, l):
""" Given k-mer, return its minimal l-mer """
assert l <= len(k)
return min(string_to_kmers(k, l))
minimizer('ABC', 2)
minimizer('abracadabra', 4)
"""
Explanation: Minimizers
One way to partit... |
robertoalotufo/ia898 | 2S2018/tutorial_numpy_1_5.ipynb | mit | a = np.arange(20).reshape(5,4)
b = 2 * np.ones((5,4))
c = np.arange(12,0,-1).reshape(4,3)
print('a=\n', a )
print('b=\n', b )
print('c=\n', c )
"""
Explanation: Introdução ao NumPy
Operações matriciais
Uma das principais vantagens da estrutura ndarray é sua habilidade de processamento matricial.
Assim, para se mul... |
ssunkara1/bqplot | examples/Applications/Visualizing the US Elections.ipynb | apache-2.0 | import pandas as pd
import numpy as np
from __future__ import print_function
from ipywidgets import VBox, HBox
import os
codes = pd.read_csv(os.path.abspath('../data_files/state_codes.csv'))
try:
from pollster import Pollster
except ImportError:
print('Pollster not found. Installing Pollster..')
import pi... |
microsoft/dowhy | docs/source/example_notebooks/dowhy_estimation_methods.ipynb | mit | %load_ext autoreload
%autoreload 2
import numpy as np
import pandas as pd
import logging
import dowhy
from dowhy import CausalModel
import dowhy.datasets
"""
Explanation: DoWhy: Different estimation methods for causal inference
This is a quick introduction to the DoWhy causal inference library.
We will load in a sa... |
drericstrong/Blog | 20170416_CentralLimitTheoremWithMonteCarlo.ipynb | agpl-3.0 | import random
import numba
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
# The first "for" loop, sampling from a random distribution
@numba.jit
def MCHist(n, f, param1, param2):
res = 0.0
for _ in range(0, n):
# Luckily, Python allows functions to be passed ... |
gwu-libraries/notebooks | 20151120-loggins-data/20151120-loggins-data.ipynb | mit | from IPython.display import Image
Image(url="screenshot.png", height=600, width=400)
"""
Explanation: Exploring loggins and entrance data
Our loggins application, available as a public UI at http://computers.library.gwu.edu, has been running continuously for over two years. It tracks user logins at any of the public ... |
BinRoot/TensorFlow-Book | ch11_seq2seq/Concept02_embedding_lookup.ipynb | mit | import tensorflow as tf
sess = tf.InteractiveSession()
"""
Explanation: Ch 11: Concept 02
Embedding Lookup
Import TensorFlow, and begin an interactive session
End of explanation
"""
embeddings_0d = tf.constant([17,22,35,51])
"""
Explanation: Let's say we only have 4 words in our vocabulary: "the", "fight", "wind"... |
rasbt/algorithms_in_ipython_notebooks | ipython_nbs/efficiency/maximum-pairwise-product.ipynb | gpl-3.0 | import random
random.seed(1)
a = [7, 1, 2, 8, 1, 3]
rnd_lst = random.sample(range(0, 10000000), 1000)
"""
Explanation: Finding the Maximum Pairwise Product
Our task is to simply fine the largest product between 2 different numbers in an array. For example, given the array
a = [7, 1, 2, 8, 1, 3],
the maximum product ... |
ceschoon/MATH-F-314-Travail-1 | Travail n°1 Kepler - SCHOONEN Cédric, JAMOTTE Maxime.ipynb | gpl-3.0 | def f(uT,uL):
out = numpy.ones((2,4))
out[0] = numpy.array([uT[2],uT[3],-G*mL*(uT[0]-uL[0])/((uT[0]-uL[0])**2+(uT[1]-uL[1])**2)**(3/2),-G*mL*(uT[1]-uL[1])/((uT[0]-uL[0])**2+(uT[1]-uL[1])**2)**(3/2)])
out[1] = numpy.array([uL[2],uL[3],-G*mT*(uL[0]-uT[0])/((uT[0]-uL[0])**2+(uT[1]-uL[1])**2)**(3/2),-G*... |
cuttlefishh/papers | red-sea-single-cell-genomes/code/singlecell_tara_stats.ipynb | mit | import pandas as pd
import numpy as np
import seaborn as sns
import re
from skbio.stats.composition import ancom
from sys import argv
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Statistics on counts of OGs (columns) in Tara surface samples (rows)
Finding significant OGs across groups of Tara s... |
ceos-seo/Data_Cube_v2 | dc_notebooks/water_detection_3.ipynb | apache-2.0 | %matplotlib inline
from datetime import datetime
import numpy as np
import datacube
from dc_water_classifier import wofs_classify
from dc_utilities import perform_timeseries_analysis
import dc_au_colormaps
from dc_notebook_utilities import *
"""
Explanation: CEOS Data Cube - Water Analysis Notebook
Description: Th... |
deepmind/svo_probes | probing_image_text_models.ipynb | apache-2.0 | import numpy as np
import sys
import json
import csv
import pandas as pd
import re
import matplotlib.pyplot as plt
import seaborn as sns
csv.field_size_limit(sys.maxsize)
"""
Explanation: Probing Image-Text Models
This Colab evaluates pretrained image--text models (in a zero-shot way) with respect to fine-grained ... |
gururajl/deep-learning | embeddings/Skip-Gram_word2vec.ipynb | mit | import time
import numpy as np
import tensorflow as tf
import utils
"""
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p... |
mldbai/mldb | container_files/tutorials/Procedures and Functions Tutorial.ipynb | apache-2.0 | from pymldb import Connection
mldb = Connection("http://localhost")
"""
Explanation: Procedures and Functions Tutorial
MLDB is the Machine Learning Database, and all machine learning operations are done via Procedures and Functions. Training a model happens via Procedures, and applying a model happens via Functions.
T... |
mitdbg/modeldb | client/workflows/demos/Nearest-Neighbors-TF-Glove.ipynb | mit | import six
import json
import numpy as np
import pandas as pd
import tensorflow as tf
import annoy
from verta import Client
from verta.utils import ModelAPI, TFSavedModel
REPRESENTATION_LENGTH = 25
MAX_INPUT_LENGTH = 50
HOST = 'app.verta.ai'
DATA_DIR = ''
DATA_FILE = DATA_DIR + 'imdb_master.csv'
EMBEDDING_FILE = D... |
lileiting/goatools | notebooks/annotation_coverage.ipynb | bsd-2-clause | # Get ftp://ftp.ncbi.nlm.nih.gov/gene/DATA/gene2go.gz
from goatools.base import download_ncbi_associations
gene2go = download_ncbi_associations()
"""
Explanation: Calculating Annotation Coverage
This section shows how to calculate annotation coverage as described here:
Annotation coverage of Gene Ontology (GO) ter... |
rmcgibbo/mdtraj | examples/ramachandran-plot.ipynb | lgpl-2.1 | traj = md.load('ala2.h5')
atoms, bonds = traj.topology.to_dataframe()
atoms
"""
Explanation: Lets load up the trajectory that we simulated in a previous example
End of explanation
"""
psi_indices, phi_indices = [6, 8, 14, 16], [4, 6, 8, 14]
angles = md.compute_dihedrals(traj, [phi_indices, psi_indices])
"""
Explana... |
CivicKnowledge/metatab-packages | ipums.org/income_home_value/Income and Home Value Distributions.ipynb | mit | %matplotlib inline
%load_ext metatab
%load_ext autoreload
%autoreload 2
%mt_lib_dir lib
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import metatab as mt
import seaborn as sns; sns.set(color_codes=True)
import sqlite3
import statsmodels as sm
from statsmodels.nonpara... |
csdms/pymt | notebooks/child.ipynb | mit | # Some magic to make plots appear within the notebook
%matplotlib inline
import numpy as np # In case we need to use numpy
"""
Explanation: CHILD Landscape Evolution Model
Link to this notebook: https://github.com/csdms/pymt/blob/master/notebooks/child.ipynb
Install command: $ conda install notebook pymt_child
Impo... |
marc-moreaux/Deep-Learning-classes | notebooks/linear_regression.ipynb | mit | from os import sys, path
sys.path.append(path.abspath('../src/regression'))
import linear_regression
from linear_regression import *
%matplotlib inline
# We use the london market to get the stock values of gold and silver
gold = quandl.get("LBMA/GOLD", returns="numpy", start_date="2015-01-01")
silver = quandl.get("LBM... |
mnschmit/LMU-Syntax-nat-rlicher-Sprachen | 12-notebook.ipynb | apache-2.0 | from sklearn.metrics import accuracy_score, precision_score,\
recall_score, f1_score
"""
Explanation: Übungsblatt 12
Präsenzaufgaben
Aufgabe 1 Evaluationsmetriken
End of explanation
"""
ground_truth = [1,0,1,0,0,1,1,1,1,0]
chunker1 = [1,1,1,0,1,0,1,1,1,1]
chunker2 = [1,0,1,0,0,0,0,0,1,... |
cliburn/sta-663-2017 | notebook/19B_Pystan.ipynb | mit | coin_code = """
data {
int<lower=0> n; // number of tosses
int<lower=0> y; // number of heads
}
transformed data {}
parameters {
real<lower=0, upper=1> p;
}
transformed parameters {}
model {
p ~ beta(2, 2);
y ~ binomial(n, p);
}
generated quantities {}
"""
coin_dat = {
'n': 100,
... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_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 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__)
"""
Explanation: Brainstorm Elekta phantom tut... |
Kuwamai/probrobo_note | rotate_error_ellipse.ipynb | mit | %matplotlib inline
import numpy as np
import math
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
class Error_ellipse:
def __init__(self, sigma_x = 1.0, sigma_y = 1.0, cov_xy = 0.0, mu_x = 0.0, mu_y = 0.0):
self.cov = np.array([[sigma_x, cov_xy], [cov_xy, sigma_y]]) # 分散共分散行列
... |
CodeNeuro/notebooks | worker/notebooks/thunder/tutorials/factorization.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_context('notebook')
sns.set_style('darkgrid')
from thunder import Colorize
image = Colorize.image
"""
Explanation: Factorization
Factorization algorithms are useful for data-driven decomposition of spatial and temporal data, for example,... |
grokkaine/biopycourse | day2/scicomp_optimization.ipynb | cc0-1.0 | %matplotlib inline
import numpy as np
import pylab as plt
from scipy import optimize
nsamp = 30
x = np.linspace(0,1,nsamp)
"""
y = -0.5*x**2 + 7*sin(x)
This is what we try to fit against. Suppose we know our function is generated
by this law and want to find the (-0.5, 7) parameters. Alternatively we might
not know an... |
shengshuyang/StanfordCNNClass | assignment2/FullyConnectedNets.ipynb | gpl-3.0 | # As usual, a bit of setup
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_gradient_array
from cs231n.solver import Solver
%matplotlib inline
... |
Yu-Group/scikit-learn-sandbox | jupyter/backup_deprecated_nbs/26_iRF_demo.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
from sklearn.datasets import load_breast_cancer
import numpy as np
from functools import reduce
# Needed for the scikit-learn wrapper function
from sklearn.utils import resample
from sklearn.ensemble import RandomForestClassifier
from math import ceil
# Import our c... |
stephenpardy/PythonNotebooks | DataScienceWorkshop.ipynb | gpl-2.0 | import pandas as pd
import numpy as np
"""
Explanation: Imports
End of explanation
"""
column_names = [
"Age", "WorkClass", "fnlwgt", "Education", "EducationNum",
"MaritalStatus", "Occupation", "Relationship", "Race", "Gender",
"CapitalGain", "CapitalLoss", "HoursPerWeek", "NativeCountry", "Income"
]
""... |
cdawei/digbeta | dchen/music/playlist_multilabel_example.ipynb | gpl-3.0 | %matplotlib inline
import os, sys, time
import pickle as pkl
import numpy as np
import pandas as pd
import sklearn as sk
from sklearn.linear_model import LogisticRegression
import matplotlib.pyplot as plt
import seaborn as sns
data_dir = 'data'
faotm = os.path.join(data_dir, 'aotm-2011/aotm-2011-subset.pkl')
fmap =... |
Vvkmnn/books | AutomateTheBoringStuffWithPython/lesson50.ipynb | gpl-3.0 | import pyautogui
"""
Explanation: Lesson 50:
Screenshots and Image Recognition
Python can be used to control the keyboard and mouse, which allows us to automate any program that uses these as inputs. However, it currently does so blindly, depending on cartesian coordinates; we need a way to show the program the screen... |
ioam/scipy-2017-holoviews-tutorial | notebooks/05-working-with-gridded-data.ipynb | bsd-3-clause | import numpy as np
import pandas as pd
import holoviews as hv
hv.extension('bokeh', 'matplotlib')
"""
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>05. Working with Gridded Datasets</h2></div>
Many datasets i... |
QuantStack/quantstack-talks | 2018-06-18-IFPEN-Tech/notebooks/08 - PyThreejs.ipynb | bsd-3-clause | ball = Mesh(geometry=SphereGeometry(radius=1),
material=MeshLambertMaterial(color='red'),
position=[2, 1, 0])
c = PerspectiveCamera(position=[0, 5, 5], up=[0, 1, 0],
children=[DirectionalLight(color='white', position=[3, 5, 1], intensity=0.5)])
scene = Scene(children=[ba... |
DamienIrving/ocean-analysis | development/water_mass_temperature_metrics.ipynb | mit | #tfile = '/g/data/ua6/DRSv3/CMIP5/CCSM4/historicalGHG/mon/ocean/r1i1p1/thetao/latest/thetao_Omon_CCSM4_historicalGHG_r1i1p1_200001-200512.nc'
#vfile = '/g/data/r87/dbi599/DRSv2/CMIP5/CCSM4/historical/fx/ocean/r0i0p0/volcello/latest/volcello-inferred_fx_CCSM4_historical_r0i0p0.nc'
#bfile = '/g/data/r87/dbi599/DRSv2/CMIP... |
Diego-Ibarra/aquamod | tutorials/8_read_satellite_data_to_force_model.ipynb | mit | import model_Mussel_IbarraEtal2014 as MusselModel
days, dt, par, InitCond = MusselModel.load_defaults()
output = MusselModel.run_model(days,dt,InitCond,par)
MusselModel.plot_model(output)
"""
Explanation: DEMO - Dowload Satellite-Temperature, use it to force model
This demo requires that you download, from Brightspac... |
mne-tools/mne-tools.github.io | 0.20/_downloads/4e37370a8ca815e788684add8304ce44/plot_ssp_projs_sensitivity_map.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
from mne import read_forward_solution, read_proj, sensitivity_map
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
subjects_dir = data_path + '/subjects'
fname = data... |
jhprinz/openpathsampling | examples/toy_model_mstis/toy_mstis_2_run.ipynb | lgpl-2.1 | %matplotlib inline
import openpathsampling as paths
import numpy as np
"""
Explanation: Running an MSTIS simulation
Now we will use the initial trajectories we obtained from bootstrapping to run an MSTIS simulation. This will show both how objects can be regenerated from storage and how regenerated equivalent objects ... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/building_production_ml_systems/solutions/1_training_at_scale_vertex.ipynb | apache-2.0 | import os
from google.cloud import bigquery
"""
Explanation: Training at scale with the Vertex AI Training Service
Learning Objectives:
1. Learn how to organize your training code into a Python package
1. Train your model using cloud infrastructure via Google Cloud Vertex AI Training Service
1. (optional) Learn... |
rishuatgithub/MLPy | nlp/UPDATED_NLP_COURSE/00-Python-Text-Basics/01-Working-with-PDF-Text.ipynb | apache-2.0 | # note the capitalization
import PyPDF2
"""
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
Working with PDF Files
Often you will have to deal with PDF files. There are many libraries in Python for working with PDFs, each with their pros and cons, the most common one bein... |
miltonlab/teachinglab | arrays2.ipynb | gpl-2.0 | from numpy import matrix
from numpy import empty
a=matrix(((2,5),(4,6)))
b=matrix(((1,3),(6,4)))
a
b
"""
Explanation: La clase matrix se hereda de array y representa estríctamente arreglos bidimensionales mientras que array permite implementar arreglos de n dimensiones.
End of explanation
"""
# shape es una tupla... |
konkam/perceptron_guide | README.ipynb | gpl-3.0 | from pylab import * #Pour tranformer python en une calculette scientifique
from scipy import misc #Pour lire les images
"""
Explanation: Guide: quelques étapes pour programmer un perceptron
Préliminaire: charger des images en Python et les mettre sous forme de vecteur
Les images
Avec votre éditeur d'images préféré, vo... |
studentofdata/qcew | vmfiles/IPNB/Examples/a Basic/04 Spark Essentials.ipynb | bsd-3-clause | ?sc
"""
Explanation: 04 Spark essentials
Spark context
The notebook deployment includes Spark automatically within each Python notebook kernel. This means that, upon kernel instantiation, there is an SparkContext object called sc immediatelly available in the Notebook, as in a PySpark shell. Let's take a look at it:
E... |
opesci/devito | examples/seismic/tutorials/01_modelling.ipynb | mit | #NBVAL_IGNORE_OUTPUT
# Adding ignore due to (probably an np notebook magic) bug
import numpy as np
%matplotlib inline
"""
Explanation: 01 - Introduction to seismic modelling
This notebook is the first in a series of tutorials highlighting various aspects of seismic inversion based on Devito operators. In this first ex... |
molgor/spystats | notebooks/.ipynb_checkpoints/predictions_and_residuals_of_FIA_logbiomasS_logsppn_with_spautocor-checkpoint.ipynb | bsd-2-clause | path = "/RawDataCSV/predictions_residuals.csv"
data = pd.read_csv(path,index_col='Unnamed: 0')
data.shape
data.shape
data.columns =['Y','logBiomass','logSppN','modres']
data = data.dropna()
data.loc[:5]
plt.scatter(np.exp(data.logSppN),np.exp(data.Y))
from statsmodels.api import OLS
mod_lin = OLS.from_formula('log... |
mne-tools/mne-tools.github.io | 0.23/_downloads/ab20eadd8e6e3c70dc4dd75cfef6ca4c/60_visualize_stc.ipynb | bsd-3-clause | import os
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample, fetch_hcp_mmp_parcellation
from mne.minimum_norm import apply_inverse, read_inverse_operator
from mne import read_evokeds
data_path = sample.data_path()
sample_dir = os.path.join(data_path, '... |
kamujun/exercise_of_deep_larning_from_scratch | notebooks/section2.ipynb | mit | # ANDの実装
def func_AND(x1, x2):
w1, w2, theta = 0.5, 0.5, 0.7
tmp = x1*w1 + x2*w2
if tmp <= theta:
return 0
elif tmp > theta:
return 1
print(func_AND(0, 0))
print(func_AND(1, 0))
print(func_AND(0, 1))
print(func_AND(1, 1))
"""
Explanation: 2章 パーセプトロン
2.1 パーセプトロンとは
xは入力信号、yは出力信号、wは重み... |
bryanwweber/thermostate | docs/air-standard-brayton-cycle-example.ipynb | bsd-3-clause | from thermostate import State, Q_, units
from thermostate.plotting import IdealGas
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
"""
Explanation: Air-Standard Brayton Cycle Example
Imports
End of explanation
"""
substance = 'air'
p_1 = Q_(1.0, 'bar')
T_1 = Q_(300.0, 'K')
T_3 = Q_(1700.0, 'K')... |
ML4DS/ML4all | NLP2.Spacy_Tutorial (Data Preprocessing)/spaCy_tutorial.ipynb | mit | # Common imports
import numpy as np
import pandas as pd
import zipfile as zp
from termcolor import colored
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
#To wrap long text lines
from IPython.display import HTML, display
def set_css():
disp... |
clarka34/exploring-ship-logbooks | scripts/classifier-notebook.ipynb | mit | classifier_algorithm = "Decision Tree"
import collections
import exploringShipLogbooks
import numpy as np
import os.path as op
import pandas as pd
import exploringShipLogbooks.wordcount as wc
from fuzzywuzzy import fuzz
from sklearn import preprocessing
from sklearn.naive_bayes import MultinomialNB
from sklearn impo... |
intel-analytics/analytics-zoo | docs/docs/colab-notebook/orca/quickstart/tf_lenet_mnist.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... |
dolittle007/dolittle007.github.io | notebooks/probabilistic_matrix_factorization.ipynb | gpl-3.0 | % matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import os
import shutil
DATA_DIR = '../data/pmf'
data = pd.read_csv(os.path.join(DATA_DIR, 'jester-dataset-v1-dense-first-1000.csv'))
data.head()
# Extract the ratings from the DataFrame
all_ratings = np.ndarray.flatten(data.va... |
smorton2/think-stats | code/chap08ex.ipynb | gpl-3.0 | from __future__ import print_function, division
%matplotlib inline
import numpy as np
import brfss
import thinkstats2
import thinkplot
"""
Explanation: Examples and Exercises from Think Stats, 2nd Edition
http://thinkstats2.com
Copyright 2016 Allen B. Downey
MIT License: https://opensource.org/licenses/MIT
End of ... |
Flaviolib/dx | 09_dx_calibration.ipynb | agpl-3.0 | from dx import *
import numpy as np
import pandas as pd
import seaborn as sns; sns.set()
"""
Explanation: <img src="http://hilpisch.com/tpq_logo.png" alt="The Python Quants" width="45%" align="right" border="4">
Implied Volatilities and Model Calibration
This setion of the documentation illustrates how to calculate im... |
marxav/hello-world | artificial_neural_network_101_pytorch.ipynb | mit | # library to store and manipulate neural-network input and output data
import numpy as np
# library to graphically display any data
import matplotlib.pyplot as plt
# library to manipulate neural-network models
import torch
import torch.nn as nn
import torch.optim as optim
# the code is compatible with Tensflow v1.4.... |
mtasende/Machine-Learning-Nanodegree-Capstone | notebooks/prod/.ipynb_checkpoints/n08_simple_q_learner_fast_learner_1000_states-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... |
endgameinc/youarespecial | BSidesLV -- your model isn't that special -- (2) End-to-End.ipynb | mit | # for this demo, will slurp in only the first 256K (2**18) bytes of the file
# for a nice GPU like a Titan X, you should be able to squeeze in > 2MB ...
# ...but warning! this makes training more difficult...larger haystack to find needles
max_file_length = int(2**18) # powers of 2 FTW
file_chunks = 8 # break file int... |
robertoalotufo/ia898 | master/dftscaleproperty.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import sys,os
ia898path = os.path.abspath('../../')
if ia898path not in sys.path:
sys.path.append(ia898path)
import ia898.src as ia
f = mpimg.imread('../data/cameraman.tif')
froi = f[19:19+64,99:99+64] # ROI sele... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/cmip6/models/hadgem3-gc31-hm/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mohc', 'hadgem3-gc31-hm', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: MOHC
Source ID: HADGEM3-GC31-HM
Topic: Seaice
Sub-Topics: Dynamics, Thermody... |
joelowj/Udacity-Projects | Udacity-Artificial-Intelligence-Nanodegree/Project-7/machine_translation.ipynb | apache-2.0 | import helper
# Load English data
english_sentences = helper.load_data('data/small_vocab_en')
# Load French data
french_sentences = helper.load_data('data/small_vocab_fr')
print('Dataset Loaded')
"""
Explanation: Artificial Intelligence Nanodegree
Machine Translation Project
In this notebook, sections that end with... |
captain-proton/aise | hci/exercise_8/Click evalutation.ipynb | gpl-3.0 | files = ['clicks_2020-01-24 09:48:51_touchpad_14"_monitor.csv',
'clicks_2020-01-24 09:44:46_mouse_24"_monitor.csv',
'clicks_2020-01-23 16:00:32_mouse_24"_monitor.csv']
"""
Explanation: Test application
Autor: Nils Verheyen\
Matriculation number: 3043171
Mouse and touchpad input were tested on full h... |
jdfekete/progressivis | doc/WritingAModule.ipynb | bsd-2-clause | from progressivis.table.module import TableModule, Table
from progressivis import SlotDescriptor
class MyModule(TableModule):
inputs = [SlotDescriptor('first', type=Table, required=True),
SlotDescriptor('second', type=Table, required=True)]
# defining the "outputs" attribute is not necessary whe... |
Riptawr/deep-learning | first-neural-network/dlnd-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... |
elvd/elec3360 | ELEC3360_week7.ipynb | mit | import math
# constants, values from wikipedia
mu_0 = 4 * math.pi * 1e-7
epsilon_0 = 8.85e-12
Rs = 2.5
length = 1 # will use base units
a = 1e-3 # inner radius in metres
b = 2.5e-3 # outer radius in metres
freq = 10e9
omega = 2 * math.pi * freq
e_r = 2.5 - 0.0025j
R = (Rs / (2 * math.pi)) * (1/a + 1/b)
L = (mu_0 / (... |
phoebe-project/phoebe2-docs | 2.2/examples/extinction_eclipse_depth_v_teff.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: Extinction: Eclipse Depth Difference as Function of Temperature
In this example, we'll reproduce Figure 3 in the extinction release paper (Jones et al. 2020).
NOTE: this script takes a long time to run.
<img src="jones+20_fig3.png" alt="Figure 3" width="800px"/>
Setu... |
arcyfelix/Courses | 17-09-17-Python-for-Financial-Analysis-and-Algorithmic-Trading/06-Data-Sources/02 - Quandl.ipynb | apache-2.0 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import quandl
"""
Explanation: Quandl
More info:
https://www.quandl.com/tools/python
End of explanation
"""
mydata = quandl.get("EIA/PET_RWTC_D")
mydata.head()
mydata.plot(figsize = (12, 6))
"""
Explanation: Make a Basic Da... |
gboeing/urban-data-science | modules/05-geocoding-apis/lecture.ipynb | mit | import geopandas as gpd
import folium
import osmnx as ox
import pandas as pd
import re
import requests
import time
from bs4 import BeautifulSoup
from geopy.geocoders import GoogleV3
from keys import google_api_key
# define a pause duration between API requests
pause = 0.1
"""
Explanation: APIs and Scraping
Overview ... |
fcollonval/coursera_data_visualization | LassoRegression.ipynb | mit | # Magic command to insert the graph directly in the notebook
%matplotlib inline
# Load a useful Python libraries for handling data
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from IPython.display import Markdown, display
from sklearn.cross_validation import train_test_s... |
leandromoreira/digital_video_introduction | filters_are_easy.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from scipy.ndimage import convolve
# loading image
img = mpimg.imread('i/super_mario_head.png')
plt.imshow(img)
# cutting the image
eye_brow = img[100:150,150:200,]
plt.imshow(eye_brow,interpolation='nearest')
"""
Explanation: Filter... |
VenkatRepaka/deep-learning | language-translation/dlnd_language_translation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
mne-tools/mne-tools.github.io | 0.16/_downloads/plot_phantom_4DBTi.ipynb | bsd-3-clause | # Authors: Alex Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
from mayavi import mlab
from mne.datasets import phantom_4dbti
import mne
"""
Explanation: ============================================
4D Neuroimaging/BTi phantom dataset tutorial
==============... |
tensorflow/docs-l10n | site/ko/hub/tutorials/tf_hub_generative_image_module.ipynb | apache-2.0 | # Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
ES-DOC/esdoc-jupyterhub | notebooks/awi/cmip6/models/awi-cm-1-0-mr/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'awi', 'awi-cm-1-0-mr', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: AWI
Source ID: AWI-CM-1-0-MR
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy... |
janpipek/physt | doc/merge-bins.ipynb | mit | from physt.binnings import *
from physt import h1, h2
import numpy as np
np.random.seed(42)
data = np.random.rand(100)
hh = h1(data, 120)
hh.plot(errors=True);
hh.merge_bins(2, inplace=True)
hh.plot(errors=True);
hh.merge_bins(2, inplace=True)
hh.plot(errors=True);
hh.merge_bins(2, inplace=True)
hh.plot(errors=Tr... |
flsantos/startup_acquisition_forecast | exploratory_code/1_dataset_creation.ipynb | mit | import numpy as np
import pandas as pd
"""
Explanation: Loading Companies...
End of explanation
"""
companies = pd.read_csv('data/companies.csv')
#Having a look to the companies data structure
companies[:3]
#Let's first remove non USA companies, since they usually have a lot of missing data
companies_USA = compani... |
ryan-leung/SolvingProjectEuler | Q011-Q020.ipynb | bsd-3-clause | s='''08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
24 47 32 60 99 ... |
mne-tools/mne-tools.github.io | 0.17/_downloads/a489b01e2c31005c72c56777df4ed4f7/plot_mixed_norm_inverse.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de>
#
# License: BSD (3-clause)
import numpy as np
import mne
from mne.datasets import sample
from mne.inverse_sparse import mixed_norm, make_stc_from_dipoles
from mne.minimum_norm import m... |
jgcasta/CitiesAtNightPythonMadrid | jupyter/Georreferenciadas.ipynb | mit |
import urllib2
import json
import asciitable
import time
import Image
idISS = 'ISS030-E-211378'
dirImagenesISS = 'images/'
dirGeoTIFF = 'geotiff/'
dirPuntosQGIS = 'puntosQGIS/'
dirPuntosGlobal = 'puntosGlobal/'
dirScriptsGDAL = 'scriptsGdal/'
def getKey(item):
return item[0]
hayProxy = False
# cargo las tareas ... |
halexand/NB_Distribution | .ipynb_checkpoints/KL rambling notes on Python-checkpoint.ipynb | mit | #First up...list the files in a directory
import os,sys
os.listdir(os.getcwd())
#read the CSV file into a data frame and use the pandas head tool to show me the first five rows.
#note that this doesn't seem to work: pd.head(CO_RawData)
CO_RawData=pd.read_csv(mtabFile, index_col='RInumber')
CO_RawData.head(n=5)
#inse... |
w4zir/ml17s | lectures/.ipynb_checkpoints/lec02-regression-checkpoint.ipynb | mit | import pandas as pd
from sklearn import linear_model
import matplotlib.pyplot as plt
# read data in pandas frame
dataframe = pd.read_csv('datasets/house_dataset1.csv')
# assign x and y
x_feature = dataframe[['Size']]
y_labels = dataframe[['Price']]
# check data by printing first few rows
dataframe.head()
"""
Explan... |
binh-vu/python-tutorial | 2.0_Functions.ipynb | mit | def square(x):
return x * x
print square(10)
"""
Explanation: Functions
Define the function using <code>def</code> keyword.
to return a value using <code>return</code> keyword
End of explanation
"""
def logging(message):
print 'Message:', message
print logging('Hello world')
"""
Explanation: even no ... |
n-witt/MachineLearningWithText_SS2017 | tutorials/4 Introducing Scikit-Learn.ipynb | gpl-3.0 | import seaborn as sns
iris = sns.load_dataset('iris')
iris.head()
"""
Explanation: Introducing Scikit-Learn
Scikit-Learn contains solid implementations of various machine learning algorithms
Clean and uniform API
Helpful documentation
Representing data in Scikit-Learn
Machine learning is about building models for ... |
barjacks/foundations-homework | 13/311 time series homework.ipynb | mit | import datetime
import datetime as dt
dt.datetime.strptime('07/06/2015 10:58:27 AM', '%m/%d/%Y %I:%M:%S %p')
#datetime.datetime(2015, 7, 6, 0, 0)
parser = lambda date: pd.datetime.strptime(date, '%m/%d/%Y %H:%M:%S')
df = pd.read_csv("311-2015.csv", low_memory=False, parse_dates=[1], dtype=str , nrows=200000)
df.info... |
IBMDecisionOptimization/tutorials | jupyter/Scheduling_Tutorial.ipynb | apache-2.0 | url = None
key = None
"""
Explanation: Tutorial: Getting started with Scheduling in CPLEX for Python
This notebook introduces the basic building blocks of a scheduling model that can be solved using Constraint Programming Optimizer (named CP Optimizer in the following) that is included in CPLEX for Python.
It is part... |
datapolitan/talks_lectures | 20151103_PrattCriticalGeography/API_Example.ipynb | gpl-2.0 | #add your client_id here
client_id = '3OSP0BXNUTQTCKT1GVUMVHEUHLY5Y1TVC14CHOU1OOONTLPA'
#add your client_secret here
client_secret = 'J1SG3PYQ21FBYE4KCOS11ATOHGOJJSFAF53F3OFRB54IVTIF'
client_id
"""
Explanation: This is a simple exercise to show you how we use Python to do what we did with a text editor and OpenRefine... |
tensorflow/text | docs/tutorials/fine_tune_bert.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... |
deepmind/multimodal_transformers | mmt_release.ipynb | apache-2.0 | import os
import numpy as np
import tensorflow.compat.v1 as tf
import tensorflow_hub as hub
from io import BytesIO as StringIO
from PIL import Image
%matplotlib inline
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.image as mpimg
import unicodedata
# Install the tensorflow Object ... |
ndanielsen/dc_parking_violations_data | notebooks/Top 15 Violations by Revenue And Total for DC.ipynb | mit | dc_df = df[(df.rp_plate_state.isin(['DC']))]
dc_fines = dc_df.groupby(['violation_code']).fine.sum().reset_index('violation_code')
fine_codes_15 = dc_fines.sort_values(by='fine', ascending=False)[:15]
top_codes = dc_df[dc_df.violation_code.isin(fine_codes_15.violation_code)]
top_violation_by_state = top_codes.groupby... |
richlewis42/scikit-chem | docs/quickstart.ipynb | bsd-3-clause | import skchem
import pandas as pd
"""
Explanation: Quickstart
We will be working on a mutagenicity dataset, released by Kazius et al.. 4337 compounds, provided as the file mols.sdf, were subjected to the AMES test. The results are given in labels.csv. We will clean the molecules, perform a brief chemical space ana... |
ewulczyn/talk_page_abuse | src/data_generation/crowdflower_analysis/src/Crowdflower Analysis (Experiment on Blocked Users k = 5).ipynb | apache-2.0 | %matplotlib inline
from __future__ import division
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import time
import datetime
from scipy import stats
import warnings
warnings.filterwarnings('ignore')
pd.set_option('display.max_colwidth', 1000)
# Download data from google drive (Respect Eng / ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.