Blind source separation
Recover latent signals from recordings containing mixtures of multiple sources.
Scikit-Learn · Class
FastICA is a transformer for estimating independent sources from mixed observations. It supports configurable component count, whitening, nonlinear contrast functions, iterative convergence, and initialization.
FastICA estimates statistically independent sources from observed mixtures. It can whiten the input, choose the number of components, and recover transformed sources through fit_transform while exposing the estimated mixing matrix.
class sklearn.decomposition.FastICA(n_components=None, *, algorithm='parallel', whiten='unit-variance', fun='logcosh', fun_args=None, max_iter=200, tol=0.0001, w_init=None, whiten_solver='svd', random_state=None)| Name | Type | Description |
|---|---|---|
n_components | int, default=None | Number of components to use; None uses all components. |
algorithm | {'parallel', 'deflation'}, default='parallel' | FastICA algorithm: parallel or deflation. |
whiten | str or bool, default='unit-variance' | Whitening strategy: unit-variance, arbitrary-variance, or False. |
fun | {'logcosh', 'exp', 'cube'} or callable, default='logcosh' | Nonlinearity used by the FastICA algorithm. |
fun_args | dict, default=None | Extra arguments passed to the nonlinearity function. |
max_iter | int, default=200 | Maximum number of fitting iterations. |
tol | float, default=0.0001 | Convergence tolerance for updates. |
w_init | ndarray, default=None | Initial matrix for the algorithm. |
whiten_solver | {'eigh', 'svd'}, default='svd' | Whitening solver, either eigenvalue decomposition or SVD. |
random_state | int, RandomState instance or None, default=None | Seed or random generator controlling randomized behavior. |
fit_transform returns the transformed independent-component representation. After fitting, mixing_ is the estimated mixing matrix.
import numpy as np
from sklearn.decomposition import FastICA
rng = np.random.RandomState(0)
t = np.linspace(0, 8, 400)
sources = np.c_[np.sin(2 * t), np.sign(np.sin(3 * t))]
X = sources @ np.array([[1.0, 1.2], [0.5, 2.0]]).T
X += 0.05 * rng.normal(size=X.shape)
ica = FastICA(n_components=2, random_state=0, whiten="unit-variance")
S = ica.fit_transform(X)
print(S.shape, ica.mixing_.shape)Creates two mixed signals, fits FastICA, and obtains the recovered independent components and estimated mixing matrix.
Recover latent signals from recordings containing mixtures of multiple sources.
Reduce a multivariate signal into estimated statistically independent components.
Use the fitted mixing_ matrix to relate recovered sources to measured features.
FastICA is an algorithm for Independent Component Analysis that estimates independent latent sources from observed data. The estimator can first whiten the data and then applies either a parallel or deflation algorithm.
Follow-up: How would you select the number of components? Use n_components to retain the desired number; leaving it as None uses all available components.
The algorithm parameter selects parallel or deflation processing. The whitening strategy is controlled separately by whiten, which can use unit variance, arbitrary variance, or no whitening when the data is already whitened.
Follow-up: When would whiten=False be appropriate? Only when preprocessing has already produced whitened data, because the estimator otherwise assumes the input needs no whitening.
fit_transform fits the estimator and returns the recovered source representation. After fitting, mixing_ provides the estimated mixing matrix, allowing the source representation to be related back to the observed features.
Follow-up: How can reproducibility be improved? Set random_state to a fixed value so randomized behavior is repeatable.
sklearn.decomposition.PCAsklearn.decomposition.fastica