spe.estimators.cp_bagged#

spe.estimators.cp_bagged(model, X, y, tr_idx, Chol_y=None, Chol_ystar=None, Cov_y_ystar=None, full_refit=False, use_trace_corr=False, n_estimators=100)#

Computes Generalized Mallows’s Cp for bagged models.

Parameters:
model: object

The base estimator to fit on bootstraps of the data.

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\).

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.

n_estimatorsint, optional

Number of base estimators in the bagged model. Default is 100.

Returns:
err_estfloat

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