Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.
| """ | |
| Example of using sub-parser, sub-commands and sub-sub-commands :-) | |
| """ | |
| import argparse | |
| def main(args): | |
| """ | |
| Just do something |
| ################################################################ | |
| # DOWNLOAD ENTIRE FOLDER STRUCTURE FROM DROPBOX TO LOCAL DRIVE # | |
| ################################################################ | |
| # Instructions: | |
| # (1) install dropbox API using pip | |
| # > pip install dropbox | |
| # (2) Create application to make requests to the Dropbox API | |
| # - Go to: https://dropbox.com/developers/apps |
| import torch | |
| from torch import LongTensor | |
| from torch.nn import Embedding, LSTM | |
| from torch.autograd import Variable | |
| from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence | |
| ## We want to run LSTM on a batch of 3 character sequences ['long_str', 'tiny', 'medium'] | |
| # | |
| # Step 1: Construct Vocabulary | |
| # Step 2: Load indexed data (list of instances, where each instance is list of character indices) |
| class TemporalBlock(tf.layers.Layer): | |
| def __init__(self, n_outputs, kernel_size, strides, dilation_rate, dropout=0.2, | |
| trainable=True, name=None, dtype=None, | |
| activity_regularizer=None, **kwargs): | |
| super(TemporalBlock, self).__init__( | |
| trainable=trainable, dtype=dtype, | |
| activity_regularizer=activity_regularizer, | |
| name=name, **kwargs | |
| ) | |
| self.dropout = dropout |
| library(tidyverse) | |
| # Data is downloaded from here: | |
| # https://www.kaggle.com/c/digit-recognizer | |
| kaggle_data <- read_csv("~/Downloads/train.csv") | |
| pixels_gathered <- kaggle_data %>% | |
| mutate(instance = row_number()) %>% | |
| gather(pixel, value, -label, -instance) %>% | |
| extract(pixel, "pixel", "(\\d+)", convert = TRUE) |
| import numpy as np | |
| from scipy.optimize import curve_fit | |
| import scipy as sy | |
| import matplotlib.pyplot as plt | |
| d = np.array([75, 80, 90, 95, 100, 105, 110, 115, 120, 125], dtype=float) | |
| p1 = np.array([6, 13, 25, 29, 29, 29, 30, 29, 30, 30], dtype=float) / 30. # scale to 0..1 | |
| # psychometric function | |
| def pf(x, alpha, beta): |
| # wavfile.py (Enhanced) | |
| # Date: 20190213_2328 Joseph Ernest | |
| # | |
| # URL: https://gist.github.com/josephernest/3f22c5ed5dabf1815f16efa8fa53d476 | |
| # Source: scipy/io/wavfile.py | |
| # | |
| # Added: | |
| # * read: also returns bitrate, cue markers + cue marker labels (sorted), loops, pitch | |
| # See https://web.archive.org/web/20141226210234/http://www.sonicspot.com/guide/wavefiles.html#labl | |
| # * read: 24 bit & 32 bit IEEE files support (inspired from wavio_weckesser.py from Warren Weckesser) |