Regularised covariance estimators (Ledoit-Wolf, OAS, fixed-diagonal, PCA, Factor Analysis, cross-validated auto-select) matching the MNE-Python compute_covariance() API. More...
#include <sts_cov_estimators.h>
Static Public Member Functions | |
| static std::pair< Eigen::MatrixXd, double > | ledoitWolf (const Eigen::MatrixXd &matData) |
| Ledoit-Wolf optimal shrinkage covariance estimator. | |
| static std::pair< Eigen::MatrixXd, double > | oas (const Eigen::MatrixXd &matData) |
| Oracle Approximating Shrinkage (OAS) covariance estimator. | |
| static std::pair< Eigen::MatrixXd, double > | diagonalFixed (const Eigen::MatrixXd &matData, double dReg=0.1) |
| Fixed diagonal regularisation. | |
| static std::pair< Eigen::MatrixXd, double > | pca (const Eigen::MatrixXd &matData, int iRank=0) |
| PCA-based rank-reduced covariance estimator. | |
| static std::pair< Eigen::MatrixXd, double > | factorAnalysis (const Eigen::MatrixXd &matData, int iNFactors=0, int iMaxIter=200, double dTol=1e-6) |
| Factor Analysis covariance estimator via EM algorithm. | |
| static std::pair< Eigen::MatrixXd, double > | autoSelect (const Eigen::MatrixXd &matData, int iNFolds=3) |
| Auto-select the best covariance estimator via cross-validation. | |
| static double | gaussianLogLikelihood (const Eigen::MatrixXd &matTestData, const Eigen::MatrixXd &matCov) |
| Gaussian log-likelihood of held-out data given a covariance model. | |
Regularised covariance estimators (Ledoit-Wolf, OAS, fixed-diagonal, PCA, Factor Analysis, cross-validated auto-select) matching the MNE-Python compute_covariance() API.
Covariance matrix estimators.
Provides multiple regularised covariance estimation methods matching MNE-Python's compute_covariance() API. Each method takes zero-mean data (n_channels x n_samples) and returns a pair of (covariance, parameter).
Definition at line 78 of file sts_cov_estimators.h.
|
static |
Auto-select the best covariance estimator via cross-validation.
Runs all available estimators (empirical, shrunk/LW, OAS, diagonal_fixed, PCA, factor_analysis) and selects the one with the highest average Gaussian log-likelihood on held-out folds.
| [in] | matData | Zero-mean data, n_channels x n_samples. |
| [in] | iNFolds | Number of cross-validation folds (default 3). |
Definition at line 194 of file sts_cov_estimators.cpp.
|
static |
Fixed diagonal regularisation.
Computes the sample covariance and adds a fixed fraction of the mean eigenvalue to the diagonal: C_reg = C + reg * trace(C)/p * I.
| [in] | matData | Zero-mean data, n_channels x n_samples. |
| [in] | dReg | Regularisation fraction (default 0.1). |
Definition at line 93 of file sts_cov_estimators.cpp.
|
static |
Factor Analysis covariance estimator via EM algorithm.
Decomposes covariance as C = W*W^T + Psi, where W is a low-rank loading matrix and Psi is a diagonal noise matrix. Uses the EM algorithm from Rubin & Thayer (1982).
| [in] | matData | Zero-mean data, n_channels x n_samples. |
| [in] | iNFactors | Number of latent factors (default: min(p,n)/2). |
| [in] | iMaxIter | Maximum EM iterations (default 200). |
| [in] | dTol | Convergence tolerance on log-likelihood (default 1e-6). |
Definition at line 152 of file sts_cov_estimators.cpp.
|
static |
Gaussian log-likelihood of held-out data given a covariance model.
Computes: -0.5 * (p * log(2π) + log|Σ| + trace(Σ^{-1} * S_test)) where S_test is the sample covariance of the test data.
| [in] | matTestData | Zero-mean test data, n_channels x n_test_samples. |
| [in] | matCov | Covariance model, n_channels x n_channels. |
Definition at line 165 of file sts_cov_estimators.cpp.
|
static |
Ledoit-Wolf optimal shrinkage covariance estimator.
Computes the shrinkage coefficient analytically using the formula from Ledoit & Wolf (2004) "A well-conditioned estimator for large-dimensional covariance matrices" (Journal of Multivariate Analysis, 88(2), 365-411).
| [in] | matData | Zero-mean data, n_channels x n_samples. |
Definition at line 73 of file sts_cov_estimators.cpp.
|
static |
Oracle Approximating Shrinkage (OAS) covariance estimator.
Implements the OAS formula from Chen, Wiesel, Eldar & Hero (2010) "Shrinkage Algorithms for MMSE Covariance Estimation" (IEEE Transactions on Signal Processing, 58(10), 5016-5029).
| [in] | matData | Zero-mean data, n_channels x n_samples. |
Definition at line 83 of file sts_cov_estimators.cpp.
|
static |
PCA-based rank-reduced covariance estimator.
Computes covariance in the subspace of the top-k principal components. Components beyond rank are zeroed. If iRank <= 0, the rank is estimated from the eigenvalue spectrum.
| [in] | matData | Zero-mean data, n_channels x n_samples. |
| [in] | iRank | Number of principal components to retain (0 = auto). |
Definition at line 111 of file sts_cov_estimators.cpp.