API Reference#

This page documents the stable public API of amica.

Most users will interact with one of two interfaces:

Core API#

Classes#

Amica

Native JAX implementation of AMICA algorithm.

AmicaConfig

Configuration for AMICA algorithm.

AmicaResult

Container for AMICA results.

Functions#

fit_ica

Fit ICA using AMICA on MNE Raw or Epochs data.

Low-level Solver#

amica.amica(X, n_components=None, whiten=False, return_n_iter=False, random_state=None, max_iter=2000, num_mix=3, **kwargs)[source]#

Adaptive Mixture ICA (AMICA).

Returns the (K, W, Y) tuple MNE-Python’s ICA dispatch expects (the calling convention shared by its fastica/infomax/picard methods), used in MNE-Python’s ICA dispatch (method='amica').

Parameters:
Xndarray, shape (n_features, n_samples)

Pre-whitened data, features x samples. This matches MNE’s ICA-method convention; MNE passes data[:, sel].T which gives (n_components, n_samples).

n_componentsint or None

Number of components. If None, uses X.shape[0].

whitenbool

If True, whiten the data internally. MNE always passes False (data is pre-whitened by MNE’s PCA step).

return_n_iterbool

If True, return n_iter as a fourth element: K, W, Y, n_iter.

random_stateint or None

Random seed for reproducibility.

max_iterint

Maximum number of EM iterations.

num_mixint

Number of generalized Gaussian mixture components per source.

**kwargs

Additional parameters passed to AmicaConfig.

Returns:
KNone

Pre-whitening matrix. Always None when whiten=False. Included for the MNE ICA-method signature; MNE discards this value.

Wndarray, shape (n_components, n_components)

Unmixing matrix (operates on whitened data).

Yndarray, shape (n_components, n_samples)

Source matrix: W @ X.

n_iterint

Number of iterations. Only returned when return_n_iter=True, as the fourth element.