theanets.trainer.UnsupervisedPretrainer¶
-
class
theanets.trainer.
UnsupervisedPretrainer
(algo, network)[source]¶ Train a classification model using an unsupervised pre-training step.
This trainer is a bit of glue code that creates a “shadow” autoencoder based on a current network model, trains the autoencoder, and then transfers the trained weights back to the original model.
This code is intended mostly as a proof-of-concept to demonstrate how shadow networks can be created, and how trainers can call other trainers for lots of different types of training regimens.
Methods
__init__
(algo, network)x.__init__(…) initializes x; see help(type(x)) for signature itertrain
(train[, valid])Train a model using a training and validation set. -
itertrain
(train, valid=None, **kwargs)[source]¶ Train a model using a training and validation set.
This method yields a series of monitor values to the caller. After every iteration, a pair of monitor dictionaries is generated: one evaluated on the training dataset, and another evaluated on the validation dataset. The validation monitors might not be updated during every training iteration; in this case, the most recent validation monitors will be yielded along with the training monitors.
Parameters: - train :
Dataset
A set of training data for computing updates to model parameters.
- valid :
Dataset
A set of validation data for computing monitor values and determining when the loss has stopped improving.
Yields: - training : dict
A dictionary mapping monitor names to values, evaluated on the training dataset.
- validation : dict
A dictionary containing monitor values evaluated on the validation dataset.
- train :
-