amica.AmicaResult#
- class amica.AmicaResult(unmixing_matrix_white_, mixing_matrix_white_, unmixing_matrix_sensor_, mixing_matrix_sensor_, whitener_, dewhitener_, mean_, alpha_, mu_, rho_, sbeta_, c_, gm_, log_likelihood, n_iter, iteration_times=<factory>, elapsed_times=<factory>, converged=False, data_scale=1.0, model_posteriors_=None, sample_mask_=None, n_rejected_=0)[source]#
Bases:
objectContainer for AMICA results.
- Attributes:
- unmixing_matrix_white_
np.ndarray,shape(n_components,n_components) Unmixing matrix W in whitened space:
sources = W @ x_white.- mixing_matrix_white_
np.ndarray,shape(n_components,n_components) Mixing matrix A in whitened space:
x_white = A @ sources + c.- unmixing_matrix_sensor_
np.ndarray,shape(n_components,n_channels) Full unmixing in sensor space:
W @ sphere.- mixing_matrix_sensor_
np.ndarray,shape(n_channels,n_components) Full mixing in sensor space:
desphere @ A.- whitener_
np.ndarray,shape(n_components,n_channels) Sphering/whitening matrix S.
- dewhitener_
np.ndarray,shape(n_channels,n_components) Dewhitening matrix (pseudo-inverse of sphere).
- mean_
np.ndarray,shape(n_channels,) Data mean removed during preprocessing.
- alpha_
np.ndarray,shape(n_mix,n_components)or(n_models,n_mix,n_components) Mixture weights for each component.
- mu_
np.ndarray,shape(n_mix,n_components)or(n_models,n_mix,n_components) Location parameters.
- rho_
np.ndarray,shape(n_mix,n_components)or(n_models,n_mix,n_components) Shape parameters.
- sbeta_
np.ndarray,shape(n_mix,n_components)or(n_models,n_mix,n_components) Scale parameters (inverse beta).
- c_
np.ndarray,shape(n_components,)or(n_models,n_components) Model centers.
- gm_
np.ndarray,shape(n_models,) Model weights (for multi-model).
- log_likelihood
np.ndarray,shape(n_iter,) Log-likelihood per iteration.
- iteration_times
np.ndarray,shape(n_iter,) Wall-clock time per iteration in seconds.
- elapsed_times
np.ndarray,shape(n_iter,) Cumulative wall-clock time in seconds.
- n_iter
int Number of iterations performed.
- convergedbool
Whether the algorithm converged.
- sample_mask_
np.ndarrayofbool orNone,shape(n_samples,) Likelihood-based sample-rejection mask over the fit-input samples (True = kept).
Nonewhendo_rejectwas off or never fired. Single-model only; indexes the data passed tofit(post-decim / post-epoch-reject), not the original recording times.- n_rejected_
int Number of samples rejected (
(~sample_mask_).sum()); 0 if no rejection.
- unmixing_matrix_white_
- Parameters:
unmixing_matrix_white_ (ndarray)
mixing_matrix_white_ (ndarray)
unmixing_matrix_sensor_ (ndarray)
mixing_matrix_sensor_ (ndarray)
whitener_ (ndarray)
dewhitener_ (ndarray)
mean_ (ndarray)
alpha_ (ndarray)
mu_ (ndarray)
rho_ (ndarray)
sbeta_ (ndarray)
c_ (ndarray)
gm_ (ndarray)
log_likelihood (ndarray)
n_iter (int)
iteration_times (ndarray)
elapsed_times (ndarray)
converged (bool)
data_scale (float)
model_posteriors_ (ndarray | None)
sample_mask_ (ndarray | None)
n_rejected_ (int)
Notes
Matrix naming convention
AMICA operates in whitened space. Matrices are stored in both spaces with explicit suffixes to avoid ambiguity:
*_white_— whitened space (after sphering)*_sensor_— original sensor space
The relationship is:
sources = unmixing_matrix_white_ @ whitener_ @ (data - mean_) data = mixing_matrix_sensor_ @ sources + mean_
- __init__(unmixing_matrix_white_, mixing_matrix_white_, unmixing_matrix_sensor_, mixing_matrix_sensor_, whitener_, dewhitener_, mean_, alpha_, mu_, rho_, sbeta_, c_, gm_, log_likelihood, n_iter, iteration_times=<factory>, elapsed_times=<factory>, converged=False, data_scale=1.0, model_posteriors_=None, sample_mask_=None, n_rejected_=0)#
- Parameters:
unmixing_matrix_white_ (ndarray)
mixing_matrix_white_ (ndarray)
unmixing_matrix_sensor_ (ndarray)
mixing_matrix_sensor_ (ndarray)
whitener_ (ndarray)
dewhitener_ (ndarray)
mean_ (ndarray)
alpha_ (ndarray)
mu_ (ndarray)
rho_ (ndarray)
sbeta_ (ndarray)
c_ (ndarray)
gm_ (ndarray)
log_likelihood (ndarray)
n_iter (int)
iteration_times (ndarray)
elapsed_times (ndarray)
converged (bool)
data_scale (float)
model_posteriors_ (ndarray | None)
sample_mask_ (ndarray | None)
n_rejected_ (int)
- Return type:
None
Methods
Attributes
- to_mne(info)[source]#
Convert results to MNE ICA object.
AMICA decomposes as:
sources = W @ S @ (x - mean)where W is the unmixing matrix in whitened space and S is the sphering/whitening matrix.MNE’s ICA reconstructs via:
unmixing_full = unmixing_ @ pca_components_[:n_comp]mixing_full = pca_components_.T @ mixing_To make these equivalent we use QR decomposition on the combined transform
W @ Sto extract an orthonormalpca_components_(Q.T) and a squareunmixing_matrix_(R), satisfying MNE’s requirement thatpca_components_has orthonormal rows.- Parameters:
- info
mne.Info Measurement info (from the Raw/Epochs used for fitting).
- info
- Returns:
- ica
mne.preprocessing.ICA Fitted MNE ICA object compatible with plot_components(), get_sources(), apply(), and ICLabel.
- ica