class sklearn.covariance.LedoitWolf(store_precision=True, assume_centered=False, block_size=1000)
[source]
LedoitWolf Estimator
LedoitWolf is a particular form of shrinkage, where the shrinkage coefficient is computed using O. Ledoit and M. Wolf’s formula as described in “A WellConditioned Estimator for LargeDimensional Covariance Matrices”, Ledoit and Wolf, Journal of Multivariate Analysis, Volume 88, Issue 2, February 2004, pages 365411.
Read more in the User Guide.
Parameters: 


Attributes: 

The regularised covariance is:
(1  shrinkage) * cov + shrinkage * mu * np.identity(n_features)
where mu = trace(cov) / n_features and shrinkage is given by the Ledoit and Wolf formula (see References)
“A WellConditioned Estimator for LargeDimensional Covariance Matrices”, Ledoit and Wolf, Journal of Multivariate Analysis, Volume 88, Issue 2, February 2004, pages 365411.
error_norm (comp_cov[, norm, scaling, squared])  Computes the Mean Squared Error between two covariance estimators. 
fit (X[, y])  Fits the LedoitWolf shrunk covariance model according to the given training data and parameters. 
get_params ([deep])  Get parameters for this estimator. 
get_precision ()  Getter for the precision matrix. 
mahalanobis (X)  Computes the squared Mahalanobis distances of given observations. 
score (X_test[, y])  Computes the loglikelihood of a Gaussian data set with self.covariance_ as an estimator of its covariance matrix. 
set_params (**params)  Set the parameters of this estimator. 
__init__(store_precision=True, assume_centered=False, block_size=1000)
[source]
error_norm(comp_cov, norm=’frobenius’, scaling=True, squared=True)
[source]
Computes the Mean Squared Error between two covariance estimators. (In the sense of the Frobenius norm).
Parameters: 


Returns: 

fit(X, y=None)
[source]
Fits the LedoitWolf shrunk covariance model according to the given training data and parameters.
Parameters: 


Returns: 

get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: 


Returns: 

get_precision()
[source]
Getter for the precision matrix.
Returns: 


mahalanobis(X)
[source]
Computes the squared Mahalanobis distances of given observations.
Parameters: 


Returns: 

score(X_test, y=None)
[source]
Computes the loglikelihood of a Gaussian data set with self.covariance_
as an estimator of its covariance matrix.
Parameters: 


Returns: 

set_params(**params)
[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: 


sklearn.covariance.LedoitWolf
© 2007–2018 The scikitlearn developers
Licensed under the 3clause BSD License.
http://scikitlearn.org/stable/modules/generated/sklearn.covariance.LedoitWolf.html