v2.0.0
Loading...
Searching...
No Matches
UTILSLIB::ICA Class Reference

Independent Component Analysis using the FastICA algorithm (deflationary, logcosh nonlinearity). More...

#include <ica.h>

Static Public Member Functions

static IcaResult run (const Eigen::MatrixXd &matData, int nComponents=-1, int maxIter=200, double tol=1e-4, int randomSeed=42)
static Eigen::MatrixXd applyUnmixing (const Eigen::MatrixXd &matData, const IcaResult &result)
static Eigen::MatrixXd excludeComponents (const Eigen::MatrixXd &matData, const IcaResult &result, const QVector< int > &excludedComponents)

Detailed Description

Independent Component Analysis using the FastICA algorithm (deflationary, logcosh nonlinearity).

Typical MEG/EEG usage:

// Fit ICA on raw sensor data (n_channels x n_samples)
IcaResult result = ICA::run(matRawData, 20);
// Inspect source waveforms and mark artifact components (e.g. {0, 3})
QVector<int> exclude = {0, 3};
Eigen::MatrixXd matClean = ICA::excludeComponents(matRawData, result, exclude);
Result of an ICA decomposition.
Definition ica.h:76
static Eigen::MatrixXd excludeComponents(const Eigen::MatrixXd &matData, const IcaResult &result, const QVector< int > &excludedComponents)
Definition ica.cpp:223
static IcaResult run(const Eigen::MatrixXd &matData, int nComponents=-1, int maxIter=200, double tol=1e-4, int randomSeed=42)
Definition ica.cpp:93

Definition at line 98 of file ica.h.

Member Function Documentation

◆ applyUnmixing()

MatrixXd ICA::applyUnmixing ( const Eigen::MatrixXd & matData,
const IcaResult & result )
static

Project new data through a previously fitted unmixing matrix. The same mean centering as during fitting is applied.

Parameters
[in]matDataNew data (n_channels x n_samples), same channel order as training data.
[in]resultResult from a previous ICA::run() call.
Returns
Source matrix (n_components x n_samples).

Definition at line 214 of file ica.cpp.

◆ excludeComponents()

MatrixXd ICA::excludeComponents ( const Eigen::MatrixXd & matData,
const IcaResult & result,
const QVector< int > & excludedComponents )
static

Reconstruct sensor-space data after suppressing selected components. The excluded component(s) are zeroed in source space before back-projection.

Parameters
[in]matDataOriginal sensor data (n_channels x n_samples).
[in]resultResult from ICA::run() on matData (or a representative segment).
[in]excludedComponents0-based indices of components to suppress (e.g. ECG, EOG artifacts).
Returns
Cleaned sensor data (n_channels x n_samples).

Definition at line 223 of file ica.cpp.

◆ run()

IcaResult ICA::run ( const Eigen::MatrixXd & matData,
int nComponents = -1,
int maxIter = 200,
double tol = 1e-4,
int randomSeed = 42 )
static

Fit FastICA on the given data matrix.

Parameters
[in]matDataInput data (n_channels x n_samples). Each row is one sensor channel.
[in]nComponentsNumber of independent components to extract. Pass -1 (default) to use all channels.
[in]maxIterMaximum iterations per component (default 200).
[in]tolConvergence tolerance on |w_new · w_old| - 1 (default 1e-4).
[in]randomSeedSeed for the random weight initialisation (default 42).
Returns
IcaResult containing mixing/unmixing matrices and source time series.

Definition at line 93 of file ica.cpp.


The documentation for this class was generated from the following files: