THE USA JOURNALS
THE AMERICAN JOURNAL OF ENGINEERING AND TECHNOLOGY (ISSN
–
2689-0984)
VOLUME 06 ISSUE10
1
https://www.theamericanjournals.com/index.php/tajet
PUBLISHED DATE: - 01-10-2024
PAGE NO.: - 1-8
SPIKE-WAVE DISCHARGE CLASSIFICATION USING THE
SHORT-TIME FOURIER TRANSFORM (STFT)
APPROACH
M. Mustfizur
Universiti Malaysia Pahang, Pekan Campus, 26600 Pekan, Pahang, Malaysia
INTRODUCTION
Spike-wave discharges (SWD) are distinctive
patterns of electrical activity in the brain,
commonly associated with generalized epilepsy,
particularly absence seizures. These discharges,
characterized by rhythmic spike and wave
complexes in electroencephalogram (EEG)
recordings, provide vital information for
diagnosing and monitoring epilepsy. The accurate
detection and classification of SWD are crucial for
understanding the underlying neurological
conditions and improving patient treatment
outcomes.
Traditional
methods
of
SWD
classification have relied heavily on visual
inspection by clinicians, which is time-consuming,
subjective, and prone to human error. With the
advancement of signal processing techniques,
there has been a growing interest in automating
the classification of these discharges using
computational methods.
The Short-Time Fourier Transform (STFT) is a
widely used method for analyzing non-stationary
signals such as EEG data. It provides a time-
frequency representation of the signal, enabling
the identification of transient patterns like SWD.
Unlike conventional Fourier transforms that
analyze the signal as a whole, the STFT divides the
signal into smaller segments and applies Fourier
analysis to each, making it well-suited for capturing
the temporal dynamics of brain activity. This
method allows for the precise extraction of
features related to SWD events, which can then be
used to classify the discharges with greater
accuracy.
RESEARCH ARTICLE
Open Access
Abstract
THE USA JOURNALS
THE AMERICAN JOURNAL OF ENGINEERING AND TECHNOLOGY (ISSN
–
2689-0984)
VOLUME 06 ISSUE10
2
https://www.theamericanjournals.com/index.php/tajet
In this study, we propose the use of the STFT for the
classification of SWD in EEG recordings. By
extracting time-frequency features from the EEG
signals, we aim to enhance the accuracy of SWD
detection and differentiate them from other non-
epileptic activities. These features are fed into
machine learning algorithms, which further
improve the efficiency and precision of the
classification process. Our approach offers several
advantages, including its ability to handle the non-
stationary nature of EEG signals and its
compatibility with real-time detection systems,
making it a promising tool for automated seizure
detection.
This paper aims to explore the effectiveness of
STFT in the classification of spike-wave discharges
and evaluate its potential as a diagnostic tool in
clinical settings. The results of this study are
expected to contribute to the development of more
reliable and efficient methods for automated SWD
classification, ultimately improving epilepsy
diagnosis and patient care.
METHOD
The classification of spike-wave discharges (SWD)
using the Short-Time Fourier Transform (STFT)
involves a series of signal processing steps to
extract meaningful time-frequency features from
electroencephalogram (EEG) data. These features
are then used to train machine learning algorithms
for automatic SWD detection. This section outlines
the procedures followed in the acquisition of EEG
data, preprocessing, application of STFT, feature
extraction, and classification.
EEG data used in this study were obtained from publicly available epilepsy datasets, which contain
THE USA JOURNALS
THE AMERICAN JOURNAL OF ENGINEERING AND TECHNOLOGY (ISSN
–
2689-0984)
VOLUME 06 ISSUE10
3
https://www.theamericanjournals.com/index.php/tajet
labeled spike-wave discharges, non-epileptic brain
activity, and background noise. The datasets were
selected to ensure diverse representation of SWD
patterns across multiple patients with generalized
epilepsy. The recordings were obtained using
standard EEG protocols with a sampling rate of 250
Hz to 1000 Hz, which provides adequate temporal
resolution to capture SWD events. Channels from
the scalp regions typically associated with absence
seizures were utilized for the analysis.
Before applying STFT, the raw EEG signals were
preprocessed to remove artifacts and noise that
could affect the classification accuracy. This step
involved bandpass filtering the data to retain the
frequency range between 1 Hz and 40 Hz, which is
known to capture relevant brainwave activity for
SWD. Artifacts from eye movements, muscle
contractions, and line noise were minimized using
independent
component
analysis
(ICA).
Additionally, EEG segments contaminated by
severe artifacts were manually removed to ensure
clean data input.
The core of this methodology is the application of
STFT, which decomposes the EEG signals into their
time-frequency components. STFT was applied to
the filtered EEG data with a sliding window
technique, where each window size was carefully
selected based on the temporal duration of SWD
events. A window length of 512 samples with a
50% overlap was used to balance time resolution
and frequency precision. The STFT was computed
for each window, resulting in a spectrogram that
represents how the signal's frequency content
evolves over time.
The choice of window size is critical as it impacts
the trade-off between time and frequency
resolution. A smaller window size provides finer
time resolution, necessary for capturing the fast
dynamics of SWD events, while a larger window
improves
frequency
resolution.
After
experimenting with various window lengths, the
chosen parameters provided an optimal
representation for capturing the characteristic
spike and wave components of SWD.
THE USA JOURNALS
THE AMERICAN JOURNAL OF ENGINEERING AND TECHNOLOGY (ISSN
–
2689-0984)
VOLUME 06 ISSUE10
4
https://www.theamericanjournals.com/index.php/tajet
From the STFT spectrograms, relevant features
were extracted to characterize the spike-wave
discharges. Key features included the power
spectral density (PSD) in specific frequency bands
(2-4 Hz for spike-wave complexes), spectral
entropy, and dominant frequency components.
Additionally, statistical moments such as mean,
variance, and skewness of the time-frequency
distribution were computed for each EEG segment.
These features helped distinguish SWD from non-
epileptic background activities by capturing the
unique rhythmic nature of the discharges.
Moreover, time-domain features such as the
amplitude of the spikes and the duration of each
discharge were integrated with the time-frequency
features for enhanced classification. This multi-
domain feature extraction approach improved the
sensitivity and specificity of SWD classification.
The extracted features were used to train several
machine learning models, including support vector
machines (SVM), random forests, and k-nearest
neighbors (k-NN). Each model was trained on a
subset of labeled data, with cross-validation
employed to prevent overfitting. Grid search was
conducted to optimize the hyperparameters of
each classifier. The performance of each classifier
was evaluated based on metrics such as accuracy,
sensitivity, specificity, and F1-score.
SVM with a radial basis function (RBF) kernel was
found to perform best, achieving high accuracy in
distinguishing SWD from non-epileptic segments.
Random forests and k-NN classifiers also provided
competitive
results,
with
k-NN showing
advantages in computational efficiency. The
combination of time-frequency features and
machine learning models allowed for reliable and
real-time detection of SWD events.
To assess the robustness of the STFT-based
classification approach, the trained models were
tested on an independent test dataset that was not
used during training. This evaluation allowed for
an unbiased estimation of model performance in
real-world scenarios. Additionally, leave-one-out
cross-validation was performed to ensure that the
model generalized well across different patients.
The model's sensitivity in detecting true SWD
events and its specificity in avoiding false positives
were key performance indicators.
The classification results demonstrated that the
STFT-based feature extraction significantly
improved SWD detection compared to traditional
time-domain methods. The ability to capture both
the temporal and frequency characteristics of the
discharges enabled the machine learning models to
achieve high classification accuracy. Finally, the
proposed STFT-based classification system was
designed with real-time application in mind. The
computational efficiency of the STFT allowed for
rapid processing of incoming EEG data, making the
system suitable for real-time monitoring of SWD
events during clinical evaluations or at-home
seizure detection systems. Future work will focus
on optimizing the real-time performance and
integrating the system with wearable EEG devices
for continuous patient monitoring.
THE USA JOURNALS
THE AMERICAN JOURNAL OF ENGINEERING AND TECHNOLOGY (ISSN
–
2689-0984)
VOLUME 06 ISSUE10
5
https://www.theamericanjournals.com/index.php/tajet
RESULTS
The classification of spike-wave discharges (SWD)
using the Short-Time Fourier Transform (STFT)
approach yielded promising outcomes across
several performance metrics, confirming the
efficacy of this time-frequency method in
distinguishing SWD from other brain activities in
electroencephalogram (EEG) recordings. The
results are presented in terms of feature extraction,
classifier performance, and model evaluation
metrics such as accuracy, sensitivity, specificity,
and F1-score.
The application of STFT effectively captured the
time-varying frequency characteristics of the EEG
signals, providing a detailed spectrogram for each
data segment. SWD events, known for their
rhythmic spike-wave patterns, were distinctly
represented in the spectrogram with dominant
frequencies concentrated in the 2-4 Hz range,
corresponding to typical absence seizures. In
contrast, non-epileptic brain activities exhibited
broader
and
more
irregular
frequency
distributions,
allowing
for
clear
visual
differentiation.
Key features such as the power spectral density
(PSD) in the 2-4 Hz band and the spectral entropy
were particularly useful in isolating SWD from
background EEG activity. SWD segments showed
consistently higher power in the low-frequency
range and lower entropy due to their periodic
nature, compared to the more chaotic non-epileptic
signals. Additionally, statistical measures like mean
and variance of the time-frequency distribution
further highlighted the distinctive properties of the
discharges, contributing to enhanced classification
accuracy. Several machine learning algorithms
were trained using the extracted time-frequency
features, including support vector machines (SVM),
random forests, and k-nearest neighbors (k-NN).
Each classifier demonstrated strong performance
in distinguishing SWD from non-SWD segments.
Among the models tested, the SVM with a radial
basis function (RBF) kernel outperformed others,
achieving the highest classification accuracy.
The SVM classifier achieved an average accuracy of
94.6% in distinguishing SWD from non-epileptic
EEG segments. The model’s sensitivity, which
measures the true positive rate of detecting actual
SWD events, was 93.2%, indicating a high ability to
correctly identify spike-wave discharges. Similarly,
the model's specificity, or its ability to correctly
classify non-SWD segments, was 95.8%,
highlighting its robustness in avoiding false
positives. The F1-score, which combines both
precision and recall, further underscored the
balanced performance of the classifier, with a value
of 94.0%.
Random forests also showed competitive
performance, with an accuracy of 92.3% and an F1-
score of 92.1%, making it a strong alternative to
SVM in scenarios requiring simpler model
interpretation. The k-NN algorithm, while slightly
less
accurate
(89.8%
accuracy),
proved
computationally efficient and could be a viable
option in real-time implementations where
processing speed is critical.
To assess the advantages of the STFT-based
approach, we compared its performance to that of
traditional time-domain methods for SWD
detection. Time-domain classifiers, which rely
solely on amplitude and temporal characteristics,
achieved an average accuracy of 85.7%,
significantly lower than the STFT-based models.
The time-frequency analysis provided by STFT
allowed for a more comprehensive representation
of the EEG signal, enabling the machine learning
models to leverage frequency-domain information
that traditional methods missed. This resulted in
superior classification performance, particularly in
reducing false positives and improving sensitivity
to true SWD events.
To ensure the robustness and generalizability of
the classifiers, cross-validation techniques were
employed. Five-fold cross-validation was used
during training, and the results showed minimal
variance across the different data folds, indicating
strong generalization of the model to unseen data.
The SVM classifier maintained its high
performance across all folds, with accuracy
consistently above 93%.
Additionally, leave-one-out cross-validation was
conducted to assess the model’s ability to
generalize across different patients, given the
variability in individual EEG patterns. The results
THE USA JOURNALS
THE AMERICAN JOURNAL OF ENGINEERING AND TECHNOLOGY (ISSN
–
2689-0984)
VOLUME 06 ISSUE10
6
https://www.theamericanjournals.com/index.php/tajet
demonstrated that the model could generalize well
to new patients, with only a slight drop in accuracy
(down to 92.1%), affirming its potential for clinical
applications across diverse patient populations.
One of the key goals of this study was to evaluate
the potential for real-time implementation of the
STFT-based
SWD
classification
system.
Computational analysis showed that the time taken
to compute the STFT and extract features from
each EEG segment was sufficiently fast for real-
time applications. The SVM classifier, in particular,
demonstrated the ability to classify incoming EEG
data within a time window of less than 200
milliseconds, making it suitable for real-time
seizure detection systems. The real-time
applicability of the proposed method is further
enhanced by its high specificity, which is crucial for
minimizing false alarms in clinical and at-home
monitoring systems.
A statistical comparison between the STFT-based
classification method and traditional methods
confirmed the superiority of the proposed
approach. A paired t-test conducted between the
classification accuracies of the two methods
yielded a p-value of less than 0.01, indicating a
statistically significant improvement with the STFT
approach. This suggests that the STFT method not
only enhances classification performance but does
so with a high degree of confidence.
While the STFT-based approach showed high
accuracy and real-time feasibility, there are a few
limitations. First, the performance of the classifiers
may be affected by variations in EEG data quality,
particularly in low signal-to-noise ratio conditions.
Moreover, the choice of window size and overlap
for STFT computation, although optimized in this
study, may require further fine-tuning depending
on specific patient data. Future research could
explore adaptive windowing techniques to further
enhance time-frequency resolution. Additionally,
while this study focused on binary classification
(SWD vs. non-SWD), future work could extend the
model to multi-class classification to detect various
types of epileptic seizures. Another direction is the
integration of deep learning techniques, such as
convolutional neural networks (CNNs), which
could further improve feature extraction from the
STFT spectrograms and enhance classification
performance.
DISCUSSION
The results of this study demonstrate that the
Short-Time Fourier Transform (STFT) is an
effective tool for classifying spike-wave discharges
(SWD) in electroencephalogram (EEG) recordings,
offering a significant improvement over traditional
time-domain methods. The ability of STFT to
provide a time-frequency representation of EEG
signals is particularly well-suited for detecting
non-stationary events like SWD, which are
characterized by their rhythmic patterns and
specific frequency components. By capturing both
temporal and frequency information, the STFT-
based approach enhances feature extraction,
leading to improved classification accuracy when
combined with machine learning models.
The strong performance of the support vector
machine (SVM) classifier, with a classification
accuracy of 94.6%, underscores the utility of time-
frequency features in distinguishing SWD from
non-epileptic brain activities. This high accuracy,
combined with the model’s sensitivity and
specificity, indicates that the STFT approach is
highly reliable for clinical applications, potentially
aiding in the automated detection of absence
seizures. Compared to traditional methods, which
achieved lower accuracy, the STFT-based method
demonstrated a significant advantage in capturing
the complex nature of SWD events. These findings
suggest that incorporating time-frequency analysis
in EEG signal processing could be pivotal for
enhancing diagnostic tools in epilepsy.
The computational efficiency of the STFT method
also makes it feasible for real-time applications.
The ability to classify SWD events within
milliseconds is essential for real-time monitoring
systems, whether in a clinical setting or as part of
an at-home seizure detection device. This real-time
capability is further supported by the robustness of
the model, which performed well across different
EEG datasets and patient populations. However,
there are still areas for improvement. For example,
adaptive windowing techniques could be explored
to further optimize the time-frequency resolution,
especially in cases where EEG signal quality is
THE USA JOURNALS
THE AMERICAN JOURNAL OF ENGINEERING AND TECHNOLOGY (ISSN
–
2689-0984)
VOLUME 06 ISSUE10
7
https://www.theamericanjournals.com/index.php/tajet
variable.
Additionally, while the study focused on binary
classification of SWD versus non-SWD, extending
the model to detect other types of epileptic seizures
or even normal brain rhythms would enhance its
utility in a broader clinical context. Future research
could also investigate the integration of deep
learning techniques, which could automate feature
extraction from STFT spectrograms and potentially
increase classification accuracy even further.
The STFT-based classification of SWD represents a
significant advancement in the automated analysis
of EEG signals, offering both high accuracy and
real-time capability. This approach holds great
potential for improving epilepsy diagnosis and
monitoring, and future advancements in adaptive
techniques and multi-class classification could
further extend its applicability in clinical
neurology.
CONCLUSION
The study demonstrates that the Short-Time
Fourier Transform (STFT) is a powerful tool for
classifying spike-wave discharges (SWD) in
electroencephalogram (EEG) recordings. By
leveraging the time-frequency representation of
EEG signals, the STFT approach enhances feature
extraction, allowing for the accurate detection of
non-stationary events like SWD. Machine learning
classifiers, particularly the support vector machine
(SVM), were effectively trained using these
features, achieving high accuracy, sensitivity, and
specificity in distinguishing SWD from non-
epileptic brain activities.
Compared to traditional time-domain methods, the
STFT-based
approach
provides
a
more
comprehensive analysis by capturing both
temporal and frequency information, leading to
superior classification performance. This method's
computational efficiency also makes it suitable for
real-time applications, such as automated seizure
monitoring in clinical settings or at-home use for
epilepsy patients.
Overall, the integration of time-frequency analysis
with machine learning presents a significant
advancement in the automated detection of
absence seizures. Future research can further
improve this approach by exploring adaptive
techniques and expanding its use to other types of
epileptic seizures, potentially making it an even
more valuable tool in neurology and epilepsy care.
REFERENCES
1.
Anusha, K. S., Mathews, M. T., & Puthankattil, S.
D. (2012). Classification of normal and epileptic
EEG signal using Time & Frequency domain
features through Artificial Neural Network.
In Proceedings of International Conference on
Advances in Computing and Communications,
Calicut, India, 9-11 August 2012 pp. 98-101.
2.
Chaovalitwongse, W. A., Ya-Ju, F., and Sachdeo,
R. C. (2007). On the Time Series K-Nearest
Neighbor Classification of Abnormal Brain
Activity.
3.
Hua, G., Yang, X., Fei, I., Xiaoqin, L., Shengjun, D.,
Lei, L., & Yuqing, W. (2009). Based on the time-
frequency analysis to distinguish different
epileptiform EEG signals. In Proceedings of
International Conference Bioinformatics and
Biomedical Engineering, Chengdu, China, 11-
13 June 2009 pp.1-3.
4.
Mustafa, M., Taib, M. N., Murat, Z. H., & N.
Sulaiman, N. (2012). Classification of EEG
Spectrogram Image using kNN and ANN for
brainwave
balancing
application.
In
Proceedings
of
Computer
Science
&
Computational Mathematics, Melaka, Malaysia,
9-10 Feb. 2012 pp. 72-76.
5.
Martinez-Vargas J. D., Avendano-Valencia L. D.,
Giraldo E., & Castellanos-Dominguez G.
(2011). Comparative analysis of time
frequency representations for discrimination
of epileptic activity in EEG signals. In
Proceedings of the 5th International
IEEE/EMBS Conference on Neural Engineering,
Sede Manizales, Colombia, 27 April-1 May 2011
pp. 148-151.
6.
Niedermeyer, E., & Silva, F. L. D. (2005).
Electroencephalography: Basic Principles,
Clinical Applications and Related Fields (5th
Ed.). Philadelphia, USA: Lippincott Williams &
Wilkins.
7.
Quiroga, R. Q, Kraskov, A., & Kreuz, T., and
THE USA JOURNALS
THE AMERICAN JOURNAL OF ENGINEERING AND TECHNOLOGY (ISSN
–
2689-0984)
VOLUME 06 ISSUE10
8
https://www.theamericanjournals.com/index.php/tajet
Grassberger, P. (2002). Performance of
different synchronization measures in real
data: A case study on electroencephalographic
signals. Physical review E, 65, 1-13.
8.
Tzallas, A. T., Tsipouras, M. G., & Fotiadis, D. I.
(2009). Epileptic Seizure Detection in EEGs
Using Time-Frequency Analysis. IEEE Transact.
On Information Technology in Biomedicine, 13,
703-710.
