mean_squared_error#
- skfda.misc.scoring.mean_squared_error(y_true, y_pred, *, sample_weight=None, multioutput='uniform_average', squared=True)[source]#
- skfda.misc.scoring.mean_squared_error(y_true, y_pred, *, sample_weight=None, squared=True, multioutput='uniform_average')
- skfda.misc.scoring.mean_squared_error(y_true: DataType, y_pred: DataType, *, sample_weight: NDArrayFloat | None = None, multioutput: Literal['uniform_average'] = 'uniform_average', squared: bool = True) float
- skfda.misc.scoring.mean_squared_error(y_true: DataType, y_pred: DataType, *, sample_weight: NDArrayFloat | None = None, multioutput: Literal['raw_values'], squared: bool = True) DataType
Mean Squared Error for
FData
.With \(y\_true = (X_1, X_2, ..., X_n)\) being the real values, \(t\_pred = (\hat{X}_1, \hat{X}_2, ..., \hat{X}_n)\) being the estimated and \(sample\_weight = (w_1, w_2, ..., w_n)\), the error is calculated as
\[MSE(y\_true, y\_pred)(t) = \frac{1}{\sum w_i} \sum_{i=1}^n w_i(X_i(t) - \hat{X}_i(t))^2\]For \(y\_true\) and \(y\_pred\) of type
FDataGrid
, \(MSE\) is also aFDataGrid
object with the same grid points.If multioutput = ‘raw_values’, the function \(MSE\) is returned. Otherwise, if multioutput = ‘uniform_average’, the mean of \(MSE\) is calculated:
\[mean(MSE) = \frac{1}{V}\int_{D} MSE(t) dt\]where \(D\) is the function domain and \(V\) the volume of that domain.
For
FDataBasis
only ‘uniform_average’ is available.If \(y\_true\) and \(y\_pred\) are numpy arrays, sklearn function is called.
- Parameters:
y_true – Correct target values.
y_pred – Estimated values.
sample_weight – Sample weights. By default, uniform weights are taken.
multioutput – Defines format of the return.
squared – If True returns MSE value, if False returns RMSE value.
- Returns:
Mean squared error.
If multioutput = ‘uniform_average’ or \(y\_pred\) and \(y\_true\) are
FDataBasis
objects, float is returned.If both \(y\_pred\) and \(y\_true\) are
FDataGrid
objects and multioutput = ‘raw_values’,FDataGrid
is returned.If both \(y\_pred\) and \(y\_true\) are ndarray and multioutput = ‘raw_values’, ndarray.