XGBoost model for evaluating cerebral hemorrhage recurrence risk of patient based on data and construction method thereof
The XGBoost model combines LASSO regression and stepwise recursive program to process data and optimize model parameters, and solves the problem of fewer and unstable cerebral hemorrhage risk assessment models in the existing technology, achieving higher prediction accuracy and stability.
Patent Information
- Application Number
- CN202411240325.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2025-01-07
AI Technical Summary
There are few existing models for assessing the risk of recurrence of cerebral hemorrhage and unstable performance, prone to false alarms, affecting patient prognosis.
The XGBoost model is used to combine LASSO regression and step-by-step recursive program to process data, and visually interpret it through SHAP and LIME interpreters, optimize model parameters to improve prediction accuracy, and ensure model stability through ten-fold cross-validation.
It improves the accuracy of the risk assessment of cerebral hemorrhage recurrence, reduces the occurrence of false alarms, and improves the stability and accuracy of predictions.
Smart Images

Figure CN119274786A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data analysis, and in particular to an XGBoost model for evaluating the risk of recurrence of cerebral hemorrhage in patients based on data and a construction method thereof. Background Art
[0002] Cerebral hemorrhage, also known as spontaneous cerebral hemorrhage, is a disease caused by rupture of blood vessels in the brain, which causes blood to flow out. It accounts for 20% to 30% of acute cerebrovascular diseases and has a large incidence rate. In addition, the risk of recurrence of cerebral hemorrhage is high, and patients with recurrence are more likely to have their condition aggravated. When the disease recurs, it takes minutes or hours to complete. Therefore, recurrence of cerebral hemorrhage is very dangerous for patients. If the probability of recurrence of cerebral hemorrhage can be accurately predicted, it can help patients to take targeted treatment and prevention strategies in a timely and effective manner, improve patient prognosis, and reduce patient mortality.
[0003] Currently, there are few models for assessing the risk of recurrence of cerebral hemorrhage. The existing model for predicting the risk of recurrence of cerebral hemorrhage only includes the electronic medical records of 38 recurrent patients as a basis, and the model AUC (area under the curve) is only 0.802, with average performance.
[0004] However, there are many risk factors that affect the prognosis of cerebral hemorrhage, and the interactions are complex, which makes the performance of the cerebral hemorrhage recurrence prediction model unstable. The machine learning model is conducive to processing more risk factors and complex interactions between factors, which can improve the model performance and enhance the prediction accuracy. Summary of the invention
[0005] The purpose of the present invention is to provide an XGBoost model for evaluating the risk of recurrence of cerebral hemorrhage in patients based on data and a method for constructing the model, aiming to overcome the fact that there are few existing models for evaluating the risk of recurrence of cerebral hemorrhage and there are many false alarms, which interfere with the prognosis of patients with cerebral hemorrhage.
[0006] To achieve the above object, the present invention provides a method for constructing an XGBoost model for evaluating the risk of recurrence of cerebral hemorrhage in patients based on data, the method comprising:
[0007] S10, reading and processing the data of patients with cerebral hemorrhage to obtain training set data;
[0008] S20, receiving the training set data, processing the training set data using LASSO regression and stepwise recursive procedures, and outputting a plurality of variable features;
[0009] S30, determining whether the p-value of each characteristic variable is less than 0.05;
[0010] S40, when the p-value of the characteristic variable is less than 0.05, outputting the variable characteristic;
[0011] S50, constructing and optimizing the parameters of the first model, and outputting an XGBoost model;
[0012] S60, using SHAP and LIME interpreters to visually interpret the evaluation results of the XGBoost model.
[0013] Preferably, in the above technical solution, the specific steps of reading and processing patient data to obtain training set data are as follows:
[0014] S11, read and output the cerebral hemorrhage patient data from the electronic medical record database, the laboratory database, the questionnaire database, and the clinical evaluation database;
[0015] S12, receiving the cerebral hemorrhage patient data, processing the cerebral hemorrhage patient data in a random undersampling manner, and outputting training set data;
[0016] S13, using a ten-fold cross validation method to compare the training set data, and outputting a stability evaluation value of the training set data.
[0017] Preferably, in the above technical solution, the steps of constructing and optimizing the parameters of the first model and outputting the XGBoost model are specifically as follows:
[0018] S51, accepting variable features with p-value less than 0.05;
[0019] S52, using the XGBoost algorithm to construct an initial model based on the variable features;
[0020] S53, used to optimize the parameters of the first model by internal verification, and output a second model;
[0021] S54, collecting data of other patients with cerebral hemorrhage as external validation data, and using the external validation data to externally validate the second model;
[0022] S55, after verification, output the XGBoost model.
[0023] Preferably, in the above technical solution, the XGBoost model is specifically 0.048+0.077*age+0.299*NIHSS dis+0.062*phe admission+0.372*phe followup+0.033*history of stroke-0.020*hypotensive drug-0.039*PLT+0.024*AST+0.026*CRP ,The NIH SS dis represents the NIHSS score at discharge, the PLT represents the platelet value at admission, the age represents the age at admission, the AST represents the aspartate aminotransferase value at admission, the CRP represents the C-reactive protein value at admission, the phe admission represents the amount of cerebral hemorrhage at admission, the history of stroke represents the history of stroke, and the hypotensive drug represents whether antihypertensive drugs are used.
[0024] An XGBoost model for evaluating the risk of recurrence of cerebral hemorrhage in patients based on data, the XGBoost model consists of a reading and processing module, a selection module, a judgment module, a construction optimization module, and a visualization output module, as follows:
[0025] Reading and processing module: used to read and process the data of patients with cerebral hemorrhage to obtain training set data;
[0026] Selection module: receiving the training set data, processing the training set data using LASSO regression and stepwise recursive procedures, and outputting a number of variable features;
[0027] Judgment module: used to determine whether the p-value of each characteristic variable is less than 0.05;
[0028] Output module: used for outputting the variable feature when the p value of the feature variable is less than 0.05;
[0029] Constructing an optimization module: for constructing and optimizing the parameters of the first model and outputting an XGBoost model;
[0030] Visualization output module: used to visualize the evaluation results of the XGBoost model using SHAP and LIME interpreters.
[0031] Preferably, in the above technical solution, the reading and processing module is composed of a reading output unit, a receiving unit, a processing unit, and a verification unit, as follows:
[0032] Reading and output unit: used to read and output cerebral hemorrhage patient data from the electronic medical record database, laboratory database, questionnaire database and clinical evaluation database;
[0033] Receiving unit: used for receiving the cerebral hemorrhage patient data;
[0034] Processing unit: used for processing the cerebral hemorrhage patient data in a random undersampling manner and outputting training set data;
[0035] Validation unit: used to compare the training set data using a ten-fold cross validation method and output a stability evaluation value of the training set data.
[0036] Preferably, in the above technical solution, the construction optimization module includes a receiving unit, a construction unit, a first optimization unit, a second optimization unit and an output unit, as follows:
[0037] Receiving unit: used to receive variable features with p-value less than 0.05;
[0038] Construction unit: used to construct an initial model based on the variable features using the XGBoost algorithm;
[0039] A first optimization unit: used for optimizing the parameters of the first model by internal verification, and outputting a second model;
[0040] The second optimization unit is used to collect data of other patients with cerebral hemorrhage as external validation data, and use the external validation data to externally validate and optimize the second model;
[0041] Output unit: used to output the XGBoost model after verification and optimization.
[0042] Preferably, in the above technical solution, the XGBoost model is 0.048+0.077*age+0.299*NIHSSdis+0.062*phe admission+0.372*phe followup+0.033*history of stroke-0.020*hypotensive drug-0.039*PLT+0.024*AST+0.026*CRP, wherein the NIHSS dis represents the NIHSS score at discharge, the PLT represents the platelet value at admission, the age represents the age at admission, the AST represents the aspartate aminotransferase value at admission, the CRP represents the C-reactive protein value at admission, the phe admission represents the amount of cerebral hemorrhage at admission, the history of stroke represents the history of stroke, and the hypotensive drug represents whether antihypertensive drugs are used.
[0043] An electronic device, comprising:
[0044] A memory storing at least one instruction;
[0045] and a processor, executing the instructions stored in the memory to implement the method for constructing an XGBoost model based on data analysis of the risk of recurrence of cerebral hemorrhage in patients as described above.
[0046] A computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in an electronic device to implement the method for constructing an XGBoost model based on data analysis of the risk of recurrence of cerebral hemorrhage in patients as described above.
[0047] Compared with the prior art, the beneficial effects of this application are:
[0048] The XGBoost model obtained by the present invention for assessing the risk of recurrence of cerebral hemorrhage in patients has a high evaluation accuracy based on the following principles: first, a downsampling method is used to obtain a data set to ensure that the model data selection is biased, so as to cope with the problem of data drift during the application of the model and ensure the prediction accuracy of the model; secondly, the model resolution AUC and prediction accuracy of the model internally verified by using nine characteristic factors are high; the model resolution AUC and prediction accuracy of the test set test are also high. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings.
[0050] Figure 1 It is a graph of the importance ranking of each feature variable in the XGBoost model of the present invention;
[0051] Figure 2 This is a graph using LIME interpreter to visualize and explain the XGBoost model to evaluate the recurrence of cerebral hemorrhage in a patient;
[0052] Figure 3 It is a schematic diagram of the process of constructing the XGBoost model of the present invention;
[0053] Figure 4 It is a flow chart of step S2 in the flow chart of constructing an XGBoost model of the present invention;
[0054] Figure 5 It is a flow chart of step S3 in the flow chart of constructing an XGBoost model of the present invention;
[0055] Figure 6 It is a structural schematic diagram of the XGBoost model constructed by the present invention;
[0056] Figure 7 It is a structural schematic diagram of the reading and processing module in the structural schematic diagram of the XGBoost model of the present invention;
[0057] Figure 8 It is a structural schematic diagram of constructing an optimization module in the structural schematic diagram of the XGBoost model of the present invention;
[0058] Fig. 9is a schematic diagram of the internal structure of an electronic device provided by an embodiment of the present invention;
[0059] Fig.10 It is a graph of the AUC value and accuracy of the logistic regression model, SVM model, and decision tree model;
[0060] Fig.11 It is a graph of PPV and NPV for logistic regression model, SVM model, and decision tree model. DETAILED DESCRIPTION
[0061] The terms first, second, third, etc. are used herein to describe various parts, components, regions, layers, and / or segments, but these parts, components, regions, layers, and / or segments should not be limited by these terms. These terms are only used to distinguish a certain part, component, region, layer, and / or segment from another part, component, region, layer, and / or segment. Therefore, without departing from the scope of the present invention, the first part, component, region, layer, and / or segment described below may also be described as the second part, component, region, layer, and / or segment.
[0062] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. Unless the context otherwise clearly indicates the opposite, the singular form used herein is also intended to include the plural form. It should also be understood that the term "comprising" specifically refers to a certain characteristic, field, integer, step, action, element and / or component, but does not exclude the existence or addition of other characteristics, fields, integers, steps, actions, elements, components and / or groups.
[0063] Although not otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those commonly understood by those skilled in the art. Terms with definitions in dictionaries should be interpreted as having the same meaning as those disclosed in the relevant technical literature and this article, and should not be interpreted in an idealized or overly formal sense.
[0064] The technical solutions in the embodiments of the present invention are described clearly and completely. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] like Figure 3 As shown, it is a flow chart of a preferred embodiment of the present invention to construct an XGBoost model for assessing the risk of cerebral hemorrhage in patients based on data, and the method is as follows:
[0066] S10, reading and processing the data of patients with cerebral hemorrhage to obtain training set data;
[0067] S20, receiving the training set data, processing the training set data using LASSO regression and stepwise recursive procedures, and outputting a plurality of variable features;
[0068] Furthermore, the Boruta library of Python receives the training set data, selects variable features related to the risk of recurrence of cerebral hemorrhage in the training set data through LASSO regression and stepwise recursive procedures, and outputs 70 variable features.
[0069] S30, determining whether the p-value of each characteristic variable is less than 0.05;
[0070] S40, when the p-value of the characteristic variable is less than 0.05, outputting the variable characteristic;
[0071] Furthermore, the actual P value of each variable feature is calculated, and the actual P value is compared with the reference P value of 0.05. When the actual P value of a variable feature is <0.05, the variable feature is output for constructing the first model. When the actual P value of a variable feature is >0.05, the variable feature is discarded.
[0072] S50, constructing and optimizing the parameters of the first model, and outputting an XGBoost model;
[0073] S60, using SHAP and LIME interpreters to visually interpret the evaluation results of the XGBoost model.
[0074] Further, in step S10, the step of reading and processing patient data to obtain training set data is as follows: Figure 4 As shown, the details are as follows:
[0075] S11, read and output the cerebral hemorrhage patient data from the electronic medical record database, the laboratory database, the questionnaire database, and the clinical evaluation database;
[0076] Step S11 specifically includes reading demographic information data, vital sign data, and comorbidity data of patients with cerebral hemorrhage from the electronic medical record database of the Affiliated Hospital of Youjiang Medical College for Nationalities, Baise, Guangxi, wherein the demographic information data includes name, gender, and age, the vital sign data includes heart rate and blood pressure, and the comorbidity data includes renal insufficiency, epilepsy, pneumonia, and location of cerebral hemorrhage;
[0077] The laboratory data of patients with cerebral hemorrhage, such as PLT (platelet), INR (international normalized ratio), ALT (alanine aminotransferase), AST (aspartate aminotransferase), LDL-C (low-density lipoprotein), and CRP (C-reactive protein), were read from the laboratory database of the Affiliated Hospital of Youjiang Medical College for Nationalities in Baise, Guangxi;
[0078] The medical history data and medication data from the structured questionnaire filled out by patients with cerebral hemorrhage were read from the questionnaire survey database of the Affiliated Hospital of Youjiang Medical College for Nationalities in Baise, Guangxi;
[0079] The NIHSS (National Institutes of Health Stroke Scale) score data at admission and discharge, the mRS (modified Rankin Scale) score data at admission and discharge, the GCS score data (Glasgow Coma Scale) score data at admission, the ADL data (activities of daily living) score data at admission, and the hematoma volume were measured by the ABC / 2 method and evaluated with Alice software (PAREXEL International, Waltham, Massachusetts, USA) for patients with cerebral hemorrhage from the clinical evaluation database of the Affiliated Hospital of Youjiang Medical College for Nationalities, Baise, Guangxi;
[0080] The data of 1024 patients with cerebral hemorrhage read from the electronic medical record database, laboratory database, questionnaire database and clinical evaluation database were integrated and output.
[0081] S12, receiving the cerebral hemorrhage patient data, performing random under-sampling on the cerebral hemorrhage patient data, and outputting training set data;
[0082] Specifically, in step S12, the scikit-learn library in Python receives the cerebral hemorrhage patient data and divides it into majority class data (N1) and minority class data (N2), sets a sampling ratio (r), and calculates the majority class data to be deleted as (N1-N2*r) according to the set sampling ratio, randomly deletes the majority class data to be deleted in the cerebral hemorrhage patient data, and outputs the training set data.
[0083] S13, using a ten-fold cross validation method to compare the training set data, and outputting a stability evaluation value of the training set data.
[0084] S13 is specifically to divide the training set data into 10 parts, take one of them as reference data for comparison with the other 9 parts, and take the average value of the 10 test results as the value for evaluating the stability of the training set data.
[0085] Further, in step S50, the step of constructing and optimizing the parameters of the first model and outputting the XGBoost model is as follows: Figure 5 As shown, the details are as follows:
[0086] S51, accepting variable features with p-value less than 0.05;
[0087] Furthermore, the variable characteristics with p-value less than 0.05 included the residual amount of cerebral hemorrhage during the follow-up period of phe, NIHSS score at discharge, platelet value at admission, age at admission, aspartate aminotransferase value at admission, CRP value at admission, amount of cerebral hemorrhage at admission of phe, history of stroke, and whether hypotensive drug was used.
[0088] S52, using the XGBoost algorithm to construct an initial model based on the variable features;
[0089] Use the xgb_clf.fit command of the sklearn library in Python to build an XGBoost model using the variable features received by the above S51, and use the xgb_clf.feature_importances command to obtain the weight parameters of each feature in the model.
[0090] S53, optimizing the parameters of the first model by internal verification, and outputting a second model;
[0091] Furthermore, the steps of optimizing the parameters of the first model by internal verification and outputting the second model are specifically as follows:
[0092] Setting the parameter range of each variable feature in the first model by grid search;
[0093] Divide the parameter range into several subsets;
[0094] Loop through each subset according to the step size to obtain the parameters of each variable feature;
[0095] The parameters of each variable feature are compared through the five-fold cross-validation method to obtain the optimal hyperparameter combination of variable features;
[0096] The optimal hyperparameters of the variable features are combined into a second model, and the second model is output.
[0097] S54, collecting data of other patients with cerebral hemorrhage as external validation data, and using the external validation data to externally validate the second model;
[0098] The data of 265 patients with cerebral hemorrhage were read and output from the electronic medical record database, laboratory database, questionnaire database and clinical evaluation database of Baidong Hospital Affiliated to Youjiang Medical College for Nationalities, Baise, Guangxi. The 265 patients with cerebral hemorrhage were external validation data for external validation of the second model.
[0099] S55, after verification, output the XGBoost model.
[0100] Furthermore, the XGBoost model is specifically 0.048+0.077*age+0.299*NIHSS dis+0.062*phe admission+0.372*phe followup+0.033*history of stroke-0.020*hypotensivedrug-0.039*PLT+0.024*AST+0.026*CRP, wherein the NIHSS dis represents the NIHSS score at discharge, the PLT represents the platelet value at admission, the age represents the age at admission, the AST represents the aspartate aminotransferase value at admission, the CRP represents the C-reactive protein value at admission, the phe admission represents the amount of cerebral hemorrhage at admission, the history of stroke represents the history of stroke, and the hypotensive drug represents whether antihypertensive drugs are used.
[0101] like Figure 6 As shown, the XGBoost model 100 for evaluating the risk of recurrence of cerebral hemorrhage in patients based on data in this embodiment is composed of a reading and processing module 110, a selection module 120, a judgment module 130, an output module 140, a construction optimization module 150 and a visualization output module 160, which are specifically as follows:
[0102] The reading and processing module 110 is used to read and process the data of patients with cerebral hemorrhage to obtain training set data;
[0103] Selection module 120: receiving the training set data, processing the training set data using LASSO regression and stepwise recursive procedures, and outputting a number of variable features;
[0104] Determination module 130: used to determine whether the p value of each characteristic variable is less than 0.05;
[0105] Output module 140: used for outputting the variable feature when the p value of the feature variable is less than 0.05;
[0106] Construct optimization module 150: construct and optimize the parameters of the first model, and output the XGBoost model as 0.048+0.077*age+0.299*NIHSS dis+0.062*phe admission+0.372*phe followup+0.033*history of stroke-0.020*hypotensive drug-0.039*PLT+
[0107] 0.024*AST+0.026*CRP;
[0108] Visualization output module 160: used to use SHAP and LIME interpreters to visualize the evaluation results of the XGBoost model.
[0109] Furthermore, if Figure 7 The reading and processing module 110 is composed of a reading and output unit 111, a receiving unit 112, a processing unit 113, and a verification unit 114, which are specifically as follows:
[0110] The reading and outputting unit 111 is used to read and output the cerebral hemorrhage patient data from the electronic medical record database, the laboratory database, the questionnaire database and the clinical evaluation database;
[0111] Receiving unit 112: used for receiving the cerebral hemorrhage patient data;
[0112] Processing unit 113: used for processing the cerebral hemorrhage patient data in a random under-sampling manner and outputting training set data;
[0113] The verification unit 114 is used to compare the training set data using a ten-fold cross-validation method and output a stability evaluation value of the training set data.
[0114] Further, such as Figure 8 The construction optimization module 150 shown includes a receiving unit 151, a construction unit 152, a first optimization unit 153, a second optimization unit 154 and an output unit 155, which are specifically as follows:
[0115] Receiving unit 151: used for receiving variable features with a p value less than 0.05;
[0116] Construction unit 152: used to construct an initial model based on the variable features using the XGBoost algorithm;
[0117] A first optimization unit 153 is used to optimize the parameters of the first model by using internal verification, and output a second model;
[0118] The second optimization unit 154 is used to collect data of other cerebral hemorrhage patients as external verification data, and use the external verification data to externally verify and optimize the second model;
[0119] Output unit 155: used to verify the optimization and output the XGBoost model 0.048+0.077*age+0.299*NIHSSdis+0.062*phe admission+0.372*phe followup+0.033*history of stroke-0.020*hypotensive drug-0.039*PLT+0.024*AST+0.026*CRP, wherein the phe followup represents the residual amount of cerebral hemorrhage during the follow-up period, the NIHSS dis represents the NIHS S score at discharge, the PLT represents the platelet value at admission, the age represents the age at admission, the AST represents the aspartate aminotransferase value at admission, the CRP represents the C-reactive protein value at admission, the phe admission represents the amount of cerebral hemorrhage at admission, the history of stroke represents the history of stroke, and the hypotensive drug represents whether antihypertensive drugs are used.
[0120] Figure 1 The importance ranking of each variable feature in the model is shown in Figure 1 The blue part in the figure represents the proportion of training set data whose corresponding variable characteristics are classified as no recurrence of cerebral hemorrhage, and the red part represents the proportion of training set data whose corresponding variable characteristics are classified as recurrence of cerebral hemorrhage; the length of the horizontal color bar represents the relative importance of the factor in the model.
[0121] Figure 2 In order to use the XGBoost model in Example 2 to evaluate the risk of recurrence of cerebral hemorrhage in a patient, the evaluation result shows that the risk of recurrence of cerebral hemorrhage in the patient may be 100%, and the patient does have recurrence of cerebral hemorrhage.
[0122] Fig. 9 The electronic device 1 is a schematic diagram of the structure of the electronic device of the preferred embodiment of the data determination method of the present invention. The electronic device 1 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), digital signal processors (DSP), embedded devices, etc.
[0123] The electronic device 1 may also be, but is not limited to, any electronic product that can interact with a user via a keyboard, mouse, remote control, touchpad or voice control device, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, a robot, etc.
[0124] The electronic device 1 may also be a computing device such as a desktop computer, a notebook, a palm computer, or a cloud server.
[0125] The network where the electronic device 1 is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.
[0126] In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a computer program stored in the memory 11 and executable on the processor 12, such as an XGBoost model 01 for assessing a patient's risk of cerebral hemorrhage based on data.
[0127] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation on the electronic device 1. The electronic device 1 may include more or fewer components than shown in the diagram, or a combination of certain components, or different components. For example, the electronic device 1 may also include input and output devices, network access devices, buses, etc.
[0128] The processor 12 executes the operating system of the electronic device 1 and various installed applications. The processor 12 executes the applications to implement the steps in the above-mentioned various data determination method embodiments, for example Figure 3 Steps S10, S20, S30, S40, S50, S60 are shown.
[0129] Alternatively, when the processor 12 executes the computer program, the functions of each module / unit in the above-mentioned device embodiments are implemented, for example: reading and processing the data of patients with cerebral hemorrhage to obtain training set data; receiving the training set data, processing the training set data using LASSO regression and stepwise recursive procedures, and outputting several variable features; determining whether the p-value of each feature variable is less than 0.05; when the p-value of the feature variable is less than 0.05, outputting the variable feature; constructing and optimizing the parameters of the first model, and outputting the XGBoost model; and using SHAP and LIME interpreters to visualize the evaluation results of the XGBoost model.
[0130] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 11 and executed by the processor 12 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into a reading and processing module 110, a selection module 120, a judgment module 130, an output module 140, a construction optimization module 150, and a visualization output module 160.
[0131] The memory 11 can be used to store the computer program and / or module, and the processor 12 realizes various functions of the electronic device 1 by running or executing the computer program and / or module stored in the memory 11, and calling the data stored in the memory 11. The memory 11 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 11 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0132] The memory 11 may be an external memory and / or an internal memory of the electronic device 1. Furthermore, the memory 11 may be a circuit with a storage function in an integrated circuit without a physical form, such as a RAM (Random-Access Memory), a FIFO (First In First Out), etc. Alternatively, the memory 11 may also be a memory in a physical form, such as a memory stick, a TF card (Trans-flash Card), etc.
[0133] If the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of each of the above-mentioned method embodiments can be implemented.
[0134] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer readable media do not include electric carrier signals and telecommunication signals.
[0135] Combination Figure 4 The memory 11 in the electronic device 1 stores a plurality of instructions to implement a data determination method, and the processor 12 can execute the plurality of instructions to implement: reading and outputting cerebral hemorrhage patient data from an electronic medical record database, a laboratory database, a questionnaire database, and a clinical evaluation database; receiving the cerebral hemorrhage patient data, randomly under-sampling the cerebral hemorrhage patient data, and outputting training set data; comparing the training set data using a ten-fold cross-validation method, and outputting a stability evaluation value of the training set data.
[0136] Specifically, the specific implementation method of the processor 12 for the above instructions can refer to Figure 3 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0137] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0138] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0139] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0140] The most commonly used machine learning models in the field of medical research, such as logistic regression model, support vector machine model, decision tree model, and random forest model, were also created to test their prediction accuracy and AUC values. The results of internal validation showed that the AUC of the logistic regression model was 0.89, the precision was 0.81, the positive predictive value (PPV) was 87.3%, and the negative predictive value (NPV) was 76.0%. The AUC of the SVM model was 0.93, the precision was 0.90, the PPV was 94.2%, and the NPV was 88.5%, while the AUC of the decision tree model was 0.91, the precision was 0.71, the PPV was 79.0%, and the NPV was 81.5%.
[0141] For the ensemble machine learning models, the score of the logistic regression model was 0.951, the score of the decision tree classifier was 0.962, and the score of the SVC model was 0.883. In the voting classifier model, the score of the soft voting method was 0.928, with an AUC and precision of 0.96 and 0.86, respectively, a PPV of 94.2%, and an NPV of 89.4%. The score of the random forest model was 0.966, with an AUC and precision of 0.95 and 0.93, respectively, a PPV of 95.0%, and an NPV of 92.3%. The score of the XGBoost model was 0.977, with an AUC and precision of 0.95 and 0.92, respectively, a PPV of 94.6%, and an NPV of 93.1%. All three ensemble machine learning models showed excellent discrimination ability, and the latter two models showed excellent calibration. The random forest and XGBoost algorithms improved the performance of the basic model.
[0142] The model performance when using the test cohort for external validation was shown to be 0.81 ( Fig.10 a-1), the accuracy is 0.79( Fig.10 a-2). The AUC of the SVM model is 0.87 ( Fig.10 b-1), with an accuracy of 0.76( Fig.10 b-2); the AUC of the decision tree model is 0.71 ( Fig.10 c-1), with an accuracy of 0.70( Fig.10 c-2). For the integrated machine learning model random forest model, the AUC is 0.92 ( Fig.11 a-1), the accuracy is 0.86( Fig.11 a-2); the AUC of the XGBoost model is 0.93 ( Fig.11b-2), the accuracy is 0.91( Fig.11 b-2). The positive predictive value (PPV) of the random forest model was 90.0%, and the negative predictive value (NPV) was 85.2%. The PPV of the XGBoost model was 92.5%, and the NPV was 93.2%. The XGBoost model still showed excellent discrimination and calibration in the test cohort among all the integrated machine learning algorithms.
[0143] The present invention can be implemented in various ways and is not limited to the embodiments described. A person skilled in the art can understand that the present invention can be implemented in other specific ways without changing the technical concept or essential features of the present invention. Therefore, it should be understood that the embodiments described above are exemplary and are not intended to limit the present invention.
Claims
1. A method for constructing an XGBoost model for evaluating the risk of recurrence of cerebral hemorrhage in patients based on data, characterized in that: The method comprises: S10, reading and processing the data of patients with cerebral hemorrhage to obtain training set data; S20, receiving the training set data, processing the training set data using LASSO regression and stepwise recursive procedures, and outputting a plurality of variable features; S30, determining whether the p-value of each characteristic variable is less than 0.05; S40, when the p-value of the characteristic variable is less than 0.05, outputting the variable characteristic; S50, constructing and optimizing the parameters of the first model, and outputting an XGBoost model; S60, using SHAP and LIME interpreters to visually interpret the evaluation results of the XGBoost model.
2. The method for constructing an XGBoost model for evaluating the risk of recurrence of cerebral hemorrhage in patients based on data according to claim 1, characterized in that: The specific steps of reading and processing patient data to obtain training set data are as follows: S11, read and output the cerebral hemorrhage patient data from the electronic medical record database, the laboratory database, the questionnaire database, and the clinical evaluation database; S12, receiving the cerebral hemorrhage patient data, processing the cerebral hemorrhage patient data in a random undersampling manner, and outputting training set data; S13, using a ten-fold cross validation method to compare the training set data, and outputting a stability evaluation value of the training set data.
3. The method for constructing an XGBoost model for evaluating the risk of recurrence of cerebral hemorrhage in patients based on data according to claim 1, characterized in that: The steps of constructing and optimizing the parameters of the first model and outputting the XGBoost model are as follows: S51, accepting variable features with p-value less than 0.05; S52, using the XGBoost algorithm to construct a first model based on the variable features; S53, optimizing the parameters of the first model by internal verification, and outputting a second model; S54, collecting data of other patients with cerebral hemorrhage as external validation data, and using the external validation data to externally validate the second model; S55, after verification, output the XGBoost model.
4. The method for constructing an XGBoost model for evaluating the risk of recurrence of cerebral hemorrhage in patients based on data according to claim 3, characterized in that: The XGBoost model is specifically 0.048+0.077*age+0.299*NIHSS dis+0.062*pheadmission+0.372*phe followup+0.033*history of stroke-0.020*hypotensive drug-0.039*PLT+0.024*AST+0.026*CRP, wherein the NIHSS dis represents the NIHSS score at discharge, the PLT represents the platelet value at admission, the age represents the age at admission, the AST represents the aspartate aminotransferase value at admission, the CRP represents the C-reactive protein value at admission, the phe admission represents the amount of cerebral hemorrhage at admission, the history of stroke represents the history of stroke, and the hypotensive drug represents whether antihypertensive drugs are used.
5. An XGBoost model for evaluating the risk of recurrence of cerebral hemorrhage in patients based on data, characterized in that: The XGBoost model consists of a reading and processing module, a selection module, a judgment module, an output module, a construction optimization module, and a visualization output module, as follows: Reading and processing module: used to read and process the data of patients with cerebral hemorrhage to obtain training set data; Selection module: receiving the training set data, processing the training set data using LASSO regression and stepwise recursive procedures, and outputting a number of variable features; Judgment module: used to determine whether the p-value of each characteristic variable is less than 0.05; Output module: used for outputting the variable feature when the p value of the feature variable is less than 0.05; Constructing an optimization module: for constructing and optimizing the parameters of the first model and outputting an XGBoost model; Visualization output module: used to visualize the evaluation results of the XGBoost model using SHAP and LIME interpreters.
6. The XGBoost model for analyzing the risk of recurrence of cerebral hemorrhage in patients based on data according to claim 5, characterized in that: The reading and processing module is composed of a reading output unit, a receiving unit, a processing unit, and a verification unit, as follows: Reading and output unit: used to read and output cerebral hemorrhage patient data from the electronic medical record database, laboratory database, questionnaire database and clinical evaluation database; Receiving unit: used for receiving the cerebral hemorrhage patient data; Processing unit: used for processing the cerebral hemorrhage patient data in a random undersampling manner and outputting training set data; Validation unit: used to compare the training set data using a ten-fold cross validation method and output a stability evaluation value of the training set data.
7. The XGBoost model for analyzing the risk of recurrence of cerebral hemorrhage in patients based on data according to claim 5, characterized in that: The construction optimization module includes a receiving unit, a construction unit, a first optimization unit, a second optimization unit and an output unit, which are specifically as follows: Receiving unit: used to receive variable features with p-value less than 0.05; Construction unit: used to construct an initial model based on the variable features using the XGBoost algorithm; A first optimization unit: used for optimizing the parameters of the first model by internal verification, and outputting a second model; The second optimization unit is used to collect data of other patients with cerebral hemorrhage as external validation data, and use the external validation data to externally validate and optimize the second model; Output unit: used to output the XGBoost model after verification and optimization.
8. The XGBoost model for analyzing the risk of recurrence of cerebral hemorrhage in patients based on data according to claim 7, characterized in that: The XGBoost model is 0.048+0.077*age+0.299*NIHSSdis+0.062*pheadmission+0.372*phefollowup+0.033*historyofstroke-0.020*hypotensivedrug-0.039*PLT+0.024*AST+0.026*CRP, wherein thephefollowup represents the residual amount of cerebral hemorrhage during the follow-up period, theNIHSSdis represents the NIHSS score at discharge, thePLT represents the platelet value at admission, theage represents the age at admission, theAST represents the aspartateaminotransferase value at admission, theCRP represents the C-reactive protein value at admission, thepheadmission represents the amount of cerebral hemorrhage at admission, thehistoryofstroke represents the history of stroke, and thehypotensivedrug represents whether antihypertensive drugs are used.
9. An electronic device, characterized in that: The electronic device comprises: A memory storing at least one instruction; and a processor, executing instructions stored in the memory to implement the method for constructing an XGBoost model based on data analysis of the risk of recurrence of cerebral hemorrhage in patients as described in any one of claims 1 to 4.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in an electronic device to implement a method for constructing an XGBo ost model for analyzing the risk of recurrence of cerebral hemorrhage in patients based on data as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Cerebrovascular hemorrhage and ischemia prediction method and device
CN109003679A
Cerebral hemorrhage prognosis prediction method and device, electronic equipment and storage medium
CN113724184A
Hemorrhagic stroke prediction device
TWM648983U
Cited By
High-energy density capacitor and preparation method thereof
CN120299914A
Model for predicting protein detection signal change after perchloric acid precipitation of serum based on protein physicochemical properties, construction method and application
CN122435976A
A model for predicting changes in detection signals of proteins after perchloric acid precipitation of serum based on physicochemical properties of proteins, a construction method and applications thereof
CN122435976B