Migraine attack advanced prediction method, system and device and medium

The migraine attack prediction model established by the Gradient Boosting algorithm and the SHAP method solves the problem of the lack of effective methods for predicting migraine attack time in the existing technology, and achieves high accuracy and interpretability in migraine attack prediction, supporting the implementation of precision medicine strategies.

CN120954735AInactive Publication Date: 2025-11-14ZHEJIANG UNIV

Patent Information

Application Number
CN202511473505.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-15
Publication Date
2025-11-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing medical models lack effective methods for predicting the timing of migraine attacks in advance, and lack transparent decision-making logic and mechanism explanations, which limits the trustworthiness and application scope of the models in clinical practice, especially in personalized treatment plans.

Method used

A migraine attack prediction model was established using the Gradient Boosting algorithm, and interpretability analysis was performed using the SHAP method. By acquiring patients' headache history, headache characteristics, triggers and causes, auxiliary examinations and demographic data, preprocessing and feature screening were performed to identify key features and generate interpretability analysis charts.

Benefits of technology

It achieves highly accurate migraine attack prediction, with a prediction model accuracy of 0.928 and an F1 score of 0.929. It is low-cost, suitable for primary healthcare institutions and mobile healthcare applications, has a clear prediction time window, is suitable for real-time clinical applications, and provides detailed feature contribution analysis to facilitate clinical understanding and application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120954735A_ABST
    Figure CN120954735A_ABST
Patent Text Reader

Abstract

The invention discloses a migraine attack advanced prediction method, system and device and a medium. The method comprises the following steps: acquiring patient health investigation and auxiliary examination data related to migraine; preprocessing the health investigation and auxiliary examination data of the patient; based on the preprocessed data, key features related to migraine are determined through feature screening; a migraine attack advanced prediction model is established based on a Gradient Boosting algorithm, the input quantity of the prediction model is the key features, and the output quantity of the prediction model is a migraine attack probability prediction result; and carrying out interpretability analysis on an output result of the prediction model based on an SHAP method. The method provided by the invention has the advantages of high accuracy, strong practicability, quick response, clear prediction time efficiency, window prediction time and strong interpretability, and is particularly suitable for scene prevention application scenes of medical institutions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart medical technology, and in particular to a method, system, device, and computer-readable storage medium for early prediction of migraine attacks using artificial intelligence-assisted diagnosis based on headache history, headache characteristics, triggers and causes, and demographic characteristics. Background Technology

[0002] Migraine is a common and complex brain disorder characterized by recurrent episodes of moderate to severe throbbing headache, often accompanied by nausea, vomiting, photophobia, and phonophobia. Each attack in adults can last from 4 to 72 hours. Chronic migraine sufferers experience headaches for more than 15 days a month, severely impacting their daily lives and work abilities.

[0003] According to The Lancet's 2020 Global Burden of Disease report, migraine has become the second leading cause of neurological disease burden worldwide, surpassing major diseases such as dementia, epilepsy, and Parkinson's disease. More than one billion people worldwide suffer from migraines, with a prevalence rate as high as 9.3% in China. Among people under 50, migraine is the leading cause of disability-adjusted life years (DALYs) globally, placing a heavy burden on society and families.

[0004] The clinical manifestations of migraine are highly heterogeneous. Even in the same patient, triggering factors, attack frequency, symptom presentation, and coping strategies can fluctuate over time, posing significant challenges to prediction and intervention. Multiple studies have shown that pre-attack analgesia is significantly more effective than post-attack analgesia. Therefore, predicting the timing of migraine attacks is crucial for improving the effectiveness of acute migraine analgesia.

[0005] However, existing medical models often exhibit significant limitations when dealing with such highly heterogeneous diseases. Currently, there is a lack of effective methods to predict in advance when migraine attacks are likely to occur. Furthermore, when analyzing such complex clinical data, existing medical models often lack clear explanations of risk prediction results, exhibiting a "black box" characteristic and lacking transparent explanations of decision-making logic and mechanisms. This lack of interpretability limits the trustworthiness and scope of application of these models in clinical practice, especially in scenarios involving chronic relapsing diseases requiring individualized treatment plans. Summary of the Invention

[0006] This application provides a method, system, device, and computer-readable storage medium for predicting migraine attacks in advance, addressing the problem in the prior art of lacking an effective method for predicting when migraines may occur. It also provides a clear explanation of individual attack risk to support the implementation of precision medicine strategies.

[0007] To address the aforementioned problems, in a first aspect, embodiments of this application provide a method for predicting migraine attacks in advance, comprising the following steps: Obtain health survey and auxiliary examination data related to migraine patients; The patient health survey and auxiliary examination data are preprocessed; Based on the preprocessed data, key features related to migraine were identified through feature filtering. A migraine attack prediction model is established based on the Gradient Boosting algorithm. The input of the prediction model is the key feature, and the output of the prediction model is the probability prediction result of migraine attacks. The interpretability of the prediction model's output is analyzed based on the SHAP method.

[0008] Preferably, the patient health survey and auxiliary examination data include headache history, headache characteristics, triggers and causes, auxiliary examination results, and demographic characteristics.

[0009] Preferably, the patient health survey and auxiliary examination data include 37 variables, specifically: Medical history: family history, past medical history; Headache characteristics: photophobia, phonophobia, olfactory phobia, nausea, vomiting, aura, prodromal symptoms, duration, frequency of attacks, dizziness / vertigo, pain intensity; Triggers and causes: fatigue, stress, menstruation, hunger, overeating, insufficient sleep, excessive sleep, weather changes, light stimulation, noise stimulation, certain foods, alcohol, drugs, emotional fluctuations, changes in body position; Demographic characteristics: sex, age, height, weight; Ancillary examinations: imaging, electrophysiology, blood tests.

[0010] Other clinical features: pulse, blood pressure.

[0011] Preferably, the preprocessing method includes at least one of the following: Numerical encoding is performed on categorical variables, that is, "yes / no" is converted into "1 / 0"; Standardize continuous variables by converting their values ​​into a standard normal distribution with a mean of 0 and a standard deviation of 1, thereby eliminating the influence of different units of measurement. Use IQR rules for outlier detection and handling; Missing values ​​are handled using missing data imputation methods to ensure data integrity and quality.

[0012] Preferably, the step of identifying key features related to migraines through feature screening specifically includes: The TreeSHAP algorithm was used to calculate the global importance of all 37 variables. The variables were sorted by their average absolute SHAP values, and the top 21 features in terms of SHAP importance were selected as the 21 key features.

[0013] Preferably, the 21 key features are as follows: Headache history: family history, past medical history; Headache characteristics include: photophobia, phonophobia, olfactory phobia, nausea, vomiting, aura, and prodromal symptoms; Triggers and causes: fatigue, stress, menstruation, hunger, lack of sleep, weather changes, light stimulation, noise stimulation, certain foods, alcohol, and mood swings.

[0014] Preferably, the interpretability analysis of the output of the prediction model based on the SHAP method specifically includes: calculating the contribution value of each key feature to the prediction result using the SHAP method, and generating an interpretability analysis chart, wherein the interpretability analysis chart includes at least one of the following: Global Bar Chart – By calculating the average absolute SHAP value of all samples, it displays the global feature importance ranking, helping users quickly identify the symptom items that have the greatest impact on model decisions; Bee swarm diagram – plots the SHAP value of each individual as a horizontal scatter point and uses color to indicate the original feature value, intuitively showing the positive and negative contributions of the same feature to the prediction result under high and low values ​​and the non-linear threshold effect; Heatmap – Expanding the SHAP value matrix in two dimensions, features and samples, and mapping the contribution size with warm and cool colors, it can simultaneously observe risk heterogeneity at the population level and key driving factors of individual cases; Dependency plots—with the original values ​​of core features on the horizontal axis and the corresponding SHAP values ​​on the vertical axis, and colored with another covariate—are used to capture the interaction relationships between core features and the clinically significant “synergistic” or “inhibitory” effects.

[0015] Secondly, embodiments of this application also provide a migraine attack early prediction system, the system comprising: The data acquisition module is used to acquire health survey and auxiliary examination data related to migraine patients; The data preprocessing module is used to preprocess the patient health survey and auxiliary examination data; The key feature filtering module is used to identify key features related to migraines based on preprocessed data through feature filtering. The prediction model building module is used to build a migraine attack prediction model based on the Gradient Boosting algorithm. The input of the prediction model is the key feature, and the output of the prediction model is the probability prediction result of migraine attacks. The interpretability analysis module is used to perform interpretability analysis on the output of the prediction model based on the SHAP method.

[0016] Thirdly, embodiments of this application also provide a migraine attack early prediction device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the migraine attack early prediction method as described above.

[0017] Fourthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method for predicting migraine attacks in advance.

[0018] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. High accuracy: The prediction model achieves an accuracy of 0.928 and an F1 score of 0.929, demonstrating excellent performance; 2. Highly practical: Only questionnaire data is required, without the need for imaging or laboratory tests, making it low-cost and easy to promote; 3. Fast response: When the prediction model is used, it runs on an Android phone with 8GB of RAM and a Snapdragon 865 processor via WeChat mini program. The prediction time for a single case is less than 20 milliseconds, which is suitable for real-time clinical applications. 4. Clear prediction timeframe: The prediction time window provides ample time for clinical intervention; 5. High interpretability: The SHAP method provides detailed feature contribution analysis, which is convenient for clinical understanding and application; 6. Wide applicability: Suitable for primary healthcare institutions and mobile healthcare application scenarios. Attached Figure Description

[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0020] Figure 1 This is a flowchart of the migraine attack prediction method provided in Embodiment 1 of this application; Figure 2The correlation coefficient heatmap of the 21 key features provided in Embodiment 1 of this application; Figure 3 The ROC curve of the GradientBoosting prediction model in Embodiment 1 of this application; Figure 4 This is the confusion matrix of the GradientBoosting prediction model in Embodiment 1 of this application; Figure 5 This is a bar chart of the average absolute value of SHAP (global feature importance) in Embodiment 1 of this application. Figure 6 This is the SHAP bee colony graph (individual contribution distribution) in Embodiment 1 of this application. Figure 7 This is the SHAP heatmap (instance × feature contribution matrix) in Embodiment 1 of this application. Figure 8 This is the SHAP bivariate (headache attack frequency × analgesic drug frequency) dependency plot (key symptom interaction effect) in Embodiment 1 of this application. Figure 9 This is the SHAP bivariate (photophobia symptoms × drug overdose headache) dependency plot (key symptom interaction effect) in Example 1 of this application. Figure 10 This is the SHAP bivariate (analgesic drug frequency × family history) dependency plot (key symptom interaction effect) in Example 1 of this application. Figure 11 This is the SHAP bivariate (vomiting symptoms × sleep disturbance) dependency graph (key symptom interaction effect) in Embodiment 1 of this application.

[0021] Figure 12 This is a structural block diagram of the migraine attack early prediction system provided in Embodiment 2 of this application; The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0022] This application provides a method, system, device, and computer-readable storage medium for predicting migraine attacks in advance, addressing the problem in the prior art of lacking an effective method for predicting when migraines may occur. It also provides a clear explanation of individual attack risk to support the implementation of precision medicine strategies.

[0023] To better understand the above technical solutions, exemplary embodiments will be described in detail below, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses consistent with some aspects of this application as detailed in the appended claims. Example

[0024] With the rapid development of artificial intelligence technology, machine learning algorithms, especially Gradient Boosting Decision Trees (GBDT), have demonstrated superior performance in medical prediction tasks. However, the decision-making process of these high-performance models is complex and difficult for doctors and inventors to understand intuitively. To bridge this interpretability gap, model interpretation tools such as SHAP (SHapley Additive exPlanations) have emerged. Based on the concept of Shapley values ​​in game theory, the SHAP method assigns a clear, quantifiable importance score to each feature, thereby enabling personalized interpretation of the model results. This technology provides a crucial bridge for translating machine learning findings into clinical practice.

[0025] Given the profound impact of chronic migraine on patients' quality of life and socioeconomic status, and the limitations of existing models in terms of interpretability, this embodiment proposes a method for predicting migraine attacks in advance by combining the Gradient Boosting model with the SHAP interpretation method, aiming to predict whether patients will experience migraine attacks within a future time window.

[0026] Figure 1 This is a flowchart of the migraine attack prediction method provided in this embodiment. The migraine attack prediction method includes the following steps: Step S1: Obtain patient health survey and auxiliary examination data related to migraine; The patient health survey and auxiliary examination data include headache history, headache characteristics, triggers and causes, auxiliary examination results, and demographic characteristics.

[0027] The headache history data includes family history and past medical history; the headache characteristic data includes, but is not limited to, dizziness / vertigo, photophobia / phonophobia / nausea / vomiting, duration and frequency of attacks; the triggering and etiology data includes, but is not limited to, fatigue, stress, menstruation, hunger / fullness and sleep; and the demographic characteristics data includes, but is not limited to, age, height and weight.

[0028] In a preferred embodiment, a "headache epidemiological questionnaire" is created using 37 readily available variables and completed by patients. The 37 variables are specifically: Medical history (2 items): family history, past medical history; Headache characteristics (11 items): photophobia, phonophobia, olfactory phobia, nausea, vomiting, aura, prodromal symptoms, duration, frequency of attacks, dizziness / vertigo, pain intensity; Triggers and causes (15 items): fatigue, stress, menstruation, hunger, overeating, insufficient sleep, excessive sleep, weather changes, light stimulation, noise stimulation, specific foods, alcohol, drugs, emotional fluctuations, changes in body position; Demographic characteristics (4 items): sex, age, height, weight; Auxiliary examinations (3 items): imaging, electrophysiology, and blood tests.

[0029] Other clinical features (2 items): pulse, blood pressure.

[0030] Step S2: Preprocess the patient health survey and auxiliary examination data; Furthermore, preprocessing methods include standardization, missing value handling, and outlier detection to ensure data quality. Specifically: (1) Numericalize the categorical variables (such as binary variables such as "whether there is a family history") and convert "yes / no" to "1 / 0"; (2) Standardize continuous variables (such as age, height, weight, number of headache days per month, etc.), that is, convert the values ​​into a standard normal distribution with a mean of 0 and a standard deviation of 1 to eliminate the influence of different units; (3) Use the IQR rule (interquartile range rule) for outlier detection and handling; (4) Use computer-implemented missing data imputation methods (such as interpolation) to handle missing values ​​and ensure data integrity and quality.

[0031] Step S3: Based on the preprocessed data, identify key features related to migraines through feature filtering; Specifically, machine learning algorithms were used to assess the importance of 37 variables and identify key features associated with migraines. The machine learning algorithms included nine types: logistic regression, K-nearest neighbors, decision tree, random forest, support vector machine, Naive Bayes, adaptive boosting (AdaBoost), gradient boosting (Gradient Boosting), and extreme gradient boosting (XGBoost).

[0032] In this embodiment, the above nine machine learning algorithms are used for preliminary training and performance comparison. Based on the F1 score and accuracy metrics, the Gradient Boosting algorithm with the best performance is selected. On this basis, the TreeSHAP algorithm is used to calculate the global importance of all 37 variables. The variables are then sorted by their average absolute SHAP values, and the top 21 features in terms of SHAP importance are selected as the 21 key features.

[0033] The 21 key features are as follows: Headache history (2 items): family history, past medical history; Headache characteristics (7 items): photophobia, phonophobia, olfactory phobia, nausea, vomiting, aura, prodromal symptoms; Triggers and causes (12 items): fatigue, stress, menstruation, hunger, lack of sleep, weather changes, light stimulation, noise stimulation, specific foods, alcohol, mood fluctuations, and changes in body position.

[0034] Step S4: Establish a migraine attack prediction model based on the Gradient Boosting algorithm. The input of the prediction model is the 21 key features, and the output of the prediction model is the probability prediction result of migraine attacks. Furthermore, the performance of the prediction model was validated through cross-validation and external validation set testing to ensure that the established prediction model performed well in terms of AUC (area under receiver operating characteristic), accuracy, sensitivity, and specificity.

[0035] When the prediction model is used, the patient's symptom data of 21 key features are input into the trained prediction model, and the prediction model will output the probability prediction result of migraine attacks within 48 hours (of course, it is also applicable to probability prediction within other time periods, such as within 72 hours, but the prediction probability within 48 hours is the most accurate).

[0036] Step S5: Perform interpretability analysis on the output of the prediction model based on the SHAP method; Specifically, the SHAP method is used to calculate the contribution of each key feature to the prediction results, generating interpretability analysis charts.

[0037] To ensure the traceability and reliability of the prediction results for clinicians, this embodiment uses the TreeSHAP algorithm from the SHAP framework to interpret the model. TreeSHAP, based on the ShapleyValue concept from game theory, can decompose the output of a complex tree model into the sum of the marginal contributions of each feature to a single prediction, while maintaining local accuracy, feature consistency, and independence of missing values. Its calculation process fully utilizes the information of the decision tree structure, thus achieving fast and accurate feature attribution even in large-scale ensemble models. Specifically, it includes: An interpreter is built using the SHAP library. The trained Gradient Boosting model is input into the SHAP interpreter to calculate the SHAP value, so as to quantify the marginal contribution of each input feature to whether the patient will experience migraine within 48 hours. Based on the calculated SHAP values, the impact of each feature on predicting whether a patient will experience migraine within 48 hours was evaluated, and the importance of each feature to the target variable was revealed. Based on the calculated SHAP values ​​and the importance of each feature to the target variable, and to facilitate visualization at different levels, four types of SHAP views were created: Global Bar Plot – By calculating the average absolute SHAP value of all samples, it displays the global feature importance ranking, helping users quickly identify the symptom items that have the greatest impact on model decisions.

[0038] Beeswarm plot – plots the SHAP value of each individual as a horizontal scatter plot and uses color to indicate the original feature value, visually presenting the positive and negative contributions of the same feature to the prediction result under high and low values, as well as the nonlinear threshold effect.

[0039] Heatmap – Expands the SHAP value matrix in two dimensions: features and samples. It uses warm and cool colors to map the contribution size, allowing simultaneous observation of risk heterogeneity at the population level and key driving factors of individual cases.

[0040] Dependence Plot – This plot uses the original values ​​of core features on the horizontal axis and the corresponding SHAP values ​​on the vertical axis, and colors another covariate to capture the interaction relationships between core features and the clinically significant “synergistic” or “inhibitory” effects.

[0041] The four types of SHAP views described above provide four levels of interpretability: Global Bar Chart – Global Interpretation: Shows the average contribution of all features to the overall decision of the model; Beehive diagram – Local interpretation: Generates personalized feature contribution analysis for each patient; Heatmaps – Feature Interactions: Identifying synergistic or antagonistic effects between features; Dependency Mapping – Clinical Guidance: Transforming SHAP analysis results into clinical decision support recommendations.

[0042] This embodiment proposes a method for predicting migraine attacks by combining the Gradient Boosting model with SHAP value analysis. This method can accurately identify differences in the daily health data of individual patients with chronic diseases and predict the risk of migraine attacks in the next 48 hours.

[0043] This method, based on large-scale daily data and diagnostic labels, integrates machine learning algorithms and has significant implications for clinical applications: 37 questionnaire variables for patients can be quickly obtained at the initial diagnosis stage; the Gradient Boosting model has fast inference speed (<20ms / case) and good robustness to collinearity and missing values, making it suitable for embedding into primary healthcare information systems or mobile mini-programs to achieve low-cost, large-scale headache risk pre-screening. Furthermore, the visual interpretation results, such as bar charts and beehive diagrams generated from SHAP values, can serve as auxiliary decision-making tools, helping non-neurologists identify patients requiring referral or further examination.

[0044] The migraine attack prediction method proposed in this embodiment not only possesses the ability of artificial intelligence to process complex clinical data, but also provides a clear interpretation of individual attack risk through SHAP values, supporting the implementation of precision medicine strategies. This invention is expected to promote the individualized and intelligent development of chronic migraine prediction and intervention, improving clinical management efficiency and patients' quality of life.

[0045] The accuracy of the above model will be verified through specific experiments below: Dataset Acquisition: The dataset originates from the China Headache & Vertigo Registry Study (CHRS) project, led by the Department of Neurology at the Second Affiliated Hospital of Zhejiang University and involving headache clinics in over 50 research hospitals nationwide. The CHRS project established a high-quality national migraine database through a 7-year follow-up using a "Headache Epidemiology Questionnaire," which employed the aforementioned 37 variables. Participants completed the "Headache Epidemiology Questionnaire" via a WeChat mini-program. The mini-program underwent front-end and back-end data validation to ensure data accuracy. All participants completed the electronic questionnaire before their consultation and, after signing informed consent, exported the anonymized data to a CSV file.

[0046] Data preprocessing: A total of 1300 original records were processed. After quality control, samples with more than 20% missing core items or contradictory key information were removed, leaving 598 valid samples. Outlier detection was performed using the IQR rule, qualitative variables were converted using one-hot coding, and all numerical variables were standardized.

[0047] Based on the preprocessed data, 21 key features associated with migraine were identified through feature selection. To assess potential multicollinearity, Pearson correlation coefficients for these 21 key features were calculated and plotted. Figure 2 The correlation coefficient heatmap shown is shown. Figure 2 In the middle, the diagonal is dark red (autocorrelation = 1.00), and most features are scattered in the range of -0.3 to 0.3, indicating that the overall correlation is weak; only the correlation coefficient between the variables "Do you feel nauseous when you have a headache?" and "Do you vomit when you have a headache?" reaches 0.61, suggesting that the two symptoms often occur at the same time in clinical practice.

[0048] Based on this result, two strategies were adopted for subsequent modeling: in tree-based algorithms (LightGBM, RandomForest, etc.), all features were directly retained, and redundancy was automatically handled using the built-in feature splitting mechanism of the model; in the linear baseline model (Logistic Regression), only the "vomiting" term was retained through the variance inflation factor (VIF<2), and L2 regularization was combined to suppress potential weight inflation.

[0049] Overall, Figure 2 The results showed that the dataset did not contain a wide range of highly correlated clusters, and the quality of the preprocessed data was sufficient to meet the needs of subsequent model training and SHAP interpretability analysis.

[0050] To fully compare the predictive performance of different algorithm models, this embodiment selects nine mainstream classification algorithms: Logistic Regression (LR), K-Nearest Neighbors (KNN), Decision Tree (DT), Random Forest (RF), Support Vector Machine (SVM), Gaussian Naive Bayes (NB), Adaptive Boosting Algorithm (AB), Gradient Boosting Decision Tree (GBDT), and Extreme Gradient Boosting Algorithm (XGBoost) (XGB).

[0051] All models are implemented based on Scikit-learn 1.4.2 (a machine learning library based on Python), and hyperparameter tuning is completed through 5-fold cross-validation (5-foldCV) nested grid search. The outer layer uses an 8:2 random hierarchical partitioning to lock the test set, and the inner layer cross-validation optimizes hyperparameters on the training set and prevents information leakage.

[0052] Table 1. Hyperparameter search space and selection strategy for different algorithm models algorithm Key hyperparameter search space (grid / random) Choose strategy LR Regularization strength C ∈ {0.01, 0.1, 1, 10}; regularization term type penalty ∈ {l1, l2}; solver = liblinear GridSearchCV KNN The number of nearest neighbors n_neighbors ∈ [3,15]; the weighting function weights ∈ {uniform weights, distance weights}; the distance metric is Euclidean distance. GridSearchCV DT Maximum depth max_depth ∈ {None, 5, 10, 15}; minimum number of samples per leaf node min_samples_leaf ∈ {1, 2, 4} GridSearchCV RF The number of trees, n_estimators ∈ {100, 300, 500}; the maximum depth, max_depth ∈ {unrestricted None, 10, 20}; the maximum number of features, max_features ∈ {square root sqrt, logarithm log2}. RandomizedSearchCV (50 groups) cross-validation SVM Regularization strength C ∈ {0.1, 1, 10}; kernel function kernel ∈ {radial basis function kernel rbf, polynomial kernel poly}; kernel coefficient gamma ∈ {scale, auto} GridSearchCV NB Default prior and variance smoothing (var_smoothing=1e-9) No parameter adjustment AB Number of base learners n_estimators ∈ {100, 200, 400}; learning rate learning_rate ∈ {0.01, 0.1, 1}; base learners = decision stubs RandomizedSearchCV (30 groups) cross-validation GBDT The number of trees, n_estimators ∈ {100, 300, 500}; the learning rate, learning_rate ∈ {0.01, 0.05, 0.1}; and the maximum depth, max_depth ∈ {3, 5, 7}. RandomizedSearchCV (30 groups) cross-validation XGB The number of trees, n_estimators ∈ {100, 300, 500}; the learning rate, learning_rate ∈ {0.01, 0.05, 0.1}; and the maximum depth, max_depth ∈ {3, 5, 7}. RandomizedSearchCV (30 groups) cross-validation

[0053] During parameter tuning, the F1 score (the harmonic mean of precision and recall) was used as the primary optimization objective, supplemented by ROC-AUC (area under the receiver operating characteristic curve) to monitor the model's discriminative ability. All randomization processes were set with a random_state = 42 to ensure reproducibility. After model training, accuracy, precision, recall, F1 score, and ROC-AUC were uniformly calculated on the retained 20% validation set, and the results are summarized in Table 2. Simultaneously, the confusion matrix of the optimal model and subsequent SHAP interpretability analysis were performed. This multi-model comparison framework ensures the objectivity of the evaluation results and provides a quantitative basis for subsequently selecting the optimal model with a performance-interpretability trade-off.

[0054] Table 2 summarizes the five evaluation metrics (rounded to three decimal places) for the nine prediction models on the validation set. The results show that tree-based ensemble methods performed best overall: Decision Tree, AdaBoost, Gradient Boosting, and Random Forest all had accuracy exceeding 0.922 and F1 scores no lower than 0.924; among them, Random Forest achieved the highest ROC-AUC of 0.954, leading in overall discriminative ability. In contrast, LogisticRegression, while achieving a recall of 1.000 due to "all predictions being positive," sacrificed precision (0.533) and accuracy (0.533), failing to meet the specificity requirements of clinical screening. KNN and Naive Bayes were at a moderate level; SVM achieved a good balance between recall (0.896) and precision (0.956), but still slightly lagged behind Random Forest in overall performance. Considering accuracy, F1 score, and ROC-AUC, Gradient Boosting and AdaBoost are the preferred models due to their robust combination of accuracy and recall; Random Forest can be given priority in scenarios where overall discriminative power (AUC) or a lower false negative rate is important.

[0055] Table 2. Predictive performance of each model on the validation set (rounded to three decimal places) Model Accuracy Precision Recal F1 Score ROC-AUC Logistic Regression 0.533 0.533 1.000 0.696 0.952 KNN 0.889 0.904 0.885 0.895 0.917 Decision Tree 0.928 0.977 0.885 0.929 0.937 Random Forest 0.922 0.966 0.885 0.924 0.954 SVM 0.922 0.956 0.896 0.925 0.952 Naive Bayes 0.900 0.906 0.906 0.906 0.952 AdaBoost 0.928 0.977 0.885 0.929 0.938 Gradient Boosting 0.928 0.977 0.885 0.929 0.950 XGboost 0.542 0.545 0.859 0.667 0.588

[0056] As can be seen from the above comparison, the Gradient Boosting algorithm model selected in this invention is the best performing model. Figure 3 The ROC curve of the Gradient Boosting algorithm model is shown. The confusion matrix is ​​plotted on a set of 180 independent validation samples (see...). Figure 4 The top left and bottom right corners of the matrix record true negatives (TN=82) and true positives (TP=85) respectively, showing that the model can correctly classify the vast majority of individuals; the top right and bottom left corners correspond to false positives (FP=2) and false negatives (FN=11), which are completely consistent with Precision=0.977 and Recall=0.885 in Table 1, and the overall accuracy remains at 0.928.

[0057] Clinical meaning: False positives (FP, n=2, 1.7%): The model identifies individuals with no history of headaches as high-risk. Although this may lead to additional follow-up, it has almost no negative impact on patient safety and can be quickly eliminated through a simple retest questionnaire.

[0058] False negatives (FN, n=11, 9.2%): Truly high-risk patients are misdiagnosed as low-risk, potentially missing the opportunity for early intervention. Although the number of FNs is kept below double digits, clinical attention should be paid to these missed diagnoses. Combined with SHAP interpretation, it can be found that individuals with FNs often simultaneously lack significant "light sensitivity" symptoms, suggesting that subsequent adjustments to dynamic thresholds or the addition of physiological indicators can further reduce the false negative rate.

[0059] Overall, the GradientBoosting prediction model maintains high accuracy while keeping the number of false nouns (FNs) within an acceptable range, making it the preferred model for balancing efficiency and security in questionnaire scenarios. In highly sensitive scenarios (such as large-scale screening), sacrificing a small amount of precision and lowering the decision threshold can be considered to further reduce the risk of FNs.

[0060] The following section analyzes the interpretability of the prediction model's output based on the SHAP method.

[0061] (1) Global feature importance like Figure 5 As shown, the mean absolute SHAP value calculated based on 598 validation samples clearly reveals the model's decision weight allocation at the global level. The top-ranked feature is "aura" (mean|SHAP|≈0.064), a high-weight symptom that has been repeatedly confirmed to be positively correlated with attack severity in previous migraine epidemiological studies, indicating that the model can capture clinically recognized core risk signals. Secondly, "insufficient sleep" (≈0.032) ranks highly, suggesting that sleep quality also has a quantifiable contribution to risk stratification. Overall, the descending order of feature importance is highly consistent with the logic of routine neurological consultations, indicating that the model can still learn discrimination patterns consistent with medical knowledge even under unsupervised constraints, providing a credible global baseline for subsequent individual-level interpretations.

[0062] (2) Individual distribution and nonlinear effects Figure 6 The swarm plot shown overlays the SHAP value distributions of 598 subjects and 10 core features within a single coordinate system, allowing us to see the marginal decision trajectory of the model at the individual level. The horizontal position of the scatter points indicates the sign and magnitude of the feature contribution, while the vertical direction is grouped by feature, and the color changes from blue to red according to the original values. By comparing the color band morphology and horizontal expansion of each feature, the following three statistically and clinically significant patterns can be observed: Monotonic positive correlation effect (see) Figure 6 The top colored band indicates that the "aura" variable corresponds to a negative or near-zero SHAP value in the low range (≤1 point, blue); as the value increases to 2 points (red), the scatter plot shifts to the right to the 0.05~0.12 range, showing a linear increase. This indicates that the symptom intensity and the model output have a univariate increasing relationship, consistent with the epidemiological evidence that aura and migraine exacerbation are linked.

[0063] Threshold-saturation effect (see) Figure 6 The central "photophobic" band—in this discrete variable, as the value changes from 0 to 1, the SHAP value jumps from near zero to approximately +0.03; however, samples with values ​​>1 do not spread further to the right, exhibiting a "plateau" phenomenon in their contribution. Nonlinear juxtaposition effect (see...) Figure 6 The "sleep deprivation" and "fatigue" color bands show a concentrated distribution with near-zero contribution at the low value end (blue); as the value increases but before reaching extreme values ​​(purple), a few positive spikes appear; while at extremely high values ​​(red), several negative scattering points appear. This U-shaped or S-shaped distribution suggests that the model captures a complex dose-response relationship, possibly stemming from disease management behaviors (such as extremely insomnia patients receiving interventions that reduce risk).

[0064] Figure 6 The study also revealed differences in the lateral width of each color band: the maximum span of approximately 0.15 for 'prodromal symptoms' indicates significant marginal uncertainty, while the scatter plots for features such as 'menstruation' and 'light stimulation' are concentrated within ±0.02, suggesting limited impact on model output. These phenomena collectively constitute the model's sensitivity curves across different value ranges, providing data-driven quantitative evidence for clinical development of stratified diagnosis and treatment or dynamic threshold strategies.

[0065] (3) Instance-level heterogeneity Figure 7 The SHAP heatmap shown presents the marginal contributions of the top 10 key variables in 118 validation samples in a "feature × individual" matrix format. The horizontal axis represents the sample number, and the vertical axis represents the feature name, with colors gradually changing from blue (negative contribution) to red (positive contribution). The overlaid black line at the top represents the model output f(x) for the corresponding sample. Significant lateral heterogeneity is observed overall: in the range of numbers 80–110, the f(x) curve is consistently above the zero baseline, and items such as "light sensitivity" show continuous red bands, indicating that individuals in this group were consistently classified as high-risk by the model due to multiple high-risk symptoms. Conversely, the range of numbers 0–30 is predominantly blue, with corresponding f(x) values ​​below the zero line, indicating that even if some patients report a high frequency of headaches, the model still gives a lower risk rating if strong contributing features such as light sensitivity are lacking, reflecting the multi-factor trade-off in the decision-making logic.

[0066] It is noteworthy that scattered red spikes are still visible in the overall low-risk segment, such as the sudden spikes in "sleep deprivation" at indices 15 and 27. These "local abnormalities" may indicate that individualized risk signals have not been fully captured by the established questionnaire, and should be verified clinically through follow-up or supplementary examinations. Correspondingly, a small number of blue bands also appear in the high-risk area (such as the negative contribution of "fatigue" at indice 95), indicating that certain protective behaviors or management measures (such as limiting excessive fatigue) can partially offset the risk in the context of high symptom burden. The heatmap thus not only validates the model's ability to identify population patterns but also provides visual clues for identifying "exceptional" cases and potential unobserved covariates.

[0067] (4) Feature cross-dependency

[0068] Figures 8-11 By condensing four sets of bivariate dependencies into a single graph, the nonlinear effect of symptom co-occurrence on the model output is intuitively revealed. Figure 8 The results showed that when the frequency of headaches in a month was low, the number of times analgesics were taken had little effect on the SHAP value; however, once the frequency of attacks exceeded the threshold of about 15 times / month and the use of analgesics increased simultaneously, the marginal contribution increased exponentially, suggesting that "high frequency of attacks + high dose of medication" constitutes a significant synergistic high-risk combination. Figure 9 Another "enhancing" pattern emerges: the increase in light sensitivity score from 1 to 2 already brings a positive risk gain. When the covariate "drug overdose headache" is also positive, the SHAP value jumps further, indicating that there may be an additive amplification effect between the two at the pathophysiological level. Clinical intervention should focus on both light stimulation management and drug dependence control. Figure 9 In the diagram, color represents the interaction effects of other features.

[0069] In comparison, Figure 10 The study revealed a "protection-reversal" phenomenon: in the low analgesic usage range (≤5 times / month), patients with a family history of analgesia showed a slightly negative SHAP value, suggesting that systematic follow-up and comprehensive management played a risk-offsetting role; however, when the frequency of medication exceeded approximately 10 times / month, this protective effect was completely offset by high-dose medication and turned into a positive contribution. Finally, Figure 11 The study points out the moderating effect of sleep disorders on the symptom of vomiting: in the absence of sleep disorders, the marginal effect of vomiting is mostly negative or neutral; if accompanied by significant sleep disorders, its negative contribution is weakened or even turned positive, suggesting that improving sleep quality may be a key imaging factor in reducing the occurrence of highly disabling headaches with vomiting symptoms. Figure 11In the diagram, colors represent the interactive effects of other features. Overall, these interaction dependency graphs not only validate the model's ability to capture joint risk patterns but also provide data support for refined intervention strategies: patients with high-frequency episodes should strictly control analgesic use, individuals with photosensitivity must be assessed for the risk of drug overdose, and sleep management demonstrates significant moderating potential across multiple symptom combinations.

[0070] This embodiment, based on data from 598 outpatient questionnaires, constructed and systematically compared nine machine learning classifiers, demonstrating that the integrated GradientBoosting prediction model can accurately distinguish high-risk headache individuals with an accuracy of 0.928 and an F1 score of 0.929 without the need for imaging / laboratory information. Through TreeSHAP multi-perspective interpretation, it consistently captured the significant positive contributions of symptoms such as light sensitivity and sleep disturbances to the prediction results at the global, individual, and interaction levels, further validating the high consistency between model decisions and clinical experience. Simultaneously, the SHAP dependency graph revealed hyperadditive risk combinations such as "high frequency attacks + excessive analgesia" and "light sensitivity + excessive medication headache," as well as the moderating effect of sleep quality on the intensity of vomiting, providing quantitative targets for precise intervention.

[0071] In terms of clinical significance, questionnaire features can be quickly obtained at the initial diagnosis stage. Gradient Boosting model inference has low time consumption (<20ms / case) and is robust to collinearity and missing values. Therefore, it is suitable for embedding into primary healthcare information systems or mobile mini-programs to achieve low-cost, large-scale headache risk pre-screening. The bar charts, beehive diagrams, etc., output by SHAP interpretation can be directly used as visual decision support to help non-neurologists identify patients who need referral or further examination.

[0072] Through TreeSHAP and the aforementioned multi-perspective visualization, this embodiment not only verifies the consistency between model decisions and clinical experience, but also reveals the marginal impact and potential interaction of each symptom variable in different value ranges, providing physicians with actionable intervention targets and further improving the model's usability and credibility in real diagnosis and treatment processes.

[0073] Example 2 Based on the same inventive concept as the migraine attack prediction method in Embodiment 1 above, this embodiment also provides a migraine attack prediction system, such as... Figure 12 As shown, the system includes: Data acquisition module 1 is used to acquire health survey and auxiliary examination data related to migraine patients; Data preprocessing module 2 is used to preprocess the patient health survey and auxiliary examination data; Key feature filtering module 3 is used to identify key features related to migraine based on the preprocessed data through feature filtering; The prediction model building module 4 is used to build a migraine attack early prediction model based on the Gradient Boosting algorithm. The input of the prediction model is the key feature, and the output of the prediction model is the probability prediction result of migraine attacks. Interpretability analysis module 5 is used to perform interpretability analysis on the output results of the prediction model based on the SHAP method.

[0074] The various specific processes and examples of the migraine attack prediction method in the aforementioned Embodiment 1 are also applicable to the migraine attack prediction system of this embodiment. Through the detailed description of Embodiment 1, those skilled in the art can clearly understand the implementation method of the photoacoustic imaging puncture needle automatic segmentation system in this embodiment. Therefore, for the sake of brevity, it will not be described in detail here.

[0075] Example 3 Based on the same inventive concept as the migraine attack prediction method in Embodiment 1 above, this embodiment also provides a migraine attack prediction device, which stores a computer program that, when executed by a processor, implements the steps of the migraine attack prediction method described in Embodiment 1.

[0076] Example 4 Based on the same inventive concept as the migraine attack prediction method in Embodiment 1 above, this embodiment also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the migraine attack prediction method described in Embodiment 1.

[0077] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0078] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0079] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0080] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0081] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0082] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for predicting migraine attacks in advance, characterized in that, Includes the following steps: Obtain health survey and auxiliary examination data related to migraine patients; The patient health survey and auxiliary examination data are preprocessed; Based on the preprocessed data, key features related to migraine were identified through feature filtering. A migraine attack prediction model is established based on the Gradient Boosting algorithm. The input of the prediction model is the key feature, and the output of the prediction model is the probability prediction result of migraine attacks. The interpretability of the prediction model's output is analyzed based on the SHAP method.

2. The method for predicting migraine attacks in advance as described in claim 1, characterized in that, The patient health survey and auxiliary examination data include headache history, headache characteristics, triggers and causes, auxiliary examination results, and demographic characteristics.

3. The method for predicting migraine attacks in advance as described in claim 1 or 2, characterized in that, The patient health survey and auxiliary examination data include 37 variables, specifically: Medical history: family history, past medical history; Headache characteristics: photophobia, phonophobia, olfactory phobia, nausea, vomiting, aura, prodromal symptoms, duration, frequency of attacks, dizziness / vertigo, pain intensity; Triggers and causes: fatigue, stress, menstruation, hunger, overeating, insufficient sleep, excessive sleep, weather changes, light stimulation, noise stimulation, certain foods, alcohol, drugs, emotional fluctuations, changes in body position; Demographic characteristics: sex, age, height, weight; Ancillary examinations: imaging, electrophysiology, blood tests; Other clinical features: pulse, blood pressure.

4. The method for predicting migraine attacks in advance as described in claim 1, characterized in that, The preprocessing method includes at least one of the following: Numerical encoding is performed on categorical variables, that is, "yes / no" is converted into "1 / 0"; Standardize continuous variables by converting their values ​​into a standard normal distribution with a mean of 0 and a standard deviation of 1, thereby eliminating the influence of different units of measurement. Use IQR rules for outlier detection and handling; Missing values ​​are handled using missing data imputation methods to ensure data integrity and quality.

5. The method for predicting migraine attacks in advance as described in claim 3, characterized in that, The key features identified through feature filtering are as follows: The TreeSHAP algorithm was used to calculate the global importance of all 37 variables. The variables were sorted by their average absolute SHAP values, and the top 21 features in terms of SHAP importance were selected as the 21 key features.

6. The method for predicting migraine attacks in advance as described in claim 5, characterized in that, The 21 key features are as follows: Headache history: family history, past medical history; Headache characteristics include: photophobia, phonophobia, olfactory phobia, nausea, vomiting, aura, and prodromal symptoms; Triggers and causes: fatigue, stress, menstruation, hunger, lack of sleep, weather changes, light stimulation, noise stimulation, certain foods, alcohol, mood swings, and changes in body position.

7. The method for predicting migraine attacks in advance as described in claim 6, characterized in that, The interpretability analysis of the output of the prediction model based on the SHAP method specifically includes: calculating the contribution value of each key feature to the prediction result using the SHAP method, and generating an interpretability analysis chart, wherein the interpretability analysis chart includes at least one of the following: Global Bar Chart – By calculating the average absolute SHAP value of all samples, it displays the global feature importance ranking, helping users quickly identify the symptom items that have the greatest impact on model decisions; Bee colony graph – plots the SHAP value of each individual as a horizontal scatter point and uses color to indicate the original feature value, intuitively showing the positive and negative contributions of the same feature to the prediction result under high and low values ​​and the non-linear threshold effect; Heatmap – Expanding the SHAP value matrix in two dimensions, features and samples, and mapping the contribution size with warm and cool colors, it can simultaneously observe risk heterogeneity at the population level and key driving factors of individual cases; Dependency plots—with the original values ​​of core features on the horizontal axis and the corresponding SHAP values ​​on the vertical axis, and colored with another covariate—are used to capture the interaction relationships between core features and the clinically significant "synergistic" or "inhibitory" effects.

8. A migraine attack prediction system, characterized in that, The system includes: The data acquisition module is used to acquire health survey and auxiliary examination data related to migraine patients; The data preprocessing module is used to preprocess the patient health survey and auxiliary examination data; The key feature filtering module is used to identify key features related to migraines based on preprocessed data through feature filtering. The prediction model building module is used to build a migraine attack prediction model based on the Gradient Boosting algorithm. The input of the prediction model is the key feature, and the output of the prediction model is the probability prediction result of migraine attacks. The interpretability analysis module is used to perform interpretability analysis on the output of the prediction model based on the SHAP method.

9. A migraine attack prediction device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the migraine attack prediction method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the migraine attack prediction method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Risk prediction model for severe fever with thrombocytopenia syndrome as well as construction method and application of risk prediction model

    CN119092124A

  • System and Method for Treating Migraine and Headache Through a Digital Therapeutic

    US20220392596A1

Cited By

  • Knowledge and data fusion driven interpretable primary headache auxiliary identification method

    CN122135924A

  • Knowledge and data fusion-driven interpretable auxiliary identification method for primary headache

    CN122135924B