Minimum Norm-Type#
- class invert.solvers.minimum_norm_estimates.SolverDSPM(name='Dynamic Statistical Parametric Mapping', **kwargs)#
- Class for the Dynamic Statistical Parametric Mapping (dSPM) inverse
solution [1,2]. The formulas provided by [3] were used for implementation.
References
[1] Dale, A. M., Liu, A. K., Fischl, B. R., Buckner, R. L., Belliveau, J. W., Lewine, J. D., & Halgren, E. (2000). Dynamic statistical parametric mapping: combining fMRI and MEG for high-resolution imaging of cortical activity. neuron, 26(1), 55-67.
[2] Dale, A. M., Fischl, B., & Sereno, M. I. (1999). Cortical surface-based analysis: I. Segmentation and surface reconstruction. Neuroimage, 9(2), 179-194.
[3] Grech, R., Cassar, T., Muscat, J., Camilleri, K. P., Fabri, S. G., Zervakis, M., … & Vanrumste, B. (2008). Review on solving the inverse problem in EEG source analysis. Journal of neuroengineering and rehabilitation, 5(1), 1-33.
- make_inverse_operator(forward, *args, alpha=0.01, noise_cov=None, source_cov=None, verbose=0, **kwargs)#
Calculate inverse operator.
- Parameters
forward (mne.Forward) – The mne-python Forward model instance.
alpha (float) – The regularization parameter.
noise_cov (numpy.ndarray) – The noise covariance matrix (channels x channels).
source_cov (numpy.ndarray) – The source covariance matrix (dipoles x dipoles). This can be used if prior information, e.g., from fMRI images, is available.
- Returns
self
- Return type
object returns itself for convenience
- class invert.solvers.minimum_norm_estimates.SolverMNE(name='Minimum Norm Estimate', **kwargs)#
- Class for the Minimum Norm Estimate (MNE) inverse solution [1]. The
formulas provided by [2] were used for implementation.
References
[1] Pascual-Marqui, R. D. (1999). Review of methods for solving the EEG inverse problem. International journal of bioelectromagnetism, 1(1), 75-86.
[2] Grech, R., Cassar, T., Muscat, J., Camilleri, K. P., Fabri, S. G., Zervakis, M., … & Vanrumste, B. (2008). Review on solving the inverse problem in EEG source analysis. Journal of neuroengineering and rehabilitation, 5(1), 1-33.
- make_inverse_operator(forward, *args, alpha='auto', verbose=0, **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.minimum_norm_estimates.SolverMinimumL1L2Norm(name='Minimum L1-L2 Norm', **kwargs)#
- Class for the Minimum L1-L2 Norm solution (MCE) inverse solution. It
imposes a L1 norm on the source and L2 on the source time courses.
References
[!] Missing reference - please contact developers if you have it!
- apply_inverse_operator(mne_obj, alpha='auto', max_iter=100, l1_spatial=0.001, l2_temporal=0.001, tol=1e-06) 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
l1_spatial (float) – Controls the spatial L1 regularization
l2_temporal (float) – Controls the temporal L2 regularization
tol (float) – Tolerance at which convergence is met.
- Returns
stc – The mne Source Estimate object.
- Return type
mne.SourceEstimate
- fista_eeg(y, alpha='auto', l1_spatial=0.001, l2_temporal=0.001, max_iter=1000, tol=1e-06)#
Solves the EEG inverse problem using FISTA with L1 regularization on the spatial dimension and L2 regularization on the temporal dimension.
Parameters: - A: array of shape (n_sensors, n_sources) - y: array of shape (n_sensors, n_timepoints) - l1_spatial: float, strength of L1 regularization on the spatial dimension - l2_temporal: float, strength of L2 regularization on the temporal dimension - max_iter: int, maximum number of iterations - tol: float, tolerance for convergence
Returns: - x: array of shape (n_sources, n_timepoints), the solution to the EEG inverse problem
- make_inverse_operator(forward, *args, alpha=0.01, **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.minimum_norm_estimates.SolverMinimumL1Norm(name='Minimum Current Estimate', **kwargs)#
- Class for the Minimum Current Estimate (MCE) inverse solution using the
FISTA solver [1].
References
[1] Beck, A., & Teboulle, M. (2009). A fast iterative shrinkage-thresholding algorithm for linear inverse problems. SIAM journal on imaging sciences, 2(1), 183-202.
- apply_inverse_operator(mne_obj, max_iter=1000, l1_reg=0.001, l2_reg=0, tol=0.01) 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
l1_reg (float) – Controls the spatial L1 regularization
l2_reg (float) – Controls the spatial L2 regularization
tol (float) – Tolerance at which convergence is met.
- Returns
stc – The mne Source Estimate object.
- Return type
mne.SourceEstimate
- fista(y, l1_reg=0.001, l2_reg=0, max_iter=1000, tol=0.01)#
- Solves the EEG inverse problem:
min_x ||y - Ax||_2^2 + l1_reg * ||x||_1 + l2_reg * ||x||_2^2
using the FISTA algorithm.
- Parameters
y (ndarray, shape (m,)) – EEG measurements.
A (ndarray, shape (m, n)) – Forward model.
x0 (ndarray, shape (n,)) – Initial guess for the CSDs.
l1_reg (float, optional (default: 1e-3)) – L1 regularization strength.
l2_reg (float, optional (default: 0)) – L2 regularization strength.
max_iter (int, optional (default: 1000)) – Maximum number of iterations to run.
tol (float, optional (default: 1e-6)) – Tolerance for the stopping criteria.
- Returns
x – Estimated CSDs.
- Return type
ndarray, shape (n,)
- make_inverse_operator(forward, *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.
alpha (float) – The regularization parameter.
- Returns
self
- Return type
object returns itself for convenience
- static soft_threshold(x, alpha)#
Applies the soft thresholding operator to x with threshold alpha.
- Parameters
x (ndarray, shape (n,)) – Input array.
alpha (float) – Threshold.
- Returns
y – Output array.
- Return type
ndarray, shape (n,)
- class invert.solvers.minimum_norm_estimates.SolverMinimumL1NormGPT(name='GPT Solver', **kwargs)#
- Class for the Minimum Current Estimate inverse solution using
interesting code from the Chat GPT AI by openai.com (GPT-solver).
I (Lukas Hecker) prompted the task to write a sparsified eLORETA-type inverse solution and this came up with little adjustments required.
I can’t express how weird it is for me, too.
References
Open AI chat GPT (openai.com)
- apply_inverse_operator(mne_obj, max_iter=1000, l1_reg=0.001, tol=0.01) 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
l1_reg (float) – Controls the spatial L1 regularization
tol (float) – Tolerance at which convergence is met.
- Returns
stc – The mne Source Estimate object.
- Return type
mne.SourceEstimate
- static grad_f(x, A, y_scaled)#
Gradient of the objective function
- 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
- static soft_threshold(x, alpha)#
Applies the soft thresholding operator to x with threshold alpha.
- Parameters
x (ndarray, shape (n,)) – Input array.
alpha (float) – Threshold.
- Returns
y – Output array.
- Return type
ndarray, shape (n,)
- solve(y, l1_reg=0.001, max_iter=1000, tol=0.01)#
- Solves the EEG inverse problem:
min_x ||y - Ax||_2^2 + l1_reg * ||x||_1 + l2_reg * ||x||_2^2
using the FISTA algorithm.
- Parameters
y (ndarray, shape (m,)) – EEG measurements.
l1_reg (float, optional (default: 1e-3)) – L1 regularization strength.
max_iter (int, optional (default: 1000)) – Maximum number of iterations to run.
tol (float, optional (default: 1e-6)) – Tolerance for the stopping criteria.
- Returns
x – Estimated CSDs.
- Return type
ndarray, shape (n,)
- class invert.solvers.minimum_norm_estimates.SolverWMNE(name='Weighted Minimum Norm Estimate', **kwargs)#
- Class for the Weighted Minimum Norm Estimate (wMNE) inverse solution
[1].
References
[1] Grech, R., Cassar, T., Muscat, J., Camilleri, K. P., Fabri, S. G., Zervakis, M., … & Vanrumste, B. (2008). Review on solving the inverse problem in EEG source analysis. Journal of neuroengineering and rehabilitation, 5(1), 1-33.
- make_inverse_operator(forward, *args, alpha='auto', verbose=0, **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