mlpy.stats.shrink_cov

mlpy.stats.shrink_cov(x, return_lambda=False, return_estimate=False)[source]

Covariance shrinkage estimation.

Ledoit-Wolf optimal shrinkage estimator for cov(X) C = \lambda*t + (1 - \lambda) * s using the diagonal variance ‘target’ t=np.diag(s) with the unbiased sample cov s as the unconstrained estimate.

Parameters:

x : array_like, shape (n, dim)

The data, where n is the number of data points and dim is the dimensionality of each data point.

return_lambda : bool

Whether to return lambda or not.

return_estimate : bool

Whether to return the unbiased estimate or not.

Returns:

C : array

The shrunk final estimate

lambda_ : float, optional

Lambda

estimate : array, optional

Unbiased estimate.

Examples

>>> shrink_cov()

Note

Adapted from Matlab:

Copyright (2010) Kevin Murphy and Matt Dunham
License: MIT