LinearSmootherLeaveOneOutScorer#

class skfda.preprocessing.smoothing.validation.LinearSmootherLeaveOneOutScorer[source]#

Leave-one-out cross validation scoring method for linear smoothers.

It calculates the cross validation score for every sample in a FDataGrid object given a linear smoother with a smoothing matrix \(\mathbf{S}(h)\) calculated with a parameter \(h\):

\[CV_{loo}(h)=\frac{1}{M} \sum_m \left(x(t_m) - \hat{x}(t_m; h)^{(-m)} \right)^2,\]

where \(\hat{x}(t_m; h)^{(-m)}\) is the estimated \(x(t_m)\) when the point \(t_m\) is excluded in the smoothing. This would require to recalculate the smoothing matrix n times. Fortunately the above formula can be expressed in a way where the smoothing matrix does not need to be calculated again.

\[CV_{loo}(h)=\frac{1}{M} \sum_{m=1}^{M} \left(\frac{x(t_m) - \hat{x}(t_m; h)}{1 - S_{mm}(h)}\right)^2,\]
Parameters:
  • estimator (Estimator) – Linear smoothing estimator.

  • X (FDataGrid) – Functional data to smooth.

  • y (FDataGrid) – Functional data target. Should be the same as X.

Returns:

Cross validation score, with negative sign, as it is a penalization.

Return type:

float

Methods