Method of determining a risk warning model for potential inappropriate prescribing of cardiovascular disease
Patent Information
- Application Number
- CN202210168629.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-21
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2042-02-21
AI Technical Summary
不过,现有的评估标准均为事后干预,不能提前预警老年患者发生PIP的风险,无法精准预警PIP风险,不能为老年患者提供精准干预,无法为老年患者提供个体化的治疗
[0035]本发明确定心血管疾病潜在不适当处方的风险预警模型的方法,关于心血管疾病患者PIP的研究大多数为传统的统计分析,例如单因素方差分析和多变量logistic回归等。本研究根据SOTTP/START标准(第二版),使用多种机器学习算法建立PIP预测模型。预警心血管疾病的老年患者发生PIP的概率,对模型进行了内部、外部验证,泛化能力更强,预测结果更加准确,还对模型进行样本量验证,验证样本数量是否满足本发明需求。
Smart Images

Figure CN114530248B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine learning and medical information processing, and in particular to a method for identifying a risk warning model for potentially inappropriate prescriptions for cardiovascular diseases. Background Technology
[0002] In recent years, with the increasing number of elderly people, many suffer from one or more chronic diseases, among which cardiovascular disease is common. Many cardiovascular disease patients also experience depression or anxiety, and many require combination therapy (antithrombotic drugs, statins, and antihypertensive drugs). Furthermore, with increasing age, the pharmacodynamics and pharmacokinetics of elderly patients change, increasing the risk of adverse drug reactions (ADRs). Although existing studies have shown that age, number of medications used, number of diseases, and potentially inappropriate prescribing (PIP) can increase the risk of ADRs in elderly patients, PIP is the most common risk factor. PIP specifically includes potentially inappropriate medications (PIM) and potential prescribing omissions (PPO).
[0003] Although various assessment standards for PIP exist both domestically and internationally, including the Beers criteria developed by the University of California, the STOPP / START criteria developed by experts at Cork University Hospital in Ireland, and the PIP criteria for elderly Chinese patients in disease states established by Zhang Xiaolan et al. using the Delphi method, multiple studies have shown that the STOPP / START criteria are more accurate than the Beers criteria. The STOPP / START criteria (second edition) outlines the rationality of using a certain class of drugs in specific disease states and potentially overlooked drug treatment options. However, existing assessment standards are all retrospective interventions. They cannot provide early warning of the risk of PIP in elderly patients, cannot accurately predict the risk of PIP, cannot provide precise interventions for elderly patients, and cannot provide individualized treatment for elderly patients.
[0004] With the application of machine learning in the medical field, many researchers have proposed using machine learning algorithms to model risk factors in patients' electronic medical records, thereby enabling risk prediction for cardiovascular diseases. Therefore, to reduce the occurrence of adverse drug events, it is necessary to provide a technical solution that utilizes machine learning to learn from the electronic medical records of cardiovascular disease patients, thereby predicting the risk of adverse drug reactions in these patients. Summary of the Invention
[0005] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a method for determining a risk warning model for potentially inappropriate prescriptions for cardiovascular diseases, which can predict the risk of adverse drug reactions in patients with cardiovascular diseases based on their electronic medical records.
[0006] To achieve the above-mentioned objectives, the present invention provides the following technical solution:
[0007] A method for identifying a risk warning model for potentially inappropriate prescriptions for cardiovascular diseases, comprising the following steps:
[0008] S1: Information such as ID card number, name, home address, and phone number was removed from the medical records of cardiovascular patients. This study was a retrospective study, and no intervention measures were taken; the ethics committee deemed it unnecessary to obtain patient consent. After the above desensitization process, data processing was performed to obtain N datasets. These N datasets were divided into training and testing sets. M machine learning models were used to model the N datasets, establishing N×M risk warning models.
[0009] S2: Internal validation using 10-fold cross-validation: Input the training set data into M machine learning models, and use 10-fold cross-validation to adjust the model parameters until the model parameters obtain the maximum AUC value on the training set. Obtain the data sampling, feature sampling, and AUC value, accuracy, precision, recall, and F1 score of the machine learning models for internal validation of PIP, PPO, and PIM models.
[0010] S3: By selecting multiple models with the largest AUC values, generate an ensemble model, and use these M+1 machine learning models to build N×(M+1) risk warning models on N datasets;
[0011] S4: External validation using Bootstrapping: The test set is resampled n times using Bootstrapping to create new samples. The new samples are used to perform external validation on N×(M+1) risk warning models to obtain the data sampling, feature sampling, and AUC, accuracy, precision, recall, and F1 score of the external validation of the PIP, PPO, and PIM models.
[0012] S5: Use AUC, accuracy, precision, recall, and F1 score to evaluate the models. Select the models with the largest AUC as the five models with the best prediction performance. Obtain the ROC curve and PR curve of the five models. Select the model with the largest ROC curve value as the risk warning model with the most accurate prediction performance for each of the PIP model, PIM model, and PPO model.
[0013] S6: Calculate the SHAP value of each variable in the risk warning model with the most accurate prediction performance. Use the SHAP value to represent the relationship between each output variable and the prediction result of the best model. Use the average of the absolute values of the SHAP values of each variable as the importance of that variable. Rank the contribution values of each variable to the best prediction model to obtain the risk warning output of each variable for PIP, PIM and PPO.
[0014] Furthermore, the data processing also includes: deleting variables with a missing data ratio higher than 90%, variables with a single category ratio higher than 90%, and variables with a coefficient of variation less than 0.1. The N datasets are divided into training and testing sets in an 8:2 ratio. The N datasets are sampled using x different data sampling methods and then filtered using y different data filtering methods to obtain N datasets, where N = x × y.
[0015] Furthermore, the variables include myocardial infarction, cardiac conduction block, venous thromboembolism, history of gout, renal failure, anticoagulation therapy, angina pectoris, atherosclerosis, heart failure, diabetes, number of medications used, number of illnesses, gender, length of hospital stay, age, gastrointestinal bleeding, antithrombotic therapy, history of cardiovascular disease, cerebrovascular disease, atrial fibrillation, hyperlipidemia, and hypertension.
[0016] Furthermore, the cardiovascular patient medical record information uses the second edition of the STOPP / START standard to identify possible PIP prescriptions in elderly patients for cardiovascular system and antiplatelet / anticoagulant drugs, including the PIM standard for cardiovascular system and antiplatelet / anticoagulant drugs and the PPO standard for cardiovascular system. The desensitization process includes deleting the patient's ID number, name, home address, and telephone number information.
[0017] Furthermore, it also includes dataset validation, verifying the amount of dataset required for the method to identify the risk warning model for potentially inappropriate prescriptions for cardiovascular diseases.
[0018] Furthermore, the sample size validation employs a resampling method with replacement, randomly sampling different amounts of data from the training set to train the model. Multiple different AUC values are obtained from the test set, repeated n times, and the resulting AUC values are plotted as a line graph. As the data volume increases, the AUC gradually increases, the data dispersion decreases, and the curve flattens out. In the PIP model, the curve flattens out when the data volume reaches 70% of the existing data volume, indicating that the sample size is sufficient in the PIP model. In the PPO and PIM models, the curve flattens out when the sample size reaches 70%, and then rises continuously, indicating that a data volume of 70%-80% of the existing data volume satisfies the requirements of the PPO and PIM models.
[0019] Furthermore, it also includes hypothesis testing, which infers the population from the existing data volume and obtains the difference between the existing data volume indicators and the population indicators.
[0020] Furthermore, the hypothesis testing includes analysis of variance and rank-sum test. If the data does not meet the normal distribution, the rank-sum test is used. If it meets the normal distribution, the homogeneity of variance is determined. If the variances are homogeneous, analysis of variance is selected; otherwise, the rank-sum test is selected. The significance level is set to 0.05. The hypothesis testing is implemented using stats in Python 3.8, and the model is built using sklearn in Python 3.8.
[0021] Furthermore, the data sampling methods include: no sampling, random upsampling, random downsampling, SMOTE upsampling, and Borderline SMOTE upsampling; the data filtering methods include: no filtering, Lasso filtering, and Boruta filtering; and the machine algorithm models include: AdaBoost, Bagging, Bernoulli_Naive_Bayes, Decision_Tree, Extra_Tree, Gaussian_Naive_Bayes, Gradient_Boosting, KNN, LDA, Logistic_Regression, Multinomial_Naive_Bayes, Passive_Aggressive, QDA, Random_Forest, SGD, SVM, and XGBoost.
[0022] Furthermore, the data sampling method includes:
[0023] No sampling: The raw data is input into the model without sampling the data.
[0024] Random upsampling: Randomly copy data with fewer label types to ensure an equal number of positive and negative data.
[0025] Random downsampling: Randomly delete data with a large number of label types to make the number of positive and negative data equal;
[0026] SMOTE upsampling:
[0027] The minority class data is analyzed using synthetic minority class upsampling, and new data of this class is synthesized and added to the dataset. The specific algorithm flow is as follows:
[0028] For each data point x in the minority class, calculate its distance to all data points in the minority class dataset using Euclidean distance to obtain its k nearest neighbors. Set a sampling ratio N based on the imbalance ratio. For each minority class data point x, randomly select several data points from its k nearest neighbors, assuming the selected neighbors are xn. For each randomly selected neighbor xn, construct new data points with the original data: x new = x + rand(0, 1)(x - xn);
[0029] Borderline SMOTE upsampling:
[0030] The Borderline SMOTE algorithm synthesizes new data by combining minority class data on the boundary, thereby improving the distribution of data categories. Borderline SMOTE sampling divides minority class data into three categories: Safe, Danger, and Noise, and only oversamples the minority class data of Danger.
[0031] A risk warning system for identifying potentially inappropriate prescriptions for cardiovascular diseases is proposed. Based on the parameters of optimal PIP, PPO, and PIM models, a prediction system is established to visualize the risk warning of potentially inappropriate prescriptions. It includes a data processing module and a risk warning module.
[0032] The data processing module is used to process the medical record data of patients with cardiovascular diseases.
[0033] The risk warning module uses a risk warning model determined by a method based on a risk warning model for identifying potentially inappropriate prescriptions for cardiovascular diseases. Based on the data input from the data processing module, it outputs the risk probabilities of PIP, PIM, and PPO.
[0034] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0035] This invention presents a method for determining a risk warning model for potential inappropriate prescriptions (PIPs) in cardiovascular disease patients. Most studies on PIPs in cardiovascular disease patients rely on traditional statistical analyses, such as one-way ANOVA and multivariate logistic regression. This study, based on the SOTTP / START standard (second edition), uses various machine learning algorithms to build a PIP prediction model. The model is used to predict the probability of PIPs in elderly patients with cardiovascular disease. Internal and external validations were performed, demonstrating stronger generalization ability and more accurate prediction results. The model was also validated with sufficient sample size to ensure it met the requirements of this invention. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of the technical process of the present invention;
[0037] Figure 2 shows the importance ranking of the PIP model, PPO model, and PMI model after filtering the variables;
[0038] Figure 3 shows the results of the internal validation of the PIP model, PPO model, and PIM model.
[0039] Figure 4 shows the results of external validation of the PIP model, PPO model, and PIM model.
[0040] Figure 5 shows the importance of variables after 200 samplings of the bootstrapping data.
[0041] Figure 6 is a bar chart based on the average SHAP value of the variable;
[0042] Figure 7 shows the relationship between variables and the prediction results of the best model.
[0043] Figure 8 is a bar chart showing the average absolute value of the variable SHAP as the importance of the variable;
[0044] Figure 9 shows the sample size-dispersion diagrams for the PIP model, PPO model, and PMI model.
[0045] Figure 10 A schematic diagram of a risk warning system module for potentially inappropriate prescriptions for cardiovascular diseases;
[0046] Figure 11 is a schematic diagram of the visualization interface of the risk warning system for potential inappropriate prescriptions for cardiovascular diseases.
[0047] Figure 12 This is a schematic diagram of Borderline SMOTE sampling. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0049] Therefore, the following detailed description of embodiments of the present invention is not intended to limit the scope of the claimed invention, but merely illustrates some embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0050] It should be noted that, unless otherwise specified, the embodiments and features and technical solutions in the present invention can be combined with each other.
[0051] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0052] In the description of this invention, it should be noted that the terms "upper," "lower," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this invention is in use, or the orientation or positional relationship commonly understood by those skilled in the art. These terms are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention. In addition, the terms "first," "second," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0053] Example 1, as Figure 1 As shown, the present invention provides a method and flowchart for determining a risk warning model for potentially inappropriate prescriptions for cardiovascular diseases. It uses the cardiovascular system and antiplatelet / anticoagulant drugs in the STOPP / START criteria (second edition) to identify prescriptions for possible PIPs in elderly patients, including 24 PIM criteria, including 13 cardiovascular system criteria, 11 antiplatelet / anticoagulant drug criteria, and 8 cardiovascular system PPO criteria.
[0054] In addition, patients discharged from the Department of Geriatric Cardiovascular Medicine of the hospital were selected as the research subjects. Corresponding medical information was collected from the electronic medical record system as the data source, including prescription information, medical record information and laboratory test information. The inclusion criteria were: (1) patients aged ≥65 years; (2) patients hospitalized for 3 to 60 days; (3) patients diagnosed with at least one cardiovascular disease, including hypertension, myocardial infarction, angina pectoris, hyperlipidemia, peripheral vascular disease, and patients with indications for antithrombotic therapy. Whether the patient had indications for antithrombotic therapy was determined by a cardiologist. After collecting the patients' electronic medical records, the data was desensitized by deleting the patients' ID card number, name, home address, telephone number and other information. The patient's basic information was assigned as shown in the table below:
[0055] Table 1 shows the variable assignment information.
[0056]
[0057] Then, the data after data anonymization is preprocessed, specifically including:
[0058] 1. By deleting columns with a missing data rate higher than 90%, columns with a single category rate higher than 90%, and columns with a coefficient of variation less than 0.1, the data was pre-screened, retaining 16 variables and deleting 6 variables, including X8 myocardial infarction, X11 heart conduction block, X16 venous thromboembolism, X17 history of gout, X18 renal failure, and X21 anticoagulation therapy.
[0059] 2. After data pre-screening and sampling, the dataset was further filtered using Lasso and Boruta, as shown in Figure 2. The results show that the top five most important variables in the PIP model are angina pectoris, atherosclerosis, heart failure, diabetes, and medication use. However, hyperlipidemia, cardiovascular history, hypertension, and cerebrovascular disease have lower importance in the PIP model, as shown in Figure 2A. In the PPO model, the top five most important variables are medication use, angina pectoris, atherosclerosis, cardiovascular history, and age. Hyperlipidemia, diabetes, hypertension, and cerebrovascular disease have lower importance in the PPO model, as shown in Figure 2B. In the PIM model, the top five most important variables are medication use, number of cases, length of hospital stay, age, and heart failure. Variables with lower importance in the PIM model include atherosclerosis, gastrointestinal bleeding, antithrombotic therapy, and cardiovascular history, as shown in Figure 2C.
[0060] Five data sampling methods were used: no sampling, random upsampling, random downsampling, SMOTE upsampling, and Borderline SMOTE upsampling. Three data filtering methods were used: no filtering, Lasso filtering, and Boruta filtering. This resulted in 15 datasets.
[0061] The process for establishing a risk warning model is as follows:
[0062] Internal model validation was performed using 10-fold cross-validation. Fifteen datasets were obtained for PIP, PPO, and PIM models through five data sampling methods and three feature selection methods. Seventeen machine learning algorithms were used, including AdaBoost, Bagging, Bernoulli Naive Bayes, Decision Tree, Extra Tree, Gaussian Naive Bayes, Gradient Boosting, KNN, LDA, Logistic Regression, Multinomial Naive Bayes, Passive Aggressive, QDA, Random Forest, SGD, SVM, and XGBoost, to build 255 prediction models. Figure 3 shows the internal validation results for the PIP, PPO, and PIM models.
[0063] The performance of the PIP model varies depending on the data sampling and the algorithm used. The best data sampling method is SMOTE, with an AUC of 0.880±0.095 and an accuracy of 0.814±0.095. The best model is XGBoost, with an AUC of 0.854±0.130 and an accuracy of 0.798±0.121.
[0064] The performance of PPO models varied depending on the data sampling and the algorithms used, but there was no difference in performance among different feature selection methods. Results showed that SMOTE was the optimal data sampling method, with an AUC of 0.800±0.126 and an accuracy of 0.733±0.114. Among the 17 models tested, XGBoost was the best, with an AUC of 0.832±0.133 and an accuracy of 0.772±0.119.
[0065] The results of the PIM and PPO models are similar. Different data sampling methods and algorithms result in varying model performance, while different feature selection methods show no difference. The optimal data sampling method is Random Over Sampler, with an AUC of 0.786±0.126 and an accuracy of 0.726±0.115. The optimal model is Random_Forest, with an AUC of 0.818±0.138 and an accuracy of 0.758±0.117.
[0066] External validation was performed by selecting the five best models with the highest AUC values to generate an ensemble model, resulting in 18 models. These 18 machine learning models were used to model 15 datasets, creating 270 machine learning models. The best model was selected as the risk warning model. External validation was conducted using data sampled 200 times via bootstrapping, as shown in Figure 4. The results show significant differences between the PIP, PPO, and PIM models built using different data sampling, feature selection, and algorithms.
[0067] Among the PIP models, the optimal data sampling method is Random Over Sampler, with an AUC of 0.643±0.101 and an accuracy of 0.616±0.100. The optimal feature selection method is no selection, with an AUC of 0.622±0.095 and an accuracy of 0.647±0.106. The optimal model is Ensemble_Learning, with an AUC of 0.696±0.095 and an accuracy of 0.682±0.107.
[0068] In the PPO model, the optimal data sampling method is Borderline SMOTE, with an AUC of 0.632±0.082 and an accuracy of 0.673±0.070. The optimal feature selection method is no selection, with an AUC of 0.604±0.089 and an accuracy of 0.646±0.081. The optimal model is Ensemble_Learning, with an AUC of 0.676±0.070 and an accuracy of 0.678±0.071.
[0069] In the PIM model, the optimal data sampling method is Random Under Sampler, with an AUC of 0.563±0.089 and an accuracy of 0.572±0.078. The optimal feature selection method is Boruta, with an AUC of 0.546±0.089 and an accuracy of 0.596±0.087. The optimal model is Ensemble_Learning, with an AUC of 0.637±0.076 and an accuracy of 0.647±0.072.
[0070] Data from 200 bootstrapping samplings were input into the PIP, PIM, and PPO models, and the importance of each variable was ranked (see Figure 5). In the PIP model, the top five most important variables were cerebrovascular disease, cardiovascular history, medication usage, length of hospital stay, and age. However, diabetes, gastrointestinal bleeding, hypertension, and angina had relatively low importance in the PIP model. (See...) Figure 5a In the PPO model, the top five most important variables are diabetes, hyperlipidemia, heart failure, length of hospital stay, and gastrointestinal bleeding. Variables of lower importance in the PPO model are hypertension, cerebrovascular disease, antithrombotic therapy, and atrial fibrillation. See [link to PPO model]. Figure 5b In the PIM model, the top five most important variables were diabetes, antithrombotic therapy, length of hospital stay, age, and hypertension. However, gastrointestinal bleeding, hyperlipidemia, cardiovascular history, and atrial fibrillation had lower importance in the PIM model. (See...) Figure 5c .
[0071] The models were evaluated using metrics such as AUC, accuracy, precision, recall, and F1 score. The five models with the best predictive performance were selected. Among the PIP models, the best-performing model had an ROC curve of 0.8341 and a PR curve of 0.9556; among the PPO models, the best-performing model had an ROC curve of 0.7007 and a PR curve of 0.7992; and among the PIM models, the best-performing model had an ROC curve of 0.7061 and a PR curve of 0.4268. Other predictive performance metrics are shown in Table 2-4 below.
[0072] Table 2 Predictive performance metrics of the five best PIP models
[0073]
[0074] Table 3. Predictive performance metrics of the five best PPO models
[0075]
[0076] Table 4. Predictive performance metrics of the five best PIM models
[0077]
[0078]
[0079] The contribution of variables in the optimal model was explained using SHAP values, as shown in Figure 6. The results show that in the PIP model, cerebrovascular disease, heart failure, age, hyperlipidemia, and hypertension contributed significantly to the predictions of the optimal model, while length of hospital stay (days), myocardial infarction, and gender contributed less. (See Figure 6A). In the PPO model, angina pectoris, age, heart failure, and hyperlipidemia contributed significantly to the predictions of the optimal model, while cerebrovascular disease, disease number, hypertension, and myocardial infarction contributed less. (See Figure 6B). In the PIM model, medication dosage, angina pectoris, and length of hospital stay (days) contributed significantly to the predictions of the optimal model, while cerebrovascular disease, disease number, myocardial infarction, atrial fibrillation, and diabetes contributed less. (See Figure 6C).
[0080] Furthermore, by calculating the SHAP value of each variable in the optimal model, the relationship between each variable and the prediction results of the optimal model was explained, as shown in Figure 7. The results show that the SHAP values of the PIP, PPO, and PIM models are similar, and higher values for variables such as length of hospital stay (days), heart failure, medication dosage, and angina pectoris reduce the predictive ability of the optimal model. A bar chart was plotted using the average absolute value of the SHAP value of each variable as the importance of that variable, as shown below. Figures 8a-8c As shown, in the PIP model, the top five most important variables are angina pectoris, atherosclerosis, number of diseases, number of medications used, and cardiovascular history; in the PPO model, the top five most important variables are angina pectoris, number of diseases, cardiovascular history, atherosclerosis, and heart failure; and in the PIM model, the top five most important variables are heart failure, number of medications used, angina pectoris, length of hospital stay, and age.
[0081] The sufficiency of the sample size was verified using a resampling method with replacement, and plotted... Figures 9a-9c The results show that as the sample size increases, the AUC gradually increases, the sample dispersion decreases, and the curve flattens out. Figure 9aAs shown, in the PIP model, the curve tends to flatten when the sample size reaches 70%, indicating that the sample size is sufficient in the PIP model. Figure 9b and Figure 9c As shown, in the PPO and PIM models, the curves flatten out when the sample size reaches 70%, and then rise continuously; this indicates that the sample size is sufficient for both the PPO and PIM models when it is between 70% and 80%.
[0082] like Figure 10 As shown, another aspect of the present invention also provides a risk warning system for identifying potentially inappropriate prescriptions for cardiovascular diseases, comprising:
[0083] The data preprocessing module is used to preprocess electronic medical records that are to be identified as having the potential risk of inappropriate prescriptions for cardiovascular diseases.
[0084] The risk warning module uses the risk warning model determined by the method for determining potential inappropriate prescriptions for cardiovascular diseases based on the present invention, and performs risk warnings for PIP, PIM and PPO based on the data input by the preprocessing module.
[0085] In implementation, as shown in Figure 11, to facilitate the input of patients' electronic medical record data, this invention also provides an electronic medical record data input interface module. This input interface includes input fields for variables X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19, X20, X21, and X22 in Table 1. The data preprocessing module is used to preprocess the input variable data to obtain a dataset. Then, the risk warning module processes the dataset to achieve risk warning of potentially inappropriate prescriptions for the patient's cardiovascular disease.
[0086] The technical solution of this invention will be further elaborated below by combining 5 data sampling methods and 17 machine learning algorithms:
[0087] No sampling: The raw data is input into the model without sampling the data.
[0088] Random upsampling: Randomly copy data with fewer label types to make the number of positive and negative samples equal;
[0089] Random downsampling: Randomly delete data with a large number of label types to make the number of positive and negative samples equal;
[0090] SMOTE upsampling:
[0091] The minority class samples are analyzed using a synthetic minority class upsampling technique, and new samples of this class are synthesized and added to the dataset. The specific algorithm flow is as follows:
[0092] For each sample x in the minority class, calculate its distance to all samples in the minority class sample set using Euclidean distance as the standard, and obtain its k nearest neighbors.
[0093] A sampling ratio N is set based on the imbalance ratio of the samples. For each minority class sample x, several samples are randomly selected from its k nearest neighbors. Assume that the selected nearest neighbors are xn.
[0094] For each randomly selected nearest neighbor xn, construct new samples with the original samples respectively:
[0095] x new = x + rand(0, 1)(x - xn)
[0096] Borderline SMOTE upsampling:
[0097] The Borderline SMOTE algorithm improves the distribution of sample classes by synthesizing new samples from minority class samples along the boundary. Borderline SMOTE sampling divides minority class samples into three categories: Safe, Danger, and Noise, and only oversamples the Danger minority class samples. Figure 12 As shown.
[0098] AdaBoost: The adaptive boosting algorithm works by first training a weak learner 1 with initial weights from the training set. The weights of the training samples are then updated based on the learning error rate of the weak learner, increasing the weights of training samples with high error rates in the initial weak learner 1. These high-error-rate points then receive more attention in the subsequent weak learner 2. Weak learner 2 is then trained based on the adjusted training set, and this process is repeated until the number of weak learners reaches a pre-specified number T. Finally, these T weak learners are integrated using an ensemble strategy to obtain the final strong learner.
[0099] Given a training dataset T = {(x1, y1), (x2, y2) ... (xN, yN)}, where instances x ∈ x, and the instance space... yi belongs to the label set {-1, +1}. The purpose of Adaboost is to learn a series of weak classifiers or basic classifiers from the training data, and then combine these weak classifiers into a strong classifier.
[0100] The algorithm flow of Adaboost is as follows:
[0101] Step 1: First, initialize the weight distribution of the training data. Each training sample is initially assigned the same weight: 1 / N.
[0102]
[0103] Step 2: Perform multiple iterations, where i = 1, 2, ..., N represents the iteration number.
[0104] a. Learn using a training dataset with a weight distribution Dm to obtain a basic classifier:
[0105] G m (x): χ → {-1, +1}
[0106] b. Calculate the classification error rate of Gm(x) on the training dataset.
[0107]
[0108] As can be seen from the above formula, the error rate em of Gm(x) on the training dataset is the sum of the weights of the samples misclassified by Gm(x);
[0109] c. Calculate the coefficient of Gm(x), where am represents the importance of Gm(x) in the final classifier, with the aim of obtaining the weight of the basic classifier;
[0110]
[0111] From the above formula, we can see that, When , am≥0, and am increases as em decreases, which means that the smaller the classification error rate of the basic classifier, the greater its role in the final classifier;
[0112] d. Update the weight distribution of the training dataset to obtain a new weight distribution for the samples in the next iteration:
[0113] D m+1 =(w m+1,1 w m+1,2 ...w m+1,i ..., w m+1,N ),
[0114]
[0115] This increases the weight of samples misclassified by the basic classifier Gm(x) and decreases the weight of correctly classified samples. In this way, Adaboost can "focus" on samples that are more difficult to classify.
[0116] Where Zm is the normalization factor, and Dm+1 is a probability respectively:
[0117]
[0118] Step 3: Combine the weak classifiers:
[0119]
[0120] The final classifier is thus obtained as follows:
[0121]
[0122] Bagging: Used in conjunction with other algorithms to improve accuracy and stability, and to avoid overfitting. The principle is to construct multiple weak learners, which are then trained in parallel and simultaneously, and finally combined. Bagging is suitable for models with low bias and high variance. The input is a sample set D = {(x, y1), (x2, y2), ..., (xm, ym)}, the weak learner algorithm, and the number of iterations T for the weak classifier.
[0123] The output is the final strong classifier f(x).
[0124] 1. For t = 1, 2, ..., T:
[0125] A: Perform random sampling on the training set for the t-th time, and collect samples m times in total, to obtain a sampling set Dt containing m samples.
[0126] B: Train the t-th weak learner Gt(x) using the sample set Dt.
[0127] 2. If it is a classification algorithm prediction, the category or one of the categories that receives the most votes from the T weak learners is the final category; if it is a regression algorithm, the arithmetic mean of the regression results obtained by the T weak learners is the final model output.
[0128] The Naive Bayes algorithm is a classification method based on Bayes' theorem. It learns the joint probability distribution from the training data and then derives the posterior probability distribution, including Bernoulli Naive Bayes, Gaussian Naive Bayes, and multinomial Naive Bayes.
[0129] Introducing Bayes' theorem:
[0130] Where (x, y) represents the feature variables, c i Represents classification, p(c i |x, y) represents the classification into category c given the feature (x, y). i Therefore, combining conditional probability and Bayes' theorem, we have:
[0131] 1: If p(c1|x,y)>p(c2,|x,y), then the classification should belong to category c1;
[0132] 2: If p(c1|x,y) < p(c2,|x,y), then the classification should belong to category c2.
[0133] Bernoulli Naive_Bayes: This model is suitable for multivariate Bernoulli distributions, meaning each feature is a binary variable. If a feature is not binary, the model can first binarize it. In document classification, the feature is whether a word appears; if the word appears in a document, it's 1, otherwise 0. In the text classification example, a vector counting word occurrences, rather than a vector counting word frequency, can be used to train and use this classifier. Bernoulli NB may perform better on some datasets, especially shorter documents.
[0134] Gaussian_Naive_Bayes: Applicable to continuous variables, assuming that each feature x... i For each category y, the distribution follows a normal distribution. The algorithm internally uses the probability density function of the normal distribution to calculate the probability.
[0135]
[0136] μ y In samples of category y, feature x i The mean;
[0137] σ 2 y: In samples of class y, feature x i The standard deviation.
[0138] Multinomial Naive Bayes: This implements a Naive Bayes algorithm that follows a multinomial distribution. It is one of the two classic Naive Bayes classification algorithms suitable for text classification. It is often represented by word vectors, and the distribution parameters are determined by the θ = (θ1, θ2, ..., θn) vector for each x, where n represents the number of features, or the vocabulary size in text classification, and θ... i The probability p(x) belongs to feature i i |c), θ i The relative frequency count is estimated using a smoothed maximum likelihood estimate:
[0139] In the formula, Nci is the number of times feature i appears in class c, and Ny is the total number of occurrences of all features in class c.
[0140] Decision Tree: A decision tree is a basic machine learning algorithm. Classification decision trees are used for categorical data, while regression decision trees are used for continuous data. The model is easy to read and fast at classifying data. The most commonly used decision tree algorithms include ID3, C4.5, and CART.
[0141] Information gain represents the degree to which the uncertainty of the classification of feature Xj is reduced by knowing information about it;
[0142] g(D, A) = H(D) - H(D|A)
[0143] The information gain g(D, A) of feature A on training dataset D is defined as the difference between the empirical entropy H(D) of set D and the empirical conditional entropy H(D|A) of D given feature A.
[0144] Suppose dataset D has K categories, and feature A has n possible values. The empirical entropy H(D) of dataset D is:
[0145]
[0146] Where P k The probability of classifying any sample data in set D into class k, or the proportion of samples belonging to class k.
[0147] The empirical conditional entropy H(D|A) is:
[0148] It can also be written as
[0149] Where P i Let D be the probability that the feature takes the i-th possible value. i Let A be the set of samples where feature A is the i-th possible value.
[0150] The greater the information gain, the greater the "purity improvement" obtained by using attribute A for splitting. Therefore, information gain can be used to select the splitting attribute in a decision tree. The ID3 decision tree learning algorithm uses information gain as the criterion for selecting the splitting attribute.
[0151] Extra Tree: The ET or Extra-Trees algorithm is very similar to the Random Forest algorithm, both consisting of many decision trees.
[0152] Extra Tree uses all samples, but the features are randomly selected. Because the splits are random, it achieves better results than Random Forest.
[0153] Gradient Boosting: Gradient Boosting and AdaBoost both make the learner pay more attention to the incorrect samples learned in the previous round in each training round. The difference is that Gradient Boosting uses negative gradients to measure the learner. In the next round of learning, it corrects the errors in the previous round by fitting negative gradients, making the model more resistant to noise, as detailed below.
[0154] 1. Initialization
[0155]
[0156] Where γ is the output value corresponding to the leaf node of the base learner.
[0157] 2. for m = 1 to M:
[0158] (a) Calculate the negative gradient: i = 1, 2, ..., N
[0159] (b) By minimizing the squared error, using the base learner h m (x) Fitting
[0160] (c) Use line search to determine step size ρ m To minimize L,
[0161] (d)f m (x)=f m-1 (x)+ρ m h m (x;w m )
[0162] 3. Output fM(x)
[0163] KNN: K-Nearest Neighbors algorithm. The idea of the algorithm is that a sample is most similar to K samples in a dataset. If most of these K samples belong to a certain class, then the sample also belongs to that class.
[0164] In KNN, the distance between objects is used as an indicator of dissimilarity, thus avoiding the matching problem between objects. Here, the distance is generally Euclidean distance or Manhattan distance.
[0165] Euclidean distance: Manhattan distance:
[0166] In the formula, (x, y) represent two samples; n is the dimension; (x k y k Let be the eigenvalues of (x, y) in the k-th dimension.
[0167] LDA: Linear Discriminant Analysis is a supervised algorithm. It projects the original data into a low-dimensional space, grouping similar data together and distributing dissimilar data.
[0168] Suppose a dataset D = {(x1, y1), (x2, y2), ..., ((xm, ym))}, where any sample xi is an n-dimensional vector, yi ∈ {0, 1}. Define Nj (j = 0, 1) as the number of samples in class j, Xj (j = 0, 1) as the set of samples in class j, and μj (j = 0, 1) as the mean vector of samples in class j. Define ∑j (j = 0, 1) as the covariance matrix of samples in class j with the denominator missing.
[0169] The expression for μj is:
[0170] The expression for ∑j is: ∑ j =∑ χ∈Xj (χ-μj)(χ-μj) T (j = 0, 1)
[0171] Since there are two types of data, we only need to project the data onto a straight line. Assuming the projection line is vector w, then for any sample xi, its projection onto line w is w_i. T For the center points μ0 and μ1 of the two categories, the projection of xi onto the line w is w. T μ0 and w T μ1. Since LDA aims to maximize the distance between the class centers of different classes, it maximizes ||w. T μ0-w T μ1|| 2 2. At the same time, the projection points of data of the same category should be as close as possible, that is, the covariance w of the projection points of the same category of samples should be... T ∑0w and w T To minimize ∑1w, i.e., to minimize w T ∑0w+w T ∑1w, the optimization objective is:
[0172]
[0173] The intra-class scatter matrix Sw is generally defined as follows:
[0174]
[0175] Meanwhile, the inter-class scatter matrix Sb is defined as:
[0176]
[0177] The optimization objective is thus rewritten as:
[0178]
[0179] Logistic Regression: Logistic regression is a probabilistic nonlinear regression model, a multivariate analysis method used to study the relationship between binary observation results and influencing factors.
[0180] Consider a vector x = (x1, x2, ..., xn) with n independent variables. n Let the conditional probability P(y=1|x)=p be the probability of an event x occurring based on the observation. Then the Logistic regression model can be expressed as:
[0181]
[0182] Therefore, the ratio of the probability of the event occurring to the probability of it not occurring is:
[0183]
[0184] This ratio is called the occurrence ratio of the events, or simply odds. Taking the logarithm of odds gives:
[0185]
[0186] In the classification case, the learned LR classifier is a set of weights ω0, ω1, ..., ω n .
[0187] Passive_Aggressive: The classic online linear classifier passive attack algorithm can continuously integrate new samples to adjust the classification model and enhance its classification ability.
[0188] QDA: Quadratic Discriminant Analysis is similar to LDA, but it extends LDA to cases where the inter-class covariance matrices differ. To achieve high classification performance, the covariance matrix needs to be accurately estimated.
[0189] First determine the midpoint of each category, then let the formula... The maximum value is:
[0190] Random Forest: Random forests mainly combine multiple decision trees for classification. Assuming there are n samples in the training set, each sample has d features, and we need to train a random forest with T trees, the specific algorithm flow is as follows:
[0191] 1. For T decision trees, repeat the following operations: a. Use Bootstrap sampling to obtain a training set D of size n from the training set D; b. Randomly select m features from d features;
[0192] 2. If it is a regression problem, the final output is the mean of the outputs of each tree;
[0193] 3. If it is a classification problem, the final category will be determined according to the voting principle;
[0194] The generation of each tree is random. As for the number of features to be randomly selected, there are two main methods to determine the size of the number of features to be randomly selected: one is cross-validation, and the other is empirical settings.
[0195] SGD: Stochastic gradient descent is an algorithm that minimizes the objective function f(x) by iterating along the opposite direction of the gradient vector to find the extreme points of the function. Generally, SGD is the simplest and most practical method, but its convergence speed is slightly slower.
[0196] SVM: Support Vector Machine is a binary classification model. It is defined on a feature space with the maximum margin. Support vectors play a crucial role in determining the separating hyperplane. For any hyperplane, each data point on either side has a minimum perpendicular distance from it; the sum of these two minimum distances is the margin. A larger margin means a lower probability of error, i.e., greater robustness, better classification performance for unknown sample points, less easily disturbed, and more reliable. The expression is:
[0197] w T x+b=0
[0198] Where w = {w1; w2; ...; wd} is a normal vector that determines the direction of the hyperplane, and d is the number of eigenvalues.
[0199] X represents the training sample; b is the displacement term, which determines the distance between the hyperplane and the origin.
[0200] Once the normal vector w and the displacement b are determined, a dividing hyperplane can be uniquely determined. The distance between the dividing hyperplane and any point on the boundary hyperplanes on either side of it is...
[0201] Using some mathematical derivation, the formula yi×(w0+w1x1+w2x2)≥1, It can be transformed into a restricted convex optimization problem:
[0202]
[0203] This equation represents the boundary-maximizing hyperplane, where i is the number of support vector points. Since most points are not support vector points, only a few points on the boundary hyperplane are. The summation is performed only on points that are support vector points; ||W|| is the norm of the hyperplane; Xi is the eigenvalue of the support vector point; yi is the class label of the support vector point Xi, such as +1 or -1; X TFor the instance to be tested, substitute it into the equation; αi and b0 are both single numerical parameters, derived from the optimal algorithm mentioned above, where αi is the Lagrange multiplier.
[0204] Whenever a new test sample X is obtained, it is substituted into the equation to see if the value of the equation is positive or negative, and then classified according to the sign.
[0205] XGBoost: XGBoost combines a linear scaling solver and a tree learning algorithm, representing an improvement on GBDT and offering greater efficiency. Traditional GBDT only utilizes first-order derivative information, while XGBoost performs a second-order Taylor expansion of the loss function, more accurately approximating the true loss function. It also adds a regularization term outside the objective function, seeking the optimal solution globally to balance the decrease in the objective function with model complexity, avoiding overfitting and improving the model's solution efficiency.
[0206] The above embodiments are only used to illustrate the present invention and are not intended to limit the technical solutions described herein. Although the present invention has been described in detail with reference to the above embodiments, the present invention is not limited to the specific embodiments described above. Therefore, any modifications or equivalent substitutions to the present invention, as well as all technical solutions and improvements that do not depart from the spirit and scope of the invention, are covered within the scope of the claims of the present invention.
Claims
1. A method for identifying a risk warning model for potentially inappropriate prescriptions for cardiovascular diseases, characterized in that, Includes the following steps: S1: Desensitize the medical records of cardiovascular patients by deleting their ID card number, name, home address, and phone number. Then, process the desensitized medical record data, including data sampling and feature filtering, to obtain N datasets. Divide the N datasets into training and testing sets, and use M machine learning models to model the N datasets to establish N×M risk warning models. S2: Internal validation using 10-fold cross-validation: Input the training set data into M machine learning models, and use 10-fold cross-validation to adjust the model parameters until the model parameters obtain the maximum AUC value on the training set. Obtain the data sampling, feature sampling, and AUC value, accuracy, precision, recall, and F1 score of the machine learning models for internal validation of PIP, PPO, and PIM models. S3: By selecting multiple models with the largest AUC values, generate an ensemble model, use M+1 machine learning models to model N datasets, and establish N×(M+1) risk warning models; S4: External validation using Bootstrapping: The test set is resampled n times using Bootstrapping to create new samples. The new samples are used to perform external validation on N×(M+1) risk warning models to obtain the data sampling, feature sampling, and AUC, accuracy, precision, recall, and F1 score of the external validation of the PIP, PPO, and PIM models. S5: Use AUC, accuracy, precision, recall, and F1 score to evaluate the models. Select the models with the largest AUC as the five models with the best prediction performance. Obtain the ROC curve and PR curve of the five models. Select the model with the largest ROC curve value as the risk warning model with the most accurate prediction performance for each of the PIP model, PIM model, and PPO model. S6: Calculate the SHAP value of each variable in the risk warning model with the most accurate prediction performance. Use the SHAP value to represent the relationship between each output variable and the prediction result of the best model. Use the average of the absolute values of the SHAP values of each variable as the importance of that variable. Rank the contribution values of each variable to the best prediction model to obtain the risk warning output of each variable for PIP, PIM and PPO. The data processing also includes: deleting variables with a missing data ratio higher than 90%, variables with a single category ratio higher than 90%, and variables with a coefficient of variation less than 0.
1. The N datasets are divided into training set and test set in an 8:2 ratio. The N datasets are sampled using x different data sampling methods and then filtered using y different data filtering methods to obtain N datasets, where N = x × y. The cardiovascular patient medical record information uses the second edition of the STOPP / START criteria to identify possible PIPs in elderly patients, including PIM criteria for cardiovascular system and antiplatelet / anticoagulant drugs, and PPO criteria for cardiovascular system. The data sampling methods include: no sampling, random upsampling, random downsampling, SMOTE upsampling, and Borderline SMOTE upsampling; the data filtering methods include: no filtering, Lasso filtering, and Boruta filtering.
2. The method for determining a risk warning model for potentially inappropriate prescriptions for cardiovascular diseases as described in claim 1, characterized in that, The variables include myocardial infarction, cardiac conduction block, venous thromboembolism, history of gout, renal failure, anticoagulation therapy, angina pectoris, atherosclerosis, heart failure, diabetes, number of medications used, number of cases, gender, length of hospital stay, age, gastrointestinal bleeding, antithrombotic therapy, history of cardiovascular disease, cerebrovascular disease, atrial fibrillation, hyperlipidemia, and hypertension.
3. The method for determining a risk warning model for potentially inappropriate prescriptions for cardiovascular diseases as described in claim 1, characterized in that, It also includes sample size validation, verifying the amount of dataset required to validate the method for identifying the risk warning model for potentially inappropriate prescriptions for cardiovascular disease.
4. The method of determining a risk alert model for potential inappropriate prescribing of cardiovascular disease according to claim 3, wherein, The sample size validation uses a resampling method with replacement to randomly sample data from the training set to train the model. The test set yields multiple different AUC values, which are repeated n times. The AUC values are then plotted as a line graph. As the amount of data increases, the AUC gradually increases, the data dispersion decreases, and the curve becomes flatter. This flattening of the curve indicates that the sample size in the model is sufficient and meets the model's requirements.
5. The method for determining a risk warning model for potentially inappropriate prescriptions for cardiovascular diseases as described in claim 1, characterized in that, It also includes hypothesis testing, which infers the population from the existing data volume and obtains the difference between the existing data volume indicators and the population indicators.
6. The method of determining a risk alert model for potential inappropriate prescribing of cardiovascular disease according to claim 5, wherein, The hypothesis testing includes analysis of variance (ANOVA) and rank-sum test. If the data does not follow a normal distribution, the rank-sum test is used. If the data follows a normal distribution, the homogeneity of variance is determined. If the variances are homogeneous, ANOVA is used; otherwise, the rank-sum test is used. The significance level is set to 0.
05. The hypothesis testing is implemented using stats in Python 3.8, and the model is built using sklearn in Python 3.
8.
7. The method for determining a risk warning model for potentially inappropriate prescriptions for cardiovascular diseases as described in claim 1, characterized in that, The machine learning models include: AdaBoost, Bagging, Bernoulli_Naive_Bayes, Decision_Tree, Extra_Tree, Gaussian_Naive_Bayes, Gradient_Boosting, KNN, LDA, Logistic_Regression, Multinomial_Naive_Bayes, Passive_Aggressive, QDA, Random_Forest, SGD, SVM, and XGBoost.
8. The method for determining a risk warning model for potentially inappropriate prescriptions for cardiovascular diseases as described in claim 7, characterized in that, The data sampling methods include: No sampling: The raw data is input into the model without sampling the data. Random upsampling: Randomly copy data with fewer label types to ensure an equal number of positive and negative data. Random downsampling: Randomly delete data with a large number of label types to make the number of positive and negative data equal; SMOTE upsampling: The minority class data is analyzed using synthetic minority class upsampling, and new data of this class is synthesized and added to the dataset. The specific algorithm flow is as follows: For each data point x in the minority class, calculate its distance to all data points in the minority class dataset using Euclidean distance to obtain its k nearest neighbors. Set a sampling ratio N based on the imbalance ratio to determine the sampling multiplier. For each minority class data point x, randomly select several data points from its k nearest neighbors, assuming the selected neighbors are xn. For each randomly selected neighbor xn, construct new data points with the original data points: ; Borderline SMOTE upsampling: The Borderline SMOTE algorithm synthesizes new data by combining minority class data on the boundary, thereby improving the distribution of data categories. Borderline SMOTE sampling divides minority class data into three categories: Safe, Danger, and Noise, and only oversamples the minority class data of Danger.