Skip to main content
MahiDev — Learn. Build. Become AI-ready.

Lesson 48

Independent Component Analysis

Unmix combined signals into sources that are statistically independent, not just uncorrelated. One example is on this page.

Intermediate12 min
Independent Component Analysis MahiDev

What You Will Learn

  • Idea
  • Example
  • When to use it

Idea

Independent component analysis assumes the columns you see are mixtures of hidden sources. It searches for a mixing that makes the recovered sources independent. PCA only forces axes to be uncorrelated and ranked by variance. ICA cares about independence.

Example

python
import numpy as np
from sklearn.decomposition import FastICA

rng = np.random.default_rng(0)
sources = rng.normal(size=(200, 2))
mix = np.array([[1.0, 1.0], [1.0, -1.0]])
X = sources @ mix.T
recovered = FastICA(n_components=2, random_state=0, whiten="unit-variance").fit_transform(X)
print(f"recovered shape: {tuple(recovered.shape)}")

Output:

text
recovered shape: (200, 2)

When to use it

  • Use it when several sensors record overlapping signals, such as audio or sensors.
  • The recovered order and sign can flip. Match sources by looking, not by column index.
  • Whiten the data first. FastICA can do that for you.

Loading playground…