Fork me on GitHub

This documentation is for scikit-learn version 0.17Other versions

If you use the software, please consider citing scikit-learn.


sklearn.covariance.oas(X, assume_centered=False)[source]

Estimate covariance with the Oracle Approximating Shrinkage algorithm.


X : array-like, shape (n_samples, n_features)

Data from which to compute the covariance estimate.

assume_centered : boolean

If True, data are not centered before computation. Useful to work with data whose mean is significantly equal to zero but is not exactly zero. If False, data are centered before computation.


shrunk_cov : array-like, shape (n_features, n_features)

Shrunk covariance.

shrinkage : float

Coefficient in the convex combination used for the computation of the shrunk estimate.


The regularised (shrunk) covariance is:

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

where mu = trace(cov) / n_features

The formula we used to implement the OAS does not correspond to the one given in the article. It has been taken from the MATLAB program available from the author’s webpage (