spe.estimators.cp_adaptive_smoother#

spe.estimators.cp_adaptive_smoother(model, X, y, tr_idx, Chol_y=None, Chol_ystar=None, Cov_y_ystar=None, nboot=100, alpha=0.05, full_refit=True, use_trace_corr=False)#

Computes Generalized Mallows’s Cp for adaptive linear smoothers.

Parameters:
model: object

The model to estimate MSE for. Must have predictions of the form \(S(Y)Y\) where \(S(Y) \in \mathbb{R}^{n\times n}\).

Xarray-like of shape (n_samples, n_features)
yarray-like of shape (n_samples,)
tr_idxbool array-like of shape (n_samples,)

Boolean index of which samples to train the model on.

Chol_yarray-like of shape (n_samples, n_samples), optional

Cholesky of covariance matrix of \(\Sigma_Y\). Default is None in which case Chol_y is set to np.eye(n).

Chol_ystararray-like of shape (n_samples, n_samples), optional

Cholesky of covariance matrix of \(\Sigma_{Y^*}\). Default is None in which case Chol_ystar is set to np.eye(n).

Cov_y_ystararray-like of shape (n_samples, n_samples), optional

Covariance matrix of \(\Sigma_{Y,Y^*}\). Default is None in which case it is assumed \(\Sigma_{Y,Y^*} = 0\).

n_bootint, optional

Number of bootstrap draws to average over. Default is 100.

alphafloat, optional

Amount of noise elevation to apply to data. To approximate performance on original data, a small value of \(\alpha\) is recommended as in default. Default is .05.

full_refitbool, optional

If True computes estimator for refitting/predicting using original data \(Y\), i.e. predictions are \(S(W)Y\). If False, uses \(S(W)W\) for predictions. Default is False.

use_trace_corrbool, optional

If True, computes estimator with deterministic trace correction. If False, uses random correction term with same expectation, but yielding an estimator with smaller variance. Default is False.

Returns:
err_estfloat

Estimate of MSE of model on \(\alpha\) noise-elevated data.