## 2 Literature Review
### CAP Detection and Classification  
For sleep micro-structure analysis, [PERSON] et al. (1999) pioneered the automatic detection of CAP sequences during sleep. They implemented feature extraction and detection with the maximum likelihood and a variable length template-matched filter [26]. The preliminary results of classifying CAP vs. Non-CAP segments were achieved by using a state machine ruled-based decision system on a group of four middle-aged adults. A tool to analyze the micro and macro-structure of sleep EEG was implemented by [PERSON] et al. (2006) [27]. They detected deep-sleep stages and arousals, the continuous description of slow wave sleep, and the measure of spindling activity by using adaptive time-frequency approximations with the matching pursuit (MP) algorithm. Though quantifiable results were not reported in this research, this tool is relevant due to the interest in automating sleep EEG analysis since 2006. More recently, [PERSON] et al. (2019) [28] implemented a long short-term memory (LSTM) model to detect A-phases and classify them into three subtypes: A1, A2, and A3. From the CAP Sleep Database, they removed epochs marked as \"Awake\" and \"REM Sleep\" and worked with two patient subsets: 16 healthy patients and 30 diagnosed with nocturnal frontal-lobe epilepsy (NFLE). They achieved averaged F1 scores ranging from 57.37% to 67.66% in the different modalities of classification (A-phase vs. non-A-phase and A1 vs. A2 vs. A3 vs. B), as shown in Table 1.  
A two-dimensional convolutional neural network (2D-CNN) was implemented by [PERSON] et al. (2020) [29] to detect A-phases and classify them into the A1, A2, and A3 subtypes by using a different approach. They segmented nine EEG recordings in 4-second  
\begin{table}
\begin{tabular}{p{113.8 pt} p{113.8 pt} p{113.8 pt} p{113.8 pt} p{113.8 pt}} \hline \hline
**Author (Year)** & **Methodology** & **Dataset (Data Subset)** & **Classification** & **Metrics** \\ \hline [PERSON] et al. (2019) [28] & Resampling (128 Hz), removing and feature extraction for an LSTM, with LOO Cross-Validation. & CAP Sleep Database (n = 46: 16 Healthy, vs. B-phase & A-phase vs. Non-A-phase & F1 Score, Recall, Precision, Accuracy, Specificity \\ \hline [PERSON] et al. (2020) [29] & Segmentation (4 s), spectrogram computation. Image classification with a deep 2D-CNN model. & CAP Sleep Database (n = 9: Healthy) & A-phase vs. Non-A-phase & F1 Score, Recall, Precision, Accuracy, Specificity \\ \hline [PERSON] et al. (2021) [30] & Segmentation (2 s), standardization, classification (ID-CNN Model) for sleep stages and CAP patterns. & CAP Sleep Database (n = 6: Healthy) - Unbalanced & A-phase vs. B-phase & F1 Score, Recall, Precision, Accuracy, Specificity \\ \hline [PERSON] et al. (2021) [31] & Segmentation (90 s, shifts of 30 s), band-pass filtering, threshold, adapted [PERSON]’s algorithm with Local analysis (channel F4-C4). & CAP Sleep Database (n = 41: 8 Healthy, 33 Pathological-Diverse) & A-phase vs. Non-A-phase vs. Non-A-phase vs. B-phase vs.  
long epochs and computed their spectrograms, which are visual representations of the frequency content of a time series. They fed the resulting images to a deep 2D-CNN and obtained mean accuracy scores of 88.09% in A-phase detection and 77.31% in A-phase classification (A1 vs. A2 vs. A3). Unfortunately, no other metric is reported, restricting the performance analysis within unbalanced data, which is the case of the A-phase subtypes. The automated detection of CAPs and the classification of sleep stages using a deep neural network was proposed by [PERSON] et al. (2021) [PERSON] et al. (2021). Six healthy patients from the CAP Sleep Database were used to segment, standardize, and classify the sleep stages and CAP patterns with a one-dimensional convolutional neural network model (1D-CNN). [PERSON] et al. (2021) reported F1 scores of 75.34% and 33.04% for CAP detection in a balanced and an unbalanced dataset, respectively.