Smoothing#

Sometimes the functional observations are noisy. The noise can be reduced by smoothing the data.

This module provide several classes, called smoothers, that perform a smoothing transformation of the data. All of the smoothers follow the API of an scikit-learn transformer object.

The degree of smoothing is controlled in all smoothers by an smoothing parameter, named smoothing_parameter, that has different meaning for each smoother.

Kernel smoothers#

Kernel smoothing methods compute the smoothed value at a point by considering the influence of each input point over it. For doing this, it considers a kernel function placed at the desired point. The influence of each input point will be related with the value of the kernel function at that input point.

The kernel smoother provided in this library is also a linear smoother, meaning that it computes a smoothing matrix (or hat matrix) that performs the smoothing as a linear transformation.

skfda.preprocessing.smoothing.KernelSmoother([...])

Kernel smoothing method.

Basis smoother#

The basis smoother smooths the data by means of expressing it in a truncated basis expansion. The data can be further smoothed penalizing its derivatives, using a linear differential operator. This has the effect of reducing the curvature of the function and/or its derivatives.

This smoother is also a linear smoother, although if the QR or Cholesky methods are used, the matrix does not need to be explicitly computed.

skfda.preprocessing.smoothing.BasisSmoother(...)

Transform raw data to a smooth functional form.

Validation#

It is necessary to measure how good is the smoothing to prevent undersmoothing and oversmoothing. The following classes follow the scikit-learn API for a scorer object, and measure how good is the smoothing. In both of them, the target object y should also be the original data. These scorers need that the smoother is linear, as they use internally the hat matrix.

skfda.preprocessing.smoothing.validation.LinearSmootherLeaveOneOutScorer()

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

skfda.preprocessing.smoothing.validation.LinearSmootherGeneralizedCVScorer([...])

Generalized cross validation scoring method for linear smoothers.

The LinearSmootherGeneralizedCVScorer object accepts also an optional penalization_function, used instead of the default one. The available ones are:

skfda.preprocessing.smoothing.validation.akaike_information_criterion(...)

Akaike's information criterion for cross validation.

skfda.preprocessing.smoothing.validation.finite_prediction_error(...)

Finite prediction error for cross validation.

skfda.preprocessing.smoothing.validation.shibata(...)

Shibata's model selector for cross validation.

skfda.preprocessing.smoothing.validation.rice(...)

Rice's bandwidth selector for cross validation.

An utility class is also provided, which inherits from the sckit-learn class GridSearchCV and performs a grid search using the scorers to find the best smoothing_parameter from a list.

skfda.preprocessing.smoothing.validation.SmoothingParameterSearch(...)

Chooses the best smoothing parameter and performs smoothing.

References#

  • Ramsay, J., Silverman, B. W. (2005). Functional Data Analysis. Springer.

  • Wasserman, L. (2006). All of nonparametric statistics. Springer Science & Business Media.