text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import os store_dir = '/global/cfs/projectdirs/m3443/usr/caditi97/iml2020/misaligned/new_mis/' og_evts = '/global/cfs/projectdirs/m3443/data/trackml-kaggle/train_all/' os.environ['TRKXINPUTDIR']=f"{store_dir}shift_x/" os.environ['TRKXOUTPUTDIR']= f"{store_dir}shift_x_pre/" import pkg_resources import yaml import pp...
github_jupyter
# Dictionaries and Sets **CS1302 Introduction to Computer Programming** ___ ``` %reload_ext mytutor ``` ## Motivation for associative container The following code simulates the outcomes from rolling a dice multiple times. ``` import random dice_rolls = [random.randint(1,6) for i in range(10)] print(*dice_rolls) `...
github_jupyter
``` # default_exp models.MINIROCKET ``` # MINIROCKET > A Very Fast (Almost) Deterministic Transform for Time Series Classification. ``` #export from tsai.imports import * from tsai.utils import * from tsai.data.external import * from tsai.models.layers import * #export from sktime.transformations.panel.rocket import...
github_jupyter
Conditional Generative Adversarial Network ---------------------------------------- A Generative Adversarial Network (GAN) is a type of generative model. It consists of two parts called the "generator" and the "discriminator". The generator takes random values as input and transforms them into an output that (hopefu...
github_jupyter
# GATE Worker The GATE Worker is a module that allows to run anything in a Java GATE process from Python and interchange documents between Python and Java. One possible use of this is to run an existing GATE pipeline on a Python GateNLP document. This is done by the python module communicating with a Java process ov...
github_jupyter
``` #! /usr/bin/env python3 # -*- coding: utf-8 -*- # vim:fenc=utf-8 # File name: test.py # First Edit: 2020-02-13 # Last Change: 13-Feb-2020. """ adb kill-server adb start-server adb device -l adb shell dumpsys display """ import io import os import subprocess import cv2 import numpy as np import pytesseract import ...
github_jupyter
[Table of Contents](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb) # Smoothing ``` #format the book %matplotlib inline from __future__ import division, print_function from book_format import load_style load_style() ``` ## Introduction The perform...
github_jupyter
``` import os import numpy as np import matplotlib.pyplot as plt plt.rcParams['mathtext.fontset'] = 'stix' ``` # Calculate $\kappa$ sampled from the first training In the first training, we let 200 independent LSTMs predict 200 trajectories of 200$ns$. Since we are using LSTM as a generative model, we can also train ...
github_jupyter
## Dependencies ``` !pip install --quiet /kaggle/input/kerasapplications !pip install --quiet /kaggle/input/efficientnet-git import warnings, glob from tensorflow.keras import Sequential, Model import efficientnet.tfkeras as efn from cassava_scripts import * seed = 0 seed_everything(seed) warnings.filterwarnings('ig...
github_jupyter
## Trajectory equations: ``` %matplotlib inline import matplotlib.pyplot as plt from sympy import * init_printing() Ex, Ey, Ez = symbols("E_x, E_y, E_z") Bx, By, Bz, B = symbols("B_x, B_y, B_z, B") x, y, z = symbols("x, y, z") vx, vy, vz, v = symbols("v_x, v_y, v_z, v") t = symbols("t") q, m = symbols("q, m") c, eps0 ...
github_jupyter
# Intro to Pandas Pandas is a Python package for data analysis and exposes two new data structures: Dataframes and Series. - [Dataframes](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html) store tabular data consisting of rows and columns. - [Series](https://pandas.pydata.org/pandas-docs/sta...
github_jupyter
``` import cv2 import time import h5py import numpy as np import pandas as pd import matplotlib.pyplot as plt from tqdm import tqdm data_path = "/home/sid-pc/ashutosh/DDP/NYU Dataset and Toolbox/nyu_depth_v2_labeled.mat" img_resize_X = 320 img_resize_Y = 240 depth_resize_X = 80 depth_resize_Y = 60 t1 = time.time() f...
github_jupyter
**This notebook is an exercise in the [Intro to Game AI and Reinforcement Learning](https://www.kaggle.com/learn/intro-to-game-ai-and-reinforcement-learning) course. You can reference the tutorial at [this link](https://www.kaggle.com/alexisbcook/n-step-lookahead).** --- # Introduction In the tutorial, you learned ...
github_jupyter
# Computer Vision Example: Image Classification with WMLA https://developer.ibm.com/technologies/artificial-intelligence/tutorials/use-computer-vision-with-dli-watson-machine-learning-accelerator/ This workflow is documented here... ### Contents - [Introduction](#Introduction) - [Upload this notebook to your envir...
github_jupyter
``` import pandas as pd import scipy as sp from scipy.sparse import diags import numpy as np from numpy import linalg as LA import sys import matplotlib.pyplot as plt #importing seaborn for plotting import seaborn as sns #for plotting purposes %pylab inline sns.set_style('ticks') sns.set_context('paper') from IPyth...
github_jupyter
``` %reload_ext autoreload %autoreload 2 %matplotlib inline import IPython import matplotlib.pyplot as plt import numpy as np import soundfile as sf import time from tqdm import tqdm import tensorflow as tf from nara_wpe.tf_wpe import wpe from nara_wpe.tf_wpe import online_wpe_step, get_power_online from nara_wpe.uti...
github_jupyter
![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/healthcare/NER_DIAG_PROC.ipynb) # **Detect diagnosis an...
github_jupyter
## Rover Lab Notebook This notebook contains the functions from the lesson and provides the scaffolding you need to test out your mapping methods. The steps you need to complete in this notebook for the project are the following: * First just run each of the cells in the notebook, examine the code and the results of ...
github_jupyter
# Prerequisites Install Theano and Lasagne using the following commands: ```bash pip install -r https://raw.githubusercontent.com/Lasagne/Lasagne/master/requirements.txt pip install https://github.com/Lasagne/Lasagne/archive/master.zip ``` Working in a virtual environment is recommended. # Data preparation Current ...
github_jupyter
``` # import the important libraries import pandas as pd pd.set_option('display.max_columns', 500) pd.set_option('display.max_rows', 1000) # Check what's in this file # The file is from NOAA for year 1950 df = pd.read_csv("StormEvents_details-ftp_v1.0_d1950_c20170120.csv") ls # the first 5 rows of the file df.head() ...
github_jupyter
![license_header_logo](../../../images/license_header_logo.png) > **Copyright (c) 2021 CertifAI Sdn. Bhd.**<br> <br> This program is part of OSRFramework. You can redistribute it and/or modify <br>it under the terms of the GNU Affero General Public License as published by <br>the Free Software Foundation, either versi...
github_jupyter
# Project - Seminar Computer Vision by Deep Learning (CS4245) 2020/2021 Group Number: 20 Student 1: Stan Zwinkels Student 2: Ted de Vries Lentsch Date: June 14, 2021 ## Instruction For correct functioning of this notebook, the dataset [morado_5may](https://www.kaggle.com/teddevrieslentsch/morado-5may) must be in ...
github_jupyter
## Reinforcement Learning for seq2seq This time we'll solve a problem of transribing hebrew words in english, also known as g2p (grapheme2phoneme) * word (sequence of letters in source language) -> translation (sequence of letters in target language) Unlike what most deep learning researchers do, we won't only trai...
github_jupyter
<a href="https://colab.research.google.com/github/joselvira/BiomecanicaPython/blob/master/Notebooks/Transformar_Bases_de_Datos.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # CÓMO TRANSFORMAR LA ORIENTACIÓN DE LAS BASES DE DATOS Normalmente utili...
github_jupyter
# Plot Entropy of Gaussian ``` import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm from scipy.integrate import quadrature def exact_entropy(s): return np.log(s*np.sqrt(2*np.pi*np.e)) sigmas = [0.4,0.8,1.2,2.0,3.5] x_pts = np.linspace(-5,5,1000) fig, axs = plt.subplots(1,2,figsize=(12,3)...
github_jupyter
<a href="https://colab.research.google.com/github/yuanqing-wang/AFEP/blob/master/test_inference.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import sys sys.path.append('..') import warnings if not sys.warnoptions: warnings.simplefilter("i...
github_jupyter
##### Copyright 2019 The TensorFlow Probability Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@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 th...
github_jupyter
``` from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) ``` ### Helper Functions ``` import tensorflow as tf def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial) def bias_variable(...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import scipy from scipy import ndimage from sklearn.datasets import fetch_openml mnist = fetch_openml('mnist_784') x = mnist.data y = mnist.target e_k = np.zeros_like(x) s_k = np.zeros_like(x) n_k = np.zeros_like(x) nw_k = np.zeros_like(x) ne_k = np.zeros_like(x) s...
github_jupyter
## 3.4 编辑段落 ### 3.4.1 段落首行缩进调整 许多出版社要求文章段落必须首行缩进,若想调整段落首行缩进的距离,可以使用`\setlength{\parindent}{长度}`命令,在`{长度}`处填写需要设置的距离即可。 【**例3-10**】使用`\setlength{\parindent}{长度}`命令调整段落首行缩进为两字符。 ```tex \documentclass[12pt]{article} \setlength{\parindent}{2em} \begin{document} In \LaTeX, We can use the setlength command to adjust th...
github_jupyter
# Qt Demo This will launch various Qt compatible packages Nota: as of 2019-05-26th, PySide2-5.13+ compatibility is - Ok for Qtconsole, Qtpy, pyzo, wppm, PyQtgraph, rx - ToDo for Spyder, guidata, guiqwt ## Qt4 & Qt5 Dedicated Graphic libraries: PyQtgraph, guidata, guiqwt ``` # PyQtgraph (Scientific Graphics and G...
github_jupyter
``` """ Distributed Proximal Policy Optimization (Distributed PPO or DPPO) continuous version implementation with distributed Tensorflow and Python’s multiprocessing package. This implementation uses normalized running rewards with GAE. The code is tested with Gym’s continuous action space environment, Pendulum-v0 o...
github_jupyter
``` from IPython.display import Image ``` # CNTK 204: Sequence to Sequence Networks with Text Data ## Introduction and Background This hands-on tutorial will take you through both the basics of sequence-to-sequence networks, and how to implement them in the Microsoft Cognitive Toolkit. In particular, we will implem...
github_jupyter
<a href="https://colab.research.google.com/github/GoogleCloudPlatform/tensorflow-without-a-phd/blob/master/tensorflow-mnist-tutorial/keras_02_mnist_dense.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ### Parameters ``` BATCH_SIZE = 128 EPOCHS = 1...
github_jupyter
# CX 4230, Spring 2016: [22] Input modeling This notebook includes sample code to accompany the slides from the Monday, February 29 class. It does not contain any exercises. ``` import numpy as np import scipy as sp import matplotlib.pyplot as plt %matplotlib inline X = np.array ([105.84, 28.92, 98.64, 55.64, ...
github_jupyter
# Ex2 - Getting and Knowing your Data Check out [Chipotle Exercises Video Tutorial](https://www.youtube.com/watch?v=lpuYZ5EUyS8&list=PLgJhDSE2ZLxaY_DigHeiIDC1cD09rXgJv&index=2) to watch a data scientist go through the exercises This time we are going to pull data directly from the internet. Special thanks to: https:/...
github_jupyter
``` import tensorflow as tf import numpy as np import random import matplotlib.pyplot as plt from zipfile import ZipFile def unzip(nm): with ZipFile(nm,"r") as zip: zip.extractall() unzip("archive.zip") random.seed(123) np.random.seed(123) tf.random.set_seed(123) train_ds = tf.keras.preprocessing.image...
github_jupyter
``` import numpy as np import pandas as pd from plotnine import * from mizani.transforms import trans ``` ### Guitar Neck ### *Using a transformed x-axis to visualise guitar chords* The x-axis is transformed to resemble the narrowing width of frets on a 25.5 inch Strat. To do that we create custom transformation. Th...
github_jupyter
<a href="https://colab.research.google.com/github/pachterlab/GFCP_2021/blob/main/notebooks/vcy_scvelo_comparison.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #Figure 1: The user-facing workflows of `velocyto` and `scVelo` In this notebook, we re...
github_jupyter
``` %matplotlib inline from pyvista import set_plot_theme set_plot_theme('document') ``` Compare Field Across Mesh Regions ================================= Here is some velocity data from a glacier modelling simulation that is compared across nodes in the simulation. We have simplified the mesh to have the simulatio...
github_jupyter
``` # Import Python packages import pickle # Import Third party packages import numpy as np import matplotlib.pyplot as plt S1_terms = ['u', 'du/dx', 'f'] S2_terms = ['u', 'du/dx', 'f', 'u^{2}'] S3_terms = ['du/dx', 'f'] S4_terms = ['f'] true_terms = [S1_terms, S2_terms, S3_terms, S4_terms] tags = ["S1", "NLSL", "S3"...
github_jupyter
``` # This notebook is used to decide on a tolerable level of corruptableness. %matplotlib inline import numpy as np import matplotlib.pyplot as plt import pandas as pd from scipy.stats import entropy as KL_divergence from slda.topic_models import BLSLDA from modules.helpers import plot_images # Generate topics # We...
github_jupyter
# Chapter 1, figures 3 and 4 This notebook will show you how to produce figures 1.3 and 1.4 after the predictive modeling is completed. The predictive modeling itself, unfortunately, doesn't fit in a notebook. The number-crunching can take several hours, and although logistic regression itself is not complicated, the...
github_jupyter
# Ch 9 Multi-Agent Reinforcement Learning ##### Listing 9.3 ``` import numpy as np import torch from matplotlib import pyplot as plt def init_grid(size=(10,)): grid = torch.randn(*size) grid[grid > 0] = 1 grid[grid <= 0] = 0 grid = grid.byte() #A return grid def get_reward(s,a): #B r = -1 ...
github_jupyter
# Store tracts and rental listings in PostGIS ...for a fast spatial-join of listings to tracts. First, create the database from command prompt if it doesn't already exist: ``` createdb -U postgres craigslist_tracts psql -U postgres -d craigslist_tracts -c "CREATE EXTENSION postgis;" ``` More info in the psycopg2 do...
github_jupyter
<a href="https://colab.research.google.com/github/jonfisik/Projects/blob/master/VetoresPython.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np import matplotlib.pyplot as plt u = [1,2] v = [2,1] # somou listas u + v u = np.arra...
github_jupyter
[![AnalyticsDojo](https://github.com/rpi-techfundamentals/spring2019-materials/blob/master/fig/final-logo.png?raw=1)](http://rpi.analyticsdojo.com) <center><h1>Introduction to MatplotLab - Python</h1></center> <center><h3><a href = 'http://rpi.analyticsdojo.com'>rpi.analyticsdojo.com</a></h3></center> This has been...
github_jupyter
# Automated ML ``` from azureml.core import Workspace, Experiment from azureml.data.dataset_factory import TabularDatasetFactory from train import clean_data import pandas as pd from sklearn.model_selection import train_test_split import os from azureml.core.compute import ComputeTarget, AmlCompute from azureml.core.c...
github_jupyter
## Training a recommendation model for Google Analytics data using BigQuery ML This notebook accompanies the article [Training a recommendation model for Google Analytics data using BigQuery ML](https://towardsdatascience.com/training-a-recommendation-model-for-google-analytics-data-using-bigquery-ml-2327f9a2e8e9) ##...
github_jupyter
<img src="http://hilpisch.com/tpq_logo.png" alt="The Python Quants" width="35%" align="right" border="0"><br> # Python for Finance **Analyze Big Financial Data** O'Reilly (2014) Yves Hilpisch <img style="border:0px solid grey;" src="http://hilpisch.com/python_for_finance.png" alt="Python for Finance" width="30%" a...
github_jupyter
# Training Deep Neural Networks > Chapter 11 - permalink: /11_training_deep_neural_networks _This notebook contains all the sample code and solutions to the exercises in chapter 11._ # Setup First, let's import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures. ...
github_jupyter
# Exploratory Data Analysis ALS Hiring A dataset simulating CRM data is available in these public AWS S3 files: Constituent Information: https://als-hiring.s3.amazonaws.com/fake_data/2020-07-01_17%3A11%3A00/cons.csv Constituent Email Addresses: https://als-hiring.s3.amazonaws.com/fake_data/2020-07-01_17%3A11%...
github_jupyter
``` import os from argparse import Namespace from collections import Counter import json import re import string import numpy as np import pandas as pd import torch import torch.nn as nn from torch.nn import functional as F from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.optim as ...
github_jupyter
``` import jax.numpy as np # from jax.config import config; config.update("jax_enable_x64", True) from jax import jacfwd, jacrev, hessian import numpy as onp import matplotlib.pyplot as plt import matplotlib.cm as cm import xara import xaosim as xs from xaosim.pupil import PHARO from scipy.ndimage import fourier_shi...
github_jupyter
# Fickian Diffusion In this example, we will learn how to perform Fickian diffusion on a `Cubic` network. The algorithm works fine with every other network type, but for now we want to keep it simple. [See here](/examples/notebooks/networks/generation) for more details on different network types. ``` import numpy as...
github_jupyter
## Part 1: LLE Implement Locally Linear Embedding function ``` from sklearn.neighbors import kneighbors_graph from scipy.sparse import csr_matrix from numpy import matlib import numpy as np def csr_from_mat(W, NI): n, k = W.shape data = np.reshape(W, n*k) cols = np.reshape(NI, n*k) r...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.lines import Line2D from TimeSeriesCrossValidation import splitTrain, splitTrainVal, splitTrainValTest timeSeries = np.arange(27) timeSeries def show_train(X, y, num): for j in np.arange(num): print...
github_jupyter
# Feature Extraction from Text This notebook is divided into two sections: * First, we'll find out what what is necessary to build an NLP system that can turn a body of text into a numerical array of *features* by **manually calcuating frequencies and building out TF-IDF**. * Next we'll show how to perform these steps...
github_jupyter
``` import pandas as pd from sklearn.preprocessing import MinMaxScaler import boto3 import os from sagemaker.amazon.amazon_estimator import get_image_uri import sagemaker from sagemaker import get_execution_role from sklearn.model_selection import train_test_split import numpy as np import sagemaker from random import...
github_jupyter
# Constellation and Chain Analysis: Prebuilt Chains <img src="chainPaths.jpg" alt="Drawing" style="width: 500px;"/> **Terminology** * Node = Object in STK * Edge = Access between two objects in STK * Strand = The sequence of nodes and edges to complete access in a chain **This notebook shows how to:** * Merge access...
github_jupyter
# Importing modules ``` import numpy as np import pandas as pd ``` # Data ``` colunas = ['ANO_CINEMATOGRAFICO', 'SEMANA_CINEMATOGRAFICA', 'TIPO_SESSAO', 'REGISTRO_COMPLEXO', 'REGISTRO_GRUPO','REGISTRO_SALA', 'CPB_ROE', 'ASSENTOS_INFERIDO', 'OCUPAÇÃO_SALA_INFERIDA', 'd_t', 'id_NAC', 'xt_comp', 't_comp',...
github_jupyter
# Introduction to Object Oriented Programming ## Lesson outline - Object-oriented programming syntax - Procedural vs. object-oriented programming - Classes, objects, methods and attributes - Coding a class - Magic methods - Inheritance - Using object-oriented programming to make a Python package ...
github_jupyter
# Contrast Effects ### Authors Ndèye Gagnessiry Ndiaye and Christin Seifert ### License This work is licensed under the Creative Commons Attribution 3.0 Unported License https://creativecommons.org/licenses/by/3.0/ This notebook illustrates 3 contrast effects: - Simultaneous Brightness Contrast - Chevreul Illusio...
github_jupyter
# Rasterio plotting of Landsat-8 scenes In this notebook, we will download bands of a Landsat-8 scene, visualize them with [rasterio's plotting module]( https://rasterio.readthedocs.io/en/latest/topics/plotting.html), and write an RGB image as rendered GeoTIFF. ``` import os import matplotlib.pyplot as plt import num...
github_jupyter
``` %load_ext autoreload %autoreload 2 %aimport utils_1_1 import pandas as pd import numpy as np import altair as alt from altair_saver import save import datetime import dateutil.parser from os.path import join from constants_1_1 import SITE_FILE_TYPES from utils_1_1 import ( get_site_file_paths, get_site_fi...
github_jupyter
# Example: CanvasXpress splom Chart No. 3 This example page demonstrates how to, using the Python package, create a chart that matches the CanvasXpress online example located at: https://www.canvasxpress.org/examples/splom-3.html This example is generated using the reproducible JSON obtained from the above page and ...
github_jupyter
(nm_heun_method)= # Heun's method ```{index} Heun's method ``` {ref}`Euler's method <nm_euler_method>` is first-order accurate because it calculates the derivative using only the information available at the beginning of the time step. Higher-order convergence can be obtained if we also employ information from other po...
github_jupyter
# Temporal-Difference Methods In this notebook, you will write your own implementations of many Temporal-Difference (TD) methods. While we have provided some starter code, you are welcome to erase these hints and write your code from scratch. --- ### Part 0: Explore CliffWalkingEnv We begin by importing the necess...
github_jupyter
# Using `pyoscode` in cosmology `pyoscode` is a fast numerical routine suitable for equations of the form $$ \ddot{x} + 2\gamma(t)\dot{x} + \omega^2(t) = 0, $$ with - $x(t)$: a scalar variable (e.g. curvature perturbation), - $\omega(t)$: frequency, - $\gamma(t)$: friction or first-derivative term. In general $\ga...
github_jupyter
# Project 5: NLP on Financial Statements ## Instructions Each problem consists of a function to implement and instructions on how to implement the function. The parts of the function that need to be implemented are marked with a `# TODO` comment. After implementing the function, run the cell to test it against the uni...
github_jupyter
``` import datetime import os import yaml import optuna import matplotlib.pyplot as plt import numpy as np import pandas as pd # Lecture du fichier d'environnement ENV_FILE = '../env.yaml' with open(ENV_FILE) as f: params = yaml.load(f) #, Loader=yaml.FullLoader) # Initialisation des chemins vers les fichiers ROOT...
github_jupyter
<h1> Classifying Iris Flower Dataset Using Naive Bayes Classifier </h1> <h2> Naive Bayes Classifier </h2> Naive Bayes classifiers are a collection of classification algorithms based on Bayes’ Theorem. It comprises of a collection of algorithms where all of them share a common principle, that is every pair of features...
github_jupyter
*Analytical Information Systems* # Tutorial 1 - Introduction Matthias Griebel<br> Lehrstuhl für Wirtschaftsinformatik und Informationsmanagement SS 2019 <h1>Agenda<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#1-Course-Overview" data-toc-modified-id="1-Course-Overview-1...
github_jupyter
Taller práctico - SQL === **Juan David Velásquez Henao** jdvelasq@unal.edu.co Universidad Nacional de Colombia, Sede Medellín Facultad de Minas Medellín, Colombia --- Haga click [aquí](https://github.com/jdvelasq/R-for-data-science/blob/master/01-uso-interactivo.ipynb) para acceder a la última versión onlin...
github_jupyter
``` %load_ext watermark %watermark -v -p numpy,sklearn,scipy,matplotlib,tensorflow ``` **14장 – 순환 신경망** _이 노트북은 14장에 있는 모든 샘플 코드와 연습문제 해답을 가지고 있습니다._ # 설정 파이썬 2와 3을 모두 지원합니다. 공통 모듈을 임포트하고 맷플롯립 그림이 노트북 안에 포함되도록 설정하고 생성한 그림을 저장하기 위한 함수를 준비합니다: ``` # 파이썬 2와 파이썬 3 지원 from __future__ import division, print_function, un...
github_jupyter
# EventVestor: Credit Facility In this notebook, we'll take a look at EventVestor's *Credit Facility* dataset, available on the [Quantopian Store](https://www.quantopian.com/store). This dataset spans January 01, 2007 through the current day, and documents financial events covering new or extended credit facilities. ...
github_jupyter
#### Package Import ``` import numpy as np from numpy import math from scipy.stats import norm from scipy import stats import matplotlib.pyplot as plt import progressbar ``` #### Model Specification: OU Process 1. $dX_{t} = \theta_{1}(\theta_{2} - X_{t})dt + \sigma dW_{t}$, $Y_{t}|X_{t} \sim \mathcal{N}(X_{t}, \thet...
github_jupyter
``` !pip install -U -q PyDrive from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials auth.authenticate_user() gauth = GoogleAuth() gauth.credentials = GoogleCredentials.get_application_default() drive = GoogleDrive(gaut...
github_jupyter
# pyscal `Trajectory` `Trajectory` is a `pyscal` module intended for working with molecular dynamics trajectories which contain more than one time slice. Currently, the module only supports [LAMMPS dump](https://lammps.sandia.gov/doc/dump.html) text file formats. It can be used to get a single or slices from a traject...
github_jupyter
# Adding and Removing Data We will be working with the `data/earthquakes.csv` file again, so we need to handle our imports and read it in. ## About the Data In this notebook, we will be working with Earthquake data from September 18, 2018 - October 13, 2018 (obtained from the US Geological Survey (USGS) using the [USG...
github_jupyter
# Triplet Loss for Implicit Feedback Neural Recommender Systems The goal of this notebook is first to demonstrate how it is possible to build a bi-linear recommender system only using positive feedback data. In a latter section we show that it is possible to train deeper architectures following the same design princi...
github_jupyter
# Discrete Bayes Animations ``` from __future__ import division, print_function import matplotlib.pyplot as plt import sys sys.path.insert(0,'..') # allow us to format the book sys.path.insert(0,'../code') import book_format book_format.load_style(directory='..') ``` This notebook creates the animations for the Disc...
github_jupyter
# nn explain nn has two main parts : data and model components containers are responsible for model components and parameters/buffers are responsible for model data containers : Module, Sequential, ModuleList, ModuleDict, ParameterList, ParameterDict for module construction parameters : parameter(...) for model t...
github_jupyter
## First day: list comprehensions and generators > List comprehensions and generators are in my top 5 favorite Python features leading to clean, robust and Pythonic code. ``` from collections import Counter import calendar import itertools import random import re import string import requests ``` ### List comprehen...
github_jupyter
# 7. Alfven operator ``` from numpy import linspace, meshgrid, pi, zeros, asarray from scipy.linalg import eig import matplotlib.pyplot as plt %matplotlib inline from IPython.display import Math from sympy.core.containers import Tuple from sympy import symbols from sympy import Symbol from sympy import Lambda from ...
github_jupyter
# Contextual Bandit Content Personalization In the Contextual Bandit(CB) introduction tutorial, we learnt about CB and different CB algorithms. In this tutorial we will simulate the scenario of personalizing news content on a site, using CB, to users. The goal is to maximize user engagement quantified by measuring cli...
github_jupyter
# 01 Intro - Introduction to Data Visualization - Introduction to Matplotlib - Basic Plotting with Matplotlib - Dataset on Immigration to Canada - Line Plots # Introduction to Data Visualization ## Data visualization > a way to show a complex data in a form that is graphical and easy to understand. >Transforming ...
github_jupyter
Notebook written by [Zhedong Zheng](https://github.com/zhedongzheng) ![title](img/birnn.png) ``` import tensorflow as tf import numpy as np import sklearn VOCAB_SIZE = 20000 EMBED_DIM = 100 RNN_SIZE = 70 CLIP_NORM = 5.0 BATCH_SIZE = 32 LR = {'start': 5e-3, 'end': 5e-4, 'steps': 1500} N_EPOCH = 2 N_CLASS = 2 def sort_...
github_jupyter
# NLP Learners This module contains the main class to quickly define a `Learner` (and automatically generates an appropriate model) from your NLP data. ``` from fastai.gen_doc.nbdoc import * from fastai.text import * from fastai.docs import * ``` ## Class RNNLearner This is the class that handles the whole creatio...
github_jupyter
# The Scientific Python Ecosystem The Scientific Python Ecosystem is made up of a robust collection of packages that provide functionality for everything from simple numeric arrays to sophisticated machine learning algorithms. In this notebook, we'll introduce the core scientific python packages and some important ter...
github_jupyter
# AdaBoost 在做重要决定的时候,我们会考虑吸收多个专家的意见而不是一个人的意见,机器学习处理问题的时候也可以采用这种方法.这就是元算法(meta-algorithm)背后的思路.元算法是对其他算法进行组合的一种方式,我们会先建立一个**单层决策树(decision stump)**分类器,实际上它是一个单节点的决策树.AdaBoots算法将应用在上述单层决策树之上,然后将在一个难数据集上应用AdaBoots分类器,以了解该算法是如何迅速超越其他分类器的. 强可学习(strongly learnable)和弱可学习(weakly learnable) - 强可学习:如果存在一个多项式学习算法,并且它的学习率很高,那么我...
github_jupyter
# Experiments with the bivariate Gaussian In this notebook, we'll get a feel for the two-dimensional Gaussian by varying the covariance matrix, drawing random samples from the resulting distribution, and plotting contour lines of the density. We begin, as always, by loading in standard packages. ``` %matplotlib inli...
github_jupyter
## Computer Vision Interpret [`vision.interpret`](/vision.interpret.html#vision.interpret) is the module that implements custom [`Interpretation`](/train.html#Interpretation) classes for different vision tasks by inheriting from it. ``` from fastai.gen_doc.nbdoc import * from fastai.vision import * from fastai.vision...
github_jupyter
# Graphical User Interface programming in Python Goal: Writing a simple Graphical User Interface (GUI) with PyQt based on available widgets. ## Exercice The exercice for this training is to create a GUI for calculating the diffraction image obtained from a 2D cristal composed on a square of NxN atoms using the Laue ...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sys sys.path.append("..") from optimus import Optimus op = Optimus("dask") df.cols.max() # df = op.create.dataframe({"name": ["A1", "B2"]*20}) df = op.load.csv("store.csv", dtype="str") df.cols.len("*").cols.max() df.cols.min(compute=False) df.cols.min(compute=True) df df.c...
github_jupyter
``` # standard libraries import pandas as pd # Binance wrapper libraries from binance.client import Client from binance.websockets import BinanceSocketManager def web_socket_modularized(): """ Signature: web_socket() -> 'BinanceSocketManager' Docstring: Deals with real-time data. Also takes ca...
github_jupyter
# Explore ways to read/write params to/from a file ``` from see import base_classes from see.Segmentors import segmentor from see.ColorSpace import colorspace from see.Workflow import workflow from see.Segment_Fitness import segment_fitness workflow.addalgos([colorspace, segmentor, segment_fitness]) wf = workflow() `...
github_jupyter
# Simple kriging in Python This follows a tutorial and code by Connor Johnson, in [his blog post](http://connor-johnson.com/2014/03/20/simple-kriging-in-python/). It is openly licensed under the MIT license. Some more geostatistics resources: - More from Connor Johnson: https://github.com/cjohnson318/geostatsmodels ...
github_jupyter
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/giswqs/geemap/blob/master/examples/notebooks/tn_surface_water.ipynb) # Automated mapping of surface water in the state of Tennessee using Google Earth Engine cloud computing Author: Qiusheng Wu ([Web...
github_jupyter
![data-x](https://raw.githubusercontent.com/afo/data-x-plaksha/master/imgsource/dx_logo.png) ___ #### NAME: #### STUDENT ID: ___ ## Numpy Introduction ``` # Load required modules import numpy as np ``` <br> **1a) Create two numpy arrays called** ```a``` **and** ```b``` **where** ```a``` **should be all integers ...
github_jupyter