Estimate the shrunk Ledoit-Wolf covariance matrix.
Read more in the User Guide.
Data from which to compute the covariance estimate.
If True, data will not be centered before computation. Useful to work with data whose mean is significantly equal to zero but is not exactly zero. If False, data will be centered before computation.
Size of blocks into which the covariance matrix will be split. This is purely a memory optimization and does not affect results.
Shrunk covariance.
Coefficient in the convex combination used for the computation of the shrunk estimate.
Notes
The regularized (shrunk) covariance is:
(1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features)
where mu = trace(cov) / n_features
Examples
>>> import numpy as np >>> from sklearn.covariance import empirical_covariance, ledoit_wolf >>> real_cov = np.array([[.4, .2], [.2, .8]]) >>> rng = np.random.RandomState(0) >>> X = rng.multivariate_normal(mean=[0, 0], cov=real_cov, size=50) >>> covariance, shrinkage = ledoit_wolf(X) >>> covariance array([[0.44, 0.16], [0.16, 0.80]]) >>> shrinkage np.float64(0.23)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4