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 |
| import mlflow | |
| # There are two ways to create parent/child runs in MLflow. | |
| # (1) The most common way is to use the fluent | |
| # mlflow.start_run API, passing nested=True: | |
| with mlflow.start_run(): | |
| num_trials = 10 | |
| mlflow.log_param("num_trials", num_trials) | |
| best_loss = 1e100 |
| ################################################################ | |
| # 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): |