Deep Learning Convenience Functions
calc_cs
calc_cs (x)
Calculate nan mean and nan std of an array. Returned as list
| Details | |
|---|---|
| x | numeric array |
apply_cs
apply_cs (xs, cs_dict_entry)
| Details | |
|---|---|
| xs | |
| cs_dict_entry | list of length 2 containing mean and s |
reverse_cs
reverse_cs (xs, cs_dict_entry)
Boilerplate Functions for Tian et al 2011
TianEtAl2011Dataset
TianEtAl2011Dataset (y1, y2, y3, idx_original, marker_type='markers', transform=None, target_transform=None, use_gpu_num=0, **kwargs)
An abstract class representing a :class:Dataset.
All datasets that represent a map from keys to data samples should subclass it. All subclasses should overwrite :meth:__getitem__, supporting fetching a data sample for a given key. Subclasses could also optionally overwrite :meth:__len__, which is expected to return the size of the dataset by many :class:~torch.utils.data.Sampler implementations and the default options of :class:~torch.utils.data.DataLoader.
.. note:: :class:~torch.utils.data.DataLoader by default constructs a index sampler that yields integral indices. To make it work with a map-style dataset with non-integral indices/keys, a custom sampler must be provided.
| Type | Default | Details | |
|---|---|---|---|
| y1 | |||
| y2 | |||
| y3 | xs, | ||
| idx_original | |||
| marker_type | str | markers | |
| transform | NoneType | None | |
| target_transform | NoneType | None | |
| use_gpu_num | int | 0 | |
| kwargs |
train_loop
train_loop (dataloader, model, loss_fn, optimizer, silent=False)
train_error
train_error (dataloader, model, loss_fn, silent=False)
test_loop
test_loop (dataloader, model, loss_fn, silent=False)
train_nn
train_nn (nb_name, training_dataloader, testing_dataloader, model, learning_rate=0.001, batch_size=64, epochs=500)
yhat_loop
yhat_loop (dataloader, model)