The Power of Independent Component Analysis (ICA) on Real-World Applications — EEG Example

Independent component analysis (ICA) is a powerful data-driven tool capable of separating linear contributions in the data

Rodrigo da Motta C. Carvalho
Towards Data Science

--

Photo by National Cancer Institute on Unsplash

Introduction

Independent component analysis (ICA) is usually associated with dimensionality reduction tasks. However, the technique's most prominent application is separating linear contributions from the data, finding statistically independent components. For example, ICA is widely used as a tool to separate instrument tracks from audio. The objective of this article is to introduce and motivate ICA with the famous “Cocktail Party”example, then, a brief introduction to how ICA extracts independent components, using the basics of probability and information theory. Then, we explore a practical example of eye blink motion identification and removal from electroencephalogram (EEG) data.

Separating contributions from signal and ICA

To better understand the separation of linear contributions from the data, the standard example is the "Cocktail Party". This scenario sets the stage at a bustling cocktail where two individuals engage in conversation, represented by the red (Y1) and blue (Y2) speakers in the room. Thus, two microphones are strategically placed nearby to capture the voices of both individuals, signified by the green (X1) and yellow (X2) microphones. The audibility of these voices varies based on the proximity of the conversationalists to each microphone.

Illustration of the “Cocktail Party”. The signals are capture by the microphones X1 and X2, we want to decompose it to the original sources Y1 e Y2. Image by the author.

The challenge is how to effectively segregate the two distinct voices from each mixed audio file to acquire isolated audio recordings of each speaker. This enigma can be resolved through the adept application of Independent Component Analysis (ICA). Where, with the right assumptions about the data (that we're going to see in the next section), each independent component will be the sound of the blue and red spearer.

Illustration of the ICA decomposition. Image by the author.

Basic mechanism of ICA

Independent Components Analysis (ICA) seeks a representation of data X using a coordinate system S in which the components Si are independent. Such independent coordinate systems arguably form a natural representation of the data.

The most important part here is that ICA assume statistically independent component rather than uncorrelated (such as PCA) [1].

Definition of statistical independence.

Principal Component Analysis (PCA) assume data and components are normally distributed, when this requirement is met PCA components are statistically independent. However, in a general case where data distribution is non-gaussian, ICA is a strong method to find independent components Y (sources) representing the data X (signal).

The ICA transformation is given by Y = AX, where the elements of A are the coefficients that define the components. Therefore, it still is a linear method, because it assumes a linear combination between source and signals.

We can also take the inverse, which means writing the data according to the ICA components

Since we're searching for statistically independent components, we want to minimize the information shared between components.

Therefore, Information theory is a natural candidate to help us solve this problem. There is a measure of information shared by two random variables X and Y, it's called Mutual Information

Hence, we want to minimize the information shared by components,

This is finding A that minimizes I[Y] = I[ AˆT X ]. Thus, the resulting orthogonal vectors lead to most independent components.

Once, we understand the motivation and the basic mechanism behind ICA, let’s apply it in a real-world situation.

Real-World application: Removing eye blink movement from EEG data

Electroencephalography (EEG) data is contaminated by various motion artifacts, which occur by voluntary or involuntary patient movement during image acquisition. A common one is the eye blink movement. Thus, tools such as ICA are widely used techniques to remove these kinds of noise [2]. As already discussed, ICA is a way to separate independent contributions of the signal. Hence, intuitively we should expect an important contribution of eye blink movement in channels closer to the eyes.

EEG measures potential differences across cortical points over time. Therefore, in an EEG experiment, we will have multiple time series from different parts of the cortex with different information about the neural circuits.

EEG time series from multiple channels example. Image by the author.
Location of the channels from the example above. Image by the author.

In order to handle EEG data and apply ICA correctly, we're going to use MNE ( a library for EEG data handling and analysis). Also, we will use data collected by Prof. João Sato at the Federal University of ABC, which is available on GitHub.

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import mne as mne
sns.set_palette('pastel')

eeg = np.loadtxt('/Users/rodrigo/Post-Grad/Disciplines/Neural Signaling Processing/Aula_3/restEEG/OlhosAbertos.txt')
canais = pd.read_csv('/Users/rodrigo/Post-Grad/Disciplines/Neural Signaling Processing/Aula_3/restEEG/NOMEScanais.txt', dtype='str', header=None)

# Sampling frequency 250Hz:
Hz = 250

eeg = pd.DataFrame(eeg, columns=canais.iloc[:,0].values)
eeg['Time(s)'] = np.arange(0, (1/Hz)*len(eeg), 1/Hz)

Creating MNE EEG object.

# Creating MNE object
mne_info = mne.create_info(
list(eeg.columns[:-1]),
Hz,
ch_types=['eeg']*len(eeg.columns[:-1]))

mne_raw = mne.io.RawArray(eeg.iloc[:,:-1].values.T, mne_info)

# Defining the electrodes architecture
standard_1020 = mne.channels.make_standard_montage('standard_1020')
mne_raw.set_montage(standard_1020)

In order to extract just important features, we need to filter the time series to exclude high ( > 120 Hz) and low ( < 4 Hz ) frequencies related to artifacts and noise, and also 60Hz contribution from the environment power line.

# Set filter parameters
lowCut = 4 # Hz
highCut = 120 # Hz
freqNotch = 60 # Hz (eletric interference from the enviroment)

# Apply bandpass and notch filter
mne_raw.filter(lowCut, highCut, fir_design='firwin')
mne_raw.notch_filter(freqNotch, fir_design='firwin')

Now, the data is ready to go through ICA.

ica_obj = mne.preprocessing.ICA(
n_components=0.95,
method='infomax',
max_iter="auto",
random_state=1,
fit_params=dict(extended=True)).fit(mne_raw)

ica = ica_obj.get_sources(mne_raw).get_data()

ica_obj.plot_components(picks=None,show=True, inst=mne_raw)

The ICA coefficients are used as a proxy to identify spatial contribution to the signal component.

Illustration of the procedure to associate values to spatial regions for each component. Image by the author.

Therefore, it's possible to create heat maps for each component.

ICA components. Image by the author.

The first component is the eye blink movement contribution to the signal. As we expected the contribution is greater in electrodes closer to the eyes. It's also possible to see more deeply the time/frequency information of the component.

ICA first component time/frequency information. Image by the author.

Now, to remove the blink movement artefact from the data, we just reconstruct the signal without this specific component. This means recovering the time series without the patterns associated with the artifact.

Conclusion

In conclusion, Independent Component Analysis (ICA) is a powerful data-driven tool, that assumes non-gaussian data and linear relationships between source and signals to seek statistically independent components. ICA allows us to separate different contributions to the data, making it particularly useful in scenarios where noise or unwanted signals need to be isolated. In the case of EEG data, ICA can identify and remove motion artifacts like eye blink movements, which can contaminate the neural signal.

Remarks

It's important to remark that ICA is a powerful tool that should be used with caution. Data-driven methods, do not assume any prior knowledge about the system. Therefore, confusion and spurious conclusions are common, making it essential to check for the requirements and evaluate the results with attention.

Acknowledgements

This project was inspired by Prof. João Ricardo Sato.

The notebook for this article is available here.

References

[1] Hastie T, Tibshirani R, Friedman J, Hastie T, Tibshirani R, et al.. (2009) Basis expansions and regularization. In: The Elements of Statistical Learning, New York, NY: Springer New York, Springer Series in Statistics.

[2] Mennes M, Wouters H, Vanrumste B, Lagae L, Stiers P. (2010).Validation of ICA as a tool to remove eye movement artifacts from EEG/ERP. Psychophysiology. 2010;47(6):1142–1150. doi:10.1111/j.1469–8986.2010.01015.x

--

--