sklearn.covariance.shrunk_covariance

sklearn.covariance.shrunk_covariance(emp_cov, shrinkage=0.1) [source]

Calculates a covariance matrix shrunk on the diagonal

Read more in the User Guide.

Parameters
emp_covarray-like of shape (n_features, n_features)

Covariance matrix to be shrunk

shrinkagefloat, default=0.1

Coefficient in the convex combination used for the computation of the shrunk estimate. Range is [0, 1].

Returns
shrunk_covndarray of shape (n_features, n_features)

Shrunk covariance.

Notes

The regularized (shrunk) covariance is given by:

(1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features)

where mu = trace(cov) / n_features

© 2007–2020 The scikit-learn developers
Licensed under the 3-clause BSD License.
https://scikit-learn.org/0.24/modules/generated/sklearn.covariance.shrunk_covariance.html