The Wayback Machine - https://web.archive.org/web/20241006094909/https://www.geeksforgeeks.org/ml-independent-component-analysis/
Open In App

ML | Independent Component Analysis

Last Updated : 25 Jan, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Independent Component Analysis is a technique used to separate mixed signals into their independent sources. The application of ICA ranges from audio and image processing to biomedical signal analysis. The article discusses about the fundamentals of ICA.

What is Independent Component Analysis?

Independent Component Analysis (ICA) is a statistical and computational technique used in machine learning to separate a multivariate signal into its independent non-Gaussian components. The goal of ICA is to find a linear transformation of the data such that the transformed data is as close to being statistically independent as possible.

The heart of ICA lies in the principle of statistical independence. ICA identify components within mixed signals that are statistically independent of each other.

Statistical Independence Concept:

It is a probability theory that if two random variables X and Y are statistically independent. The joint probability distribution of the pair is equal to the product of their individual probability distributions, which means that knowing the outcome of one variable does not change the probability of the other outcome.

P(X and Y) = P(X) * P(Y)

or  P(X \cap Y) = P(X) * P(Y)

Assumptions in ICA

  1. The first assumption asserts that the source signals (original signals) are statistically independent of each other.
  2. The second assumption is that each source signal exhibits non-Gaussian distributions.

Mathematical Representation of Independent Component Analysis

The observed random vector is X= (x_1 , ..., x_m )^T  , representing the observed data with m components. The hidden components are represented by the random vector S = (s_{1} , ..., s_{n})^T   , 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.

S = WX

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 F(s_1 , ..., s_n)  . The task is to find the optimal transformation matrix W that maximizes the independence of the hidden components.

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.

Cocktail Party Problem

Consider Cocktail Party Problem or Blind Source Separation problem to understand the problem which is solved by independent component analysis.

Problem: 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.

[ X_1, X_2, ...., X_n ] => [ Y_1, Y_2, ...., Y_n ]

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.

Python3

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”.

Python3

# 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)  # Add noise
 
# Mix the signals
A = np.array([[1, 1, 1], [0.5, 2, 1], [1.5, 1, 2]])  # Mixing matrix
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_).

Python3

ica = FastICA(n_components=3)
S_ = ica.fit_transform(X)  # Estimated sources

                    
[/sourcecode]


Step 4: Visualize the signals

Python3

# 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:

signals-min

Difference between PCA and ICA

Both the techniques are used in signal processing and dimensionality reduction, but they have different goals.

Principal Component AnalysisIndependent 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.

Also Check:

Frequently Asked Questions (FAQs)

Q. What is the difference between PCA and ICA?

PCA emphasize to capture maximum variance and provide uncorrelated components, while ICA focuses onextracting statistically independent components, even if they are correlated, hence, ICA is suitable forblind source separation and signal extraction tasks.

Q. What is the application of ICA?

ICA demonstrate it’s application in diverse field such as signal processing, neuroscience, and finance. It is employed for blind source separation, extracting independent components from mixed signals, leading to advancements in fields like biomedical signal processing, communication systems, and environmental monitoring.

Q. Is ICA for dimensionality reduction?

ICA is a linear dimensionality reduction method, converting a dataset into sets of independent components. The number of independent components extracted by ICA corresponds to the dimensions or features present in the original dataset.



Previous Article
Next Article

Similar Reads

Difference Between Factor Analysis and Principal Component Analysis
Factor Analysis (FA) and Principal Component Analysis (PCA) are two pivotal techniques used for data reduction and structure detection. Despite their similarities, they serve distinct purposes and operate under different assumptions. This article explores the key differences between FA and PCA. Understanding Principal Component Analysis (PCA)Princi
4 min read
Factor Analysis | Data Analysis
Factor analysis is a statistical method used to analyze the relationships among a set of observed variables by explaining the correlations or covariances between them in terms of a smaller number of unobserved variables called factors. Table of Content What is Factor Analysis?What does Factor mean in Factor Analysis?How to do Factor Analysis (Facto
13 min read
Data Analysis through Ethnographic Content Analysis
Ethnographic Content Analysis (ECA) is a qualitative research method that combines the systematic approach of content analysis with the depth and contextual richness of ethnography. This hybrid methodology is particularly useful for exploring complex social phenomena, uncovering patterns, and understanding cultural contexts. In this article, we wil
8 min read
Python - Variations of Principal Component Analysis
Principal Component Analysis (PCA) is an unsupervised dimensionality reduction and visualization technique. It is often referred to as a linear technique because the mapping of new features is given by the multiplication of features by the matrix of PCA eigenvectors. It works by simply identifying the hyperplane that lies close to the data and then
8 min read
Python OpenCV - Connected Component Labeling and Analysis
In this article, we'll learn to implement connected component labeling and analysis using OpenCV in Python. Connected component labeling Component labeling is basically extracting a region from the original image, except that we try to find only the components which are "connected" which is determined by the application of the graph theory. OpenCV
6 min read
Principal Component Analysis(PCA)
As the number of features or dimensions in a dataset increases, the amount of data required to obtain a statistically significant result increases exponentially. This can lead to issues such as overfitting, increased computation time, and reduced accuracy of machine learning models this is known as the curse of dimensionality problems that arise wh
14 min read
Principal Component Analysis with Python
Principal Component Analysis is basically a statistical procedure to convert a set of observations of possibly correlated variables into a set of values of linearly uncorrelated variables. Each of the principal components is chosen in such a way that it would describe most of them still available variance and all these principal components are orth
7 min read
Analysis of test data using K-Means Clustering in Python
This article demonstrates an illustration of K-means clustering on a sample random data using open-cv library. Pre-requisites: Numpy, OpenCV, matplot-lib Let's first visualize test data with Multiple Features using matplot-lib tool. # importing required tools import numpy as np from matplotlib import pyplot as plt # creating two test data X = np.ra
2 min read
Multidimensional data analysis in Python
Multi-dimensional data analysis is an informative analysis of data which takes many relationships into account. Let's shed light on some basic techniques used for analysing multidimensional/multivariate data using open source libraries written in Python. Find the link for data used for illustration from here.Following code is used to read 2D tabula
5 min read
Exploratory Data Analysis in Python | Set 2
In the previous article, we have discussed some basic techniques to analyze the data, now let's see the visual techniques. Let's see the basic techniques - # Loading Libraries import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import trim_mean # Loading Data data = pd.read_csv("state.c
4 min read
Heteroscedasticity in Regression Analysis
Prerequisite: Linear Regression In Simple Linear Regression or Multiple Linear Regression we make some basic assumptions on the error term [Tex]\epsilon [/Tex]. Simple Linear Regression: [Tex] \begin{equation} Y_i = \beta_0 + \beta_1 X_i + \epsilon_i \end{equation} [/Tex] Multiple Linear Regression: [Tex] \begin{equation} Y_i = \beta_0 + \beta_1 X_
3 min read
ML | Adjusted R-Square in Regression Analysis
Prerequisite: Linear Regression, R-square in Regression Why Adjusted-R Square Test: R-square test is used to determine the goodness of fit in regression analysis. Goodness of fit implies how better regression model is fitted to the data points. More is the value of r-square near to 1, better is the model. But the problem lies in the fact that the v
3 min read
Facebook Sentiment Analysis using python
This article is a Facebook sentiment analysis using Vader, nowadays many government institutions and companies need to know their customers' feedback and comment on social media such as Facebook. What is sentiment analysis? Sentiment analysis is one of the best modern branches of machine learning, which is mainly used to analyze the data in order t
6 min read
Python | Customer Churn Analysis Prediction
Customer Churn It is when an existing customer, user, subscriber, or any kind of return client stops doing business or ends the relationship with a company. Types of Customer Churn - Contractual Churn : When a customer is under a contract for a service and decides to cancel the service e.g. Cable TV, SaaS. Voluntary Churn : When a user voluntarily
5 min read
Step by Step Predictive Analysis - Machine Learning
Predictive analytics involves certain manipulations on data from existing data sets with the goal of identifying some new trends and patterns. These trends and patterns are then used to predict future outcomes and trends. By performing predictive analysis, we can predict future trends and performance. It is also defined as the prognostic analysis,
3 min read
Analysis required in Natural Language Generation (NLG) and Understanding (NLU)
Language is the method to share and communicate our understanding and knowledge with one another. Language plays an essential factor when it comes to sharing our knowledge, ideas, and vision. Hence, if we can discover a computational approach of language, we can develop a very sturdy means of communication. We adopt various techniques to completely
11 min read
Stock Price Analysis With Python
Python is a great language for making data-based analyses and visualizations. It also has a wide range of open-source libraries that can be used off the shelf for some great functionalities. Python Dash is a library that allows you to build web dashboards and data visualizations without the hassle of complex front-end HTML, CSS, or JavaScript. In t
3 min read
Conceptual Framework for Solving Data Analysis Problems
Data Science is an interdisciplinary field that focuses on extracting knowledge from data sets which are typically huge in amount. The field encompasses analysis, preparing data for analysis, and presenting findings to inform high-level decisions in an organization. As such, it incorporates skills from computer science, mathematics, statistics, inf
4 min read
Aspect Modelling in Sentiment Analysis
Prerequisite: Sentiment Analysis Before getting into the specifics of Aspect Modelling, let us first briefly understand what Sentiment Analysis is with a real-life example. Sentiment Analysis (SA): It is a technique to distinguish a person's feeling towards something or someone based on a piece of text they have written about it. It could be positi
3 min read
Covid-19 Data Analysis Using Tableau
Tableau is a software used for data visualization and analysis. it's a tool that can make data-analysis easier. Visualizations can be in the form of worksheets or dashboard. Here are some simple steps in creating worksheets and dashboard using covid-19 dataset in Tableau tool. Data link: https://data.world/covid-19-data-resource-hub/covid-19-case-c
4 min read
Regularized Discriminant Analysis
Regularized Discriminant analysis Linear Discriminant analysis and QDA work straightforwardly for cases where a number of observations is far greater than the number of predictors n>p. In these situations, it offers very advantages such as ease to apply (Since we don't have to calculate the covariance for each class) and robustness to the deviat
3 min read
Quadratic Discriminant Analysis
Linear Discriminant Analysis Now, Let's consider a classification problem represented by a Bayes Probability distribution P(Y=k | X=x), LDA does it differently by trying to model the distribution of X given the predictors class (I.e. the value of Y) P(X=x| Y=k): [Tex]P(Y=k | X=x) = \frac{P(X=x | Y=k) P(Y=k)}{P(X=x)}[/Tex] [Tex]= \frac{P(X=x | Y=k)
4 min read
Human Scream Detection and Analysis for Controlling Crime Rate - Project Idea
Project Title: Human Scream Detection and Analysis for Controlling Crime Rate using Machine Learning and Deep Learning Crime is the biggest social problem of our society which is spreading day by day. Thousands of crimes are committed every day, and still many are occurring right now also all over the world. A crime occurs in many faces, it can hap
6 min read
Restaurant Review Analysis Using NLP and SQLite
Normally, a lot of businesses are remained as failures due to lack of profit, lack of proper improvement measures. Mostly, restaurant owners face a lot of difficulties to improve their productivity. This project really helps those who want to increase their productivity, which in turn increases their business profits. This is the main objective of
9 min read
Machine Learning and Analysis of Site Position Data
The content has been removed as per the author's request.
1 min read
Olympics Data Analysis Using Python
In this article, we are going to see the Olympics analysis using Python. The modern Olympic Games or Olympics are leading international sports events featuring summer and winter sports competitions in which thousands of athletes from around the world participate in a variety of competitions. The Olympic Games are considered the world's foremost spo
4 min read
Understanding Semantic Analysis - NLP
Introduction to Semantic AnalysisSemantic Analysis is a subfield of Natural Language Processing (NLP) that attempts to understand the meaning of Natural Language. Understanding Natural Language might seem a straightforward process to us as humans. However, due to the vast complexity and subjectivity involved in human language, interpreting it is qu
6 min read
Sentiment Analysis of Hindi Text - Python
Sentiment Analysis for Indic Language: This article exhibits how to use the library VADER for doing the sentiment analysis of the Indic Language'Hindi'. Sentiment analysis is a metric that conveys how positive or negative or neutral the text or data is. It is performed on textual data to help businesses monitor brand and product sentiment in custom
3 min read
Syntactically analysis in Artificial Intelligence
In this article, we are going to see about syntactically analysing in Artificial Intelligence. Parsing is the process of studying a string of words in order to determine its phrase structure using grammatical rules. We can start with the S sign and search top-down for a tree with the words as its leaves, or we can start with the words and search bo
5 min read
Data Preprocessing, Analysis, and Visualization for building a Machine learning model
In this article, we are going to see the concept of Data Preprocessing, Analysis, and Visualization for building a Machine learning model. Business owners and organizations use Machine Learning models to predict their Business growth. But before applying machine learning models, the dataset needs to be preprocessed. So, let's import the data and st
5 min read
Article Tags :
Practice Tags :