Skip to main content

EmpiricalCovariance

The maximum-likelihood (sample) covariance estimator.

Algorithm

Centres the data (unless assume_centered) and forms the 1/n scatter matrix. The maximum-likelihood normalisation matches scikit-learn.

Constructor

Skigen::EmpiricalCovariance<Scalar> model(bool assume_centered = false);

Parameters

ParameterDefaultDescription
assume_centeredfalseSkip mean subtraction if data is already centred.

Methods

MethodDescription
fit(X)Estimate the covariance.
score(X)Gaussian log-likelihood of new data.

Fitted Attributes

AccessorDescription
covariance()Estimated p×p covariance.
location()Estimated mean.

Example

Skigen::EmpiricalCovariance<double> cov;
cov.fit(X);
auto C = cov.covariance();
Verified against scikit-learn

This estimator is checked by the parity suite. See the generator tests/parity/generate_covariance_reference.py and the reference fixtures in tests/parity/data/empirical_covariance/, exercised by tests/parity/parity_covariance.cpp.

API Reference

For full signatures see the EmpiricalCovariance API Reference.