ShrunkCovariance

class ibex.sklearn.covariance.ShrunkCovariance(store_precision=True, assume_centered=False, shrinkage=0.1)

Bases: sklearn.covariance.shrunk_covariance_.ShrunkCovariance, ibex._base.FrameMixin

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Covariance estimator with shrinkage

Read more in the User Guide.

store_precision : boolean, default True
Specify if the estimated precision is stored
assume_centered : boolean, default False
If True, data are not centered before computation. Useful when working with data whose mean is almost, but not exactly zero. If False, data are centered before computation.
shrinkage : float, 0 <= shrinkage <= 1, default 0.1
Coefficient in the convex combination used for the computation of the shrunk estimate.
covariance_ : array-like, shape (n_features, n_features)
Estimated covariance matrix
precision_ : array-like, shape (n_features, n_features)
Estimated pseudo inverse matrix. (stored only if store_precision is True)
shrinkage : float, 0 <= shrinkage <= 1
Coefficient in the convex combination used for the computation of the shrunk estimate.

The regularized covariance is given by

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

where mu = trace(cov) / n_features

fit(X, y=None)[source]

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Fits the shrunk covariance model

according to the given training data and parameters.

X : array-like, shape = [n_samples, n_features]
Training data, where n_samples is the number of samples and n_features is the number of features.

y : not used, present for API consistence purpose.

self : object
Returns self.
score(X_test, y=None)

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Computes the log-likelihood of a Gaussian data set with

self.covariance_ as an estimator of its covariance matrix.

X_test : array-like, shape = [n_samples, n_features]
Test data of which we compute the likelihood, where n_samples is the number of samples and n_features is the number of features. X_test is assumed to be drawn from the same distribution than the data used in fit (including centering).

y : not used, present for API consistence purpose.

res : float
The likelihood of the data set with self.covariance_ as an estimator of its covariance matrix.