theanets.recurrent.Predictor

class theanets.recurrent.Predictor(layers, weighted=False, sparse_input=False)

A predictor network attempts to predict its next time step.

A recurrent prediction model takes the following inputs:

  • x: A three-dimensional array of input data. Each element of axis 0 of x is expected to be one moment in time. Each element of axis 1 of x represents a single sample in a batch of data. Each element of axis 2 of x represents the measurements of a particular input variable across all times and all data items.
__init__(layers, weighted=False, sparse_input=False)

Methods

error(outputs) Build a theano expression for computing the network error.
generate_prediction(outputs) Given outputs from each time step, map them to subsequent inputs.

Attributes

num_params Number of parameters in the entire network model.
params A list of the learnable theano parameters for this network.
tied_weights A boolean indicating whether this network uses tied weights.
error(outputs)

Build a theano expression for computing the network error.

Parameters:

outputs : dict mapping str to theano expression

A dictionary of all outputs generated by the layers in this network.

Returns:

error : theano expression

A theano expression representing the network error.

generate_prediction(outputs)

Given outputs from each time step, map them to subsequent inputs.

This defaults to the identity transform, i.e., the output from one time step is treated as the input to the next time step with no transformation. Override this method in a subclass to provide, e.g., predictions based on random samples, lookups in a dictionary, etc.

Parameters:

outputs : dict mapping str to theano expression

A dictionary of all outputs generated by the layers in this network.

Returns:

prediction : theano variable

A symbolic variable representing the inputs for the next time step.