theanets.trainer.UnsupervisedPretrainer

class theanets.trainer.UnsupervisedPretrainer(algo, network)

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.

__init__(algo, network)

Methods

__init__(algo, network)
itertrain(train[, valid]) Train a model using a training and validation set.
itertrain(train, valid=None, **kwargs)

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.