repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
paolorivas/homeworkfoundations
05/homework_5_Paolo_Rivas_Legua.ipynb
mit
#Question 2 awnser. for artist in artists: print(artist['name'], artist['popularity']) if len(artist['genres']) == 0: print("no genres listed") else: genres = ", ".join(artist['genres']) print("Genres list: ", genres) """ Explanation: Question 2: What genres are most represented in...
junhwanjang/DataSchool
Lecture/05. 기초 선형 대수 1 - 행렬의 정의와 연산/4) NumPy를 활용한 선형대수 입문.ipynb
mit
x = np.array([1, 2, 3, 4]) x x = np.array([[1], [2], [3], [4]]) x """ Explanation: NumPy를 활용한 선형대수 입문 선형대수(linear algebra)는 데이터 분석에 필요한 각종 계산을 위한 기본적인 학문이다. 데이터 분석을 하기 위해서는 실제로 수많은 숫자의 계산이 필요하다. 하나의 데이터 레코드(record)가 수십개에서 수천개의 숫자로 이루어져 있을 수도 있고 수십개에서 수백만개의 이러한 데이터 레코드를 조합하여 계산하는 과정이 필요할 수 있다. 선형대수를 사용하는 첫번째 장점은 이러한...
dataDogma/Computer-Science
Courses/DAT-208x/DAT 208x - Week 4 - Section 4 - Lab.ipynb
gpl-3.0
"""Since the data is unavailabe from data camp, let's create some of our own""" # Import numpy import numpy as np from numpy import random from numpy import column_stack # np_baseball is un-available, so let's generate some random distribution! height = np.round( np.random.normal( 5.50, 5.0, 1015 ), 2 ) weight = np...
FractalFlows/DAOResearch
notebooks/predictive.ipynb
mit
import numpy as np import math from scipy.interpolate import interp1d from scipy.special import erf import matplotlib.pylab as pl %matplotlib inline # illustration of what a predictive market would look like. guess = np.array([ # year, n_articles, std [ 0.0, 0., 0.0001 ], [ 1.0, 2., 3. ...
florent-leclercq/borg_sdss_data_release
borg_sdss_origami/borg_sdss_origami.ipynb
gpl-3.0
import numpy as np origami = np.load('borg_sdss_origami.npz') """ Explanation: BORG SDSS data products borg_sdss_origami package Authors: Florent Leclercq, Jens Jasche, Guilhem Lavaux, Benjamin Wandelt, Will Percival Last update: 09/10/2018 This package contains the maps obtained by Leclercq et al. (2017), who perfo...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_time_frequency_mixed_norm_inverse.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import mne from mne.datasets import sample from mne.minimum_norm import make_inverse_operator, apply_inverse from mne.inverse_sparse import tf_mixed_norm from mne.viz import plot_sparse_source_estimates print(__doc__) ...
initialized/tensorflow-tutorial
inception-inference/Inception Inference.ipynb
mit
# Location of checkpoint directory from training CHECKPOINT_DIR = "/tmp/mnist-inception" # Number of classes (MNIST = 10, 1 for each digit) NUM_CLASSES = 10 # Number of test images to evaluate at a time. Adjust to smaller if you're # evaluation on a memory-constrained box BATCH_SIZE = 20 from __future__ import absol...
roebius/deeplearning_keras2
nbs/statefarm-sample.ipynb
apache-2.0
from __future__ import division, print_function %matplotlib inline # path = "data/state/" path = "data/state/sample/" from importlib import reload # Python 3 import utils; reload(utils) from utils import * from IPython.display import FileLink batch_size=64 #batch_size=1 """ Explanation: Enter State Farm End of expla...
arcyfelix/Courses
17-09-17-Python-for-Financial-Analysis-and-Algorithmic-Trading/03-General Pandas/08-Data-Input-and-Output.ipynb
apache-2.0
import numpy as np import pandas as pd """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> Typically we will just be either reading csv files directly or using pandas-datareader or quandl. Consider this lecture just a quick overview of what is possible with pandas (we wo...
dietmarw/EK5312_ElectricalMachines
Chapman/Ch9-Problem_9-05.ipynb
unlicense
%pylab notebook %precision %.4g """ Explanation: Excercises Electric Machinery Fundamentals Chapter 9 Problem 9-5 End of explanation """ V = 220 # [V] p = 6 R1 = 1.3 # [Ohm] R2 = 1.73 # [Ohm] X1 = 2.01 # [Ohm] X2 = 2.01 # [Ohm] Xm = 105.0 # [Ohm] s = 0.05 Prot = 291.0 # [W] """ Explanation: Desc...
vzg100/Post-Translational-Modification-Prediction
.ipynb_checkpoints/Lysine Acetylation -XGB -dbptm -checkpoint.ipynb
mit
from pred import Predictor from pred import sequence_vector from pred import chemical_vector """ Explanation: Template for test End of explanation """ par = ["pass", "ADASYN", "SMOTEENN", "random_under_sample", "ncl", "near_miss"] for i in par: print("y", i) y = Predictor() y.load_data(file="Data/Trainin...
Linlinzhao/linlinzhao.github.io
_drafts/.ipynb_checkpoints/多种方法实现一个两层神经网络-checkpoint.ipynb
mit
import numpy as np #先定义网络结构: batch_size, Input Dimension, Hidden Dimension, Output Dimension N, D_in, D_hidden, D_out = 10, 20, 30, 5 #随机生成输入和输出数据 x = np.random.randn(N, D_in) y = np.random.randn(N, D_out) #对输入层和输出层的参数进行初始化 w1 = np.random.randn(D_in, D_hidden) w2 = np.random.randn(D_hidden, D_out) learning_rate ...
Automating-GIS-processes/Lesson-7-Automating-Raster-Data-Processing
Python-and-Gdal.ipynb
mit
mkdir LandsatData tar -zxvf LC81910182016153-SC20161208043748.tar.gz -C LandsatData/ """ Explanation: Raster data processing with Python and GDAL In this lesson we will learn basic techniques for automating raster data processing with python and the Geospatial Data Abstraction Library GDAL. Raster files are commonly ...
mne-tools/mne-tools.github.io
0.18/_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...
bjshaw/phys202-2015-work
assignments/assignment12/FittingModelsEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt """ Explanation: Fitting Models Exercise 1 Imports End of explanation """ a_true = 0.5 b_true = 2.0 c_true = -4.0 """ Explanation: Fitting a quadratic curve For this problem we are going to work with the following mod...
AllenDowney/ThinkBayes2
notebooks/chap06.ipynb
mit
# If we're running on Colab, install empiricaldist # https://pypi.org/project/empiricaldist/ import sys IN_COLAB = 'google.colab' in sys.modules if IN_COLAB: !pip install empiricaldist # Get utils.py from os.path import basename, exists def download(url): filename = basename(url) if not exists(filename...
zerothi/ts-tbt-sisl-tutorial
presentations/01/run.ipynb
gpl-3.0
chain = sisl.Geometry([0]*3, sisl.Atom(1, R=1.), sc=[1, 1, 10]) chain.set_nsc([3, 3, 1]) # Transport along y-direction chain = chain.tile(20, 0) He = sisl.Hamiltonian(chain) He.construct(([0.1, 1.1], [0, -1])) Hd = He.tile(20, 1) He.write('ELEC.nc') Hd.write('DEVICE.nc') with open('RUN.fdf', 'w') as f: f.write(""...
spectralDNS/shenfun
binder/Shenfun-introduction.ipynb
bsd-2-clause
from shenfun import * print('hello world') """ Explanation: <center> Shenfun - High-Performance Computing platform for the Spectral Galerkin method <div><img src="https://rawcdn.githack.com/spectralDNS/spectralutilities/f3419a3e6c40dad55be5dcca51f6e0e21713dd90/figures/Chebyshev_Polynomials_of_the_First_Kind.svg" width...
U302/Stuff
Bitcoin_Trading_Bot/Saved Predictions.ipynb
gpl-3.0
def plot_results(predicted_data, true_data): fig=plt.figure(figsize=(18, 12), dpi= 80, facecolor='w', edgecolor='k') ax = fig.add_subplot(111) ax.plot(true_data, label='True Data') plt.plot(predicted_data, label='Prediction') plt.legend() plt.show() def predict_sequences_multiple(model, data, w...
rasbt/python-machine-learning-book
code/bonus/softmax-regression.ipynb
mit
%load_ext watermark %watermark -a 'Sebastian Raschka' -u -d -v -p matplotlib,numpy,scipy # to install watermark just uncomment the following line: #%install_ext https://raw.githubusercontent.com/rasbt/watermark/master/watermark.py %matplotlib inline """ Explanation: Sebastian Raschka, 2016 https://github.com/rasbt/p...
aschaffn/phys202-2015-work
assignments/assignment06/ProjectEuler17.ipynb
mit
def number_to_words(n): """Given a number n between 1-1000 inclusive return a list of words for the number.""" num19 = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",\ "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", \ "ei...
empet/PSCourse
Birthday-problem-ro.ipynb
bsd-3-clause
from __future__ import division def prob_theor(n): if n==2: return (1-1/365) else: return prob_theor(n-1)*(1-(n-1)/365) %matplotlib inline import matplotlib.pyplot as plt plt.style.use('ggplot') # setam stilul de afisare a plot-urilor. # Incepand cu matplotlib 1.4...
tensorflow/docs
site/en/tutorials/audio/transfer_learning_audio.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...
tpin3694/tpin3694.github.io
python/queues_and_stacks.ipynb
mit
from collections import deque """ Explanation: Title: Queues And Stacks Slug: queues_and_stacks Summary: Queues And Stacks in Python. Date: 2016-01-23 12:00 Category: Python Tags: Basics Authors: Chris Albon Interesting in learning more? Check out Fluent Python Preliminaries End of explanation """ # Option 1: ...
tensorflow/probability
spinoffs/oryx/examples/notebooks/probabilistic_programming.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
kingmolnar/DataScienceProgramming
06-Descriptive-Statistics/CrimeData_orig.ipynb
cc0-1.0
import numpy as np import pandas as pd %matplotlib inline import matplotlib.pyplot as plt # load data set df = pd.read_csv('/home/data/APD/COBRA-YTD2017.csv.gz') print "Shape of table: ", df.shape """ Explanation: Atlanta Police Department The Atlanta Police Department provides Part 1 crime data at http://www.atlant...
fonnesbeck/PyMC3_Oslo
notebooks/4. Approximation Methods.ipynb
cc0-1.0
# %load ../data/melanoma_data.py from numpy import reshape, sum melanoma_data = reshape([1.57808, 0.00000, 2, 1.27, 35.9945, 1, 1.48219, 0.00000, 2, 0.76, 41.9014, 1, 0.0, 7.33425, 1, 35.00, 70.2164, 2, 2.23288, 0.00000, 1, 1.70, 33.7096, 1, 0.0, 9.38356, 2, 1.00, 47.9726, 1, 3.27671, 0.00000, 1, 11.00,...
wheeler-microfluidics/teensy-minimal-rpc
teensy_minimal_rpc/notebooks/dma-examples/Example - Multi-channel ADC multiple samples using DMA.ipynb
gpl-3.0
from arduino_rpc.protobuf import resolve_field_values from teensy_minimal_rpc import SerialProxy import teensy_minimal_rpc.DMA as DMA import teensy_minimal_rpc.ADC as ADC # Disconnect from existing proxy (if available) try: del proxy except NameError: pass proxy = SerialProxy() dma_channel_scatter = 0 dma_c...
mit-eicu/eicu-code
notebooks/allergy.ipynb
mit
# Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import psycopg2 import getpass import pdvega # for configuring connection from configobj import ConfigObj import os %matplotlib inline # Create a database connection using settings from config file config='../db/config.ini' #...
empet/Plotly-plots
kdeplot-2d-Plotly.ipynb
gpl-3.0
import numpy as np import pandas as pd import seaborn as sns import numpy as np import scipy.stats as st import matplotlib.pyplot as plt %matplotlib inline """ Explanation: 2D kernel density estimation and its Plotly plot We have two Excel files with two columns. We read the files into two pandas dataframes and plot...
florianwittkamp/FD_ACOUSTIC
JupyterNotebook/1D/FD_1D_DX4_DT2_fast.ipynb
gpl-3.0
%matplotlib inline import numpy as np import time as tm import matplotlib.pyplot as plt """ Explanation: FD_1D_DX4_DT2_fast 1-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 wav...
zaqwes8811/micro-apps
self_driving/deps/Kalman_and_Bayesian_Filters_in_Python_master/13-Smoothing.ipynb
mit
from __future__ import division, print_function %matplotlib inline #format the book import book_format book_format.set_style() """ Explanation: Table of Contents Smoothing End of explanation """ import matplotlib.pyplot as plt data = [10.1, 10.2, 9.8, 10.1, 10.2, 10.3, 10.1, 9.9, 10.2, 10.0, 9.9, 11.4] pl...
royalosyin/Python-Practical-Application-on-Climate-Variability-Studies
ex23-CO2 and Global Temperature Anomaly.ipynb
mit
import pandas as pd from matplotlib import pyplot as plt %matplotlib inline # Set some parameters to apply to all plots. These can be overridden import matplotlib # Plot size to 14" x 7" matplotlib.rc('figure', figsize = (14, 7)) # Font size to 14 matplotlib.rc('font', size = 14) # Do not display top and right frame ...
GoogleCloudPlatform/analytics-componentized-patterns
retail/recommendation-system/bqml-scann/ann02_run_pipeline.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 """ Explanation: Low-latency item-to-item recommendation system - Orchestrating with TFX Overview This notebook is a part of the series that describes the process of implementing a Low-latency item-to-item recommendation system. This notebook demonstrates how to use TFX and AI Platfo...
probml/pyprobml
notebooks/misc/haiku_intro.ipynb
mit
%%capture !pip install git+https://github.com/deepmind/dm-haiku import haiku as hk %%capture !pip install git+git://github.com/deepmind/optax.git import optax import haiku as hk import jax import jax.numpy as jnp import numpy as np """ Explanation: <a href="https://colab.research.google.com/github/probml/probml-note...
davofis/computational_seismology
05_pseudospectral/cheby_elastic_1d.ipynb
gpl-3.0
# This is a configuration step for the exercise. Please run it before calculating the derivative! import numpy as np import matplotlib.pyplot as plt from ricker import ricker # Show the plots in the Notebook. plt.switch_backend("nbagg") """ Explanation: <div style='background-image: url("../../share/images/header.sv...
morganics/bayesianpy
examples/notebook/iris_univariate_joint_pdf_plot.ipynb
apache-2.0
%matplotlib inline import pandas as pd import sys sys.path.append("../../../bayesianpy") import bayesianpy from bayesianpy.network import Builder as builder import logging import os import math import numpy as np import scipy.stats as ss import matplotlib.pyplot as plt import seaborn as sns logger = logging.getLogger...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_artifacts_detection.ipynb
bsd-3-clause
import numpy as np import mne from mne.datasets import sample from mne.preprocessing import create_ecg_epochs, create_eog_epochs # getting some data ready data_path = sample.data_path() raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif' raw = mne.io.read_raw_fif(raw_fname, preload=True) """ Explanation: In...
avicennax/Bayesian-Notes
Gaussian Process.ipynb
mit
import warnings import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm from scipy.optimize import minimize from scipy.spatial.distance import pdist, squareform %matplotlib inline %config InlineBackend.figure_format = 'retina' # Defining Data n = 10 a = 3 b = .5 sigma = 5 X...
rmalouf/learning
Person marking.ipynb
mit
from itertools import combinations, combinations_with_replacement referents = [] for i in xrange(1, len(entities) * 2): for combo in combinations_with_replacement(entities, i): # choral we is impossible if combo.count('self') > 1: continue # only singular ...
tcstewar/testing_notebooks
Cosine tuning curves.ipynb
gpl-2.0
# How to compute intercept range given an angle range import numpy as np angle_range_degrees = np.array([15.0, 35.0]) angle_range = angle_range_degrees * np.pi / 180 print np.cos(angle_range) """ Explanation: First, here is a quick way to determine what the intercepts should be, given a desired angle that you want t...
timgasser/bcycle-austin
notebooks/bcycle_bikes.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt import folium import seaborn as sns from bcycle_lib.utils import * %matplotlib inline plt.rc('xtick', labelsize=14) plt.rc('ytick', labelsize=14) # for auto-reloading external modules # see http://stackoverflow.com/questions/1907993/autoreload-...
tkoyama010/getfem_presentation
demo/linear-dynamic-2D.ipynb
cc0-1.0
import numpy as np import getfem as gf import pylab as plt from scipy import io from scipy.sparse import linalg """ Explanation: Getfem++を使用した地盤の線形時刻歴応答解析 Getfem++を使用して地盤の2次元線形時刻歴応答解析を行いました。 End of explanation """ # S波速度(m/sec2) Vs = 2.000e+03 # ポアソン比(-) Nu = 4.800e-01 # 質量密度(kg/m3) rho = 1.800e+01 # ラメの弾性定数 Mu ...
edinburghlivinglab/D4I
viz/python/Simplify_Bin_Sensor_Data.ipynb
apache-2.0
import pandas as pd table = pd.read_csv("../data/binsensors.csv") """ Explanation: How to get a simple dataset from a big CSV file This notebook goes through some steps to convert a large unwieldy file from the Council's Litter Bin Sensor Project into a simpler dataset for visualisation. We use a number of functions p...
t-makaro/nbconvert_pdf_template
example/test.ipynb
mit
next_paragraph = """ Aenean vitae diam consectetur, tempus arcu quis, ultricies urna. Vivamus venenatis sem quis orci condimentum, sed feugiat dui porta. """ def identity_dec(ob): return ob @identity_dec def nifty_print(text): """Used to test syntax highlighting""" print(text * 2) nifty_print(next_...
garibaldu/boundary-seekers
gated_perceptron.ipynb
mit
%matplotlib inline import numpy.random as rng import pylab as pl import autograd.numpy as np from autograd import grad def sigmoid(phi): return 1.0/(1.0 + np.exp(-phi)) def calc_outputs(params): # Sigmoid perceptron ('logistic regression') XX = X - params['m'] phi = np.dot(XX, params['w']) psi = ...
mne-tools/mne-tools.github.io
0.24/_downloads/e7de7baffeeb4beff147bad8657b46dc/opm_data.ipynb
bsd-3-clause
import os.path as op import numpy as np import mne data_path = mne.datasets.opm.data_path() subject = 'OPM_sample' subjects_dir = op.join(data_path, 'subjects') raw_fname = op.join(data_path, 'MEG', 'OPM', 'OPM_SEF_raw.fif') bem_fname = op.join(subjects_dir, subject, 'bem', subject + '-5120-5120-5...
Kaggle/learntools
notebooks/python/raw/tut_2.ipynb
apache-2.0
help(round) """ Explanation: You've already seen and used functions such as print and abs. But Python has many more functions, and defining your own functions is a big part of python programming. In this lesson, you will learn more about using and defining functions. Getting Help You saw the abs function in the previo...
CompPhysics/MachineLearning
doc/src/Optimization/GradientMethods.ipynb
cc0-1.0
#Program that solves exercise 1b. %matplotlib inline import numpy as np import matplotlib.pyplot as plt def gradient_descent(xk,dx_f,gamma): return xk-gamma*dx_f def quadratic(a,b,c,x): return a*x**2+b*x+c def dx_quadratic(a,b,x): return 2*a*x+b #One variable examples a,b,c = 1,0,1 x = np.linspa...
tensorflow/docs
site/en/r1/tutorials/keras/basic_classification.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...
pierre-rouanet/dtw
examples/speech-recognition.ipynb
gpl-3.0
%matplotlib inline import os import glob import librosa import numpy as np """ Explanation: Speech recognition Simple sppeech recognition system can be implemented using DTW + MFCC. End of explanation """ DATABASE_PATH = '/Users/pierrerouanet/Downloads/data-speech_commands_v0.02' labels = {'cat', 'dog', 'house', '...
oroszl/topins
RM.ipynb
gpl-2.0
# The usual imports %pylab inline from ipywidgets import * # Some extra imports for 3D from mpl_toolkits.mplot3d import * # These are only needed to make things pretty.. # they are mostly refered to in the formatting part of the figures # and enshure us to have the figures also present in the book. from matplotlib.pa...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/text_classification/labs/text_classification.ipynb
apache-2.0
# Import necessary libraries import matplotlib.pyplot as plt import os import re import shutil import string import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras import losses # Print the TensorFlow version print(tf.__version__) """ Explanation: Basic Text Classification Overview This n...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive/09_sequence/reusable-embeddings.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst !pip install --user google-cloud-bigquery==1.25.0 """ Explanation: Using pre-trained embedding with Tensorflow Hub Learning Objectives 1. How to instantiate a Tensorflow Hub module 1. How to find pretrained Tensorflow Hub module for variety of purpose...
mne-tools/mne-tools.github.io
0.18/_downloads/c1aa88a2be3f4bc4a4552ce39a81e4e1/plot_morph_volume_stc.ipynb
bsd-3-clause
# Author: Tommy Clausner <tommy.clausner@gmail.com> # # License: BSD (3-clause) import os import nibabel as nib import mne from mne.datasets import sample from mne.minimum_norm import apply_inverse, read_inverse_operator from nilearn.plotting import plot_glass_brain print(__doc__) """ Explanation: Morph volumetric s...
fastai/course-v3
nbs/dl2/12c_ulmfit.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline #export from exp.nb_12a import * """ Explanation: ULMFit End of explanation """ path = datasets.untar_data(datasets.URLs.IMDB) ll = pickle.load(open(path/'ll_lm.pkl', 'rb')) bs,bptt = 128,70 data = lm_databunchify(ll, bs, bptt) vocab = ll.train.proc_x[1].voc...
CompPhysics/MachineLearning
doc/Programs/IsingModel/logisticIsing.ipynb
cc0-1.0
import pickle import os import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import sklearn.model_selection as skms import sklearn.linear_model as skl import sklearn.metrics as skm import tqdm import copy import time from IPython.display import display %matplotlib in...
erdewit/ib_insync
notebooks/bar_data.ipynb
bsd-2-clause
from ib_insync import * util.startLoop() ib = IB() ib.connect('127.0.0.1', 7497, clientId=14) """ Explanation: Bar data End of explanation """ contract = Stock('TSLA', 'SMART', 'USD') ib.reqHeadTimeStamp(contract, whatToShow='TRADES', useRTH=True) """ Explanation: Historical data To get the earliest date of avail...
GustavoRP/IA369Z
deliver/DTI_open_01-05-17_GRP.ipynb
gpl-3.0
# import modules and libs import io, os, sys, types import numpy as np # image and graphic from IPython.display import Image from IPython.display import display import matplotlib.pyplot as plt %matplotlib #import specific modules sys.path.append('C:/iPython/DTIlib') import DTIlib as DTI """ Explanation: Openig DTI d...
LDSSA/learning-units
units/08-data-cleaning/examples/01 - Eliminating Outliers.ipynb
mit
import pandas as pd import numpy as np % matplotlib inline from matplotlib import pyplot as plt """ Explanation: 01 - Example - Eliminating Outliers This notebook presents how to eliminate the diagnosed outliers (in the previous Learning Unit). By: Hugo Lopes Learning Unit 08 Some inital imports: End of explanation "...
Applied-Groundwater-Modeling-2nd-Ed/Chapter_4_problems-1
P4.1_FlopyIntro-Toth_Flowsystem.ipynb
gpl-2.0
%matplotlib inline import sys import os import shutil import numpy as np from subprocess import check_output # Import flopy import flopy """ Explanation: <img src="AW&H2015.tiff" style="float: left"> <img src="flopylogo.png" style="float: center"> Problem P4.1 Flopy Background and Toth (1962) Flow System Pages 171-17...
ES-DOC/esdoc-jupyterhub
notebooks/mpi-m/cmip6/models/icon-esm-lr/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mpi-m', 'icon-esm-lr', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: MPI-M Source ID: ICON-ESM-LR Sub-Topics: Radiative Forcings. Properties: 8...
Joozty/FIT-VUT
2. Semester/ISJ - Scripting Languages/1. Project/xharag01.ipynb
gpl-3.0
from __future__ import division, print_function import re import itertools def words(text): return set(text.split()) winners = words('''washington adams jefferson jefferson madison madison monroe monroe adams jackson jackson van-buren harrison polk taylor pierce buchanan lincoln lincoln grant grapartnt haye...
rasbt/algorithms_in_ipython_notebooks
ipython_nbs/essentials/recursion-examples.ipynb
gpl-3.0
def factorial(x): if x <= 1: return x else: return x * factorial(x-1) factorial(0) factorial(1) """ Explanation: Examples using Recursion Important Note For most cases, using function recursion should be avoided in Python are better be implemented using for/while loops most of the time (altho...
QuantEcon/QuantEcon.notebooks
ddp_ex_MF_7_6_4_py.ipynb
bsd-3-clause
%matplotlib inline import numpy as np from scipy import sparse import matplotlib.pyplot as plt import quantecon as qe from quantecon.markov import DiscreteDP, backward_induction, sa_indices T = 0.5 # Time expiration (years) vol = 0.2 # Annual volatility r = 0.05 # Annual interest rate strike = 2.1 # S...
rbreu/birdcam
talk/.ipynb_checkpoints/Vogelkamera-checkpoint.ipynb
mit
import glob import numpy from matplotlib import image def rgb2gray(rgb): return numpy.dot(rgb[...,:3], [0.299, 0.587, 0.144]) oldimg = None for infile in glob.glob('*.JPG'): img = rgb2gray(image.imread(infile)) if oldimg is not None: diff = numpy.linalg.norm(img - oldimg) # ... do someth...
GoogleCloudPlatform/training-data-analyst
blogs/ncaa/ncaa_feateng_solution.ipynb
apache-2.0
%%bigquery df1 SELECT team_code, AVG(SAFE_DIVIDE(fgm + 0.5 * fgm3,fga)) AS offensive_shooting_efficiency, AVG(SAFE_DIVIDE(opp_fgm + 0.5 * opp_fgm3,opp_fga)) AS opponents_shooting_efficiency, AVG(win) AS win_rate, COUNT(win) AS num_games FROM lab_dev.team_box WHERE fga IS NOT NULL GROUP BY team_code """ Expl...
yunqu/PYNQ
boards/Pynq-Z1/base/notebooks/arduino/arduino_ardumoto.ipynb
bsd-3-clause
from pynq.overlays.base import BaseOverlay base = BaseOverlay("base.bit") """ Explanation: Ardumoto Example This example shows how to use the Ardumoto on the board. Ardumoto supports two DC motor driving. There are also instructions on how to hook up the shield. Motor A and Motor B are connected as below to the ard...
tensorflow/docs-l10n
site/en-snapshot/hub/tutorials/senteval_for_universal_sentence_encoder_cmlm.ipynb
apache-2.0
# Copyright 2021 The TensorFlow Hub Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
rishuatgithub/MLPy
torch/PYTORCH_NOTEBOOKS/00-Crash-Course-Topics/01-Crash-Course-Pandas/01-Series.ipynb
apache-2.0
import numpy as np import pandas as pd """ Explanation: <a href='http://www.pieriandata.com'><img src='../Pierian_Data_Logo.png'/></a> <center><em>Copyright Pierian Data</em></center> <center><em>For more information, visit us at <a href='http://www.pieriandata.com'>www.pieriandata.com</a></em></center> Series The fi...
royalosyin/Python-Practical-Application-on-Climate-Variability-Studies
ex24-Visualize CO2 Time Series with Python.ipynb
mit
import pandas as pd import statsmodels.api as sm from matplotlib import pyplot as plt import warnings warnings.filterwarnings('ignore') %matplotlib inline # Set some parameters to apply to all plots. These can be overridden import matplotlib # Plot size to 12" x 7" matplotlib.rc('figure', figsize = (12, 7)) # Font s...
mne-tools/mne-tools.github.io
0.19/_downloads/4395f5fd5291fa48208a82dab72d1893/plot_sensor_regression.ipynb
bsd-3-clause
# Authors: Tal Linzen <linzen@nyu.edu> # Denis A. Engemann <denis.engemann@gmail.com> # Jona Sassenhagen <jona.sassenhagen@gmail.com> # # License: BSD (3-clause) import pandas as pd import mne from mne.stats import linear_regression, fdr_correction from mne.viz import plot_compare_evokeds from mne.da...
rhiever/scipy_2015_sklearn_tutorial
notebooks/01.3 Data Representation for Machine Learning.ipynb
cc0-1.0
from sklearn.datasets import load_iris iris = load_iris() """ Explanation: Representation and Visualization of Data Machine learning is about creating models from data: for that reason, we'll start by discussing how data can be represented in order to be understood by the computer. Along with this, we'll build on our...
sergey-tomin/workshop
6_Genesis_postprocessor.ipynb
mit
# the output of plotting commands is displayed inline within frontends, # directly below the code cell that produced it %matplotlib inline from __future__ import print_function # this python library provides generic shallow (copy) and deep copy (deepcopy) operations from copy import deepcopy # import from Ocelot gra...
ContinuumIO/cube-explorer
notebooks/Colocated_cube_pair.ipynb
bsd-3-clause
from IPython.display import Image as IPImage IPImage(url="http://www.wetterzentrale.de/wz/pics/Recm1201.gif", width=500) import iris import numpy as np import holoviews as hv import holocube as hc from cartopy import crs from cartopy import feature as cf hv.notebook_extension() iris.FUTURE.strict_grib_load = True %ou...
rsignell-usgs/notebook
Siphon/.ipynb_checkpoints/casestudy-checkpoint.ipynb
mit
import xray ds = xray.open_dataset('https://motherlode.ucar.edu/repository/opendap/41f2b38a-4e70-4135-8ff8-dbf3d1dcbfc1/entry.das', decode_times=False) print(ds) """ Explanation: netCDF File Visualization Case Study I was asked by a colleague to visualize data contained within this netCDF file ...
lesley2958/lesley2958.github.io
blog/2018/aq-india-map.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import pandas as pd %matplotlib inline """ Explanation: Mapping location of air quality sensing in India In this notebook, I'll show a quick example of how to use Folium (which internally uses LeafletJS) for visualising the location of air quality monitors in India. T...
Vvkmnn/books
AutomateTheBoringStuffWithPython/lesson40.ipynb
gpl-3.0
import bs4 """ Explanation: Lesson 40: Parsing HTML with the BeautifulSoup Module HTML stands for 'Hyper Text Markup Language', which is text that loads elements of a webpage. Parsing HTML in Python can be done via the beautifulsoup module. It is a third party module, and must be installed via pip. End of explanation ...
fereshteh-razmi/mimic-code
notebooks/elective-surgery.ipynb
mit
# Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import psycopg2 # used to calculate AUROC/accuracy from sklearn import metrics %matplotlib inline # create a database connection sqluser = 'postgres' dbname = 'mimic' schema_name = 'mimiciii' # Connect to local postgres versi...
rethore/FUSED-Wake
examples/Script.ipynb
agpl-3.0
v80 = wt.WindTurbine('Vestas v80 2MW offshore','V80_2MW_offshore.dat',70,40) HR1 = wf.WindFarm('Horns Rev 1','HR_coordinates.dat',v80) WD = range(0,360,1) """ Explanation: Verification of the FUSED-Wind wrapper common inputs End of explanation """ """ ##Fused inputs inputs = dict( wind_speed=8.0, roughness=0...
juditacs/labor
notebooks/Python_alapok.ipynb
lgpl-3.0
print("Hello world\nvagy magyarul: Szia világ") """ Explanation: Python alapok Ez a leírás Python 3.5-ös verziójához készült, de bármilyen Python 3.3 feletti verzióhoz használható. Az anyag elsajátításához nem szükséges Pythont és Jupytert telepíteni, de teljes értékűbb, ha te is ki tudod próbálni, át tudod írni az it...
dato-code/tutorials
notebooks/model_parameter_search.ipynb
apache-2.0
import graphlab as gl data_url = 'https://static.turi.com/datasets/movie_ratings/sample.small' movie_data = gl.SFrame.read_csv(data_url, delimiter='\t') """ Explanation: Model Parameter Search - Automated and Distributed Back when I was creating a movie recommender the most time consuming part was finding good parame...
google/eng-edu
ml/testing-debugging/testing-debugging-ml-debugging.ipynb
apache-2.0
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the L...
bbglab/adventofcode
2017/iker/Ferran AoC 2017.ipynb
mit
digits = '91212129' L = len(digits) sum([int(digits[i]) for i in range(L) if digits[i] == digits[(i+1) % L]]) def solve(captcha): captcha = list(map(int, captcha)) prev_val = captcha[-1] repeated = 0 for v in captcha: if v == prev_val: repeated += v prev_val = v return ...
aleph314/K2
Foundations/Math/linear-algebra_exercise.ipynb
gpl-3.0
import numpy as np """ Explanation: Linear Algebra Although its name may sound harmless, Linear Algebra is by no means a trivial branch of mathematics, and the deeper you dive into Data Science and Statistics, the more often you will encounter its concepts. In this exercise, we'll start with some basic operations on ...
hashiprobr/redes-sociais
encontro07/pagerank.ipynb
gpl-3.0
import sys sys.path.append('..') import numpy as np import socnet as sn """ Explanation: Encontro 07: Simulação e Demonstração de PageRank Importando as bibliotecas: End of explanation """ sn.graph_width = 225 sn.graph_height = 225 """ Explanation: Configurando a biblioteca: End of explanation """ g = sn.load_gr...
misken/hillmaker
hillmaker/testing/metamodeling_obs_ldr.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns # Make the graphs a bit prettier, and bigger # pd.set_option('display.mpl_style', 'default') # pd.set_option('display.width', 5000) # pd.set_option('display.max_columns', 60) %matplotlib...
infotranecon/IEtools
Dynamic Equilibrium Examples.ipynb
mit
import numpy as np import pylab as pl from IEtools import * %pylab inline """ Explanation: Here are some examples of using IEtools ('Information Equilibrium tools') for python to investigate a couple of dynamic equilibrium models. There are two datasets used below, both obtainable from FRED. One is (nominal) GDP div...
RaspberryJamBe/ipython-notebooks
notebooks/en-gb/Communication - Cloud message 2 - Receive messages and blink LEDs.ipynb
cc0-1.0
APPKEY = "******" """ Explanation: APPKEY is the Application Key for a (free) http://www.realtime.co/ "Realtime Messaging Free" subscription. See "104 - Remote deurbel - Een cloud API gebruiken om berichten te sturen" voor meer gedetailleerde info. End of explanation """ import time import RPi.GPIO as GPIO GPIO.setm...
Sandor-PRA/pandas_tutorial
demos/climate_timeseries/climate_timeseries.ipynb
mit
%matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt from pandas import set_option set_option("display.max_rows", 16) LARGE_FIGSIZE = (12, 8) # Change this cell to the demo location on YOUR machine %cd 'D:\\Git\\Pandas_Tutorial\\demos\\climate_timeseries' %ls """ Explanation: L...
Oaklight/Grade-Sender
send_the_grade.ipynb
apache-2.0
import gradeSender as gs gs.DEBUG = True # Switch to False when deployed :D gs.user_account = "xyz@whatever.com" gs.user_password = "password/autherization_code" # autherization code if using 163, qq, etc. gs.user_smtp_server = "smtp.whatever.com" # some may use mail.whatever.com as an alternative gs.user_smtp_port ...
sbenthall/bigbang
examples/word_analysis/SpecialWordsAnalysis.ipynb
agpl-3.0
from bigbang.archive import Archive from bigbang.archive import load as load_archive import bigbang.parse as parse import bigbang.graph as graph import bigbang.mailman as mailman import bigbang.process as process import networkx as nx import matplotlib.pyplot as plt import pandas as pd from pprint import pprint as pp i...
daniel-severo/dask-ml
docs/source/examples/joblib-distributed.ipynb
bsd-3-clause
from time import time import matplotlib.pyplot as plt from sklearn.datasets import fetch_olivetti_faces from sklearn.ensemble import ExtraTreesClassifier from sklearn.externals import joblib import distributed.joblib from distributed import Client """ Explanation: Distributed Joblib Scikit-learn already parallelizes...
ES-DOC/esdoc-jupyterhub
notebooks/ncc/cmip6/models/sandbox-2/atmoschem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'sandbox-2', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: NCC Source ID: SANDBOX-2 Topic: Atmoschem Sub-Topics: Transport, Emissions Co...
m2dsupsdlclass/lectures-labs
labs/09_triplet_loss/Face_Verification_Using_Triplet_Loss.ipynb
mit
import tensorflow as tf # If you have a GPU, execute the following lines to restrict the amount of VRAM used: gpus = tf.config.experimental.list_physical_devices('GPU') if len(gpus) > 1: print("Using GPU {}".format(gpus[0])) tf.config.experimental.set_visible_devices(gpus[0], 'GPU') else: print("Using CPU"...
samirma/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...
minesh1291/Practicing-Kaggle
master-class/FeatureTransformation/Feature_transformation.ipynb
gpl-3.0
import numpy as np import pandas as pd %matplotlib inline """ Explanation: Hypothesis/ Questions? When we need log transformation ? Which log base ? natural, 2, 10 ? When we need **2 polynomial ? Distribution with Spike, very low variance/ standard deviation By observation STD, Var, Mean MSE LIbraries End of expla...
adrn/TwoFace
notebooks/figures/Sample K cuts.ipynb
mit
with h5py.File(control_samples_file) as f: control_K = np.full((len(f.keys()), 256), np.nan) for i, key in enumerate(f): n_samples = len(f[key]['K']) control_K[i, :n_samples] = f[key]['K'][:] ln_control_K = np.log(control_K) n_samples = np.sum(np.logical_not(np.isnan(control_K)), axis=...
dedx/STAR2015
notebooks/DoubleSlit.ipynb
mit
%pylab inline import numpy as np import matplotlib.pyplot as plot from scipy.integrate import trapz,cumtrapz from IPython.html.widgets import interact, interactive def distribute1D(x,prob,N): """takes any distribution which is directly proportional to the number of particles, and returns data that is sta...
FlorianWilhelm/distvis
index.ipynb
mit
import warnings from collections import OrderedDict, defaultdict from enum import Enum import numpy as np from scipy import stats from bokeh.io import output_notebook, show, push_notebook from bokeh.plotting import figure from bokeh.io import show from ipywidgets import widgets, interact, interactive from IPython.di...