theanets.feedforward.Regressor¶
-
class
theanets.feedforward.
Regressor
(layers, weighted=False, sparse_input=False)¶ A regression model attempts to produce a target output.
Regression models are trained by optimizing a (possibly regularized) loss that centers around some measurement of error with respect to the target outputs. This regression model implementation uses the mean squared error.
If we have a labeled dataset containing \(m\) \(d\)-dimensional input samples \(X \in \mathbb{R}^{m \times d}\) and \(m\) \(e\)-dimensional paired target outputs \(Y \in \mathbb{R}^{m \times e}\), then the loss that the Regressor model optimizes with respect to the model parameters \(\theta\) is:
\[\mathcal{L}(X, Y, \theta) = \frac{1}{m} \sum_{i=1}^m \| F_\theta(x_i) - y_i \|_2^2 + R(X, \theta)\]where \(F_\theta\) is the feedforward function that computes the network output, and \(R\) is a regularization function.
A regression model requires the following inputs at training time:
x
: A two-dimensional array of input data. Each row ofx
is expected to be one data item. Each column ofx
holds the measurements of a particular input variable across all data items.targets
: A two-dimensional array of target output data. Each row oftargets
is expected to be the target values for a single data item. Each column oftargets
holds the measurements of a particular output variable across all data items.
The number of rows in
x
must be equal to the number of rows oftargets
, but the number of columns in these two arrays may be whatever is required for the inputs and outputs of the problem.-
__init__
(layers, weighted=False, sparse_input=False)¶
Methods
error
(outputs)Build a theano expression for computing the network error. Attributes
num_params
Number of parameters in the entire network model. params
A list of the learnable theano parameters for this network. -
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.