8.2.10. sklearn.covariance.shrunk_covariance¶
- sklearn.covariance.shrunk_covariance(emp_cov, shrinkage=0.1)¶
- Calculates a covariance matrix shrunk on the diagonal - Parameters : - emp_cov: array-like, shape (n_features, n_features) : - Covariance matrix to be shrunk - shrinkage: float, 0 <= shrinkage <= 1 : - coefficient in the convex combination used for the computation of the shrunk estimate. - Returns : - shrunk_cov: array-like : - shrunk covariance - Notes - The regularized (shrunk) covariance is given by - (1 - shrinkage)*cov
- shrinkage*mu*np.identity(n_features)
 
 - where mu = trace(cov) / n_features 
