Drug safety credit assessment method and device, electronic equipment and storage medium
By using random forest and gradient enhancement models in drug safety credit assessment, the inconsistency of quality and data in the drug market in drug market are solved, the efficiency and accuracy of drug safety credit assessment are achieved, and the safety of patients' medication is improved.
Patent Information
- Application Number
- CN202411755625.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-11
AI Technical Summary
There are problems in the drug market with inconsistent drug quality, data quality problems, data privacy and security, data integration and standardization, real-timeness and timeliness, algorithm interpretation and model generalization capabilities, resulting in low efficiency and accuracy of drug safety credit assessment, affecting patients' medication safety.
A drug safety credit assessment method is proposed, by obtaining the data to be evaluated, selecting and preprocessing characteristics, and using random forests and gradient enhancement models to conduct drug safety credit assessment, generating evaluation reports, and improving evaluation efficiency and accuracy.
It has achieved the efficiency and accuracy of drug safety credit assessment, effectively solved the problems of inconsistency in drug quality and data, and improved the safety of patients' medication.
Smart Images

Figure CN119599693A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data analysis technology, and in particular to a drug safety credit assessment method, device, electronic device and storage medium. Background Art
[0002] Drugs are a special commodity with extremely high requirements for quality and safety. Strict supervision is required to ensure their effectiveness and safety. Drug safety credit refers to the credibility of drug quality and safety obtained by evaluating the different quality risks of drugs. Drugs with the same name have multiple approval numbers and are produced by multiple manufacturers, which can easily bring safety risks to patients. Therefore, the above drug safety issues need to be solved urgently. Summary of the invention
[0003] The main purpose of the embodiments of the present application is to propose a drug safety credit assessment method, device, electronic device and storage medium, which can realize drug safety credit assessment and improve the efficiency and accuracy of drug safety credit assessment.
[0004] On the one hand, the present application embodiment proposes a drug safety credit assessment method, the method comprising the following steps:
[0005] Get the data to be evaluated;
[0006] Performing feature selection on the data to be evaluated to extract corresponding key feature data;
[0007] A drug safety credit assessment model is used to perform a safety credit assessment on the key feature data to obtain a drug safety credit assessment result.
[0008] In some embodiments, the method further comprises the steps of:
[0009] Acquire a sample data set; the sample data set includes a plurality of pre-processed drug safety credit history data;
[0010] The drug safety credit assessment model is trained and optimized using the sample data set.
[0011] In some embodiments, the using the sample data set to train and optimize the drug safety credit assessment model specifically includes:
[0012] Dividing the sample data set to obtain a training set, a validation set, and a test set;
[0013] Acquire a first benchmark model and a second benchmark model;
[0014] Input the training set into the first benchmark model, output the prediction result of the first model, input the prediction result of the first model into the second benchmark model, perform model iterative correction using the second benchmark model, and obtain the drug safety credit assessment model;
[0015] Inputting the verification set into the drug safety credit assessment model to determine the model verification result; the model verification result includes the model performance evaluation result and the model parameter combination;
[0016] According to the model verification results, hyperparameter tuning is performed on the drug safety credit assessment model;
[0017] Inputting the test set into the drug safety credit assessment model after hyperparameter tuning, performing model performance testing, and obtaining model performance test results;
[0018] Determine whether to stop training the drug safety credit assessment model based on the model performance test results.
[0019] In some embodiments, inputting the training set into the first benchmark model, outputting the first model prediction result, inputting the first model prediction result into the second benchmark model, and performing model iterative correction using the second benchmark model to obtain the drug safety credit assessment model specifically includes:
[0020] A random forest model is obtained as the first benchmark model, and a gradient boosting model is obtained as the second benchmark model;
[0021] Inputting the training set into the first benchmark model, performing classification prediction using multiple decision trees in the first benchmark model, and outputting decision tree prediction results;
[0022] The second benchmark model is used to perform iterative training of the decision tree according to the prediction result of the decision tree to obtain the drug safety credit assessment model.
[0023] In some embodiments, the feature selection of the data to be evaluated to extract the corresponding key feature data specifically includes:
[0024] Build a feature selection system;
[0025] A feature selection system is used to perform feature selection on the data to be evaluated to determine the key feature data, wherein the feature selection system at least includes a filtering feature selection unit, a wrapping feature selection unit and an embedded feature selection unit.
[0026] In some embodiments, the method further comprises:
[0027] A drug safety credit assessment report is generated based on the data to be evaluated, the key feature data and the drug safety credit assessment result.
[0028] In some embodiments, obtaining the data to be evaluated specifically includes:
[0029] Get the data to be evaluated;
[0030] The data to be evaluated are preprocessed, and the preprocessing includes data cleaning, data integration and data standardization.
[0031] On the other hand, the embodiment of the present application provides a drug safety credit assessment device, the device comprising:
[0032] The first module is used to obtain the data to be evaluated;
[0033] The second module is used to perform feature selection on the data to be evaluated and extract corresponding key feature data;
[0034] The third module is used to use the drug safety credit assessment model to perform safety credit assessment on the key feature data to obtain the drug safety credit assessment result.
[0035] On the other hand, an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the drug safety credit assessment method described above when executing the computer program.
[0036] On the other hand, an embodiment of the present application proposes a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the drug safety credit assessment method described above.
[0037] The embodiments of the present application include at least the following beneficial effects: The present application provides a drug safety credit assessment method, device, electronic device and storage medium, which obtains the data to be evaluated, performs feature selection on the data to be evaluated, extracts the corresponding key feature data, and uses the drug safety credit assessment model to perform safety credit assessment on the key feature data to obtain the drug safety credit assessment result. The present application can realize drug safety credit assessment, improve the efficiency and accuracy of drug safety credit assessment, and effectively solve the safety risk problem of patients' medication. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0040] Figure 1 It is a flow chart of a drug safety credit assessment method provided in an embodiment of the present application;
[0041] Figure 2 is a flowchart of step S101 in an embodiment of the present application;
[0042] Figure 3 is a flowchart of step S102 in an embodiment of the present application;
[0043] Figure 4 is a schematic diagram of determining key feature data in an embodiment of the present application;
[0044] Figure 5 is another flow chart of a drug safety credit assessment method provided by an embodiment of the present application;
[0045] Figure 6 is a flowchart of step S402 in an embodiment of the present application;
[0046] Figure 7 is a flowchart of step S503 in an embodiment of the present application;
[0047] Figure 8 is a schematic diagram of constructing a drug safety credit assessment model in an embodiment of the present application;
[0048] Fig. 9 It is a structural schematic diagram of a drug safety credit assessment device provided in an embodiment of the present application;
[0049] Fig.10 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.
[0051] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0052] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0054] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0055] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.
[0056] 1) ETL: Extraction-Transformation-Loading, Chinese name is data extraction, transformation and loading. ETL is responsible for extracting data from distributed and heterogeneous data sources such as relational data and flat data files to a temporary intermediate layer for cleaning, transformation, and integration, and finally loading it into a data warehouse or data mart, becoming the basis for online analytical processing and data mining.
[0057] 2) SHAP (SHapley Additive exPlanations): is a Python library designed to provide interpretable machine learning capabilities. It can explain the output of any machine learning model and enhance the transparency of the model by decomposing the impact of each feature in the model prediction. The SHAP library assigns a numerical value to the contribution of each feature in the model prediction based on the Shapley value in cooperative game theory, thereby helping users and decision makers better understand the working principle and prediction results of the model.
[0058] 3) Z-score: It is a common technique in statistics to identify outliers in a data set. The Z-score (also known as the standard score) is calculated by calculating the difference between a data point and the mean of the data set and then dividing it by the standard deviation.
[0059] 4) TF-IDF (Term Frequency–Inverse Document Frequency): is a commonly used weighting technique for information retrieval and text mining. TF-IDF is a statistical method used to assess the importance of a word to a document set or a document in a corpus. The importance of a word increases in direct proportion to the number of times it appears in a document, but decreases in inverse proportion to the frequency of its occurrence in the corpus. Various forms of TF-IDF weighting are often used by search engines as a measure or rating of the relevance between documents and user queries.
[0060] 5) Random Forest: It is an ensemble learning method mainly used for classification and regression tasks. It improves the accuracy and robustness of the model by combining multiple decision trees. The random forest algorithm is based on the idea of ensemble of decision trees. Each decision tree is built from randomly sampled training samples, and when building each decision tree, the random forest randomly selects a subset of features for training to increase the diversity of the model. The working principle of random forest is to use the "bagging" technique to randomly bootstrap sampling of data sets and features and build complete decision trees in parallel. This randomness ensures that the correlation between individual trees is low, thereby reducing the risk of overfitting. The presence of a large number of trees also further reduces the overfitting problem, because even if some trees make wrong predictions, other trees may correct these errors, thereby improving the accuracy of the overall model.
[0061] 6) LIME (Local Interpretable Model-Agnostic Explanations): is a dynamic programming language that uses LISP-like syntax and is designed to explain the prediction results of any machine learning classifier. It supports text classifiers, tabular data classifiers (such as numerical or categorical data in numpy arrays), and image classifiers. The core idea of LIME is to understand the prediction behavior of the model through local explanations, so that users can better understand the decision-making process of the model.
[0062] 7) Apache Spark: Apache Spark is a fast and general computing engine designed for large-scale data processing. Spark is a general parallel framework similar to Hadoop MapReduce, which was developed by UC Berkeley AMP lab. Spark has the advantages of Hadoop MapReduce, but it is different from MapReduce in that the intermediate output results of a job can be stored in memory, eliminating the need to read and write HDFS. Therefore, Spark is better suited for MapReduce algorithms that require iteration, such as data mining and machine learning.
[0063] 8) XGBoost (eXtreme Gradient Boosting): is an optimized distributed gradient boosting library designed to be efficient, flexible, and portable. It implements machine learning algorithms under the Gradient Boosting framework. XGBoost provides parallel tree boosting (also known as GBDT, GBM) that can solve many data science problems quickly and accurately. The same code runs on major distributed environments (Hadoop, SGE, MPI) and can solve problems beyond billions of examples. XGBoost is an improvement on the gradient boosting algorithm. Newton's method is used to solve the extreme value of the loss function, and the loss function is Taylor expanded to the second order. In addition, a regularization term is added to the loss function. The objective function during training consists of two parts, the first part is the gradient boosting algorithm loss, and the second part is the regularization term.
[0064] 9) KNN filling: It is a missing value filling method based on K-Nearest Neighbors (KNN) algorithm. Its basic idea is to use the values of K samples in the data set that are most similar to the missing samples to estimate and fill the missing values.
[0065] 10) Filtering feature selection method: It is a method of selecting features based on the statistical relationship between features. The basic idea is to evaluate each feature, obtain the correlation between a feature and the target variable, and then select the feature with the highest correlation with the target variable as the final feature set according to a specific evaluation index.
[0066] 11) Parcel feature selection method: It is a commonly used feature selection method in machine learning. Its core idea is to transform the feature selection problem into an optimization problem, and select the best feature combination by searching for feature subsets to improve model performance. Unlike the filtering feature selection method, the parcel feature selection method directly uses the performance of the model to evaluate the quality of the feature subset, so it is closer to the actual application scenario.
[0067] 12) Embedded Feature Selection: It is a method that combines the feature selection process with the model training process. It improves the performance and generalization ability of the model by automatically selecting important features during the model training process.
[0068] 13) K-fold cross validation: It is a method for evaluating model performance. It divides the dataset into K parts and uses each part as a validation set to evaluate the model, thereby reducing the risk of overfitting and improving the generalization ability of the model.
[0069] Drugs are a special commodity with extremely high requirements for quality and safety. All countries implement strict supervision to ensure their effectiveness and safety. Drug safety credit refers to the evaluation of different quality risks of drugs, thereby obtaining the credibility of drug quality and safety. At present, there is a problem of dishonesty in the drug market, especially for drugs with the same name, which have multiple approval numbers and are produced by multiple manufacturers, resulting in a serious phenomenon of uneven drug quality. However, there are still some problems in the practical application of traditional drug safety credit assessment methods:
[0070] Data quality issues: Data sources are diverse and of varying quality, with problems such as missing data, inconsistencies, and errors.
[0071] Data privacy and security: Drug-related data involves patient privacy, and there is a contradiction between data sharing and protection.
[0072] Data integration and standardization: The data formats and structures of different data sources are inconsistent, making integration and standardization difficult.
[0073] Real-time and timeliness: Drug safety data changes quickly, requiring real-time monitoring and timely analysis.
[0074] Algorithm explainability: The results of complex machine learning and deep learning algorithms are difficult to explain and understand, affecting the transparency and credibility of decision-making.
[0075] Model generalization ability: The model performs well on the training data, but may not perform well in actual applications due to differences in data distribution.
[0076] Secondly, many low-quality and high-priced drugs are still circulating on the market, which may bring safety risks to patients.
[0077] Based on this, the embodiment of the present application proposes a drug safety credit assessment method, device, electronic device and storage medium, which effectively performs drug safety credit assessment by combining random forest and gradient boosting models. Random forest and gradient boosting models have good performance and interpretability, can process complex multi-dimensional data, and play an important role in drug safety analysis, can realize drug safety credit assessment, and improve the efficiency and accuracy of drug safety credit assessment.
[0078] Reference Figure 1 , Figure 1 This is an optional flow chart of a drug safety credit assessment method provided in an embodiment of the present application. The method may include but is not limited to steps S101 to S103:
[0079] Step S101, obtaining data to be evaluated;
[0080] Step S102, performing feature selection on the data to be evaluated and extracting corresponding key feature data;
[0081] Step S103, using the drug safety credit assessment model to perform a safety credit assessment on the key feature data to obtain a drug safety credit assessment result.
[0082] In some embodiments, the data to be evaluated may include, but is not limited to, clinical trial data, adverse reaction report data, electronic medical record data, social media feedback data, and drug sales data.
[0083] In some embodiments, reference Figure 2 , Figure 2 This is an optional flowchart of step S101 in the embodiment of the present application. Step S101 may include but is not limited to steps S201 to S202:
[0084] Step S201, obtaining data to be evaluated;
[0085] Step S202, preprocessing the data to be evaluated, including data cleaning, data integration and data standardization.
[0086] In some embodiments, data cleaning includes missing value processing, duplicate value processing and outlier processing; data integration, namely data ETL, includes data extraction, conversion and loading. Data extraction is to extract raw data from multiple data sources, data conversion is to clean, convert and standardize the data, and data loading is to load the processed data into a data warehouse or database; data standardization, also known as normalization, can convert data from the original range to a specific range or distribution, which helps to eliminate the impact of different dimensions or magnitudes on data analysis, making the comparison between different features more reasonable. Through data standardization processing, the data can be converted to the same scale to facilitate comprehensive analysis and comparison.
[0087] Specifically, missing value processing: for fields with fewer missing values, use interpolation or mean filling method to fill in the missing values; for fields with more missing values, consider deleting the field or using machine learning methods (such as KNN filling) for predictive filling; duplicate value processing: data deduplication is performed through primary keys or unique identifiers; outlier processing: statistical methods (such as box plot method, Z-score method) are used to identify and process outliers in the data; data standardization: standardize numerical data, such as normalization or Z-score standardization, so that data features are on the same scale, and encode the classified data, such as One-hot encoding or Label encoding.
[0088] In some embodiments, reference Figure 3 , Figure 3 This is an optional flowchart of step S102 in the embodiment of the present application. Step S102 may include but is not limited to steps S301 to S302:
[0089] Step S301, constructing a feature selection system;
[0090] Step S302, using a feature selection system to perform feature selection on the data to be evaluated to determine key feature data, the feature selection system at least includes a filtering feature selection unit, a wrapping feature selection unit and an embedded feature selection unit.
[0091] In some embodiments, key feature data may include, but are not limited to, the drug's ingredients, dosage, usage, patient demographic information, medical history, and adverse reaction records, etc. The feature selection system is used to perform feature selection on the data to be evaluated, extract the most representative features, reduce data dimensions, and improve subsequent model analysis performance.
[0092] Optionally, the filtering feature selection unit integrates the filtering feature selection method, the wrapping feature selection unit integrates the wrapping feature selection method, and the embedded feature selection unit integrates the embedded feature selection method. Through the filtering feature selection unit, the wrapping feature selection unit and the embedded feature selection unit, feature selection is performed on the data to be evaluated, and key feature data is extracted from the data to be evaluated as much as possible.
[0093] For example, the filtering feature selection method mainly evaluates the correlation or importance between each feature and the target variable through statistical tests or information theory, and then selects the feature with the highest score. The advantages of this type of method are fast calculation speed and independence from subsequent learning algorithms, including the following methods:
[0094] Variance threshold method: Reduce the number of features by removing features whose variance is below a certain threshold. A feature with a small variance means that it varies little in the dataset and may contribute little to the model, so it can be removed;
[0095] Correlation coefficient method: Calculate the correlation coefficient between the feature and the target variable, and select the features with high correlation. The correlation coefficient measures the linear relationship between two variables, and the larger the value, the stronger the relationship;
[0096] Chi-square test: The classic chi-square test is to test the correlation of qualitative independent variables with qualitative dependent variables. The correlation of independent variables with dependent variables is evaluated by constructing statistics;
[0097] Mutual Information Method: Mutual information measures the dependency between two variables and selects important features by calculating the mutual information between the feature and the target variable;
[0098] Relief algorithm: randomly select a sample from the training set, then find the nearest neighbor samples from the same class, find the nearest neighbor samples from different class samples, and finally update the feature weight according to the formula.
[0099] The wrapper feature selection method constructs multiple models to evaluate the impact of different feature subsets on model performance, thereby selecting the optimal feature subset, including the following methods:
[0100] Recursive Feature Elimination (RFE): Recursively train the model and remove the least important features until a predetermined number of features is reached. After each training of the model, the least important features are removed based on the feature importance scores.
[0101] Feature perturbation method: perturb the feature set (such as adding noise) and observe the changes in model performance to evaluate the importance of the feature.
[0102] Embedded feature selection methods embed feature selection into the model training process and select features through regularization or feature importance scores. This type of method depends on specific models, such as decision trees, random forests, linear regression, etc., and includes the following methods:
[0103] Tree-based feature selection: Use feature importance scores in tree models such as decision trees and random forests to select important features. Feature importance in tree models is based on the loss function value that is reduced when a feature splits a node in the tree structure;
[0104] L1 regularization: Feature selection is achieved by adding an L1 norm term to the loss function, which makes the weights of some features become zero. L1 regularization tends to produce sparse models, that is, many features with zero weights;
[0105] Embedding method: Similar to the filtering feature selection method, but the quality of features is determined through training. For example, a base model with L1 or L2 penalty terms is used for feature selection, and dimensionality reduction is performed at the same time.
[0106] In some embodiments, reference Figure 4 , Figure 4 It is an optional schematic diagram for determining key feature data in an embodiment of the present application, wherein the feature selection system includes a filtering feature selection unit, a wrapping feature selection unit and an embedded feature selection unit, the filtering feature selection unit is used to extract features from the data to be evaluated to determine the first feature data, the wrapping feature selection unit is used to extract features from the data to be evaluated to determine the second feature data, the embedded feature selection unit is used to extract features from the data to be evaluated to determine the third feature data, and the key feature data is determined based on the first feature data, the second feature data and the third feature data.
[0107] In some embodiments, reference Figure 5 , Figure 5 is another optional flow chart of a drug safety credit assessment method provided in an embodiment of the present application. The drug safety credit assessment method may further include steps S401 to S402:
[0108] Step S401, obtaining a sample data set; the sample data set includes a plurality of pre-processed drug safety credit history data;
[0109] Step S402: Use the sample data set to train and optimize the drug safety credit assessment model.
[0110] In some embodiments, drug safety credit history data may include but is not limited to clinical trial data, adverse reaction report data, electronic medical record data, social media feedback data, and drug sales data, etc. Drug safety credit history data preprocessing includes data cleaning, data integration, data standardization, and feature selection, wherein feature selection is completed through the above-mentioned feature selection system.
[0111] Exemplarily, the data sources of drug safety credit history data are as follows:
[0112] Clinical trial data: Obtain test results and data about drugs at different stages of clinical trials, including information on efficacy, safety, adverse reactions, etc.
[0113] Adverse reaction reporting: Obtaining data on adverse reactions that occur during drug use from drug regulatory agencies, such as the FDA's Adverse Event Reporting System (FAERS) database.
[0114] Electronic medical records (EMR): Electronic medical record data is obtained from hospitals and medical institutions, including patients' medication records, diagnosis information, treatment results, etc.
[0115] Social media feedback: Collect user feedback and comments on drugs from social media platforms and analyze users’ actual experience of using drugs.
[0116] Drug sales data: Obtain drug sales data from drug sales platforms and pharmacies to analyze the market acceptance and usage frequency of drugs.
[0117] In some embodiments, drug safety credit history data and drug safety credit assessment models are integrated into a big data processing and analysis platform, such as an Apache Spark platform, to achieve dynamic monitoring and analysis of big data.
[0118] In some embodiments, reference Figure 6 , Figure 6 This is an optional flowchart of step S402 in the embodiment of the present application. Step S503 may include but is not limited to steps S501 to S507:
[0119] Step S501, dividing the sample data set to obtain a training set, a validation set and a test set;
[0120] Step S502, obtaining a first reference model and a second reference model;
[0121] Step S503, input the training set into the first benchmark model, output the prediction result of the first model, input the prediction result of the first model into the second benchmark model, use the second benchmark model to perform model iterative correction, and obtain a drug safety credit assessment model;
[0122] Step S504, inputting the validation set into the drug safety credit assessment model to determine the model validation result; the model validation result includes the model performance assessment result and the model parameter combination;
[0123] Step S505, performing hyperparameter tuning on the drug safety credit assessment model according to the model verification result;
[0124] Step S506, inputting the test set into the drug safety credit assessment model after hyperparameter tuning, performing a model performance test, and obtaining a model performance test result;
[0125] Step S507, determining whether to stop training the drug safety credit assessment model based on the model performance test result.
[0126] In some embodiments, reference Figure 7 , Figure 7 This is an optional flowchart of step S503 in the embodiment of the present application. Step S103 may include but is not limited to steps S601 to S603:
[0127] Step S601, obtaining a random forest model as a first benchmark model, and obtaining a gradient boosting model as a second benchmark model;
[0128] Step S602, inputting the training set into the first benchmark model, performing classification prediction using multiple decision trees in the first benchmark model, and outputting decision tree prediction results;
[0129] Step S603, using the second benchmark model to perform iterative training of the decision tree according to the decision tree prediction results, to obtain a drug safety credit assessment model.
[0130] In some embodiments, the random forest model is suitable for processing high-dimensional and diversified data and has strong robustness. The random forest model is an integrated model composed of multiple decision trees. The drug safety credit assessment prediction result is obtained by majority voting or averaging. The standard Gini coefficient for splitting the decision tree nodes is given, and the drug safety credit assessment prediction result of the random forest model is obtained at the same time. Optionally, the random forest model is composed of N decision trees, which are randomly sampled from the original data by the bootstrap method. Each decision tree in the random forest model is constructed based on a sample, and the training sample is x. i , labelled y i , using the Gini Index or Information Gain as the criterion for splitting nodes. Each time a node is split, some features are randomly selected for splitting to avoid overfitting. The final output prediction result is obtained by majority voting or averaging. The relevant formula of the random forest model is as follows:
[0131]
[0132] Among them, Gini(D) is the Gini coefficient of the training set D, p ij is the training sample x i The probability of belonging to class j, m is the number of classes in the dataset.
[0133]
[0134] Where N is the number of decision trees, T i (x) is the predicted drug safety credit assessment result of the i-th decision tree.
[0135] The random forest model is trained using historical drug safety credit data, and the results are predicted through each decision tree in the random forest model to obtain the prediction results corresponding to each decision tree. Based on the prediction results corresponding to each decision tree, the final drug safety credit assessment prediction results (such as the above-mentioned decision tree prediction results) are obtained through majority voting or averaging.
[0136] In some embodiments, the gradient boosting model is an XGBoost model. During the training of the drug safety credit assessment model, assuming that there are M training samples, the gradient boosting model is used to continuously build and correct the model in the iterative training of each decision tree to obtain an objective function F(x), where F(x) is the prediction result of the final model.
[0137] XG Boost is a decision tree model based on gradient boosting. It optimizes the tree structure by gradually building a decision tree and minimizing the objective function. The relevant formula is as follows;
[0138]
[0139] in, is the loss function, Ω(f k ) is the regularization term;
[0140]
[0141] Among them, Gain is the information gain when the node is split, G L and G R is the accumulation of first-order derivatives, H L and H R is the accumulation of the second-order derivatives, and λ and γ are regularization parameters.
[0142] According to the prediction value of the initial model, the fitting function F_0(x) is initialized, where the prediction value of the initial model is the prediction result of the drug safety credit assessment output by the above random forest model. Then, N decision trees are iteratively trained to gradually correct F(x). The prediction result of the i-th decision tree is h i (x), the learning rate is γ i .
[0143] The objective function F(x) can be expressed as:
[0144] F(x)=F_0(x)+γ1h1(x)+γ2h2(x)+...+γihi(x);
[0145] Here, F(x) represents the prediction result of the final model; F_0(x) is the prediction result of the initial model, and h i (x) is the prediction result of the i-th decision tree, γ i is the learning rate of the i-th decision tree. Optionally, the initial model is the above-mentioned random forest model.
[0146] The gradient boosting model uses a combination of additive models. The goal of training each decision tree is to fit the residual of the previous decision tree. Specifically, the prediction result F of the i-th decision tree is i (x) is defined as the prediction result F of the previous decision tree i-1 (x) plus the prediction result h of the newly added i-th decision tree i (x), that is, F i (x) = F i-1 (x)+γ i h i (x), its purpose is to predict the result F of the previous decision tree. i-1 (x) and the prediction result h of the newly constructed i-th decision tree i (x), to gradually correct the prediction results F of the final model i (x).
[0147] Specifically, the update formula F i (x) = F i-1 (x)+γ i h i The purpose of (x) is to use the prediction result h of the newly constructed i-th decision tree in each round of iterative training. i (x) to correct and improve the prediction results of the previous round of models (such as the prediction results of the previous decision tree mentioned above) i-1 (x).
[0148] This iterative training process can gradually improve the prediction ability and fitting effect of the model, thereby more accurately predicting the tensile and compressive loads of the foundation pit. In each round of iteration, the prediction result h of the newly added i-th decision tree is i (x) fits the residual of the previous model, which is the difference between the actual observations and the predictions of the previous model. In this way, the gradient boosting model can gradually improve the prediction effect of the model, especially when nonlinear relationships exist.
[0149] During the model training process, the residual is calculated according to the loss function, and a decision tree is fitted to approximate the residual. By iteratively training multiple decision trees, the gradient boosting model gradually corrects the prediction results of the random forest model and improves the model's fitting ability. The gradient boosting model has good generalization and nonlinear modeling capabilities, and the performance of the model can be adjusted by the preset learning rate and number of iterations. By using the gradient boosting model, the model's fitting effect can be improved and the nonlinear relationship between features can be revealed.
[0150] In practical applications, methods such as cross-validation can be used to select a suitable initial model, adjust the prediction results and learning rate of each decision tree. The selection of these parameters will depend on the specific data set and model requirements, and experiments and tuning are required to obtain the best model performance and fitting results.
[0151] Learning rate γ i Controls the contribution of the i-th decision tree by adjusting the learning rate γ i , can balance the influence of the i-th decision tree on the model. A smaller learning rate γ i It can make the contribution of the newly added i-th decision tree more stable and reduce the risk of overfitting; a larger learning rate γ i It can speed up the learning process, but it may also make the model too complex and cause overfitting. In model training, the learning rate needs to be selected according to the actual situation.
[0152] The gradient boosting model is continuously iterated and corrected to build and train multiple decision trees to improve the model's prediction ability and fitting effect, and effectively deal with complex data situations. When the performance of the gradient boosting model converges or reaches the predetermined number of iterations, the prediction results of the current latest decision tree are added to the prediction results of all trained decision trees in the previous gradient boosting model to obtain the latest decision tree model, which is used as a drug safety credit assessment model.
[0153] In some embodiments, reference Figure 8 , Figure 8It is an optional schematic diagram for constructing a drug safety credit assessment model in an embodiment of the present application. The training set is input into the first benchmark model, the prediction result of the first model is output, the prediction result of the first model is input into the second benchmark model, and the decision tree is iteratively trained using the second benchmark model to construct a drug safety credit assessment model.
[0154] In some embodiments, a cross-validation method, such as K-fold cross-validation, is used to perform model validation on the drug safety credit assessment model using a validation set. Based on the model evaluation results, the hyperparameters of the drug safety credit assessment model are tuned to determine the optimal model hyperparameters.
[0155] In some embodiments, multiple model performance indicators are obtained, such as accuracy, recall rate, F1 value, AUC, etc., and the drug safety credit assessment model is tested using a test set to determine the model performance test results, including specific values of indicators corresponding to each model performance indicator. Optionally, when the specific values of indicators corresponding to each model performance indicator exceed a given threshold corresponding to each model performance indicator, the training of the drug safety credit assessment model is stopped; otherwise, the training of the drug safety credit assessment model continues.
[0156] In some embodiments, key feature data is input into a trained drug safety credit assessment model, and the drug safety credit assessment model is used for classification prediction to determine the corresponding drug safety credit level, and the drug quality is determined based on the drug safety credit level.
[0157] In some embodiments, a drug safety credit assessment report is generated based on the data to be evaluated, key feature data and the results of the drug safety credit assessment. Optionally, a big data processing and analysis platform is used to generate a visualization report and decision recommendations for the drug safety credit assessment based on the data to be evaluated, key feature data and the results of the drug safety credit assessment, i.e., the above-mentioned drug safety credit assessment report. The drug safety credit assessment report is shared with relevant departments, such as regulatory agencies, medical institutions and drug manufacturers. Sharing the drug safety credit assessment report helps relevant departments make scientific and reasonable decisions.
[0158] Reference Fig. 9 , Fig. 9 : is an optional structural diagram of a drug safety credit evaluation device provided in an embodiment of the present application. The device is used to implement the above-mentioned drug safety credit evaluation method. The device may include:
[0159] The first module is used to obtain the data to be evaluated;
[0160] The second module is used to perform feature selection on the data to be evaluated and extract the corresponding key feature data;
[0161] The third module is used to use the drug safety credit assessment model to perform safety credit assessment on key feature data to obtain drug safety credit assessment results.
[0162] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0163] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned drug safety credit assessment method when executing the computer program. The electronic device can be any smart terminal including a tablet computer.
[0164] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0165] See also Fig.10 , Fig.10 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0166] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0167] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other applications. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the drug safety credit assessment method of the embodiment of this application;
[0168] Input / output interface 903, used to implement information input and output;
[0169] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0170] A bus 905 that transmits information between the various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0171] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0172] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned drug safety credit assessment method is implemented.
[0173] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0174] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0175] The embodiments of the present application provide a drug safety credit assessment method, device, electronic device, and storage medium, which obtains data to be evaluated, performs feature selection on the data to be evaluated, extracts corresponding key feature data, and uses a drug safety credit assessment model to perform safety credit assessment on the key feature data to obtain a drug safety credit assessment result. The embodiments of the present application can implement drug safety credit assessment, improve the efficiency and accuracy of drug safety credit assessment, and effectively solve the safety risk problem of patients' medication.
[0176] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0177] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0178] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, 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.
[0179] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0180] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0181] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0182] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0183] The units described above as separate components may or may not be physically separated, and the components shown as units 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 units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0184] In addition, each functional unit in each embodiment of the present application 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 software functional units.
[0185] It should be appreciated that embodiments of the present invention may be implemented or enforced by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable memory. The method may be implemented in a computer program using standard programming techniques including a non-transitory computer-readable storage medium configured with a computer program, wherein the storage medium so configured causes the computer to operate in a specific and predefined manner - according to the methods and drawings described in the specific embodiments. Each program may be implemented in a high-level procedural or object-oriented programming language to communicate with a computer system. However, if desired, the program may be implemented in an assembly or machine language. In any case, the language may be a compiled or interpreted language. In addition, the program may be run on a programmed ASIC for this purpose.
[0186] If the integrated unit 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 technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0187] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A drug safety credit assessment method, characterized in that: The method comprises the following steps: Get the data to be evaluated; Performing feature selection on the data to be evaluated to extract corresponding key feature data; A drug safety credit assessment model is used to perform a safety credit assessment on the key feature data to obtain a drug safety credit assessment result.
2. The drug safety credit assessment method according to claim 1, characterized in that: The method further comprises the steps of: Acquire a sample data set; the sample data set includes a plurality of pre-processed drug safety credit history data; The drug safety credit assessment model is trained and optimized using the sample data set.
3. The drug safety credit assessment method according to claim 2, characterized in that: The using the sample data set to train and optimize the drug safety credit assessment model specifically includes: Dividing the sample data set to obtain a training set, a validation set, and a test set; Acquire a first benchmark model and a second benchmark model; Input the training set into the first benchmark model, output the prediction result of the first model, input the prediction result of the first model into the second benchmark model, perform model iterative correction using the second benchmark model, and obtain the drug safety credit assessment model; Inputting the verification set into the drug safety credit assessment model to determine the model verification result; the model verification result includes the model performance evaluation result and the model parameter combination; According to the model verification results, hyperparameter tuning is performed on the drug safety credit assessment model; Inputting the test set into the drug safety credit assessment model after hyperparameter tuning, performing model performance testing, and obtaining model performance test results; Determine whether to stop training the drug safety credit assessment model based on the model performance test results.
4. The drug safety credit assessment method according to claim 3, characterized in that: The step of inputting the training set into the first benchmark model, outputting the prediction result of the first model, inputting the prediction result of the first model into the second benchmark model, and performing iterative model correction using the second benchmark model to obtain the drug safety credit assessment model specifically includes: A random forest model is obtained as the first benchmark model, and a gradient boosting model is obtained as the second benchmark model; Inputting the training set into the first benchmark model, performing classification prediction using multiple decision trees in the first benchmark model, and outputting decision tree prediction results; The second benchmark model is used to perform iterative training of the decision tree according to the prediction result of the decision tree to obtain the drug safety credit assessment model.
5. The drug safety credit assessment method according to claim 1, characterized in that: The feature selection of the data to be evaluated to extract the corresponding key feature data specifically includes: Build a feature selection system; A feature selection system is used to perform feature selection on the data to be evaluated to determine the key feature data, wherein the feature selection system at least includes a filtering feature selection unit, a wrapping feature selection unit and an embedded feature selection unit.
6. The drug safety credit assessment method according to claim 1, characterized in that: The method further comprises: A drug safety credit assessment report is generated based on the data to be evaluated, the key feature data and the drug safety credit assessment result.
7. The drug safety credit assessment method according to claim 1, characterized in that: The obtaining of the data to be evaluated specifically includes: Get the data to be evaluated; The data to be evaluated are preprocessed, and the preprocessing includes data cleaning, data integration and data standardization.
8. A drug safety credit assessment device, characterized in that: The device comprises: The first module is used to obtain the data to be evaluated; The second module is used to perform feature selection on the data to be evaluated and extract corresponding key feature data; The third module is used to use the drug safety credit assessment model to perform a safety credit assessment on the key feature data to obtain a drug safety credit assessment result.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the drug safety credit assessment method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: The computer program is executed by a processor to implement the drug safety credit assessment method according to any one of claims 1 to 7.