Electroencephalography (EEG) and electrocardiography (ECG) not only reflect physiological activity but can also predict brain age and identify specific mental activities. As the importance of their complex features becomes increasingly prominent, MATLAB, as a powerful signal processing tool, is gaining favor among researchers.
Written by Wu Dake
Edited by Wei Xiao
A study published in May by the American Academy of Sleep Medicine in the journal Sleep collected EEG signals from subjects during sleep and trained deep neural networks (DNN) to predict brain age (BAI). Researchers found that the absolute difference between predicted brain age and actual age (IBAI) is related to the risk of various diseases such as depression, epilepsy, and stroke.
EEG-based signal algorithms can not only analyze brain age but also identify mental activities. A 2020 study by Skolkovo Institute of Science and Technology compared various algorithms used for EEG analysis in this field. It found that no single algorithm can independently achieve comprehensive and accurate EEG feature analysis and emotional classification: convolutional neural networks (CNN) can make the most accurate judgments about mental workload, but their ability to classify emotions is slightly inferior to that of algorithms like the Riemannian geometry classifier (RGC). Researchers pointed out that the best analytical approach for brain-computer interaction (BCI) should be led by more complex artificial intelligence methods and combined with other technologies for processing and analyzing time series signals.
In everyday applications such as wearable devices, collecting EEG signals poses certain challenges, and ECG is expected to become an effective alternative.
Combining Signal Processing and Machine Learning to Facilitate Emotion Classification Research and Applications
A study published on May 11 in Applied Sciences achieved efficient emotion recognition based on ECG by combining wavelet analysis and neural network classification. The researchers also collaborated with textile manufacturers to deploy the results in T-shirts as wearable devices.
The T-shirt, which inherits signal processing and neural network components, can collect ECG and recognize emotions.
Source: Paper
The combination of artificial intelligence and traditional signal processing algorithms is one of the important factors for the success of this research and development. The various MATLAB tools used by the team provided vital support for signal processing, model development, training, and final deployment:
1) The team used the wavelet scattering function from the Signal Processing Toolbox to convolve, modulate, and filter ECG signals, extracting complex features that cannot be directly obtained from the time or frequency domain.
2) The team selected linear combinations of effective features using Principal Component Analysis (PCA) from the Classification Learner App, reducing the dimensionality of the data for easier and faster subsequent analysis. They also tried various classification models in the Classification Learner App, including Linear Discriminant Analysis (LDA), Decision Trees (DT), and K-Nearest Neighbors (KNN).
The team ultimately selected the best-performing Ensemble and KNN classifiers to categorize the pre-processed wavelet signals, achieving over 80% accuracy.
Accuracy of 10-NN and Ensemble analysis on ECG
Source: Paper
Signal processing analysis is a traditional strength of MATLAB. Wavelet scattering is an important signal processing method. By converting signals into time-invariant representations through wavelet scattering, it can help classifiers perform better classification. MATLAB’s waveletScattering function provides convenient wavelet scattering capabilities, allowing for quick processing and visualization with simple code:
Wavelet time scattering and plotting
Source: MATLAB Documentation Example
For researchers studying EEG, ECG, and many similar topics, the complex mathematics and computer knowledge required for signal processing can often become obstacles on the research path. Compared to “reinventing the wheel”, the tools included in MATLAB simplify the application difficulty. Just a few lines of code can achieve basic functionality, and all functions and parameters involved can be thoroughly understood and quickly accessed through MATLAB’s documentation and help functions.
From Data Collection to Model Deployment, MATLAB Efficiently Integrates the Entire AI Workflow
Artificial intelligence is not only a trend of the times but also an algorithm that the scientific and technological field of emotion recognition will rely on in the future. In addition to its powerful and user-friendly signal processing capabilities, MATLAB also has unique advantages as a deep learning tool.
Building and training models is a core part of the artificial intelligence workflow, and MATLAB provides a well-packaged process for quickly and easily building and training neural network models.
The MATLAB code for building neural network structures is simple and understandable, integrating the visualization of training results. Source: MATLAB Documentation
MATLAB is inherently based on matrix operations, which aligns perfectly with the underlying mathematics of neural networks, placing it at the forefront of efficiency. Moreover, these operational capabilities are significantly expanded through toolboxes, making them powerful and user-friendly. More importantly, unlike platforms like TensorFlow that focus on neural network research and development, MATLAB itself includes most of the functionalities needed for the entire workflow of artificial intelligence project development: preprocessing, labeling, building and training models, and finally transforming and deploying applications.
As the top choice for research and development in the signal field, MATLAB is one of the best tools for preprocessing time series data, and this advantage also gives MATLAB-based labeling work higher efficiency. The Signal Labeler tool can not only help operators complete data labeling faster with a graphical interface, but it can also automatically label data with known features by combining signal algorithms. This greatly improves the efficiency of preparing datasets for supervised learning.
Signal Labeler
Source: MATLAB Documentation
After training is completed, the model needs to be transformed into a program that can run on the target device to create usable artificial intelligence terminal devices. MATLAB’s Code Replacement has powerful code replacement capabilities, allowing generated code to be replaced for specific environments or devices, helping developers complete the final step of practical application of the model.
Efficient and reliable emotion recognition requires the combination of signal processing and artificial intelligence. MATLAB’s usability at the intersection of these two areas has already helped researchers uncover numerous mysteries. In the future, MATLAB’s complete workflow will further promote fundamental research and transformation, ultimately achieving efficient and reliable analysis of human emotions and allowing portable and accurate artificial intelligence emotion monitoring devices to enter clinical applications and daily life.
Further Reading:
Main References:
[1] https://academic.oup.com/sleep/article-abstract/44/Supplement_2/A214/6260205?redirectedFrom=fulltext
[2] https://ieeexplore.ieee.org/document/9141493
[3] https://www.mdpi.com/2076-3417/11/11/4945/htm
Cover image source: Pixabay