samlab.train module

Utilities to simplify training artifacts.

class samlab.train.EarlyStop(patience=10, delta=0)[source]

Bases: object

Stop training if a loss doesn’t improve within N iterations.

Parameters

patience (integer, optional) –

property triggered

Warning

property ‘samlab.train.EarlyStop.triggered’ undocumented

class samlab.train.Loss(delta=0)[source]

Bases: object

Keeps track of whether a loss value has improved.

improved(loss)[source]

Warning

method ‘samlab.train.Loss.improved’ undocumented

property value

Warning

property ‘samlab.train.Loss.value’ undocumented

samlab.train.k_fold(dataset, n=5, k=2, validation=0.2, count=None)[source]

Return sets of indices partitioning a dataset for K-fold cross validation.

samlab.train.random_split(dataset, split=0.1)[source]

Return indices that randomly partition a dataset into two sets.

samlab.train.train_validate_test_split(dataset, test=0.2, validation=0.2)[source]

Return indices that randomly partition a dataset into training, validation, and test sets.