Abstract
Abstract
Background
To examine whether the modulating evoked cortical oscillations could be brain signatures among patients with chronic migraine, we investigated cortical modulation using an electroencephalogram with machine learning techniques.
Methods
We directly record evoked electroencephalogram activity during nonpainful, painful, and repetitive painful electrical stimulation tasks. Cortical modulation for experimental pain and habituation processing was analyzed and used to differentiate patients with chronic migraine from healthy controls using a validated machine-learning model.
Results
This study included 80 participants: 40 healthy controls and 40 patients with chronic migraine. Evoked somatosensory oscillations were dominant in the alpha band. Longer latency (nonpainful and repetitive painful) and augmented power (nonpainful and repetitive painful) were present among patients with chronic migraine. However, for painful tasks, alpha increases were observed among healthy controls. The oscillatory activity ratios between repetitive painful and painful tasks represented the frequency modulation and power habituation among healthy controls, respectively, but not among patients with chronic migraine. The classification models with oscillatory features exhibited high performance in differentiating patients with chronic migraine from healthy controls.
Conclusion
Altered oscillatory characteristics of sensory processing and cortical modulation reflected the neuropathology of patients with chronic migraine. These characteristics can be reliably used to identify patients with chronic migraine using a machine-learning approach.
Introduction
Migraine leads to substantial functional disability and causes considerable economic costs, especially when the migraine evolves from episodic migraine (EM) to chronic migraine (CM) (1). Early and accurate detection of CM is pivotal in clinical practice.
Patients with migraine are characterized by altered cortical responsiveness, the malfunctioning of pain control mechanisms, and altered cortical pain processing (2). Consequently, cortical hyperexcitability or central sensitisation is associated with the imbalance of excitatory and inhibitory neurotransmission in the migraine brain (3). Specifically, deficits of cortical habituation and attenuated somatosensory gating have been linked to the severity or treatment outcomes of patients with migraine (4–6). Regarding pain processing, the pain generator or mediator in the peripheral trigeminal system, brainstem and midbrain (7,8), and cortical areas and networks are involved in the dysfunctional modulatory mechanisms of sensory perception. Accordingly, abnormal quantitative sensory tests (9), altered pain processing (4–6,10–12), and reduced habituation (4,6,13) have been observed among patients with migraine. However, whether modulating cortical oscillations for painful (PF) and nonpainful (NP) sensory processing represents a potential brain signature that can be used to discern patients with CM from those without migraine remains debatable.
Although studies have investigated the brain dysfunctions for migraine, they have often reported differences at the group level. Therefore, neurologists still rely on traditional diagnostic tools to diagnose because clinical decisions must be made at the individual level (14). To achieve an individualised diagnosis, we applied a supervised machine-learning (ML) approach (10) to examining evoked oscillatory activities; algorithms have been developed to automatically detect patterns in the data, which are then used to predict or classify future data. This approach may provide a high level of individual characterisation suitable for routine clinical use. Moreover, performing a ML analysis to distinguish a patient with CM can have several potential benefits, even if the condition can be easily and reliably identified on the basis of clinical data. First, clinical diagnosis of patients with CM can be time-consuming considering it starts with a one-month headache diary. A ML based model could identify the CM after just an electroencephalogram (EEG) recording. Second, ML could potentially be used as a biomarker that determine the prognosis of certain treatments and could lead to more personalized and effective treatments. Third, ML can also be used to help researchers better understand the underlying pathophysiological mechanisms of CM.
In this study, we used an EEG to directly record evoked cortical activity in PF and NP stimulations; to analyse the oscillatory responses within an early time window (0–150 ms) in the primary somatosensory cortex; and to examine the cortical modulation for experimental pain and habituation processing. We hypothesized that oscillatory dynamics during sensory processing can define the pathophysiological characteristics of patients with CM, which can then be used to identify diagnoses. This study aimed to unveil the electrophysiological pain-related oscillatory attributes underlying the CM neuropathology and differentiate patients with CM from healthy controls (HC) by using a validated ML model.
Materials and methods
Participants
All participants were 20–60 years old, had no history of systemic or major neurological diseases, and were recruited from the headache clinic of Taipei Veterans General Hospital. Patients with CM were diagnosed according to the International Classification of Headache Disorders, Third Edition (1), and they were naïve to preventive treatment of migraine with prophylactic drugs. Patients with medication overuse headache were excluded. None of the HC participants had personal or family histories of pain disorders. The hospital’s Institutional Review Board approved the study protocol (VGHTPE: IRB 2020-11-004C), and all participants provided written informed consent before study commencement.
Study design
All participants completed semistructured questionnaires that included demographic information, headache profile including the headache days per month and duration of headache attack, and psychometric scales such as the Hospital Anxiety and Depression Scale (HADS) (15). The degree to which the situations in one’s life were considered stressful was examined using the Perceived Stress Scale (PSS). The Headache Impact Test-6 (HIT-6) was used to measure the effects of headache burden (16). Moreover, the Migraine Disability Assessment questionnaire was administered to evaluate migraine-related disability (17). All patients maintained a headache diary after recruitment.
Each participant underwent EEG recording to provide evoked oscillations. The presence of a background or interval headache during this period was allowed for patients with CM (5). For patients with CM, the recording was conducted during the interictal period, arbitrarily defined as the absence of an acute migraine attack in the 2 days before and after the EEG recording. The EEG recording was rescheduled in the event of an acute attack or the use of analgesics, triptans, or ergots for any reason in the 48 h before the recording.
Electroencephalogram recording
Scalp EEG data were collected from an EEG cap housing a 64-electrode BrainVision actiCAP system (Brain Products, Germany) that covered the brain in accordance with the extended international 10–20 system. EEG study design included transcutaneous nonpainful (NP), painful (PF), and repetitive painful (RP) tasks (Figure 1). In the first session, participants performed the NP task; after a three minute break, the PF task was performed. For the study of habituation, the second repetitive painful task (RP) task commenced immediately after varying the stimulating area used in the PF task. All electrical stimulations were delivered on the left thumb pulp. Before the NP task, the perceptual (i.e., NP) electrical intensity of the left thumb pulp was obtained, which was the subjective sensory threshold. Before the PF task, the painful electrical intensity was measured and rated 3–4/10 on the numerical rating scale. The painful electrical intensity during the RP task was identical to that during the PF task; however, to avoid skin damage, the stimulation area on the left thumb pulp was slightly moved before the stimulation. A Digitimer DS7A device (Digitimer, UK) was used in addition to a planar concentric stimulating electrode with 0.2-ms constant-current square-wave pulses (0.2-ms width, proximal cathode). Evoked brain activity was recorded continuously at a digital sampling rate of 1000 Hz. To reduce external interference and minimize data distortion during pre-processing, we employed two methods. Firstly, we manually reviewed the data and discarded any epochs with aberrant waveforms. Secondly, we applied bandpass filters with a range of 0.1 Hz to 150 Hz to eliminate high-frequency noise and direct current (DC) drift. For each task, we collected 30 artifact-free evoked epochs with an interstimulus interval of 3.5–4.5 s. Each epoch consisted of a prestimulus baseline of 50 ms and poststimulus measurement of 150 ms. During recording, participants were comfortably seated on a chair in an illuminated room and asked to remain awake with their eyes closed.

Electroencephalogram experimental design. Participants took a break before painful tasks; after painful stimulation finished, repetitive painful tasks were performed immediately. ISI, interstimulus interval.
Electroencephalogram oscillatory analysis
The EEG evoked responses for NP, PF, and RP tasks were transformed into a time–frequency map by using a Morlet wavelet analysis and ranged from 1 to 40 Hz in frequency and −50 to 150 ms in time. The averaged time–frequency representation for each task was calculated across 30 epochs. Oscillatory activities were normalized to a prestimulus period of −50 to 0 ms. The electrode with the maximal oscillatory activities over the somatosensory cortex contralateral to the electrical stimulation was selected through visual inspection. A single-electrode investigation would be advantageous for future routine clinical use due to its ease of setup, rapidity, and straightforward analysis. The peak latency, power, and frequency of contralateral evoked activities were extracted for each task and participant. Moreover, the response ratios of oscillatory activities of NP:PF and RP:PF for each participant were extracted to estimate the differences in evoked oscillatory power between tactile processing and combined tactile and nociceptive processing and the changes in evoked oscillatory power for habituation effect, respectively. Notably, to obtain the cortical localisation of peak oscillatory activities, oscillatory activation was mapped onto the T1-weighted magnetic resonance imaging (MRI), which was calculated by performing a weighted minimum norm estimate analysis with symmetric boundary element (18) and inverse operator methods. Data analysis was performed using Brainstorm software (19), which has been partially described in our previous studies (4,6,11,20).
Machine-learning analysis
This study applied all the features obtained from the oscillatory analysis and the selected features that exhibited significant differences between groups, which were then used to construct data sets imported to the classification model. The models used supervised ML algorithms, including decision trees, a discriminant analysis, naïve Bayes classifiers, a support vector machine (SVM), and k-nearest neighbours (KNN), to decode two conditions in a pairwise manner (i.e., CM vs. HC). Bayesian optimization was used to automate the selection of hyperparameter values. To avoid overfitting: 1) 80% of the oscillatory data were randomly selected as a training data set, and the others 20% were selected as an independent testing data set; 2) the models were trained based on a fivefold leave-one-out cross-validation technique. All analyses were performed using the ML toolbox from MATLAB software (R2019a).
Statistical analysis
Demographics (age and gender), clinical profiles (HADS and PSS), stimulus intensity, and all EEG measures (i.e., peak latency, power and frequency of the evoked oscillatory activities for each task, and the ratios of oscillatory activities in NP:PF and RP:PF) were compared between groups by conducting independent t, nonparametric Kolmogorov-Smirnov Z or chi-squared tests when appropriate. To evaluate the psychiatric impact on evoked oscillatory responses, the oscillatory responses were examined the nonparametric ANCOVA (Quade’s) analysis with the HADS as covariate. All statistical analyses were performed using SPSS version 22.0 (IBM, USA) or Statistics toolbox from MATLAB software (R2019a; The Mathworks, USA). Regarding the classification model on the independent testing data set, the statistical significance was estimated using nonparametric permutation tests (10,000 times) to obtain the statistical significance of predictive accuracy. A p value of 0.05 was considered statistically significant.
Results
Demographic data
This study included 80 participants—40 HCs (age: 29.6 ± 8.7 years old; male–female ratio = 13:27) and 40 patients with CM (age: 31.9 ± 7.2 years old; male–female ratio = 10:30). The two groups did not significantly differ in terms of age or gender (Table 1). Anxiety (HADS_A) and depression (HADS_D) scores were higher in the CM group than in the HC group (HADS_A, CM: 8.5 ± 3.4, HC: 3.9 ± 3.5, t = 5.4; HADS_A, CM: 6.2 ± 3.6, HC: 2.9 ± 3.0, t = 4.3; all p < 0.001), and the PSS values were higher in the CM group (CM: 28.5 ± 7.9, HC: 21.9 ± 9.3, t = 2.9, p = 0.005). The electrical intensity did not differ between groups for NP (p = 0.6) and PF tasks (p = 0.65).
Demographics and clinical profiles.
HC, Healthy control; CM, Chronic migraine; F, Female; M, Male; HADS,
Hospital anxiety and depression score; A, Anxiety; D, Depression; PSS,
Perceived Stress Scale; HIT6, Headache Impact Test-6; MIDAS, Migraine disability assessment.
Evoked oscillatory activities among healthy controls and patients with chronic migraine
The grand-averaged oscillatory responses from one EEG electrode, which were selected from the contralateral sensorimotor area, for the NP and PF stimulations of the HC (n = 40) and CM (n = 40) groups are depicted in Figure 2 (a). Time–frequency representations indicated prominent event-related oscillatory responses following electrical stimulations during all three tasks between both groups, which peaked at 50–80 ms in latency and 9–12 Hz in frequency. For example, the oscillatory responses to painful stimulation from one representative HC (Figure 2 [b]) peaked at 8 Hz and 66 ms. The topographic pattern at 8 Hz and 66 ms revealed a contralateral activation over the parietal area, which mapped onto the MRI and indicated the activation of the somatosensory cortex.

(a) Grand-averaged time–frequency plots of evoked oscillatory activities for nonpainful, painful, and repetitive painful tasks at a frequency of 0 to 40 Hz and a latency of −50 to 150 ms among HCs (n = 40) and patients with CM (n = 40) groups and (b) Representative oscillatory activities for painful stimulation from one HC (#14) are depicted in the time–frequency plot (upper left), time- and frequency-varying power dynamics (lower left), and the topography and cortical mapping (right panel). HC, healthy control; CM, chronic migraine; L, left; R, right.
Altered pain processing in chronic migraine
In the peak latency responses (Figure 3), patients with CM exhibited longer latency than HCs in the NP (CM: 69.8 ± 5.3 ms, HC: 49.5 ± 1.0 ms; z = 2.12, p < 0.001) and RP (CM: 77.4 ± 6.7 ms, HC: 51.4 ± 1.4 ms; z = 1.56, p = 0.015) tasks. With respect to peak power in the PF tasks, HCs demonstrated larger power increases than patients with CM (CM: 47.1% ± 4.0%, HC: 71.9% ± 6.9%; z = 1.45, p = 0.029). However, larger power increases were observed among patients with CM than HCs during the NP (CM: 44.2% ± 3.1%, HC: 35.3% ± 1.2%; z = 1.56, p = 0.015) and RP (CM: 45.2% ± 3.4%, HC: 36.9% ± 1.5%; z = 1.45, p = 0.029) tasks. Regarding habituation for pain processing (Figure 4), the RP:PF ratios on the frequency were lower among patients with CM (CM: 1.02 ± 0.02, HC: 1.26 ± 0.06; z = 1.79, p = 0.003); whereas those on the peak latency were increased in patients with CM (CM: 1.05 ± 0.03, HC: 0.93 ± 0.06; z = 1.45, p = 0.029). Additionally, the ratios of power responses were higher among patients with CM (CM: 1.01 ± 0.04, HC: 0.68 ± 0.05; z = 1.90, p = 0.001), which implied that the oscillatory responses for RP stimulation did not habituate among patients with CM.

Differences in oscillatory latency, power, and frequency between patients with CM and HCs during NP, PF, and RP tasks. HC, healthy control; CM, chronic migraine; NP, nonpainful; PF, painful; RP, repetitive painful; **p < 0.001; *p < 0.05.

Differences in oscillatory activities of NP:PF and RP:PF ratios for the latency, power, and frequency responses between patients with CM and HCs. HC, healthy control; CM, chronic migraine; NP, nonpainful; PF, painful; RP, repetitive painful; **p < 0.01; *p < 0.05.
To estimate evoked oscillatory responses while controlling the psychiatric effects, nonparametric ANCOVA (Quade’s) analysis showed longer latency responses in patients with CM were observed in the NP and RP conditions (NP: F = 5.92, p = 0.017; RP: F = 4.39, p = 0.039). Moreover, the evoked oscillatory powers were increased among patients with CM in the NP and PF conditions (NP: F = 3.9, p = 0.05; PF: F = 4.32, p = 0.04). As for the habituation effects, the RP:PF ratios among patients with CM were higher on the latency and power responses (latency: F = 4.9, p = 0.03; power: F = 8.2, p = 0.005); moreover, the ratios of frequency responses were lower in patients with CM (F = 5.49, p = 0.022).
Classification model using evoked oscillatory responses for chronic migraine
To construct the data sets for ML, we used all 15 features from the oscillatory analysis. Additionally, the responses that significantly differed between groups were also used to establish the data sets. Therefore, 8 features were also applied to the models, which comprised the oscillatory power of all three tasks, NP and RP latency, and latency, frequency and power ratios of RP:PF. By using 15 features, the training models for differentiating CM from HC achieved an accuracy of 71.9%–81.2% and an AUC of 0.78–0.84 by using decision trees, a discriminant analysis, naïve Bayes classifiers, SVM, and KNN algorithms (Table 2). When using the 8 features with significant group differences, the classifiers had an accuracy of 73.4%–87.5% and an AUC of 0.80–0.86 from all algorithms. The optimal algorithm of the training model was the decision tree, which yielded a performing accuracy of 87.5%, sensitivity of 81%, specificity of 93.8%, and AUC of 0.84 (Figure 5 [a]). We further examined the generalizability of the classification model featuring decision tree algorithms by using an independent data set of eight patients with CM and eight HCs. The classification model also exhibited high performance (accuracy: 87.5%, AUC: 0.875, sensitivity: 0.875, specificity: 0.875; p = 0.0001) (Figure 5 [b]). Thus, these findings validated that our model had favorable generalizability for identifying patients with CM.
Optimized models and their performance.
N, number; AUC, area under the curve; SVM, support vector machine; KNN, k-nearest neighbors.

(a) Confusion matrix and receiver operating characteristic (ROC) plot for differentiating patients with chronic migraine (CM) from healthy controls (HCs) and (b) Confusion matrix and ROC plot from the independent data set to identify patients with CM (left and middle column). Overall prediction accuracy of this model was determined using a permutation test and independent testing data set (right column). AUC, area under the curve.
Discussion
In this study, patients with CM demonstrated an altered peak latency and power of evoked oscillatory responses over the contralateral sensorimotor cortex during PF or NP processing. Moreover, the ratios of oscillatory activities in NP:PF and RP:PF tasks revealed significant frequency modulation and power habituation among HCs, which were not present among patients with CM. By using evoked oscillatory data to develop classification models, we discovered that the model with the oscillatory features exhibited high performance in differentiating patients with CM from HCs. These findings indicated that oscillatory characteristics of sensory processing can be reliable for identifying patients with CM.
Abnormal evoked oscillatory activities in chronic migraine
By using planar concentric stimulating electrodes, central neural activities were elicited through the co-excitation of a considerable proportion of large myelinated A-beta fibres (21,22). Thus, cortical evoked oscillatory activities that peaked at 50–90 ms were recorded over the primary somatosensory cortex, which was consistent with other studies (21,22). The spectral power of evoked oscillatory activities was associated with stimulus intensity (23); therefore, in the HC group, higher oscillatory power was observed for PF stimulation compared with NP stimulation when the electrical intensity differed. Additionally, repeated painful stimuli resulted in a diminished cortical response that resembled habituation, which could be a physiological defense response of an inhibitory antinociceptive type. HC group showed this response by having lower power in the evoked oscillations during RP stimulation (24). The study tasks elicited sensory processing, which revealed the cortical modulation from the oscillatory powers regarding the effects of stimulus intensity and repetition among HCs.
Among the patients with CM, the peak power of oscillatory responses was not correspondingly modulated for the effects of pain afferent and stimulus repetition, which indicated deficits in cortical sensory and anti-nociceptive defensive processing (2,24,25). With respect to cortical sensory processing, evoked powers were abnormally augmented for NP, which supported the central hyperexcitability in CM (4,6). Nevertheless, in contrast to HC, oscillatory powers for PF stimulation did not increase among patients with CM; the stimulus intensity increased, which might indicate that pain processing was altered and the somatosensory activation coding of the stimulus intensity was defective. The saliency of the stimulus was associated with the cortical responses following PF input (26), which might explain the unchanging pain-evoked power among patients with CM who often undergo the pain attacks. Furthermore, the habituation deficit to repetitive noxious stimuli was recognized in CM because no power changes occurred during RP stimulation, which suggested that the cortical activities of patients with CM was characterised by the dysfunctional inhibitory antinociceptive capabilities over the sensory cortex (4,6) or reduced salience to pain stimuli (27). Thus, the oscillatory powers of the sensory responses and their modulations for pain afferent and repetition might be pivotal for identifying patients with CM.
Longer peak oscillatory latencies of sensory processing were observed among patients with CM. This implies a general hyporeactivity to innocuous and painful stimuli as one critical feature of migraine chronification. Because the electrical stimuli were delivered through a planar concentric electrode, the latency differences might be due to the proportion of co-excitation from large myelinated A-beta and A-delta fibres (21,22). The A-beta fibre was dominant in the cortical processing of HCs, whereas the sensory input after concentric-electrode stimulation transmitted through the A-delta afferent in a larger proportion in patients with CM, which led to prolonged oscillatory latencies. The latency of evoked oscillation elicited using concentric stimulating electrode was rarely investigated among migraine patients; one study reported that the latency of an early somatosensory component was related to migraine treatment (28), which implied that the latency responses represented the pathophysiology of migraine. Thus, the measurement of somatosensory latency was reported to be a potentially prominent feature for identifying patients with migraine (29).
Identifying patients with chronic migraine using machine learning
The classification model of the present study exhibited favorable performance in differentiating patients with CM from HCs. Studies have examined classifying patients with migraine and HCs. When measuring the latency and amplitude responses of somatosensory-evoked activities (29), ML models exhibited accuracies of >80% in identifying patients with migraine. Using the structural MRI, Schwedt et al. (30) reported a classification accuracy of 86.3% in distinguishing patients with CM from HCs. Resting-state functional MRI connectivity data had an accuracy of 86.1% in identifying patients with migraine (31). In our previous study (10), the resting-state magnetoencephalographic functional connectivity within pain-related areas was used to establish a model that achieved excellent performance in distinguishing patients with CM from HCs. Generally, an ML approach combined with neuroimaging data might be capable of identifying of patients with migraine. In contrast to fMRI and magnetoencephalography (MEG techniques, EEG recording is low cost and convenient to perform in clinics; moreover, the present findings verified reliability and generalizability for identifying patients with CM. Therefore, EEG recordings are the optimal candidate for clinical settings. Moreover, the oscillatory signatures from the EEG that were used in this classification model might represent the prominent signatures for monitoring and evaluating migraine progression and severity.
Limitations
This study has several limitations. First, EEG-based evoked oscillatory characteristics were examined and validated. However, our sample size was small for implementing ML algorithms, and future studies with larger sample sizes and additional test dataset are necessary to further validate the results and examine the impacts of psychiatric comorbidity or other chronic pain disorders. Second, all CM patients were naïve to any migraine preventive medication, which precluded determining whether the oscillatory features and the classification model could be generalized to patients taking such treatments. Finally, prolonged latency responses may have resulted from median nerve entrapment at the wrist. Although none of the recruited patients reported numbness at the stimulation site on their left hand, unfortunately, electromyographic (EMG) examinations were not conducted to evaluate their nerve conduction.
Conclusion
This study revealed that one-electrode oscillatory characteristics for the sensory processing can be reliable for identifying patients with CM. By using interpretable ML techniques, our findings contribute to the knowledge of the underlying pathophysiological mechanisms of CM and predicting patients with CM. Further studies with a larger sample size and that evaluate other chronic pain disorders are warranted to verify the reliability and generalizability of our model.
Article highlights
Aberrant pain-related oscillatory responses might represent the underlying neuropathological mechanisms in CM. Patients with CM were characterized with altered peak latency and power over the sensorimotor cortex, as well as the deficits of habituation. The classification model with the EEG oscillatory signatures could be reliable for identifying patients with CM.
Footnotes
Acknowledgements
We would like to thank the study participants for actively participating. This work was supported by the Brain Research Center, National Yang Ming Chiao Tung University, from the Featured Areas Research Center Program within the framework of the Higher Education Sprout Project by the Ministry of Education of Taiwan.
Data availability statement
The data that support the findings of this study are available from the corresponding authors upon reasonable request.
Declaration of conflicting interests
The authors declared the following potential conflicts of interest with respect to the research, authorship, and/or publication of this article: FJ Hsiao, WT Chen, YF Wang, SP Chen, KL Lai, and G Coppola declare no potential conflicts of interest. SJ Wang reports grants and personal fees from Norvatis Taiwan, personal fees from Daiichi-Sankyo, grants and personal fees from Eli-Lilly, personal fees from AbbVie/Allergan, personal fees from Pfizer Taiwan, personal fees from Biogen, Taiwan, outside the submitted work.
Funding
The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This study was founded by the Ministry of Science and Technology of Taiwan (MOST 109-2314-B-075 -050 -MY2 to WT Chen, 108-2321-B-010-014-MY2, 110-2321-B-010-005, and 111-2321-B-A49-004 to SJ Wang, and 109-2221-E-003-MY2 and 111-2221-E-A49-038 to FJ Hsiao), and Veterans General Hospitals and University System of Taiwan Joint Research Program (VGHUST 112-G1-2-2 to FJ Hsiao). The funders had no role in the study design, data collection and analysis, decision to publish, or manuscript preparation.
