Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Scikit learn Scikit learn FastICA

From Leeroopedia


Knowledge Sources
Domains Signal Processing, Independent Component Analysis
Last Updated 2026-02-08 15:00 GMT

Overview

Concrete tool for Independent Component Analysis using the FastICA algorithm provided by scikit-learn.

Description

FastICA is a fast algorithm for Independent Component Analysis (ICA) that separates a multivariate signal into additive, independent non-Gaussian components. The implementation is based on the fixed-point iteration scheme described by Hyvarinen et al. and supports both parallel (symmetric) and deflation approaches to decorrelation. It can optionally whiten the data before performing ICA to ensure uncorrelated outputs.

Usage

Use FastICA when you need to perform blind source separation, such as separating mixed audio signals (the cocktail party problem), or when you want to find statistically independent components in your data. It is also useful as a preprocessing step for feature extraction where independence rather than mere uncorrelatedness is desired.

Code Reference

Source Location

Signature

class FastICA(ClassNamePrefixFeaturesOutMixin, TransformerMixin, BaseEstimator):
    def __init__(
        self,
        n_components=None,
        *,
        algorithm="parallel",
        whiten="unit-variance",
        fun="logcosh",
        fun_args=None,
        max_iter=200,
        tol=1e-4,
        w_init=None,
        whiten_solver="svd",
        random_state=None,
    ):

Import

from sklearn.decomposition import FastICA

I/O Contract

Inputs

Name Type Required Description
n_components int No Number of components to use. If None, all are used.
algorithm str No Algorithm to use: 'parallel' or 'deflation' (default='parallel').
whiten str or bool No Whitening strategy: 'unit-variance', 'arbitrary-variance', or False (default='unit-variance').
fun str or callable No Neg-entropy approximation function: 'logcosh', 'exp', 'cube', or callable (default='logcosh').
fun_args dict No Arguments to send to the functional form.
max_iter int No Maximum number of iterations during fit (default=200).
tol float No Convergence tolerance for the un-mixing matrix (default=1e-4).
w_init array-like No Initial un-mixing array of shape (n_components, n_components).
whiten_solver str No Solver for whitening: 'eigh' or 'svd' (default='svd').
random_state int or RandomState No Random state for reproducibility.

Outputs

Name Type Description
components_ ndarray of shape (n_components, n_features) The linear operator to apply to the data to get independent sources.
mixing_ ndarray of shape (n_features, n_components) The pseudo-inverse of components_, the mixing matrix.
mean_ ndarray of shape (n_features,) Mean over features, computed from the training set.
whitening_ ndarray of shape (n_components, n_features) The whitening matrix used to decorrelate the data.
n_iter_ int Number of iterations used to converge.

Usage Examples

Basic Usage

import numpy as np
from sklearn.decomposition import FastICA

# Generate sample data
rng = np.random.RandomState(0)
S = rng.standard_t(1.5, size=(200, 3))
A = rng.randn(3, 3)
X = S @ A.T  # Mix the signals

ica = FastICA(n_components=3, random_state=0)
S_recovered = ica.fit_transform(X)
print(S_recovered.shape)  # (200, 3)
print(ica.mixing_.shape)  # (3, 3)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment