OAS
#include <Skigen/Covariance>
template <typename Scalar = double>
class Skigen::OAS(assume_centered=false)
Oracle Approximating Shrinkage (OAS) covariance estimator.
Estimates the covariance matrix using the OAS shrinkage formula, which provides an improved estimate over Ledoit-Wolf for Gaussian data.
The estimator computes:
where the shrinkage coefficient is given by:
Reference: Chen, Wiesel, Eldar & Hero (2010), "Shrinkage Algorithms for MMSE Covariance Estimation", IEEE Trans. Signal Processing, 58(10), 5016-5029.
Mirrors sklearn.covariance.OAS.
Parameters:
- assume_centered : bool, default=false
If
true, data is assumed centered (bool, defaultfalse).
Attributes:
-
covariance : MatrixType Estimated covariance matrix (p × p).
-
shrinkage : Scalar Shrinkage coefficient ρ ∈ [0, 1].
-
location : RowVectorType Estimated location (mean) of the data (1 × p).
Methods
fit(X)
Fit the OAS covariance model.
Parameters:
- X : MatrixType Data matrix of shape (n_samples, n_features).
Returns:
- result : OAS
Reference to the fitted estimator (
*this).
score(X)
Return the Gaussian log-likelihood of X under the fitted model.
Parameters:
- X : MatrixType Data matrix of shape (n_samples, n_features).
Returns:
- result : Scalar Average log-likelihood per sample.
Example
Skigen::OAS<double> oas;
oas.fit(X);
std::cout << "=== OAS ===\n"
<< "Shrinkage coefficient: " << oas.shrinkage() << "\n"
<< "Covariance (4x4):\n" << oas.covariance() << "\n\n";