InvGammaMap
Namespace: INVLIB · Library: Inverse Library
mne.inverse_sparse.gamma_map in MNE-Python.
#include <inv/inv_gamma_map.h>
class INVLIB::InvGammaMap
Gamma-MAP sparse inverse solver (Sparse Bayesian Learning).
Iteratively estimates source variance hyperparameters (gamma) and prunes sources whose gamma falls below a threshold, yielding a sparse solution.
Gamma-MAP sparse inverse solver.
// Gamma-MAP: sparse Bayesian learning with unit (whitened) noise, MacKay updates as in mne.inverse_sparse.gamma_map.
const InvGammaMapResult gammaMap = InvGammaMap::compute(gain, measured, MatrixXd::Identity(gain.rows(), gain.rows()), 1000, 1e-8);
Static Methods
compute(matGain, matData, matNoiseCov, nIterations, tolerance, gammaThreshold)
Compute the Gamma-MAP inverse solution.
Parameters:
-
matGain : const Eigen::MatrixXd & Forward gain matrix (n_channels x n_sources).
-
matData : const Eigen::MatrixXd & Measurement data (n_channels x n_times).
-
matNoiseCov : const Eigen::MatrixXd & Noise covariance matrix (n_channels x n_channels).
-
nIterations : int Maximum number of fixed-point iterations.
-
tolerance : double Convergence tolerance on relative gamma change.
-
gammaThreshold : double Threshold below which sources are pruned.
Returns:
- InvGammaMapResult — The Gamma-MAP result containing the sparse source estimate.
Example
- Full source:
src/examples/ex_inv_api/main.cpp - Build target:
ex_inv_api(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_inv_api
Inverse library: minimum-norm estimates, resolution matrices, label time courses, sparse solvers.
// Gamma-MAP: sparse Bayesian learning with unit (whitened) noise, MacKay updates as in mne.inverse_sparse.gamma_map.
const InvGammaMapResult gammaMap = InvGammaMap::compute(gain, measured, MatrixXd::Identity(gain.rows(), gain.rows()), 1000, 1e-8);
ok &= expect(!gammaMap.activeVertices.isEmpty() && gammaMap.activeVertices.size() < 70 && gammaMap.vecGamma.size() == 70,
QString("InvGammaMap: %1 of 70 V1 sources keep a nonzero variance").arg(gammaMap.activeVertices.size()));
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>