ML | Independent Component Analysis
Last Updated :
10 Feb, 2025
Independent Component Analysis (ICA) is a technique used to separate mixed signals into their independent, non-Gaussian components. It aims to find a linear transformation of data that maximizes statistical independence among the components.
ICA is widely applied in fields like audio, image processing, and biomedical signal analysis to isolate distinct sources from mixed signals
Statistical Independence Concept
Statistical independence refers to the idea that two random variables, X and Y, are independent if knowing one does not affect the probability of the other. Mathematically, this means the joint probability of X and Y is equal to the product of their individual probabilities.
[Tex]P(X and Y) = P(X) * P(Y)[/Tex] or [Tex] P(X \cap Y) = P(X) * P(Y)[/Tex]
Assumptions in ICA
- ICA operates under two key assumptions:
- 1. The source signals are statistically independent of each other.
- 2. The source signals have non-Gaussian distributions. These assumptions allow ICA to effectively separate mixed signals into independent components, a task that traditional methods like PCA cannot achieve
Mathematical Representation of ICA
So far, we have discussed about the basics of ICA, but lets jump into the mathematical representation of independent component analysis in brief.
The observed random vector is [Tex]X= (x_1 , …, x_m )^T[/Tex], representing the observed data with m components. The hidden components are represented by the random vector [Tex]S = (s_{1} , …, s_{n})^T [/Tex], where n is the number of hidden sources.
Linear Static Transformation
The observed data X is transformed into hidden components S using a linear static transformation representation by the matrix W.
[Tex]S = WX[/Tex]
Here, W = transformation matrix.
The goal is to transform the observed data x in a way that the resulting hidden components are independent. The independence is measured by some function [Tex]F(s_1 , …, s_n)[/Tex]. The task is to find the optimal transformation matrix W that maximizes the independence of the hidden components.
Cocktail Party Problem in ICA
To better understand how Independent Component Analysis (ICA) works, let’s look at a classic example known as the Cocktail Party Problem
Problem Statement: To extract independent sources’ signals from a mixed signal composed of the signals from those sources.
Given: Mixed signal from five different independent sources.
Aim: To decompose the mixed signal into independent sources:
- Source 1
- Source 2
- Source 3
- Source 4
- Source 5
Solution: Independent Component Analysis

Here, there is a party going into a room full of people. There is ‘n’ number of speakers in that room, and they are speaking simultaneously at the party. In the same room, there are also ‘n’ microphones placed at different distances from the speakers, which are recording ‘n’ speakers’ voice signals. Hence, the number of speakers is equal to the number of microphones in the room.
Now, using these microphones’ recordings, we want to separate all the ‘n’ speakers’ voice signals in the room, given that each microphone recorded the voice signals coming from each speaker of different intensity due to the difference in distances between them.
Decomposing the mixed signal of each microphone’s recording into an independent source’s speech signal can be done by using the machine learning technique, independent component analysis.
[Tex][ X_1, X_2, …., X_n ] => [ Y_1, Y_2, …., Y_n ] [/Tex]
where, X1, X2, …, Xn are the original signals present in the mixed signal and Y1, Y2, …, Yn are the new features and are independent components that are independent of each other.
Implementing ICA in Python
FastICA is a specific implementation of the Independent Component Analysis (ICA) algorithm that is designed for efficiency and speed.
Step 1: Import necessary libraries
The implementation requires to import numpy, sklearn, FastICA and matplotlib.
Python
import numpy as np
from sklearn.decomposition import FastICA
import matplotlib.pyplot as plt
Step 2: Generate Random Data and Mix the Signals
In the following code snippet,
- Random seed is set to generate random numbers.
- Samples and Time parameters are defined.
- Synthetic signals are generated and then combined to single matrix “S”.
- Noise is added to each element of the matrix.
- Matrix “A” is defined with coefficients the represent how the original signals are combined to form observed signals.
- The observed signals are obtained by multiplying the matrix “S” by the transpose of the mixing matrix “A”.
Python
# Generate synthetic mixed signals
np.random.seed(42)
samples = 200
time = np.linspace(0, 8, samples)
signal_1 = np.sin(2 * time)
signal_2 = np.sign(np.sin(3 * time))
signal_3 = np.random.laplace(size= samples)
S = np.c_[signal_1, signal_2, signal_3]
S += 0.2 * np.random.normal(size=S.shape)
# Mix the signals
A = np.array([[1, 1, 1], [0.5, 2, 1], [1.5, 1, 2]])
X = S.dot(A.T) # Observed mixed signals
Step 3: Apply ICA to unmix the signals
In the following code snippet,
- An instance of FastICA class is created and number of independent components are set to 3.
- Fast ICA algorithm is applied to the observed mixed signals ‘X’. This fits the model to the data and transforms the data to obtain the estimated independent sources (S_).
Python
ica = FastICA(n_components=3)
S_ = ica.fit_transform(X) # Estimated sources
Step 4: Visualize the signals
Python
# Plot the results
plt.figure(figsize=(8, 6))
plt.subplot(3, 1, 1)
plt.title('Original Sources')
plt.plot(S)
plt.subplot(3, 1, 2)
plt.title('Observed Signals')
plt.plot(X)
plt.subplot(3, 1, 3)
plt.title('Estimated Sources (FastICA)')
plt.plot(S_)
plt.tight_layout()
plt.show()
Output:

Difference between PCA and ICA
Both the techniques are used in signal processing and dimensionality reduction, but they have different goals.
| Principal Component Analysis | Independent Component Analysis |
|---|
| It reduces the dimensions to avoid the problem of overfitting. | It decomposes the mixed signal into its independent sources’ signals. |
| It deals with the Principal Components. | It deals with the Independent Components. |
| It focuses on maximizing the variance. | It doesn’t focus on the issue of variance among the data points. |
| It focuses on the mutual orthogonality property of the principal components. | It doesn’t focus on the mutual orthogonality of the components. |
| It doesn’t focus on the mutual independence of the components. | It focuses on the mutual independence of the components. |
Do Check this article for better understanding :
Advantages of Independent Component Analysis (ICA):
- ICA is a powerful tool for separating mixed signals into their independent components. This is useful in a variety of applications, such as signal processing, image analysis, and data compression.
- ICA is a non-parametric approach, which means that it does not require assumptions about the underlying probability distribution of the data.
- ICA is an unsupervised learning technique, which means that it can be applied to data without the need for labeled examples. This makes it useful in situations where labeled data is not available.
- ICA can be used for feature extraction, which means that it can identify important features in the data that can be used for other tasks, such as classification.
Disadvantages of Independent Component Analysis (ICA):
- ICA assumes that the underlying sources are non-Gaussian, which may not always be true. If the underlying sources are Gaussian, ICA may not be effective.
- ICA assumes that the sources are mixed linearly, which may not always be the case. If the sources are mixed nonlinearly, ICA may not be effective.
- ICA can be computationally expensive, especially for large datasets. This can make it difficult to apply ICA to real-world problems.
- ICA can suffer from convergence issues, which means that it may not always be able to find a solution. This can be a problem for complex datasets with many sources.
Similar Reads
Machine Learning Algorithms
Machine learning algorithms are essentially sets of instructions that allow computers to learn from data, make predictions, and improve their performance over time without being explicitly programmed. Machine learning algorithms are broadly categorized into three types: Supervised Learning: Algorith
9 min read
Top 15 Machine Learning Algorithms Every Data Scientist Should Know in 2025
Machine Learning (ML) Algorithms are the backbone of everything from Netflix recommendations to fraud detection in financial institutions. These algorithms form the core of intelligent systems, empowering organizations to analyze patterns, predict outcomes, and automate decision-making processes. Wi
15 min read
Linear Model Regression
Ordinary Least Squares (OLS) using statsmodels
Ordinary Least Squares (OLS) is a widely used statistical method for estimating the parameters of a linear regression model. It minimizes the sum of squared residuals between observed and predicted values. In this article we will learn how to implement Ordinary Least Squares (OLS) regression using P
3 min read
Linear Regression (Python Implementation)
Linear regression is a statistical method that is used to predict a continuous dependent variable i.e target variable based on one or more independent variables. This technique assumes a linear relationship between the dependent and independent variables which means the dependent variable changes pr
14 min read
ML | Multiple Linear Regression using Python
Linear regression is a fundamental statistical method widely used for predictive analysis. It models the relationship between a dependent variable and a single independent variable by fitting a linear equation to the data. Multiple Linear Regression is an extension of this concept that allows us to
4 min read
Polynomial Regression ( From Scratch using Python )
Prerequisites Linear RegressionGradient DescentIntroductionLinear Regression finds the correlation between the dependent variable ( or target variable ) and independent variables ( or features ). In short, it is a linear model to fit the data linearly. But it fails to fit and catch the pattern in no
5 min read
Bayesian Linear Regression
Linear regression is based on the assumption that the underlying data is normally distributed and that all relevant predictor variables have a linear relationship with the outcome. But In the real world, this is not always possible, it will follows these assumptions, Bayesian regression could be the
11 min read
How to Perform Quantile Regression in Python
In this article, we are going to see how to perform quantile regression in Python. Linear regression is defined as the statistical method that constructs a relationship between a dependent variable and an independent variable as per the given set of variables. While performing linear regression we a
4 min read
Isotonic Regression in Scikit Learn
Isotonic regression is a regression technique in which the predictor variable is monotonically related to the target variable. This means that as the value of the predictor variable increases, the value of the target variable either increases or decreases in a consistent, non-oscillating manner. Mat
6 min read
Stepwise Regression in Python
Stepwise regression is a method of fitting a regression model by iteratively adding or removing variables. It is used to build a model that is accurate and parsimonious, meaning that it has the smallest number of variables that can explain the data. There are two main types of stepwise regression: F
6 min read
Least Angle Regression (LARS)
Regression is a supervised machine learning task that can predict continuous values (real numbers), as compared to classification, that can predict categorical or discrete values. Before we begin, if you are a beginner, I highly recommend this article. Least Angle Regression (LARS) is an algorithm u
3 min read
Linear Model Classification
K-Nearest Neighbors (KNN)
ML | Stochastic Gradient Descent (SGD)
Stochastic Gradient Descent (SGD) is an optimization algorithm in machine learning, particularly when dealing with large datasets. It is a variant of the traditional gradient descent algorithm but offers several advantages in terms of efficiency and scalability, making it the go-to method for many d
8 min read