repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
StanIsAdmin/PyProt | examples/structure-prediction.ipynb | gpl-3.0 | datasetPath = joinpath("resources", "dataset")
with open(joinpath(datasetPath, "CATH_info.txt")) as infoFile:
with open(joinpath(datasetPath, "CATH_info-PARSED.txt"), 'w') as outFile:
dsspPath = joinpath(datasetPath, "dssp", "")
for line in infoFile.readlines():
d = DSSP(dsspPath + line[0:4] + ".dssp")
descr... |
amueller/odsc-masterclass-2017-morning | notebooks/04 - Preprocessing.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
% matplotlib inline
from sklearn.datasets import load_boston
boston = load_boston()
from sklearn.model_selection import train_test_split
X, y = boston.data, boston.target
X_train, X_test, y_train, y_test = train_test_split(
X, y, random_state=0)
print(boston.DESC... |
metpy/MetPy | v1.1/_downloads/62a1acd718d4c5b9717787544d4cf09f/Gradient.ipynb | bsd-3-clause | import numpy as np
import metpy.calc as mpcalc
from metpy.units import units
"""
Explanation: Gradient
Use metpy.calc.gradient.
This example demonstrates the various ways that MetPy's gradient function
can be utilized.
End of explanation
"""
data = np.array([[23, 24, 23],
[25, 26, 25],
... |
nick-youngblut/SIPSim | ipynb/bac_genome/n3/dataset.ipynb | mit | workDir = '/home/nick/notebook/SIPSim/dev/bac_genome3/'
SIPSimExe = '/home/nick/notebook/SIPSim/SIPSim'
genomeDir = '/home/nick/notebook/SIPSim/dev/bac_genome1210/genomes/'
#genomeTable = '/var/seq_data/ncbi_db/genome/prok-bac_filt_rand.txt'
"""
Explanation: Description:
Simulating bacterial communities using all of ... |
rubensmachado/nolearn | docs/notebooks/CNN_tutorial.ipynb | mit | import os
import matplotlib.pyplot as plt
%pylab inline
import numpy as np
from lasagne.layers import DenseLayer
from lasagne.layers import InputLayer
from lasagne.layers import DropoutLayer
from lasagne.layers import Conv2DLayer
from lasagne.layers import MaxPool2DLayer
from lasagne.nonlinearities import softmax
fro... |
gaufung/Data_Analytics_Learning_Note | Data_Analytics_in_Action/numpy.ipynb | mit | import numpy as np
a = np.array([1,2,3])
print a
type(a)
type(a)
a.dtype
print a.ndim
print a.size
print a.shape
"""
Explanation: Numpy 是 Python 数据分析的基础,很多有关Python数据分析都是建立在其之上。
1 ndarray
整个 numpy 的基础是 ndarray (n dimensional array),表示同一元素组成的多维数组。
+ dtype
数据类型
+ shape
由N个正整数组成的元组,每一个元素代表了每一维的大小
+ axes
数组的维数为轴,轴的数量为... |
FRBs/FRB | docs/nb/KCWIspectrumextraction.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import astropy.units as u
from astropy.table import Table
from astropy.coordinates import SkyCoord
from astropy.io import fits
from astropy.wcs import WCS, utils as wcsutils
from astropy.stats import sigma_clipped_stats
import astropy.visualiz... |
pgmpy/pgmpy | examples/Structure Learning with Chow-Liu.ipynb | mit | import networkx as nx
import matplotlib.pyplot as plt
from pgmpy.models import BayesianNetwork
# construct the tree graph structure
model = BayesianNetwork([("A", "B"), ("A", "C"), ("B", "D"), ("B", "E"), ("C", "F")])
nx.draw_circular(
model, with_labels=True, arrowsize=30, node_size=800, alpha=0.3, font_weight="... |
CPernet/LanguageDecision | notebooks/exploratory/2017-06-01-data-wrangling.ipynb | gpl-3.0 | import scipy.io as scio
# Import .mat file as python object
data = scio.loadmat('../data/data_18333.mat', struct_as_record=False)
"""
Explanation: Data Wrangling
Explore the experimental data & convert to HDDM-ready format (CSV)
Fine-tune output for individual .mat files
End of explanation
"""
dat_struct = data['da... |
gully/starfish-demo | demo7/raw/mixture_model_01_exploratory.ipynb | mit | import numpy as np
import Starfish
from Starfish.grid_tools import HDF5Creator
h5i = Starfish.grid_tools.HDF5Interface("libraries/PHOENIX_TRES_test.hdf5")
"""
Explanation: Issue #35: Mixture model mode
gully
Tue, March 1, 2016
Basically we want to add two spectra together (in the right proportions) to mimic a two-co... |
pycircle/presentations | wprowadzenie_3/wprowadzenie_3.ipynb | apache-2.0 | range(2), xrange(2)
def gen(r):
for i in xrange(r):
yield i ** 2
generator = gen(5)
generator
list(generator)
generator = (i ** 2 for i in xrange(5))
generator
list(generator)
def gen_squares(up_to=100000):
s = 0
for sq in (i**2 for i in xrange(up_to)):
s += sq
return s
def square... |
synthicity/activitysim | activitysim/examples/example_estimation/notebooks/06_cdap.ipynb | agpl-3.0 | import numpy as np
import pandas as pd
import larch
import os
os.chdir('test')
"""
Explanation: Estimating Coordinated Daily Activity Patterns
This notebook illustrates how to re-estimate ActivitySim's CDAP model. This process
includes running ActivitySim in estimation mode to read household travel survey files and ... |
ES-DOC/esdoc-jupyterhub | notebooks/miroc/cmip6/models/sandbox-1/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'miroc', 'sandbox-1', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: MIROC
Source ID: SANDBOX-1
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turb... |
giacomov/3ML | docs/notebooks/Point_source_plotting.ipynb | bsd-3-clause | %matplotlib inline
jtplot.style(context="talk", fscale=1, ticks=True, grid=False)
import matplotlib.pyplot as plt
plt.style.use("mike")
import numpy as np
from threeML import *
from threeML.io.package_data import get_path_of_data_file
#mle1 = load_analysis_results(get_path_of_data_file("datasets/toy_xy_mle1.fits")... |
folivetti/BIGDATA | Spark/Lab5a_PCA.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
def preparePlot(xticks, yticks, figsize=(10.5, 6), hideLabels=False, gridColor='#999999',
gridWidth=1.0):
"""Template for generating the plot layout."""
plt.close()
fig, ax = plt.subplots(figsize=figsize, facecolor='white', edgecolor='white... |
judithyueli/pyFKF | .ipynb_checkpoints/Demo_InsightIDX-checkpoint.ipynb | mit | from IPython.html.widgets import interact, interactive, fixed
from IPython.html.widgets import FloatSlider
from CO2simulation import CO2simulation
def plot_CO2plume(time):
import param as param
CO2 = CO2simulation(param)
x = CO2.extract_state(int(time/3))
data = CO2.extract_data(int(time/3))
fig_set... |
moonbury/pythonanywhere | github/sympy-factoring-bfield.ipynb | gpl-3.0 | import sympy as sym
from IPython.display import Math
syms = sym.symbols("\mu I1 I2 I xhat x1 x2 x yhat y s1 s2 d")
(m, I1, I2, I, xhat, x1, x2, x, yhat, y, s1, s2, d) = syms
B = m * I * (-y/s1**2*xhat + (x-d)/s1**2*yhat) + m * I * (-y/s2**2*xhat + (x+d)/s2**2*yhat)
"""
Explanation: Factoring vector equations
Magneti... |
5hubh4m/CS231n | Assignment2/BatchNormalization.ipynb | mit | # 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
... |
johnbachman/emcee | docs/_static/notebooks/parallel.ipynb | mit | import os
os.environ["OMP_NUM_THREADS"] = "1"
"""
Explanation: Parallelization
End of explanation
"""
import time
import numpy as np
def log_prob(theta):
t = time.time() + np.random.uniform(0.005, 0.008)
while True:
if time.time() >= t:
break
return -0.5 * np.sum(theta ** 2)
"""
E... |
empirical-org/WikipediaSentences | notebooks/Subject Verb Agreement Detection.ipynb | agpl-3.0 | import numpy as np
import tensorflow as tf
import tflearn
from tflearn.data_utils import to_categorical
import spacy
import re
from textstat.textstat import textstat
from pattern.en import lexeme, tenses
from pattern.en import pluralize, singularize
import sqlite3
import hashlib
nlp = spacy.load('en_core_web_lg')
conn... |
chemo-wakate/tutorial-6th | beginner/mario/statisticaltest.ipynb | mit | import numpy as np # 数値計算を行うライブラリ
import scipy as sp # 科学計算ライブラリ
from scipy import stats # 統計計算ライブラリ
"""
Explanation: <h1 STYLE="background: #c2edff;padding: 0.5em;">Step 2. 統計的検定</h1>
<ol>
<li><a href="#1">カイ2乗検定</a>
<li><a href="#2">t検定</a>
<li><a href="#3">分散分析</a>
</ol>
<h4 style="border-bottom: solid 1px black;"... |
LimeeZ/phys292-2015-work | days/day11/Day11.ipynb | mit | def f(x):
print(x**2)
a = f(2)
print(a)
"""
Explanation: Day 11
Computational Physics (PHYS 202)
Cal Poly, Spring 2015
Brian E. Granger
In class
Go over midterm
Discuss solutions
Grade distribution
Coding tips and help
Difference between return and print.
Transforming data between different container type... |
ml6973/Course | assignment/Soman-Sawani/assign-02-Sawani_github_11.ipynb | apache-2.0 | # calculate a random number where: a <= rand < b
def rand(a, b):
return (b-a)*random.random() + a
# Make a matrix
def makeMatrix(I, J, fill=0.0):
return np.zeros([I,J])
# our sigmoid function
def sigmoid(x):
#return math.tanh(x)
return 1/(1+np.exp(-x))
# derivative of our sigmoid function, in terms... |
msanterre/deep_learning | sentiment-rnn/Sentiment_RNN_Solution.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... |
evangelistalab/forte | tutorials/Tutorial_01.02_forte_dets.ipynb | lgpl-3.0 | import psi4
import forte
import forte.utils
"""
Explanation: Forte Tutorial 1.02: Forte's determinant class
In this tutorial we are going to explore how to create a simple FCI code using forte's Python API.
Import modules
Here we import forte.utils bto access functions to directly run an SCF computation in psi4.
End ... |
tensorflow/docs-l10n | site/ko/guide/extension_type.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... |
km-Poonacha/python4phd | Session 2/ipython/Lesson 4 - Web API - Worksheet.ipynb | gpl-3.0 |
url = 'http://www.github.com/ibm'
"""
Explanation: Lesson 4 - Web API
Requesting information from the web
Python 'requests' module.
This module provides functions to send a HTTP request and get the response from the server
Requests is a third party module. If not installed, we will need to do "pip install requests... |
TimothyHelton/k2datascience | notebooks/PCA_algorithm.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
import numpy as np
import pandas as pd
import seaborn as sns
import sklearn
from sklearn import datasets
from sklearn.decomposition import PCA
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity =... |
t-vi/pytorch-tvmisc | transformers-pytorch-tvm/pytorch-tvm-training.ipynb | mit | import inspect
import types
import sys
# I sometimes need to choose PyTorch...
#sys.path.insert(0, '/home/tv/pytorch/pytorch/build/lib.linux-x86_64-3.8//')
import torch
import torch.utils.dlpack
# import TVM
import sys
import os
tvm_root = '/home/tv/rocm/tvm/tvm/'
tvm_paths = [os.path.join(tvm_root, p) for p in ['p... |
LSSTDESC/SLTimer | notebooks/SLTimer_Tutorial.ipynb | bsd-3-clause | from __future__ import print_function
%matplotlib inline
import sys
sys.path.append('../python')
import desc.sltimer
%load_ext autoreload
%autoreload 2
"""
Explanation: SLTimer Tutorial
Milan Williams and Phil Marshall, August 2016
This notebook shows you how to find the estimatation of a lens time delays from exam... |
matthewzhenggong/fiwt | workspace_py/RigStaticRollId-Exp51-2.ipynb | lgpl-3.0 | %run matt_startup
%run -i matt_utils
button_qtconsole()
#import other needed modules in all used engines
#with dview.sync_imports():
# import os
"""
Explanation: Parameter Estimation of RIG Roll Experiments
Setup and descriptions
Without ACM model
Turn on wind tunnel
Only 1DoF for RIG roll movement
Use small-ampl... |
yavuzovski/playground | machine learning/google-ml-crash-course/tensorflow/creating_and_manipulating_tensors.ipynb | gpl-3.0 | import tensorflow as tf
"""
Explanation: Creating and Manipulating Tensors
Learning Objectives:
- Initialize and assing TensorFlow Variables
- Create and manipulate tensors
- Refresh your memory about addition and multiplication in linear algebra (consult an introduction to matrix addition and multiplication if these ... |
uqyge/combustionML | FPV_ANN/notebooks/.ipynb_checkpoints/fgm_nn_inhouse-checkpoint.ipynb | mit | !pip install gdown
!mkdir ./data
import gdown
def data_import():
ids = {
"tables_of_fgm.h5":"1XHPF7hUqT-zp__qkGwHg8noRazRnPqb0"
}
url = 'https://drive.google.com/uc?id='
for title, g_id in ids.items():
try:
output_file = open("/content/data/" + title, 'wb')
gdown.download(url + g_id, o... |
WillenZh/deep-learning-project | tutorials/tensorboard/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... |
griffinfoster/fundamentals_of_interferometry | 1_Radio_Science/1_1_a_brief_introduction_to_basic_astrophysics.ipynb | gpl-2.0 | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import HTML
HTML('../style/course.css') #apply general CSS
"""
Explanation: Outline
Glossary
1. Radio Science using Interferometric Arrays
Previous: 1.0 Introduction
Next: 1.2 Electromagnetic radiation and astronomical quanti... |
cdlib/pid | scripts/pid_stats_scp.ipynb | bsd-3-clause | import datetime
import collections
import getpass
import json
import os
import yaml
import pandas
import pymysql
"""
Explanation: PID SCP Stats Report
This script runs stat totals for SCP and UCSD up to a specific date. This is requested yearly by the UCSD SCP Group.
Create export from database
Imports
End of explan... |
vicente-gonzalez-ruiz/YAPT | 02-basics/04-structuring_code.ipynb | cc0-1.0 | !cat my_module.py
"""
Explanation: Structuring code
An structured code is easier to be maintained and reused.
Modules and packages
Python code can be organized into modules and packages (folders with other folders and modules). A module is a piece of code stored in a file. For example:
End of explanation
"""
!tree m... |
phoebe-project/phoebe2-docs | development/tutorials/emcee_init_from_requires.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
import phoebe
from phoebe import u # units
import numpy as np
logger = phoebe.logger('error')
"""
Explanation: Advanced: Emcee Initializing Distribution Requirements
IMPORTANT: this tutorial assumes basic knowledge (and uses a file resulting from) the emcee tutorial.
NOTE: this be... |
JaviMerino/lisa | ipynb/tutorial/04_ExecutorUsage.ipynb | apache-2.0 | import logging
reload(logging)
log_fmt = '%(asctime)-9s %(levelname)-8s: %(message)s'
logging.basicConfig(format=log_fmt)
# Execute this cell to enabled executor debugging statements
logging.getLogger().setLevel(logging.DEBUG)
"""
Explanation: Tutorial Goal
This tutorial aims to show how to configure and run a predef... |
christopherkullenberg/openscienceliterature | openscienceliterature.ipynb | mit | maketimeseries() # Load this function from bottom of notebook to print.
"""
Explanation: <!-- Some HTML for ncie picture -->
<p>
<a href="https://commons.wikimedia.org/wiki/File:Open_Science_-_Prinzipien.png#/media/File:Open_Science_-_Prinzipien.png"><img src="https://upload.wikimedia.org/wikipedia/commons/9/9c/Op... |
tensorflow/docs-l10n | site/ja/tutorials/structured_data/preprocessing_layers.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... |
SamLau95/nbinteract | docs/notebooks/index.ipynb | bsd-3-clause | import numpy as np
import nbinteract as nbi
def normal(mean, sd):
'''Returns 1000 points drawn at random fron N(mean, sd)'''
return np.random.normal(mean, sd, 1000)
normal(10, 1.0)
# Plot aesthetics
options = {
'xlim': (-2, 12),
'ylim': (0, 0.7),
'bins': 20
}
# Pass in the `normal` function and ... |
CORE-GATECH-GROUP/serpent-tools | examples/Settings.ipynb | mit | import serpentTools
from serpentTools.settings import rc
"""
Explanation: Copyright (c) 2017-2020 Serpent-Tools developer team, GTRC
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND N... |
chbehrens/pr_bc_connectivity-1 | cone_contact_evaluation.ipynb | gpl-3.0 | import numpy as np
from scipy.stats import itemfreq
import matplotlib
import matplotlib.pyplot as plt
from scipy.io import loadmat
import pandas as pd
import seaborn as sns
from sklearn import cross_validation
from sklearn import svm
from sklearn.decomposition import PCA
%matplotlib inline
matplotlib.rc('font',**{'fami... |
GSimas/EEL7045 | Aula 12 - Resposta a Degrau RL e RC.ipynb | mit | print("Exemplo 7.10")
from sympy import *
m = 10**(-3)
k = 10**3
C = 0.5*m
Vc0 = 24*5*k/(3*k + 5*k) #tensao no capacitor em condicao inicial v0
Vcf = 30 #tensao no capacitor em condicao final
tau = 4*k*C
t = symbols('t')
v = Vcf + (Vc0 - Vcf)*exp(-t/tau)
print("Tensão v(t):",v,"V")
"""
Explanation: Resposta a D... |
parrt/msan501 | notes/computation.ipynb | mit | cost = 100.0
tax = 8.1
total = cost + tax
print(total)
"""
Explanation: Model of Computation
Now that we know how computers store data in memory, we need a basic understanding of how computers process that data. Let's explore the simplest, fine-grained operations that a computer can perform. Ultimately, we will draw f... |
snowch/biginsight-examples | misc/WebHDFS_Example.ipynb | apache-2.0 | # Cluster number, e.g. 10000
cluster = ''
# Cluster username
username = ''
# Cluster password
password = ''
# file path in HDFS
filepath = 'yourpath/yourfile.csv'
"""
Explanation: This streams data directly into dataframes. See also: https://github.com/snowch/biginsight-examples/blob/master/misc/WebHDFS_Example_... |
JackDi/phys202-2015-work | days/assignment06/InteractEx05.ipynb | mit | # YOUR CODE HERE
raise NotImplementedError()
"""
Explanation: Interact Exercise 5
Imports
Put the standard imports for Matplotlib, Numpy and the IPython widgets in the following cell.
End of explanation
"""
s = """
<svg width="100" height="100">
<circle cx="50" cy="50" r="20" fill="aquamarine" />
</svg>
"""
SVG(s... |
tensorflow/docs-l10n | site/en-snapshot/io/tutorials/mongodb.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... |
brettavedisian/phys202-2015-work | assignments/assignment05/MatplotlibEx03.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Matplotlib Exercise 3
Imports
End of explanation
"""
def well2d(x, y, nx, ny, L=1.0):
"""Compute the 2d quantum well wave function."""
psi=(2/L)*np.sin((nx*np.pi*x)/L)*np.sin((ny*np.pi*y)/L)
return psi
psi = well2d(np... |
tensorflow/docs | site/en/r1/guide/ragged_tensors.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... |
eduardojvieira/Curso-Python-MEC-UCV | 7-numba.ipynb | mit | import numpy as np
from numba import njit
arr2d = np.arange(20 * 30, dtype=float).reshape(20,30)
%%timeit
np.sum(arr2d)
def py_sum(arr):
M, N = arr.shape
sum = 0.0
for i in range(M):
for j in range(N):
sum += arr[i,j]
return sum
%%timeit
py_sum(arr2d)
fast_sum = njit(py_sum)
%%... |
anandha2017/udacity | nd101 Deep Learning Nanodegree Foundation/DockerImages/21_recurrent_neural_networks/notebooks/01_intro-to-rnns/Anna_KaRNNa_Exercises.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, we'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 bas... |
robblack007/clase-dinamica-robot | Practicas/.ipynb_checkpoints/Practica 3 - Visualizacion de sistemas mecanicos-checkpoint.ipynb | mit | from control import step, tf
m = 1200
k = 15000
c = 1500
F = 1
G = tf([0, 0, 1/m], [1, c/m, k/m])
G
y, t = step(G)
"""
Explanation: Visualización de sistemas mecánicos
Dado un sistema masa resorte amortiguador como el de la figura siguiente:
Graficar la trayectoria del sistema, y animar los componentes fisicos de ... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/bigquery_tensorflow.ipynb | apache-2.0 | %%bash
# create output dataset
bq mk advdata
%%bigquery
CREATE OR REPLACE MODEL advdata.ulb_fraud_detection
TRANSFORM(
* EXCEPT(Amount),
SAFE.LOG(Amount) AS log_amount
)
OPTIONS(
INPUT_LABEL_COLS=['class'],
AUTO_CLASS_WEIGHTS = TRUE,
DATA_SPLIT_METHOD='seq',
DATA_SPLIT_COL='Time',
MODEL_TY... |
bert9bert/statsmodels | examples/notebooks/quantile_regression.ipynb | bsd-3-clause | %matplotlib inline
from __future__ import print_function
import patsy
import numpy as np
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
import matplotlib.pyplot as plt
from statsmodels.regression.quantile_regression import QuantReg
data = sm.datasets.engel.load_pandas().data
da... |
jradavenport/aas225-gender | analysis.ipynb | mit | %pylab inline
from urllib.request import urlopen
import datetime
import numpy as np
import matplotlib
matplotlib.rcParams['font.size'] = 15
from matplotlib import pyplot as plt
stableURL = 'https://raw.githubusercontent.com/jradavenport/aas225-gender/master/data.csv'
raw = urlopen(stableURL).read().splitlines()
num =... |
kubeflow/kfp-tekton-backend | components/gcp/ml_engine/batch_predict/sample.ipynb | apache-2.0 | %%capture --no-stderr
KFP_PACKAGE = 'https://storage.googleapis.com/ml-pipeline/release/0.1.14/kfp.tar.gz'
!pip3 install $KFP_PACKAGE --upgrade
"""
Explanation: Name
Batch prediction using Cloud Machine Learning Engine
Label
Cloud Storage, Cloud ML Engine, Kubeflow, Pipeline, Component
Summary
A Kubeflow Pipeline com... |
vicente-gonzalez-ruiz/YAPT | scientific_computation/numpy.ipynb | cc0-1.0 | try:
import numpy as np
except:
!pip3 install numpy --user
import numpy as np
"""
Explanation: SciPy.org's NumPy
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Intro" data-toc-modified-id="Intro-1"><span class="toc-item-num">1 </... |
Tsiems/machine-learning-projects | Lab3/Lab3.ipynb | mit | #For final version of report, remove warnings for aesthetics.
import warnings
warnings.filterwarnings('ignore')
#Libraries used for data analysis
import pandas as pd
import numpy as np
from sklearn import preprocessing
df = pd.read_csv('data/cleaned.csv') # read in the csv file
colsToInclude = [ 'Drive', 'qtr', 'd... |
yandex-load/volta | firmware/arduino_due_1MHz/compare_download-lte-wf.ipynb | mpl-2.0 | df = pd.DataFrame(np.fromfile(
"./browser_download_lte_wf.bin",
dtype=np.uint16).astype(np.float32) * (3300 / 2**12))
"""
Explanation: Сценарий:
- заранее выдвигаем шторку с фонариком и запускаем браузер
- включаем мониторинг
- мигаем фонариком пять раз
- задвигаем шторку, ждем чуть больше минуты
- жме... |
Parallel-in-Time/pyMG-2016 | notebooks/InteraktivesUebungsblattMitLoesung.ipynb | bsd-2-clause | import sys
# Diese Zeile muss angepasst werden!
sys.path.append("/home/moser/MG_2016/pyMG-2016/")
import scipy as sp
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import pymg
from project.helmholtz1d import Helmholtz1D
from project.helmholtz1d_periodic import Helmholtz1D_Periodic
from project.g... |
adeibel/dStar | examples/INT-16-2b-demo/INT2016-crusts.ipynb | mit | %matplotlib inline
from __future__ import print_function, division
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import scipy.constants as sc
# class to read in dStar output files
from reader import dStarCrustReader, dStarReader
# plot format
charsize=14
major_ticklength=0.6*charsize
ma... |
sgratzl/ipython-tutorial-VA2015 | 01_GettingStarted.ipynb | cc0-1.0 | #include some package which we use later on
import numpy as np
#test np.ar -> tab
a = np.array([1,2,3,4])
#test np.array -> shift-tab or np.array?
"""
Explanation: Getting Started
During this tutorial, we are using IPython/Jupyter Notebooks. Jupyter notebooks are a web based Python development environment allowing yo... |
ES-DOC/esdoc-jupyterhub | notebooks/mpi-m/cmip6/models/sandbox-1/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mpi-m', 'sandbox-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: MPI-M
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Transport, Emissions, Con... |
r-shekhar/NYC-transport | 15_dataframe_analysis/attic/lowfreq_bike_stations.ipynb | bsd-3-clause | client = dask.distributed.Client()
"""
Explanation: Set up a local cluster of Dask Distributed
End of explanation
"""
df = dd.read_parquet('/bigdata/citibike.parquet')
df.head()
df.tail()
# Count rows
df.start_station_id.compute().shape
# Select start and end columns as separate dataframes,
# apply range checks... |
pydata/xarray | doc/examples/area_weighted_temperature.ipynb | apache-2.0 | %matplotlib inline
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import numpy as np
import xarray as xr
"""
Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Compare-weighted-and-unweighted-mean-temperature" data-toc-modified-i... |
rflamary/POT | notebooks/plot_otda_mapping.ipynb | mit | # Authors: Remi Flamary <remi.flamary@unice.fr>
# Stanislas Chambon <stan.chambon@gmail.com>
#
# License: MIT License
import numpy as np
import matplotlib.pylab as pl
import ot
"""
Explanation: OT mapping estimation for domain adaptation
This example presents how to use MappingTransport to estimate at the sa... |
drericstrong/Blog | 20170408_MonteCarloVarianceReductionWithAnUnbalancedRouletteWheel.ipynb | agpl-3.0 | import random
from numba import jit
# Monte Carlo simulation function. This is defined as
# a function so the numba library can be used to speed
# up execution. Otherwise, this would run much slower.
# p1 is the probability of the first area, and s1 is the
# score of the first area, and so on. The probabilities
# are ... |
huajianmao/learning | coursera/deep-learning/4.convolutional-neural-networks/week1/pa.1.Convolution model - Step by Step - v1.ipynb | mit | import numpy as np
import h5py
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
%load_ext autoreload
%autoreload 2
np.random.seed(1)
"""
Explanation: Convolut... |
nholtz/structural-analysis | Devel/Old/v04-old/Milestones/Frame2D-v04-Milestone2.ipynb | cc0-1.0 | from __future__ import print_function
import salib as sl
sl.import_notebooks()
from Tables import Table
from Nodes import Node
from Members import Member
from LoadSets import LoadSet, LoadCombination
from NodeLoads import makeNodeLoad
from MemberLoads import makeMemberLoad
from collections import OrderedDict, defaultd... |
urgedata/pythondata | fbprophet/fbprophet_metrics.ipynb | mit | import pandas as pd
import numpy as np
from fbprophet import Prophet
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error
%matplotlib inline
plt.rcParams['figure.figsize']=(20,10)
plt.style.use('ggplot')
"""
Explanation: This notebook covers using metrics to ... |
google/flax | docs/notebooks/state_params.ipynb | apache-2.0 | #@title
! pip install --upgrade pip jax jaxlib
! pip install --upgrade git+https://github.com/google/flax.git
! pip install optax
import flax
from flax import linen as nn
import jax
from jax import numpy as jnp
from jax import random
import optax
from functools import partial
#@title
# Initialize random variables
... |
OSHI7/Learning1 | MatplotLib Pynotebooks/AnatomyOfMatplotlib-Part1-Figures_Subplots_and_layouts.ipynb | mit | import matplotlib
print(matplotlib.__version__)
print(matplotlib.get_backend())
"""
Explanation: Matplotlib
Introduction
Matplotlib is a library for producing publication-quality figures. mpl (for short) was designed from the bottom-up to serve dual-purposes. First, to allow for interactive, cross-platform control of ... |
seinberg/deep-learning | reinforcement/Q-learning-cart.ipynb | mit | import gym
import tensorflow as tf
import numpy as np
"""
Explanation: Deep Q-learning
In this notebook, we'll build a neural network that can learn to play games through reinforcement learning. More specifically, we'll use Q-learning to train an agent to play a game called Cart-Pole. In this game, a freely swinging p... |
xdze2/thermique_appart | start_influxDB.ipynb | mit | from influxdb import InfluxDBClient
db = InfluxDBClient(host='127.0.0.1',
port=8086,
username='root',
password='root',
database='mydb')
db.create_database('mydb')
"""
Explanation: Premier pa... |
Mashimo/datascience | 01-Regression/LogisticRegressionSKL.ipynb | apache-2.0 | import pandas as pd
# get titanic training file as a DataFrame
titanic = pd.read_csv("../datasets/titanic_train.csv")
titanic.shape
# preview the data
titanic.head()
"""
Explanation: Titanic
Goal: predict survival on the Titanic
It's a basic learning competition on the ML platform Kaggle, a simple introduction to m... |
StingraySoftware/notebooks | Simulator/Concepts/Simulator.ipynb | mit | from stingray import Crossspectrum, Lightcurve, sampledata
import numpy as np
from scipy import signal
from matplotlib import pyplot as plt
%matplotlib inline
"""
Explanation: Outline
Following features of impulse response simulator have been implemented in this notebook.
1- Find lag-frequency spectrum of a simple de... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/1_core_tensorflow.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
# Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.5
import numpy as np
from matplotlib import pyplot as plt
import tensorflow as tf
print(tf.__version__)
"""
Explanation: Getting started with TensorFlow
Learning... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/plots_boxplots.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
"""
Explanation: Box Plots
The following illustrates some options for the boxplot in statsmodels. These include violin_plot and bean_plot.
End of explanation
"""
data = sm.datasets.anes96.load_pandas()
party_ID = np.a... |
mramanathan/pydiary_notes | functools_partial_usage.ipynb | gpl-3.0 | import functools
def hello_doctor(greet_msg, greet_whom):
return "%s %s, Welcome to the world of robots." %(greet_msg, greet_whom)
## this line works
# hello_doctor = functools.partial(hello_doctor, "R2-D2")
# hello_doctor("Dr.Susan Calvin")
"""
Explanation: 26/May/2016:
** Hey, what's this 'functools' thingy, h... |
ipython/ipywidgets | docs/source/examples/Export As (nbconvert).ipynb | bsd-3-clause | notebook_name = widgets.Text()
"""
Explanation: This notebook shows a really roundabout way to get the name of the notebook file using widgets. The true purpose of this demo is to demonstrate how Javascript and Python widget models are related by id.
Create a text Widget without displaying it. The widget will be use... |
alimanfoo/agam-vgsc-report | notebooks/supp_tables.ipynb | mit | %run setup.ipynb
%matplotlib inline
# load haplotypes
callset_haps = np.load('../data/haps_phase1.npz')
haps = allel.HaplotypeArray(callset_haps['haplotypes'])
pos = allel.SortedIndex(callset_haps['POS'])
n_variants = haps.shape[0]
n_haps = haps.shape[1]
n_variants, n_haps
list(callset_haps)
callset_haps['ANN']
cal... |
jgolebiowski/graphAttack | tutorial.ipynb | mit | import numpy as np
import graphAttack as ga
"""
Explanation: graphAttack Tutorial #01
Introduction
This tutorial demonstrates the basic graph framework used in graphAttack and applies it to a simple linear model
You should be familiar with basic linear algebra, Python and the Jupyter Notebook editor. It also helps if ... |
ioggstream/python-course | ansible-101/notebooks/03_facts_and_variables.ipynb | agpl-3.0 | cd /notebooks/exercise-03
# Let's run the setup module
!ansible -i inventory -m setup localhost
"""
Explanation: Facts and variables
When connecting to an host, ansible creates a dictionary with a huge set of useful informations.
This step is named fact gathering.
You can inspect facts using the setup module.
End ... |
sarahmid/programming-bootcamp-v2 | lab5_exercises_ANSWERS_v2.ipynb | mit | # run this cell first!
fruits = {"apple":"red", "banana":"yellow", "grape":"purple"}
print fruits["banana"]
query = "apple"
print fruits[query]
print fruits[0]
"""
Explanation: Programming Bootcamp 2016
Lesson 5 Exercises -- ANSWERS
1. Guess the output: dictionary practice (1pt)
For the following blocks of code, ... |
alfkjartan/nvgimu | notebooks/.ipynb_checkpoints/Testing the cyclic motion method-checkpoint.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
import nvg.ximu.ximudata as ximudata
%matplotlib notebook
"""
Explanation: Getting started with the analysis of nvg data
This notebook assumes that data exists in a database in the hdf5 format. For instructions how to set up the database with data see [../readme.md].
... |
celiasmith/syde556 | SYDE 556 Lecture 2 Representation.ipynb | gpl-2.0 | from IPython.display import YouTubeVideo
YouTubeVideo('KE952yueVLA', width=720, height=400, loop=1, autoplay=0)
from IPython.display import YouTubeVideo
YouTubeVideo('lfNVv0A8QvI', width=720, height=400, loop=1, autoplay=0)
"""
Explanation: SYDE 556/750: Simulating Neurobiological Systems
Accompanying Readings: Chap... |
tgrammat/ML-Data_Challenges | Dato-tutorials/marketing-analytics/Bank Marketing [Lead Scoring].ipynb | apache-2.0 | import graphlab as gl
import pandas as pd
from datetime import datetime
from sklearn.cross_validation import StratifiedKFold
## load data set from a locally saved csv file
bank_marketing = gl.SFrame.read_csv('./../../../04.UCI.ML.REPO/Bank_Marketing/bank-additional/bank-additional-full.csv',
... |
ceos-seo/data_cube_notebooks | notebooks/water/quality/TSM_Demo.ipynb | apache-2.0 | import sys
import os
sys.path.append(os.environ.get('NOTEBOOK_ROOT'))
import warnings
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import xarray as xr
from utils.data_cube_utilities.clean_mask import landsat_clean_mask_full
from utils.data_cube_utilities.dc_load import get_product_exten... |
5agado/data-science-learning | image processing/Image Processing - Basics.ipynb | apache-2.0 | import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
import sys
sys.path.append(os.path.join(os.pardir))
from utils import image_processing
%load_ext autoreload
%autoreload 2
%matplotlib inline
sns.set_style("dark")
"""
Explanation: Table of Contents
Intro
Load an... |
rasbt/pattern_classification | machine_learning/scikit-learn/scikit_linear_classification.ipynb | gpl-3.0 | %load_ext watermark
%watermark -a 'Sebastian Raschka' -u -d -v -p numpy,scikit-learn,matplotlib
"""
Explanation: Sebastian Raschka
Open in IPython nbviewer
Link to this IPython notebook on Github
Link to the GitHub Repository pattern_classification
End of explanation
"""
import numpy as np
# reading in ... |
quasars100/Resonance_testing_scripts | python_tutorials/Forces.ipynb | gpl-3.0 | import rebound
rebound.reset()
rebound.integrator = "whfast"
rebound.add(m=1.)
rebound.add(m=1e-6,a=1.)
rebound.move_to_com() # Moves to the center of momentum frame
"""
Explanation: Additional forces
REBOUND is a gravitational N-body integrator. But you can also use it to integrate systems with additional, non-gravi... |
bambinos/formulae | formulae/examples/Examples.ipynb | mit | import pandas as pd
import numpy as np
from formulae import design_matrices
np.random.seed(1234)
SIZE = 20
CNT = 20
data = pd.DataFrame(
{
'x': np.random.normal(size=SIZE),
'y': np.random.normal(size=SIZE),
'z': np.random.normal(size=SIZE),
'$2#abc': np.random.normal(size=SIZE),
... |
matteobachetti/srt-single-dish-tools | notebooks/Introduction to the SRT Single Dish Tools.ipynb | bsd-3-clause | %load_ext autoreload
%autoreload 2
%matplotlib inline
from __future__ import print_function, division
from astropy.table import Table
import numpy as np
from matplotlib import pyplot as plt
from seaborn import pairplot, lmplot
import warnings
from pandas import read_csv
from astropy.wcs import WCS
from astropy.io im... |
fabriziocosta/GraphFinder | Fasta_Input_File_to_Graph-read one file-submit.ipynb | gpl-2.0 | %matplotlib inline
import os, sys
import subprocess as sp
from itertools import cycle
import networkx as nx
import re
from eden.util import display
#class names with CamelStyle
#function names with underscore_style
#always named arguments to functions
class FastaToGraph(object):
def __init__(self, mode= 'RNAfold')... |
Gezort/YSDA_deeplearning17 | Seminar3/HW3_Modules.ipynb | mit | class Module(object):
def __init__ (self):
self.output = None
self.gradInput = None
self.training = True
"""
Basically, you can think of a module as of a something (black box)
which can process `input` data and produce `ouput` data.
This is like applying a function which is ... |
UltronAI/Deep-Learning | CS231n/reference/CS231n-master/assignment2/Dropout.ipynb | mit | # 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
... |
benwaugh/NuffieldProject2016 | notebooks/MultipleHistograms.ipynb | mit | import pylab
import matplotlib.pyplot as plt
%matplotlib inline
pylab.rcParams['figure.figsize'] = 8,6
"""
Explanation: Plotting histograms from the "Z path" analysis
Initial set-up
These commands give us access to some tools for plotting histograms and other graphs. We only need to run these once at the beginning of ... |
littlewizardLI/Udacity-ML-nanodegrees | Project2-finding_donors/finding_donors.ipynb | apache-2.0 | # 为这个项目导入需要的库
import numpy as np
import pandas as pd
from time import time
from IPython.display import display # 允许为DataFrame使用display()
# 导入附加的可视化代码visuals.py
import visuals as vs
# 为notebook提供更加漂亮的可视化
%matplotlib inline
# 导入人口普查数据
data = pd.read_csv("census.csv")
# 成功 - 显示第一条记录
display(data.head(n=1))
"""
Explan... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.