Skip to content

Commit

Permalink
DOC formula format in shrunk_covariance_.py (scikit-learn#10747)
Browse files Browse the repository at this point in the history
  • Loading branch information
qinhanmin2014 authored and jnothman committed Mar 3, 2018
1 parent 76b5b2a commit efe7567
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions sklearn/covariance/shrunk_covariance_.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ def shrunk_covariance(emp_cov, shrinkage=0.1):
Notes
-----
The regularized (shrunk) covariance is given by
The regularized (shrunk) covariance is given by:
(1 - shrinkage)*cov
+ shrinkage*mu*np.identity(n_features)
(1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features)
where mu = trace(cov) / n_features
Expand Down Expand Up @@ -98,10 +97,9 @@ class ShrunkCovariance(EmpiricalCovariance):
Notes
-----
The regularized covariance is given by
The regularized covariance is given by:
(1 - shrinkage)*cov
+ shrinkage*mu*np.identity(n_features)
(1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features)
where mu = trace(cov) / n_features
Expand Down Expand Up @@ -176,8 +174,7 @@ def ledoit_wolf_shrinkage(X, assume_centered=False, block_size=1000):
-----
The regularized (shrunk) covariance is:
(1 - shrinkage)*cov
+ shrinkage * mu * np.identity(n_features)
(1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features)
where mu = trace(cov) / n_features
Expand Down Expand Up @@ -276,8 +273,7 @@ def ledoit_wolf(X, assume_centered=False, block_size=1000):
-----
The regularized (shrunk) covariance is:
(1 - shrinkage)*cov
+ shrinkage * mu * np.identity(n_features)
(1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features)
where mu = trace(cov) / n_features
Expand Down Expand Up @@ -350,10 +346,9 @@ class LedoitWolf(EmpiricalCovariance):
Notes
-----
The regularised covariance is::
The regularised covariance is:
(1 - shrinkage)*cov
+ shrinkage*mu*np.identity(n_features)
(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)
Expand Down Expand Up @@ -433,8 +428,7 @@ def oas(X, assume_centered=False):
-----
The regularised (shrunk) covariance is:
(1 - shrinkage)*cov
+ shrinkage * mu * np.identity(n_features)
(1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features)
where mu = trace(cov) / n_features
Expand Down Expand Up @@ -513,10 +507,9 @@ class OAS(EmpiricalCovariance):
Notes
-----
The regularised covariance is::
The regularised covariance is:
(1 - shrinkage)*cov
+ shrinkage*mu*np.identity(n_features)
(1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features)
where mu = trace(cov) / n_features
and shrinkage is given by the OAS formula (see References)
Expand Down

0 comments on commit efe7567

Please sign in to comment.