Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Scikit-Learn · Class

FastICA

FastICA is a transformer for estimating independent sources from mixed observations. It supports configurable component count, whitening, nonlinear contrast functions, iterative convergence, and initialization.

How it works

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.

Syntax

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)

Parameters

NameTypeDescription
n_componentsint, default=NoneNumber of components to use; None uses all components.
algorithm{'parallel', 'deflation'}, default='parallel'FastICA algorithm: parallel or deflation.
whitenstr 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_argsdict, default=NoneExtra arguments passed to the nonlinearity function.
max_iterint, default=200Maximum number of fitting iterations.
tolfloat, default=0.0001Convergence tolerance for updates.
w_initndarray, default=NoneInitial matrix for the algorithm.
whiten_solver{'eigh', 'svd'}, default='svd'Whitening solver, either eigenvalue decomposition or SVD.
random_stateint, RandomState instance or None, default=NoneSeed or random generator controlling randomized behavior.

Returns

fit_transform returns the transformed independent-component representation. After fitting, mixing_ is the estimated mixing matrix.

Key points

  • FastICA estimates independent components from multivariate observations.
  • n_components controls how many source components the estimator extracts; None requests all components.
  • algorithm supports parallel and deflation approaches.
  • max_iter limits the iterations used during fitting.

Common mistakes

  • Setting whiten=False skips preprocessing, so use it only when the input has already been whitened.
  • The default unit-variance whitening changes the scaling of recovered sources; do not interpret source amplitudes as raw mixture amplitudes.
  • whiten_solver affects the whitening computation and accepts only eigh or svd.

Example: Recover independent components

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.

When to use it

Blind source separation

Recover latent signals from recordings containing mixtures of multiple sources.

Independent component extraction

Reduce a multivariate signal into estimated statistically independent components.

Mixture analysis

Use the fitted mixing_ matrix to relate recovered sources to measured features.

Interview questions

QWhat problem does FastICA solve?

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.

QHow do algorithm and whiten differ?

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.

QWhich fitted result helps reconstruct the observed mixtures?

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.PCA
  • sklearn.decomposition.fastica

Source: FastICA — scikit-learn 1.9.1 documentation. Checked 2026-10-15.