Skip to main content

InvGammaMap

Namespace: INVLIB  ·  Library: Inverse Library

Python equivalent

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.

src/examples/ex_inv_api/main.cpp
// 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:


Example​

Used in examples​

ex_inv_api​

Inverse library: minimum-norm estimates, resolution matrices, label time courses, sparse solvers.

src/examples/ex_inv_api/main.cpp, line 250
// 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​