Bayesian Inverse Solutions#

class invert.solvers.bayes.SolverBCS(name='Bayesian Compressed Sensing', **kwargs)#

Class for the Bayesian Compressed Sensing (BCS) inverse solution [1].

References

[1] Ji, S., Xue, Y., & Carin, L. (2008). Bayesian compressive sensing. IEEE Transactions on signal processing, 56(6), 2346-2356.

apply_inverse_operator(mne_obj, max_iter=100, alpha_0=0.01, eps=1e-16) mne.source_estimate.SourceEstimate#

Apply the inverse operator.

Parameters
  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • max_iter (int) – Maximum number of iterations

  • alpha_0 (float) – Regularization parameter

  • eps (float) – Epsilon, used to avoid division by zero.

Returns

stc – The SourceEstimate data structure containing the inverse solution.

Return type

mne.SourceEstimate

calc_bcs_solution(y, max_iter=100, alpha_0=0.01, eps=1e-16)#

This function computes the BCS inverse solution.

Parameters
  • y (numpy.ndarray) – The M/EEG data matrix (n_channels, n_timepoints)

  • max_iter (int) – Maximum number of iterations

  • alpha_0 (float) – Regularization parameter

  • eps (float) – Epsilon, used to avoid division by zero.

Returns

x_hat – The source estimate.

Return type

numpy.ndarray

make_inverse_operator(forward, *args, alpha='auto', **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • alpha (float) – The regularization parameter.

Returns

self

Return type

object returns itself for convenience

class invert.solvers.bayes.SolverGammaMAP(name='Gamma-MAP', **kwargs)#

Class for the Gamma Maximum A Posteriori (Gamma-MAP) inverse solution [1].

References

Wipf, D., & Nagarajan, S. (2009). A unified Bayesian framework for MEG/EEG source imaging. NeuroImage, 44(3), 947-966.

make_gamma_map_inverse_operator(B, alpha, max_iter=100)#

Computes the gamma MAP inverse operator based on the M/EEG data.

Parameters
  • B (numpy.ndarray) – The M/EEG data matrix (channels, time points).

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum numbers of iterations to find the optimal hyperparameters. max_iter = 1 corresponds to sLORETA.

Returns

inverse_operator – The inverse operator which can be used to compute inverse solutions from new data.

Return type

numpy.ndarray

make_inverse_operator(forward, mne_obj, *args, alpha='auto', smoothness_prior=False, max_iter=100, verbose=0, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (str/ float) – The regularization parameter.

  • max_iter (int) – Maximum numbers of iterations to find the optimal hyperparameters. max_iter = 1 corresponds to sLORETA.

  • smoothness_prior (bool) –

Returns

self

Return type

object returns itself for convenience

class invert.solvers.bayes.SolverGammaMAPMSP(name='Gamma-MAP-MSP', **kwargs)#

Class for the Gamma Maximum A Posteriori (Gamma-MAP) inverse solution using multiple sparse priors (MSP).

forward#

The mne-python Forward model instance.

Type

mne.Forward

References

Wipf, D., & Nagarajan, S. (2009). A unified Bayesian framework for MEG/EEG source imaging. NeuroImage, 44(3), 947-966.

get_smooth_prior_cov(L, smoothness_order)#

Create a smooth prior on the covariance matrix.

Parameters
  • L (numpy.ndarray) – Leadfield matrix (channels, dipoles)

  • smoothness_order (int) – The higher the order, the smoother the prior.

Returns

  • L (numpy.ndarray) – The smoothed Leadfield matrix (channels, dipoles)

  • gradient (numpy.ndarray) – The smoothness gradient (laplacian matrix)

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=100, p=0.5, smoothness_order=1, verbose=0, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum numbers of iterations to find the optimal hyperparameters. max_iter = 1 corresponds to sLORETA-like solution.

  • p (0 < p < 2) – Hyperparameter which controls sparsity. Default: p = 0

  • smoothness_order (int) – Controls the smoothness prior. The higher this integer, the higher the pursued smoothness of the inverse solution.

Returns

self

Return type

object returns itself for convenience

make_source_map_inverse_operator(B, alpha, max_iter=100, p=0.5, smoothness_order=1)#

Computes the source MAP inverse operator based on the M/EEG data.

Parameters
  • B (numpy.ndarray) – The M/EEG data matrix (channels, time points).

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum numbers of iterations to find the optimal hyperparameters. max_iter = 1 corresponds to sLORETA.

  • p (0 < p < 2) – Hyperparameter which controls sparsity. Default: p = 0.5

  • smoothness_order (int) – Controls the smoothness prior. The higher this integer, the higher the pursued smoothness of the inverse solution.

Returns

inverse_operator – The inverse operator which can be used to compute inverse solutions from new data.

Return type

numpy.ndarray

class invert.solvers.bayes.SolverSourceMAP(name='Source-MAP', **kwargs)#

Class for the Source Maximum A Posteriori (Source-MAP) inverse solution [1].

References

Wipf, D., & Nagarajan, S. (2009). A unified Bayesian framework for MEG/EEG source imaging. NeuroImage, 44(3), 947-966.

make_inverse_operator(forward, mne_obj, *args, alpha='auto', smoothness_prior=False, max_iter=100, p=0.5, verbose=0, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum numbers of iterations to find the optimal hyperparameters. max_iter = 1 corresponds to sLORETA.

  • p (0 < p < 2) – Hyperparameter which controls sparsity. Default: p = 0.5

Returns

self

Return type

object returns itself for convenience

make_source_map_inverse_operator(B, alpha, max_iter=100, p=0.5)#

Computes the source MAP inverse operator based on the M/EEG data.

Parameters
  • B (numpy.ndarray) – The M/EEG data matrix (channels, time points).

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum numbers of iterations to find the optimal hyperparameters. max_iter = 1 corresponds to sLORETA.

  • p (0 < p < 2) – Hyperparameter which controls sparsity. Default: p = 0.5

Returns

inverse_operator – The inverse operator which can be used to compute inverse solutions from new data.

Return type

numpy.ndarray

class invert.solvers.bayes.SolverSourceMAPMSP(name='Source-MAP-MSP', **kwargs)#

Class for the Source Maximum A Posteriori (Source-MAP) inverse solution using multiple sparse priors [1]. The method is conceptually similar to [2], but formally not equal.

References

[1] Wipf, D., & Nagarajan, S. (2009). A unified Bayesian framework for MEG/EEG source imaging. NeuroImage, 44(3), 947-966.

[2] Friston, K., Harrison, L., Daunizeau, J., Kiebel, S., Phillips, C., Trujillo-Barreto, N., … & Mattout, J. (2008). Multiple sparse priors for the M/EEG inverse problem. NeuroImage, 39(3), 1104-1120.

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=100, p=0.5, smoothness_order=1, verbose=0, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • p (0 < p < 2) – Hyperparameter which controls sparsity. Default: p = 0.5

  • max_iter (int) – Maximum numbers of iterations to find the optimal hyperparameters. max_iter = 1 corresponds to sLORETA.

  • smoothness_order (int) – Controls the smoothness prior. The higher this integer, the higher the pursued smoothness of the inverse solution.

Returns

self

Return type

object returns itself for convenience

make_source_map_inverse_operator(B, alpha, max_iter=100, p=0.5, smoothness_order=1)#

Computes the source MAP inverse operator based on the M/EEG data.

Parameters
  • B (numpy.ndarray) – The M/EEG data matrix (channels, time points).

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum numbers of iterations to find the optimal hyperparameters. max_iter = 1 corresponds to sLORETA.

  • p (0 < p < 2) – Hyperparameter which controls sparsity. Default: p = 0.5

  • smoothness_order (int) – Controls the smoothness prior. The higher this integer, the higher the pursued smoothness of the inverse solution.

Returns

inverse_operator – The inverse operator which can be used to compute inverse solutions from new data.

Return type

numpy.ndarray

class invert.solvers.empirical_bayes.SolverChampagne(name='Champagne', **kwargs)#

Class for the Champagne inverse solution. Code is based on the implementation from the BSI-Zoo: https://github.com/braindatalab/BSI-Zoo/

References

[1] Owen, J., Attias, H., Sekihara, K., Nagarajan, S., & Wipf, D. (2008). Estimating the location and orientation of complex, correlated neural activity using MEG. Advances in Neural Information Processing Systems, 21.

[2] Wipf, D. P., Owen, J. P., Attias, H. T., Sekihara, K., & Nagarajan, S. S. (2010). Robust Bayesian estimation of the location, orientation, and time course of multiple correlated neural sources using MEG. NeuroImage, 49(1), 641-655.

[3] Owen, J. P., Wipf, D. P., Attias, H. T., Sekihara, K., & Nagarajan, S. S. (2012). Performance evaluation of the Champagne source reconstruction algorithm on simulated and real M/EEG data. Neuroimage, 60(1), 305-323.

champagne(y, alpha, max_iter=1000)#

Champagne method.

Parameters
  • y (array, shape (n_sensors,)) – measurement vector, capturing sensor measurements

  • alpha (float) – The regularization parameter.

  • max_iter (int, optional) – The maximum number of inner loop iterations

Returns

x – Parameter vector, e.g., source vector in the context of BSI (x in the cost function formula).

Return type

array, shape (dipoles, time)

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=1000, noise_cov=None, verbose=0, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum number of iterations.

  • noise_cov ([None, numpy.ndarray]) – The noise covariance matrix. Use “None” if not available.

Returns

self

Return type

object returns itself for convenience

class invert.solvers.empirical_bayes.SolverConvexityChampagne(name='Convexity-Champagne', **kwargs)#

Class for the Convexity Champagne inverse solution.

References

[1] Cai, C., Kang, H., Hashemi, A., Chen, D., Diwakar, M., Haufe, S., … & Nagarajan, S. S. (2022). Bayesian algorithms for joint estimation of brain activity and noise in electromagnetic imaging. IEEE Transactions on Medical Imaging.

mackay_champagne(Y, alpha, max_iter=1000, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08)#

Majority Maximization Champagne method.

Parameters
  • Y (array, shape (n_sensors,)) – measurement vector, capturing sensor measurements

  • alpha (float) – The regularization parameter.

  • max_iter (int, optional) – The maximum number of inner loop iterations

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

x – Parameter vector, e.g., source vector in the context of BSI (x in the cost function formula).

Return type

numpy.ndarray

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=1000, noise_cov=None, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum number of iterations.

  • noise_cov ([None, numpy.ndarray]) – The noise covariance matrix. Use “None” if not available.

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

self

Return type

object returns itself for convenience

class invert.solvers.empirical_bayes.SolverEMChampagne(name='EM-Champagne', **kwargs)#

Class for the Expectation Maximization Champagne inverse solution.

References

[1] Hashemi, A., & Haufe, S. (2018, September). Improving EEG source localization through spatio-temporal sparse Bayesian learning. In 2018 26th European Signal Processing Conference (EUSIPCO) (pp. 1935-1939). IEEE.

em_champagne(Y, alpha, max_iter=1000, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08)#

Expectation Maximization Champagne method.

Parameters
  • Y (array, shape (n_sensors,)) – measurement vector, capturing sensor measurements

  • alpha (float) – The regularization parameter.

  • max_iter (int, optional) – The maximum number of inner loop iterations

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

x – Parameter vector, e.g., source vector in the context of BSI (x in the cost function formula).

Return type

numpy.ndarray

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=1000, noise_cov=None, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum number of iterations.

  • noise_cov ([None, numpy.ndarray]) – The noise covariance matrix. Use “None” if not available.

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

self

Return type

object returns itself for convenience

class invert.solvers.empirical_bayes.SolverFUN(name='FUN', **kwargs)#

Class for the Full-Structure Noise (FUN) inverse solution.

References

[1] Hashemi, A., Cai, C., Gao, Y., Ghosh, S., Müller, K. R., Nagarajan, S. S., & Haufe, S. (2022). Joint learning of full-structure noise in hierarchical Bayesian regression models. IEEE Transactions on Medical Imaging.

make_fun(Y, max_iter=1000, prune=False, pruning_thresh=0.001, convergence_criterion=1e-08)#

Majority Maximization Champagne method.

Parameters
  • Y (array, shape (n_sensors,)) – measurement vector, capturing sensor measurements

  • max_iter (int, optional) – The maximum number of inner loop iterations

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

x – Parameter vector, e.g., source vector in the context of BSI (x in the cost function formula).

Return type

numpy.ndarray

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=1000, noise_cov=None, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08, return_noise_cov=False, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum number of iterations.

  • noise_cov ([None, numpy.ndarray]) – The noise covariance matrix. Use “None” if not available.

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

self

Return type

object returns itself for convenience

class invert.solvers.empirical_bayes.SolverHSChampagne(name='HS-Champagne', **kwargs)#

Class for the Homoscedastic Champagne (HS-Champagne) inverse solution.

References

[1] Hashemi, A., Cai, C., Gao, Y., Ghosh, S., Müller, K. R., Nagarajan, S. S., & Haufe, S. (2022). Joint learning of full-structure noise in hierarchical Bayesian regression models. IEEE Transactions on Medical Imaging.

make_hs_champagne(Y, max_iter=1000, prune=False, pruning_thresh=0.001, convergence_criterion=1e-08, update_noise=True)#

Homoscedastic Champagne method.

Parameters
  • Y (array, shape (n_sensors,)) – measurement vector, capturing sensor measurements

  • max_iter (int, optional) – The maximum number of inner loop iterations

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

x – Parameter vector, e.g., source vector in the context of BSI (x in the cost function formula).

Return type

numpy.ndarray

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=1000, noise_cov=None, prune=False, pruning_thresh=0.001, convergence_criterion=1e-08, return_noise_cov=False, update_noise=True, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum number of iterations.

  • noise_cov ([None, numpy.ndarray]) – The noise covariance matrix. Use “None” if not available.

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

self

Return type

object returns itself for convenience

class invert.solvers.empirical_bayes.SolverLowSNRChampagne(name='LowSNR-Champagne', **kwargs)#

Class for the LOW SNR Champagne inverse solution.

References

[1] Hashemi, A., & Haufe, S. (2018, September). Improving EEG source localization through spatio-temporal sparse Bayesian learning. In 2018 26th European Signal Processing Conference (EUSIPCO) (pp. 1935-1939). IEEE.

low_snr_champagne(Y, alpha, max_iter=1000, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08)#

Low SNR Champagne method.

Parameters
  • Y (array, shape (n_sensors,)) – measurement vector, capturing sensor measurements

  • alpha (float) – The regularization parameter.

  • max_iter (int, optional) – The maximum number of inner loop iterations

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

x – Parameter vector, e.g., source vector in the context of BSI (x in the cost function formula).

Return type

numpy.ndarray

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=1000, noise_cov=None, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum number of iterations.

  • noise_cov ([None, numpy.ndarray]) – The noise covariance matrix. Use “None” if not available.

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

self

Return type

object returns itself for convenience

class invert.solvers.empirical_bayes.SolverMMChampagne(name='MM-Champagne', **kwargs)#

Class for the Majority Maximization Champagne inverse solution.

References

[1] Hashemi, A., & Haufe, S. (2018, September). Improving EEG source localization through spatio-temporal sparse Bayesian learning. In 2018 26th European Signal Processing Conference (EUSIPCO) (pp. 1935-1939). IEEE.

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=1000, noise_cov=None, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum number of iterations.

  • noise_cov ([None, numpy.ndarray]) – The noise covariance matrix. Use “None” if not available.

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

self

Return type

object returns itself for convenience

mm_champagne(Y, alpha, max_iter=1000, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08)#

Majority Maximization Champagne method.

Parameters
  • Y (array, shape (n_sensors,)) – measurement vector, capturing sensor measurements

  • alpha (float) – The regularization parameter.

  • max_iter (int, optional) – The maximum number of inner loop iterations

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

x – Parameter vector, e.g., source vector in the context of BSI (x in the cost function formula).

Return type

numpy.ndarray

class invert.solvers.empirical_bayes.SolverMacKayChampagne(name='MacKay-Champagne', **kwargs)#

Class for the MacKay Champagne (MacKay) inverse solution.

References

[1] Cai, C., Kang, H., Hashemi, A., Chen, D., Diwakar, M., Haufe, S., … & Nagarajan, S. S. (2022). Bayesian algorithms for joint estimation of brain activity and noise in electromagnetic imaging. IEEE Transactions on Medical Imaging.

mackay_champagne(Y, alpha, max_iter=1000, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08)#

Majority Maximization Champagne method.

Parameters
  • Y (array, shape (n_sensors,)) – measurement vector, capturing sensor measurements

  • alpha (float) – The regularization parameter.

  • max_iter (int, optional) – The maximum number of inner loop iterations

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

x – Parameter vector, e.g., source vector in the context of BSI (x in the cost function formula).

Return type

numpy.ndarray

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=1000, noise_cov=None, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum number of iterations.

  • noise_cov ([None, numpy.ndarray]) – The noise covariance matrix. Use “None” if not available.

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

Returns

self

Return type

object returns itself for convenience

class invert.solvers.empirical_bayes.SolverTEMChampagne(name='TEM-Champagne', **kwargs)#

Class for the Temporal Expectation Maximization Champagne (T-EM Champagne) inverse solution.

References

[1] Hashemi, A., & Haufe, S. (2018, September). Improving EEG source localization through spatio-temporal sparse Bayesian learning. In 2018 26th European Signal Processing Conference (EUSIPCO) (pp. 1935-1939). IEEE.

make_inverse_operator(forward, mne_obj, *args, alpha='auto', max_iter=1000, noise_cov=None, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08, theta=0.01, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • max_iter (int) – Maximum number of iterations.

  • noise_cov ([None, numpy.ndarray]) – The noise covariance matrix. Use “None” if not available.

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

  • theta (float) – Another regularization term

Returns

self

Return type

object returns itself for convenience

tem_champagne(Y, alpha, max_iter=1000, prune=True, pruning_thresh=0.001, convergence_criterion=1e-08, theta=0.01)#

Temporal Trade-Off Expectation Maximization Champagne method.

Parameters
  • Y (array, shape (n_sensors,)) – measurement vector, capturing sensor measurements

  • alpha (float) – The regularization parameter.

  • max_iter (int, optional) – The maximum number of inner loop iterations

  • prune (bool) – If True, the algorithm sets small-activity dipoles to zero (pruning).

  • pruning_thresh (float) – The threshold at which small gammas (dipole candidates) are set to zero.

  • convergence_criterion (float) – Minimum change of loss function until convergence is assumed.

  • theta (float) – Another regularization term

Returns

x – Parameter vector, e.g., source vector in the context of BSI (x in the cost function formula).

Return type

numpy.ndarray