spe.estimators.cp_arbitrary#
- spe.estimators.cp_arbitrary(model, X, y, tr_idx, Chol_y=None, Chol_ystar=None, Cov_y_ystar=None, nboot=100, alpha=0.05, use_trace_corr=False)#
Computes Generalized Mallows’s Cp for arbitrary models.
- Parameters:
- model: object
The model to estimate MSE for.
- 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 caseChol_y
is set tonp.eye(n)
.- Chol_ystararray-like of shape (n_samples, n_samples), optional
Cholesky of covariance matrix of \(\Sigma_{Y^*}\). Default is
None
in which caseChol_ystar
is set tonp.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
.- use_trace_corrbool, optional
If
True
, computes estimator with deterministic trace correction. IfFalse
, uses random correction term with same expectation, but yielding an estimator with smaller variance. Default isFalse
.
- Returns:
- err_estfloat
Estimate of MSE of
model
on \(\alpha\) noise-elevated data.