theanets.trainer.SampleTrainer

class theanets.trainer.SampleTrainer(network)

This trainer replaces network weights with samples from the input.

__init__(network)

Methods

__init__(network)
itertrain(train[, valid]) Train a model using a training and validation set.
reservoir(xs, n, rng) Select a random sample of n items from xs.
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.

static reservoir(xs, n, rng)

Select a random sample of n items from xs.