EmpiricalCovariance
#include <Skigen/Covariance>
template <typename Scalar = double>
class Skigen::EmpiricalCovariance(assume_centered=false)
Maximum likelihood covariance estimator.
Computes the sample covariance matrix from data.
Mirrors sklearn.covariance.EmpiricalCovariance.
Attributes:
-
covariance : MatrixType Estimated covariance matrix (p × p).
-
location : RowVectorType Estimated location (mean) of the data (1 × p).
Methods
fit(X)
Fit the empirical covariance model.
Parameters:
- X : MatrixType Data matrix of shape (n_samples, n_features).
Returns:
- result : EmpiricalCovariance
Reference to the fitted estimator (
*this).
score(X)
Return Gaussian log-likelihood of X under the fitted model.
Example
Skigen::EmpiricalCovariance<double> emp;
emp.fit(X);
std::cout << "=== EmpiricalCovariance ===\n"
<< "Covariance (4x4):\n" << emp.covariance() << "\n\n"
<< "Location: " << emp.location() << "\n\n";