LocalLinearRegressionHatMatrix#
- class skfda.misc.hat_matrix.LocalLinearRegressionHatMatrix(*, bandwidth=None, kernel=<function normal>)[source]#
Local linear regression method.
Creates the matrix \(\hat{H}\), used in the kernel smoothing and kernel regression algorithms, as explained below.
For kernel smoothing algorithm to estimate the smoothed value for \(t_i'\) the following error must be minimised
\[AWSE(a, b) = \sum_{j=1}^n \left[ \left(y_j - \left(a + b (t_j - t'_i) \right) \right)^2 K \left( \frac {|t_j - t'_i|}{h} \right) \right ]\]which gives the following expression for each cell
\[\hat{H}_{i,j} = \frac{b_j(t_i')}{\sum_{k=1}^{n}b_k(t_i')}\]\[b_j(t_i') = K\left(\frac{t_j - t_i'}{h}\right) S_{n,2}(t_i') - (t_j - t_i')S_{n,1}(t_i')\]\[S_{n,k}(t_i') = \sum_{j=1}^{n}K\left(\frac{t_j-t_i'}{h}\right) (t_j-t_i')^k\]where \(\{t_1, t_2, ..., t_n\}\) are points with known value and \(\{t_1', t_2', ..., t_m'\}\) are the points for which it is desired to estimate the smoothed value [1].
For kernel regression algorithm:
Given functional data, \(\{X_1, X_2, ..., X_n\}\) where each function is expressed in a orthonormal basis with \(J\) elements and scalar response \(Y = \{y_1, y_2, ..., y_n\}\).
It is desired to estimate the values \(\hat{Y} = \{\hat{y}_1, \hat{y}_2, ..., \hat{y}_m\}\) for the data \(\{X'_1, X'_2, ..., X'_m\}\) (expressed in the same basis).
For each \(X'_k\) the estimation \(\hat{y}_k\) is obtained by taking the value \(a_k\) from the vector \((a_k, b_{1k}, ..., b_{Jk})\) which minimizes the following expression
\[AWSE(a_k, b_{1k}, ..., b_{Jk}) = \sum_{i=1}^n \left(y_i - \left(a_k + \sum_{j=1}^J b_{jk} c_{ik}^j \right) \right)^2 K \left( \frac {d(X_i - X'_k)}{h} \right)\]Where \(c_{ik}^j\) is the \(j\)-th coefficient in a truncated basis expansion of \(X_i - X'_k = \sum_{j=1}^J c_{ik}^j\) and \(d\) some functional distance [2]
For both cases, \(K(\cdot)\) is a kernel function and \(h\) the bandwidth.
- Parameters:
bandwidth (float | None) – Window width of the kernel (also called h).
kernel (Callable[[NDArrayFloat], NDArrayFloat]) – Kernel function. By default a normal kernel.
References
Methods
Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
set_params
(**params)Set the parameters of this estimator.
- get_metadata_routing()#
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
routing – A
MetadataRequest
encapsulating routing information.- Return type:
MetadataRequest
- get_params(deep=True)#
Get parameters for this estimator.
- set_params(**params)#
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.- Parameters:
**params (dict) – Estimator parameters.
- Returns:
self – Estimator instance.
- Return type:
estimator instance