Warning: This documentation is for scikits.learn version 0.6.0. — Latest stable version

Contents

6.9.4. scikits.learn.covariance.ledoit_wolf

scikits.learn.covariance.ledoit_wolf(X, return_shrinkage=False)

Estimates the shrunk Ledoit-Wolf covariance matrix.

Parameters :

X: 2D ndarray, shape (n, p) :

The data matrix, with p features and n samples.

return_shrinkage: boolean, optional :

If return_shrinkage is True, the regularisation_factor is returned.

Returns :

regularised_cov: 2D ndarray :

Regularized covariance

shrinkage: float :

Regularisation factor

Notes

The regularised covariance is:

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

where mu = trace(cov) / n_features