MeanSquaredError

class dragon.vm.tensorflow.keras.losses.MeanSquaredError(
  reduction='mean',
  name=None
)[source]

A criterion to compute the reduced element-wise squared error.

The SquaredError function is defined as:

\[\text{SquaredError}(y_{true}, y_{pred}) = (y_{pred} - y_{true})^{2} \]

Examples:

criterion = tf.keras.cost.MeanSquaredError()
y_true = tf.constant([1., 2., 3.])
y_pred = tf.constant([0., 0., 0.])
print(criterion(y_true, y_pred))  # 4.666666

__init__

MeanSquaredError.__init__(
  reduction='mean',
  name=None
)[source]

Create a MeanSquaredError criterion.

Parameters:
  • reduction ({'none', 'sum', 'mean'}, optional) The reduction method.
  • name (str, optional) The operation name.

Methods

__call__

Loss.__call__(
  y_true,
  y_pred
)[source]

Compute the defined loss function.

Parameters:
Returns:

dragon.Tensor The loss.