v2.0.0
Loading...
Searching...
No Matches
sts_cov_estimators.cpp File Reference

Implementation of the regularised covariance estimators declared in sts_cov_estimators.h. More...

#include "sts_cov_estimators.h"
#include <Skigen/Covariance>
#include <Skigen/Decomposition>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <vector>
#include <Eigen/Eigenvalues>
Include dependency graph for sts_cov_estimators.cpp:

Go to the source code of this file.

Detailed Description

Implementation of the regularised covariance estimators declared in sts_cov_estimators.h.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.2.0
Date
April 2026

Ledoit-Wolf and OAS forward to Skigen::LedoitWolf and Skigen::OAS after transposing the input so the (n_channels, n_samples) STSLIB convention is mapped onto the (n_samples, n_features) layout that Skigen expects; the analytic shrinkage coefficients are returned alongside the resulting covariance.

The diagonal-fixed estimator adds \(\lambda \cdot \mathrm{tr}(C)/p \cdot I\) to the sample covariance. The PCA estimator projects onto the top-k eigenvectors of the sample covariance and reconstructs a low-rank approximation. The Factor-Analysis estimator runs the Rubin & Thayer (1982) EM updates until the log-likelihood plateaus and returns W*W^T + Psi.

The auto-selector splits the samples into nFolds, fits every estimator on the training samples, scores the held-out fold with the Gaussian log-likelihood \(-\tfrac12(p\log 2\pi + \log|\Sigma| + \mathrm{tr}(\Sigma^{-1} S_\text{test}))\) and returns the covariance with the highest average score along with a numeric index identifying the winning method.

Definition in file sts_cov_estimators.cpp.