theanets.losses.MeanSquaredError¶
-
class
theanets.losses.
MeanSquaredError
(target, weight=1.0, weighted=False, output_name='out')¶ Mean-squared-error (MSE) loss function.
Notes
The mean squared error (MSE) loss computes the mean of the squared difference between the output of a computation graph \(x = (x_1, \dots, x_d)\) and its expected target value \(t = (t_1, \dots, t_d)\). Mathematically,
\[\begin{split}\begin{eqnarray*} \mathcal{L}(x, t) &=& \frac{1}{d} \|x - t\|_2^2 \\ &=& \frac{1}{d} \sum_{i=1}^d (x_i - t_i)^2 \end{eqnarray*}\end{split}\]Whereas some MSE computations return the sum over dimensions, the MSE here is computed as an average over the dimensionality of the data.
For cases where \(x\) and \(t\) are matrices, the MSE computes the average over corresponding rows in \(x\) and \(t\):
\[\mathcal{L}(X, T) = \frac{1}{dm} \sum_{j=1}^m \sum_{i=1}^d (x_{ji} - t_{ji})^2\]-
__init__
(target, weight=1.0, weighted=False, output_name='out')¶
Methods
__init__
(target[, weight, weighted, output_name])log
()Log some diagnostic info about this loss. Attributes
variables
A list of Theano variables used in this loss. -