Skip to main content

InvCMNESettings

Namespace: INVLIB  ·  Library: Inverse Library

#include <inv/inv_cmne_settings.h>

struct INVLIB::InvCMNESettings

Settings for the Contextual MNE (CMNE) inverse solver (Dinh et al.

2021).

CMNE settings


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 271
// Contextual MNE: dSPM with a fixed-orientation kernel, then rectified and z-scored per source. Without an
// ONNX LSTM model the result is the paper's control estimate.
InvCMNESettings cmneSettings;
cmneSettings.lambda2 = lambda2;
cmneSettings.lookBack = 20;
const MatrixXd fixedGain = fixedFwd.sol->data;
const MatrixXd sourceCov = MatrixXd::Identity(fixedGain.cols(), fixedGain.cols());
const InvCMNEResult cmne = InvCMNE::compute(goodData, fixedGain, inverse.noise_cov->data, sourceCov, cmneSettings);
// Every row of the dSPM kernel maps sensor noise with the noise covariance to unit variance.
const MatrixXd& kDspm = cmne.matKernelDspm;
const VectorXd unitNoise = (kDspm * inverse.noise_cov->data * kDspm.transpose()).diagonal();
ok &= expect(kDspm.rows() == 70 && (unitNoise.array() - 1.0).abs().maxCoeff() < 1e-6 && cmne.stcCmne.data.rows() == 70 && cmne.stcCmne.data.cols() == 421,
"InvCMNE: dSPM kernel has unit noise variance per source, CMNE estimate for all 421 samples");

Authors of this file​