Chemical risk prediction model based on interpretable machine learning and construction method thereof

By constructing a chemical risk prediction model based on interpretable machine learning, the problems of long time consumption, high cost and insufficient model generalization ability in existing chemical hazard assessment technologies are solved. It achieves efficient and interpretable prediction of chemical toxicity, flammability and water reactivity, and provides reliable risk assessment support.

CN121617501APending Publication Date: 2026-03-06FUJIAN NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511724067.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-22
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Existing chemical hazard assessment methods are time-consuming, costly, and struggle to capture the complex dynamic relationship between molecular structure and hazardous properties. Existing machine learning models are deficient in generalization ability, robustness, and interpretability, making it difficult to meet the requirements of regulatory scenarios. In particular, they are unable to effectively predict the reactivity and water reactivity of complex chemical interactions and environmental dependence.

Method used

A chemical risk prediction model based on interpretable machine learning is adopted. A high-dimensional feature set is generated by molecular descriptor and fingerprint calculation. Recursive feature elimination and model importance screening are used. Combined with Shapley additive interpretation, individual conditional expectation and two-dimensional interaction biased dependency analysis, a multi-endpoint hazard attribute prediction model is constructed, including toxicity, flammability and water reactivity. Hierarchical five-fold cross-validation and ROC-AUC are used as the main indicators to ensure the applicability and interpretability of the model.

Benefits of technology

It improves the accuracy and transparency of chemical hazard prediction, identifies key molecular structural factors, provides reliable chemical risk assessment and regulatory support, and enables efficient and interpretable prediction of a variety of hazardous properties.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121617501A_ABST
    Figure CN121617501A_ABST
Patent Text Reader

Abstract

The invention provides a chemical risk prediction model based on interpretable machine learning and a construction method thereof, and the method comprises the steps: S1, obtaining chemical data with risk endpoints, S2, generating a high-dimensional feature set containing physicochemical properties and structural topology for a molecular structure through employing a molecular descriptor and a fingerprint calculation platform; s3, performing comparison modeling on each risk endpoint by independently adopting different types of machine learning models, re-training an optimal model on a training set, and reporting a final result in an independent prediction set; s4, the model application range of the optimal model is determined, and an application domain framework of the model is constructed based on conformal prediction, and S5, the importance of global and sample-level key descriptors is output; and finally, batch reasoning and result exporting: outputting a prediction label, a prediction probability, an application domain framework mark, a significance level and an explanatory result one by one for a chemical list corresponding to the target chemical data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention proposes a chemical risk prediction model based on interpretable machine learning and its construction method, which relates to the fields of computer science and chemical safety. Background Technology

[0002] The key hazard properties of chemicals (including toxicity, flammability, reactivity, and reactivity with water) are core indicators for assessing their potential risks during storage, transportation, use, and disposal, and are also important bases for environmental management and chemical safety supervision. Traditional experimental methods (such as OECD 423 acute toxicity testing and ASTM E681 flammability determination) are time-consuming, costly, and struggle to capture the complex dynamic relationship between molecular structure and hazardous properties, making it difficult to cover the rapidly growing chemical inventory in a short period. This limitation severely restricts the efficiency of large-scale screening and tiered management of hazardous chemicals.

[0003] With the development of machine learning, alternative solutions have been provided for assessing the critical hazard attributes of chemicals. Machine learning methods can predict hazardous properties from molecular descriptors, structural information, and historical data, greatly reducing reliance on expensive experiments. Currently, methods using quantitative structure-activity relationship (QSAR), random forest (RF), and graph neural networks (GNN) are available to predict properties such as acute toxicity, lightning, and explosion limits of chemicals. However, due to limitations such as sparse features, limited data volume, and uneven class distribution, these methods still have shortcomings in generalization ability, robustness, and interpretability, making it difficult to meet the requirements of regulatory scenarios for transparency, traceability, and clearly defined applicability boundaries.

[0004] In recent years, the continuous development of machine learning, such as GNNs, RF, and other ensemble techniques, has been applied to predict individual hazardous properties. These methods use sophisticated feature engineering to encode molecular characteristics and make predictions with higher accuracy. However, few studies have focused on simultaneously predicting multiple hazardous properties. In particular, for reactivity and RW reactivity, which require modeling complex chemical interactions and environmental dependencies, existing models often fail to capture the full complexity. Summary of the Invention

[0005] In view of this, to fill the gaps and deficiencies in existing technologies, this invention proposes a chemical risk prediction model and its construction method based on interpretable machine learning, used to quantitatively predict the multi-endpoint hazard properties (including toxicity, flammability, reactivity, and water reactivity) of hazardous chemicals. This invention improves prediction accuracy and transparency while identifying key molecular structural factors driving hazard characteristics, thereby providing reliable technical support for chemical risk assessment and regulation.

[0006] This invention proposes a chemical risk prediction model based on interpretable machine learning and its construction method, including the following:

[0007] This invention proposes a method for constructing a chemical risk prediction model based on interpretable machine learning, characterized by the following:

[0008] Step S1: Obtain chemical data with risk endpoints, use the chemical data with risk endpoints as samples, and construct a supervised learning dataset; samples in the supervised learning dataset with more than or equal to 2 types of risk endpoints are marked as samples with significant risk, and samples with fewer than 2 types are marked as samples without significant risk; each chemical data sample with risk endpoints has at least 1 type of risk endpoint; for chemical data samples with 2 or more types of risk endpoints, each type of risk endpoint is different, and the correlation is direct, completely independent, and does not affect each other;

[0009] Step S2: Use a molecular descriptor and fingerprint computing platform to generate a high-dimensional feature set for the molecular structure, including physicochemical properties and structural topology, and delete constant or near-constant features; then use recursive feature elimination and model-based importance screening to obtain a subset of descriptors for modeling.

[0010] Step S3: For each risk endpoint, different types of machine learning models are used independently for comparative modeling. In the comparative modeling, ROC-AUC is used as the main indicator, and accuracy, precision, recall and F1 are recorded as supplementary indicators to evaluate performance. After determining the optimal model, the optimal model is retrained on the training set and the final results are reported on the independent prediction set.

[0011] Step S4: Determine the applicability range of the optimal model, including constructing the applicable domain framework of the model based on conformal prediction, where the applicable domain framework is independent of the optimal model and is constructed through a model-independent prediction interval framework; then, based on the test sample set, calculate the prediction set Γ of the test samples for a given significance level. α (x), when |Γ α (x i If |=1, the test sample is considered to be within the applicable domain framework; otherwise, it is considered to be outside the applicable domain framework.

[0012] Step S5: Perform Shapley additive interpretation, individual conditional expectation, and two-dimensional interaction biased dependency analysis on the optimal model to output the importance of global and sample-level key descriptors; finally, batch inference and result export: output the prediction label, prediction probability, applicable domain frame label, significance level, and explanatory results for each chemical list corresponding to the target chemical data.

[0013] Further, step S1 includes the following:

[0014] In step S1, the chemical is derived from organic matter; the chemical does not include inorganic matter or mixtures; the chemical data with risk endpoints is in SMILES format, which describes the molecular structure in string form; the risk endpoints include toxicity endpoints for indicating chemical toxicity, flammability endpoints for indicating chemical flammability, reactivity endpoints for indicating chemical reactivity, and water reactivity endpoints for indicating chemical water reactivity.

[0015] Further, step S2 includes the following:

[0016] In step S2, the molecular descriptor and fingerprint computing platform includes one or more combinations of cheminformatics tools for generating physicochemical properties and structural topological features. The features include at least two types: molecular descriptors and structural fingerprints. Constant or near-constant features are eliminated. The recursive feature elimination and model-based importance screening are two types of embedded feature selection strategies used in parallel or serially to obtain a subset of descriptors for modeling from the high-dimensional feature set.

[0017] Further, step S3 includes the following:

[0018] Step S31: Data partitioning and hyperparameter tuning: Hierarchical five-fold cross-validation is used for model selection and hyperparameter determination; the hyperparameter search is only completed within the training fold to avoid information leakage;

[0019] Step S32: Test Set Report: Calculate and report ROC-AUC as the primary metric on the independently retained test set, along with accuracy, recall, precision, and F1 score to comprehensively reflect classification performance; ROC-AUC represents the area under the receiver operating characteristic curve. The F1 score is a machine learning evaluation metric.

[0020] Furthermore, step S3 also includes the following:

[0021] Step S33: Class Imbalance Control: Introduce class weights related to class frequency during the training phase, and use hierarchical splitting and pairwise metrics to measure the model's ability to identify minority classes in the evaluation; the pairwise metrics include recall and F1 score.

[0022] Step S34: Model comparison and selection rules: In the candidate model set, the optimal model for each endpoint is determined based on the ROC-AUC performance of cross-validation; the final performance is based on the metric of the optimal model on the test set.

[0023] Step S35: Preprocessing robustness check: Conduct a comparative experiment on missing value imputation and feature scaling and obtain a test set report, in which the optimal model configuration is determined within the training iteration; the test set report corresponds to the result of the optimal preprocessing and model combination.

[0024] Furthermore, step S3 also includes the following:

[0025] Step S36: Verify that the final result comes from the real structural property signal by using response scrambling: While keeping the feature matrix unchanged, randomly shuffle the labels multiple times and repeat the training and evaluation; when the AUC of the scrambled model significantly falls back to the near-random level, it proves that the performance of the optimal model comes from the real structural property signal rather than data noise or label randomness.

[0026] Further, step S4 includes the following:

[0027] Step S41: Let the classifier be f: x→y, and output the probability f of each class. k (x), at a significance level α∈(0,1), the test sample x i The prediction set is defined as: in To preserve the shape of class k, the p-value is determined by the calibration set based on the consistency score. calculate:

[0028]

[0029] Where α is the significance level, y is the actual hazard level label of the chemical, i is the test sample index number, j is the calibration set sample index number, and n is the calibration set size;

[0030] When |Γ α (x i If |=1, the test sample is considered to be within the applicable domain framework; otherwise, it is considered to be outside the applicable domain framework.

[0031] Furthermore, step S4 also includes the following:

[0032] Step S42: Calculate the coverage and accuracy within the applicable domain at several significance levels α to determine the optimal confidence threshold. A composite evaluation index is introduced, and the significance level α that maximizes this score is selected. The most robust confidence boundary is obtained according to the following:

[0033] Score α =Coverage α ×Accuracy ln-AD

[0034] Coverage αFor coverage; Accuracy ln-AD Accuracy within the applicable domain framework; deployment only applies to |Γ α (x i |=1 Sample output final conclusion and confidence level, |Γ α (x i Samples with |≠1 are marked as uncertain.

[0035] Further, step S5 includes the following:

[0036] Step S51: The interpretation method includes one or more of Shapley additive interpretation, individual conditional expectation, and two-dimensional interaction biased dependency, used to give the importance of global features and the importance of sample-level key descriptors; wherein the interpretation results are used to show the feature and response relationship and potential interaction related to each endpoint, and are exported together with the batch inference results for auditing and traceability.

[0037] This invention proposes a chemical risk prediction model based on interpretable machine learning, which is constructed using the method described in any one of these inventions. The chemical risk prediction model based on interpretable machine learning includes the following:

[0038] The feature generation module is used to generate a feature set of molecular structures, including physicochemical properties and structural topology, and to remove constant features.

[0039] The feature selection module is used to perform recursive feature elimination and / or model-based importance filtering;

[0040] The model training and comparison module is used to train the model set and search for hyperparameters according to hierarchical five-fold cross-validation and ROC-AUC main metrics;

[0041] The applicable domain determination module is used to perform conformal prediction and output the applicable domain frame marker;

[0042] The explanation generation module is used to output global and sample-level explanations.

[0043] The results output module is used to output the predicted labels, probabilities, applicable domain frame labels, significance level α, and explanatory results. Attached Figure Description

[0044] Figure 1 This is a schematic diagram of the steps of the present invention.

[0045] Figure 2 This is a structural diagram of the machine learning model of the present invention.

[0046] Figure 3This is a heatmap of the Shap value of the model of this invention.

[0047] Figure 4 This is an ICE analysis diagram of the model of this invention.

[0048] Figure 5 This is a 2D interaction-partial dependency analysis diagram of the model of this invention.

[0049] Figure 6 This is the application domain evaluation diagram based on conformal prediction of the present invention. Detailed Implementation

[0050] The technical solution of the present invention will now be described in detail with reference to the accompanying drawings.

[0051] It should be noted that the following detailed description is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0052] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments of the present invention; as used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise; furthermore, it should be understood that when the terms “comprising” and / or “including” are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.

[0053] like Figures 1 to 6 As shown, this invention proposes a chemical risk prediction model based on interpretable machine learning and its construction method, including the following:

[0054] This invention proposes a method for constructing a chemical risk prediction model based on interpretable machine learning, characterized by the following:

[0055] Step S1: Obtain chemical data with risk endpoints, use the chemical data with risk endpoints as samples, and construct a supervised learning dataset; samples in the supervised learning dataset with more than or equal to 2 types of risk endpoints are marked as samples with significant risk, and samples with fewer than 2 types are marked as samples without significant risk; each chemical data sample with risk endpoints has at least 1 type of risk endpoint; for chemical data samples with 2 or more types of risk endpoints, each type of risk endpoint is different, and the correlation is direct, completely independent, and does not affect each other;

[0056] Step S2: Use a molecular descriptor and fingerprint computing platform to generate a high-dimensional feature set for the molecular structure, including physicochemical properties and structural topology, and delete constant or near-constant features; then use recursive feature elimination and model-based importance screening to obtain a subset of descriptors for modeling.

[0057] Step S3: For each risk endpoint, different types of machine learning models are used independently for comparative modeling. In the comparative modeling, ROC-AUC is used as the main indicator, and accuracy, precision, recall and F1 are recorded as supplementary indicators to evaluate performance. After determining the optimal model, the optimal model is retrained on the training set and the final results are reported on the independent prediction set.

[0058] Step S4: Determine the applicability range of the optimal model, including constructing the applicable domain framework of the model based on conformal prediction, where the applicable domain framework is independent of the optimal model and is constructed through a model-independent prediction interval framework; then, based on the test sample set, calculate the prediction set Γ of the test samples for a given significance level. α (x), when |Γ α (x i If |=1, the test sample is considered to be within the applicable domain framework; otherwise, it is considered to be outside the applicable domain framework.

[0059] Step S5: Perform Shapley additive interpretation, individual conditional expectation, and two-dimensional interaction biased dependency analysis on the optimal model to output the importance of global and sample-level key descriptors; finally, batch inference and result export: output the prediction label, prediction probability, applicable domain frame label, significance level, and explanatory results for each chemical list corresponding to the target chemical data.

[0060] Step S1 includes the following:

[0061] In step S1, the chemical is derived from organic matter; the chemical does not include inorganic matter or mixtures; the chemical data with risk endpoints is in SMILES format, which describes the molecular structure in string form; the risk endpoints include toxicity endpoints for indicating chemical toxicity, flammability endpoints for indicating chemical flammability, reactivity endpoints for indicating chemical reactivity, and water reactivity endpoints for indicating chemical water reactivity.

[0062] Corresponding to step S1, in one embodiment of the present invention, step S1 further includes the following:

[0063] Organic compound data tagged with NFPA 704 were collected from the PubChem database to construct a supervised learning dataset containing four hazard endpoints (toxicity, flammability, reactivity, and water reactivity). For each endpoint, samples with a numerical rating of 2 or higher were labeled as having significant hazard, while samples with a numerical rating lower than 2 were labeled as inactive and having no significant hazard. The screening criteria included:

[0064] (1) The compound is an organic substance (excluding inorganic salts and mixtures);

[0065] (2) Possesses effective standardized SMILES;

[0066] (3) It also has clear NFPA 704 toxicity and flammability endpoint labels (reported or cross-referenced from regulatory safety information sources in PubChem).

[0067] In one embodiment of the present invention, samples with structural ambiguity or those that cannot be resolved are eliminated through analytical verification, aromatization and chiral unification, salt stripping and deduplication. Approximately 700 organic chemical samples are ultimately obtained, with varying sample sizes for toxicity, flammability, reactivity, and water reactivity (the fewest RW endpoint data), reflecting the uneven distribution of chemical risks in reality.

[0068] Further, step S2 includes the following:

[0069] In step S2, the molecular descriptor and fingerprint computing platform includes one or more combinations of cheminformatics tools for generating physicochemical properties and structural topological features. The features include at least two types: molecular descriptors and structural fingerprints. Constant or near-constant features are eliminated. The recursive feature elimination and model-based importance screening are two types of embedded feature selection strategies used in parallel or serially to obtain a subset of descriptors for modeling from the high-dimensional feature set.

[0070] Corresponding to step S2, in one embodiment of the present invention, step S2 further includes the following:

[0071] The ChemDes descriptor generation platform was used to calculate various physicochemical features and topological parameters, including PaDEL, Chemopy, CDK, RDKit, and Pybel modules. The feature set covers information such as electronic properties, hydrophobicity, molecular topology, and polar surface area, and is supplemented with a 2048-bit Morgan fingerprint to capture local structural information.

[0072] By eliminating low-variance features (threshold 1×10) -4The algorithm employs a combination of recursive feature elimination (RFE) and model-based importance assessment (SelectFromModel) to select variables that contribute most to prediction. The final feature dimension for each endpoint task is approximately 2000.

[0073] Further, step S3 includes the following:

[0074] Step S31: Data partitioning and hyperparameter tuning: Hierarchical five-fold cross-validation is used for model selection and hyperparameter determination; the hyperparameter search is only completed within the training fold to avoid information leakage;

[0075] Step S32: Test Set Report: Calculate and report ROC-AUC as the primary metric on the independently retained test set, along with accuracy, recall, precision, and F1 score to comprehensively reflect classification performance; ROC-AUC represents the area under the receiver operating characteristic curve. The F1 score is a machine learning evaluation metric.

[0076] Furthermore, step S3 also includes the following:

[0077] Step S33: Class Imbalance Control: Introduce class weights related to class frequency during the training phase, and use hierarchical splitting and pairwise metrics to measure the model's ability to identify minority classes in the evaluation; the pairwise metrics include recall and F1 score.

[0078] Step S34: Model comparison and selection rules: In the candidate model set, the optimal model for each endpoint is determined based on the ROC-AUC performance of cross-validation; the final performance is based on the metric of the optimal model on the test set.

[0079] Step S35: Preprocessing robustness check: Conduct a comparative experiment on missing value imputation and feature scaling and obtain a test set report, in which the optimal model configuration is determined within the training iteration; the test set report corresponds to the result of the optimal preprocessing and model combination.

[0080] Furthermore, step S3 also includes the following:

[0081] Step S36: Verify that the final result comes from the real structural property signal by using response scrambling: While keeping the feature matrix unchanged, randomly shuffle the labels multiple times and repeat the training and evaluation; when the AUC of the scrambled model significantly falls back to the near-random level, it proves that the performance of the optimal model comes from the real structural property signal rather than data noise or label randomness.

[0082] Corresponding to step S3, in one embodiment of the present invention, step S3 further includes the following:

[0083] like Figure 2As shown, this invention employs a variety of machine learning models for comparative modeling, including Random Forest (RF), K Nearest Neighbors (KNN), Decision Tree (DT), Gradient Boosting Tree (XGBoost), Support Vector Machine (SVC), Graph Attention Network (GAT), GraphSAGE, and Graph Convolutional Network (GCN).

[0084] The training and validation process employs stratified 5-fold cross-validation (CV) to ensure a consistent positive / negative sample ratio across each fold and reduce sampling variance. ROC-AUC is used as the primary metric in model selection and comparison, while accuracy, precision, recall, and F1 score are recorded as supplementary performance evaluations. Hyperparameter optimization is performed within the training fold (decoupled from the test set), using a systematic search and comparison within a predefined search space to avoid information leakage. After determining the optimal configuration, the model is retrained on the training set, and the final results are reported on an independent test set. To address class imbalance, class weights related to class frequency are introduced during the training phase to improve the stability of minority class identification.

[0085] This invention independently employs different types of machine learning models for comparative modeling of each risk endpoint, and the evaluation follows a unified principle that is decoupled from the training process, specifically including:

[0086] Data partitioning and hyperparameter tuning: Hierarchical five-fold cross-validation is used for model selection and hyperparameter determination; hyperparameter search is only completed within the training fold to avoid information leakage.

[0087] Test set report: The area under the receiver operating characteristic curve (ROC-AUC) is calculated and reported on the independently retained test set as the main metric, along with accuracy, recall, precision, and F1 score to comprehensively reflect classification performance.

[0088] Class imbalance control: During the training phase, class weights related to class frequency are introduced, and in the evaluation, hierarchical splitting and paired metrics (such as Recall / Precision and F1) are used to jointly measure the model's ability to identify minority classes.

[0089] Model comparison and selection rules: In the candidate model set (including tree models, traditional machine learning models and graph neural network paradigms), the optimal model at each endpoint is determined based on the ROC-AUC performance of cross-validation; the final performance is based on the metric of the optimal model on the test set.

[0090] Preprocessing robustness check: Comparative experiments were conducted on missing value imputation (mean / median / KNN) and feature scaling (no scaling / standardization / min-max scaling), and the configuration was determined only within the training iteration; the test set report showed the results of the corresponding optimal preprocessing and model combination.

[0091] To verify that the predictions are not merely random, this invention employs Y-scrambling: while keeping the feature matrix unchanged, the labels are randomly shuffled multiple times, and the training and evaluation are repeated. The AUC of the shuffled model significantly drops to near-random levels, proving that the performance of the original model comes from genuine structural-property signals rather than data noise or label randomness.

[0092] Y-scrambling proves that the "signals" captured throughout the entire modeling process (from data to the final model) are real, rather than accidental coincidences. It verifies the "validity" and "authenticity" of the entire discovery process, providing evidence for the authenticity of the "original model performance".

[0093] Further, step S4 includes the following:

[0094] Step S41: Let the classifier be f: x→y, and output the probability f of each class. k (x), at a significance level α∈(0,1), the test sample x i The prediction set is defined as: in To preserve the shape of class k, the p-value is determined by the calibration set based on the consistency score. calculate:

[0095]

[0096] Where α is the significance level, which means the confidence threshold set by the user;

[0097] y represents the true hazard level of the chemical (0 or 1);

[0098] i is the test sample index, which means the number of a chemical being predicted;

[0099] j is the sample index of the calibration set, which means the number of a certain chemical in the set of known chemicals used to calibrate the model;

[0100] n is the size of the calibration set, which represents the total number of known chemicals used to calibrate the model;

[0101] When |Γ α (x i If |=1, the test sample is considered to be within the applicable domain framework; otherwise, it is considered to be outside the applicable domain framework.

[0102] Furthermore, step S4 also includes the following:

[0103] Step S42: Calculate the coverage and accuracy within the applicable domain at several significance levels α to determine the optimal confidence threshold. A composite evaluation index is introduced, and the significance level α that maximizes this score is selected. The most robust confidence boundary is obtained according to the following:

[0104] Score α =Coverage α ×Accuracy ln-AD

[0105] Coverage α For coverage; Accuracy ln-AD Accuracy within the applicable domain framework; deployment only applies to |Γ α (x i |=1 Sample output final conclusion and confidence level, |Γ α (x i Samples with |≠1 are marked as uncertain.

[0106] Corresponding to step S4, in one embodiment of the present invention, step S4 further includes the following:

[0107] When |Γ α (x i When || = 1, an instance is considered an In-AD instance, representing a unique, statistically supported prediction. Otherwise, it is labeled out-AD, reflecting model uncertainty at a given confidence level. Figure 6 As shown, this invention uses conformal prediction to determine In-AD / Out-AD for samples and compares coverage and In-AD accuracy across multiple α values ​​to determine the run point. This invention evaluates multiple α values ​​and calculates for each α value: the proportion of In-AD samples (coverage) and the prediction accuracy of In-AD and Out-AD subsets. To determine the optimal confidence threshold, this invention introduces a composite evaluation index and selects the α that maximizes this score:

[0108] Score α =Coverage α ×Accuracy ln-AD

[0109] This yields the most robust confidence boundary: during deployment, only the final conclusion and confidence level are output for In-AD samples, while Out-AD samples are marked as uncertain.

[0110] Further, step S5 includes the following:

[0111] Step S51: The interpretation method includes one or more of Shapley additive interpretation, individual conditional expectation, and two-dimensional interaction biased dependency, used to give the importance of global features and the importance of sample-level key descriptors; wherein the interpretation results are used to show the feature and response relationship and potential interaction related to each endpoint, and are exported together with the batch inference results for auditing and traceability.

[0112] Corresponding to step S5, in one embodiment of the present invention, step S5 further includes the following:

[0113] This invention employs an interpretability framework based on feature contributions to provide global and individual-level explanations for the endpoint optimal model. First, SHAP (Shapley Additive Explanations) is used to perform posterior interpretation of the model output after a predetermined training period: Shapley contribution values ​​are calculated for each sample and each feature, and the main driving factors are displayed globally using feature importance ranking and distribution maps. At the individual level, the positive and negative feature contributions of samples reveal the decision-making basis. The visualization is as follows: Figure 3 As shown. Secondly, the relationship between "single feature change – sample predicted response" is characterized using the ICE (Individual Conditional Expectation) curve: with other features fixed, forward reasoning is performed point-by-point along the feasible value range of the feature, reflecting the heterogeneity of responses from different samples in the form of a trajectory; the analysis is as follows... Figure 4 As shown. If necessary, two-dimensional partial dependence (PD) can be used as a supplement, i.e., forward inference is performed on a two-dimensional grid of given feature pairs and conditional expectations are taken for other features, thereby observing the joint effect of both on the prediction results and possible nonlinear / interactive effects; the illustration is as follows. Figure 5 As shown.

[0114] Shapley Additive Explanation (SHAP) is a method based on solid game theory for explaining the predictions of any machine learning model. It answers the question "why the model made this decision" in a quantitative way (SHAP value) by fairly allocating the contribution of each feature to a single prediction.

[0115] Based on the above process, this invention obtains auditable interpretable outputs at different risk endpoints: at the global level, it provides a ranking and distribution of feature importance (for identifying major driving factors and their directions of action); at the individual level, it provides the feature contribution and response trajectory of a single sample (for supporting and verifying single-point conclusions); when significant interactions exist, it uses a two-dimensional PD to display joint effects and boundary regions. To maintain decoupling from the modeling process, all the above interpretive steps are generated using forward inference after training is completed, without retraining or adjusting the model parameters.

[0116] This invention proposes a chemical risk prediction model based on interpretable machine learning, which is constructed using the method described in any one of these inventions. The chemical risk prediction model based on interpretable machine learning includes the following:

[0117] The feature generation module is used to generate a feature set of molecular structures, including physicochemical properties and structural topology, and to remove constant features.

[0118] The feature selection module is used to perform recursive feature elimination and / or model-based importance filtering;

[0119] The model training and comparison module is used to train the model set and search for hyperparameters according to hierarchical five-fold cross-validation and ROC-AUC main metrics;

[0120] The applicable domain determination module is used to perform conformal prediction and output the applicable domain frame marker;

[0121] The explanation generation module is used to output global and sample-level explanations.

[0122] The results output module is used to output the predicted labels, probabilities, applicable domain frame labels, significance level α, and explanatory results.

[0123] In addition to the above, the present invention also has related embodiments, including the following:

[0124] This invention provides a chemical risk prediction model based on interpretable machine learning and its construction method. The hazardous properties include toxicity (NFPA-T), flammability (NFPA-F), reactivity (NFPA-R), and reactivity with water (NFPA-RW). Those skilled in the art should understand that the following embodiments are illustrative and not limiting; equivalent substitutions for the order of steps, parameter values, and module implementations without departing from the spirit of the invention fall within the scope of protection of this invention.

[0125] In one embodiment of the present invention, modeling is performed on four hazardous properties of the NFPA 704 system: toxicity, flammability, reactivity, and reactivity with water (RW). The data source is molecular entries and their NFPA 704 rating information extracted from PubChem. According to the NFPA criteria, a rating ≥2 at any endpoint is classified as "active" (label = 1), and a rating <2 is classified as "inactive" (label = 0), thus completing the binarization labeling.

[0126] In one embodiment of the present invention, to obtain learningable input from molecular structures, the ChemDes computing platform (integrating PaDEL, Chemopy, CDK, RDKit, and Pybel) is used to transform the molecular representation, obtaining features such as molecular descriptors and fingerprints. Routine quality control is performed on the original features: constant or near-constant features are removed, and in the subsequent model selection stage, embedded methods (such as gain-based splitting and regularization in tree models) are used to automatically screen effective features and suppress overfitting.

[0127] In one embodiment of this invention, stratified 5-fold cross-validation is used for model selection and performance evaluation, maintaining a relatively consistent ratio of positive to negative classes within the training / validation fold. All models are tuned within the training fold using grid search, with the primary optimization objective being ROC-AUC. The results analysis includes metrics such as precision, recall, and F1 score to comprehensively measure classification performance. To analyze the impact of data conditions on error, this invention employs (i) stratified random sampling to generate training subsets at scales of 20%, 40%, 60%, 80%, and 90% to examine the data volume effect; (ii) comparison of three imputation strategies for missing values: mean, median, and KNNImputer (k=5, Euclidean distance); and (iii) comparison of three preprocessing strategies for data heterogeneity: "no scaling," StandardScaler, and MinMaxScaler.

[0128] Among them, the F1 score is a core machine learning evaluation metric.

[0129] The F1 score = 2 * (Precision * Recall) / (Precision + Recall), which is the harmonic mean of precision and recall. It is a value between 0 and 1, with 1 representing optimal performance. It considers both the model's "predictive accuracy" and "sample identification ability," providing a single, balanced score that reflects the balance the model achieves between "not missing any cases" (high precision) and "not missing any cases" (high recall).

[0130] In one embodiment of this invention, multiple models are trained and compared based on molecular descriptors / fingerprints: Random Forest (RF), k-Nearest Neighbors (KNN), Decision Tree (DT), XGBoost, Support Vector Classifier (SVC), and Graph Attention Networks (GAT; GraphSAGE; GCN). The search space and optimal hyperparameters for each model are described in the supplementary materials of the paper (Text 4, Tables S1–S4). For example, RF, under optimal settings, has approximately 659 base learners, a maximum depth of approximately 32, and a minimum split threshold of approximately 0.0217; the deep graph model adjusts hyperparameters such as hidden channel dimension, learning rate, dropout, and L2 regularization to prevent overfitting. Class imbalance is addressed at the algorithmic level: tree models introduce class weights inversely proportional to class frequency; in the RW task, the scale_pos_weight of XGBoost is adjusted to enhance the identification of minority classes.

[0131] In one embodiment of the invention, a model-independent conformal prediction framework is employed, and AD determination is achieved using MAPIE. For the classifier f: x→y and the significance level α, the test sample x... i The prediction set is defined as in The conformal p-value based on the calibration set (calculated using class probability as the consistency score). If |Γ α (x i If α = 1, it is classified as In-AD; otherwise, it is classified as Out-AD, indicating the uncertainty of the model at that confidence level. This AD architecture is decoupled from the specific learner, which can improve the reliability assessment of the In-AD subset while maintaining coverage. This invention compares the coverage-accuracy tradeoffs at different α levels to select practical running points, and the results are as follows. Figure 6 As shown.

[0132] In one embodiment of this invention, to reveal the structural drivers of model discrimination and improve reviewability, SHAP (Shapley Additive Interpretation), ICE (Individual Conditional Expectation), and two-dimensional / three-dimensional interactive analysis are employed to interpret important endpoint-related descriptors at both the global and individual levels. This invention predicts the following for representative chemical families (such as ketones / aldehydes): important descriptors for toxicity endpoints include MIC4; important descriptors for flammability endpoints include ATSC2i; important descriptors for reactivity endpoints include ATS4i; and important descriptors for water-reactive endpoints include ETA_dEpsilon_C. These conclusions demonstrate the relationship between structural factors such as topological autocorrelation, electrical properties, and branching degree and various hazardous properties.

[0133] In one embodiment of the present invention, the output of the present invention includes at least: molecular identifier, endpoint prediction label and its probability, AD marker (In-AD or Out-AD) and runtime parameters (such as the selected α value); the interpretation phase can simultaneously provide sample-level SHAP / ICE summaries or a list of key descriptors for auditing and tracing.

[0134] The method of this invention can be implemented on general-purpose electronic devices, specifically as a local program, a cloud service, or an edge device; the method steps can be implemented by a processor executing program instructions stored in a non-transitory computer-readable storage medium. Those skilled in the art can reasonably adjust the parameter ranges (such as maximum sequence length and grid step size) based on the above description to obtain the same or equivalent effects.

[0135] like Figure 2 As shown, in one embodiment of the present invention, the machine learning models used include: Random Forest (RF), k-Nearest Neighbors (KNN), Decision Tree (DT), XGBoost, Support Vector Classifier (SVC), and Graph Attention Networks (GAT; GraphSAGE; GCN). The labels output by the present invention include: Toxicity, Flammability, Reactivity, and Reactivity with Water (RW).

[0136] In one embodiment of the present invention, Figure 3 This invention provides a global interpretation of the "toxicity-XGBoost model": it places different functional groups (vertical axis) and key molecular descriptors (horizontal axis) in a matrix, showing the importance (SHAP value) of each descriptor for toxicity prediction in the corresponding functional group.

[0137] In one embodiment of the present invention, Figure 4 This invention provides a univariate local interpretation of the ketone / aldehyde toxicity model: Each blue line represents how the model predicts toxicity (PD) as the MIC4 of a molecule is swept from left to right, while keeping other features constant. The orange dashed line is the average of all blue lines, i.e., the classic PDP curve. The graph shows that when MIC4 < 0, the partial dependence value remains high at 0.8–0.9; when MIC4 > 0, the predicted toxicity decreases rapidly and tends to stabilize, indicating that there is a "critical point" for MIC4; exceeding this topological complexity threshold reduces the toxicity probability given by the model.

[0138] In one embodiment of the present invention, Figure 5This is a visualization (2D PDP) of the bivariate interaction effect of the "toxicity-XGBoost model" of this invention: the darker the color, the higher the average probability of the model predicting toxicity for this pair of values. The graph shows that when MIC4 is low (the molecule is simpler) and BCUTC-1l is within a certain range, the toxicity is high; while when MIC4 increases or BCUTC-1l becomes positive, the toxicity decreases significantly. In other words, there is a clear interaction between the two descriptors, "topological complexity × charge distribution," and it is not a simple additive relationship.

[0139] In one embodiment of the present invention, Figure 6 This invention demonstrates the following: Within a conformal prediction framework, as the significance level α changes: Blue line (In-ADAccuracy): The model's accuracy on the subset of samples considered "reliable". Red line (Out-ADAccuracy): The accuracy on samples "outside the applicability domain," which is generally significantly lower. Green line (Coverage): The proportion of samples judged as In-AD at the current α. The circled α = 0.17 in the figure is the "compromise point" chosen by the authors: at this point, the coverage is approximately 95.8%, the In-AD accuracy is 0.912, far higher than the baseline accuracy, while the Out-AD accuracy is only 0.333, indicating that the model can distinguish between samples within and outside the model's applicability domain.

[0140] The above are preferred embodiments of the present invention. Any changes made to the technical solution of the present invention that do not exceed the scope of the technical solution of the present invention shall fall within the protection scope of the present invention.

Claims

1. A method of constructing a chemical risk prediction model based on an interpretable machine learning, the method comprising: obtaining a plurality of chemical data; obtaining a plurality of chemical risk data; and constructing a chemical risk prediction model based on the plurality of chemical data and the plurality of chemical risk data. The method comprises the following steps: Step S1: obtaining chemical data with risk endpoints, taking the chemical data with risk endpoints as samples and constructing a supervised learning data set; Wherein the number of categories of risk endpoints of the samples in the supervised learning data set is greater than or equal to 2, and the samples are marked as samples with significant risk; the number of categories is less than 2, and the sample is marked as a sample without significant risk; Wherein each sample of the chemical data with risk endpoints has at least one risk endpoint; for the chemical data sample with two or more risk endpoints, each risk endpoint is different and related directly and completely independent and does not affect each other; Step S2: using a molecular descriptor and fingerprint calculation platform to generate a high-dimensional feature set containing physicochemical properties and structure topology for the molecular structure, and deleting constant or approximately constant features; Then, recursive feature elimination and model-based importance screening are used to obtain a descriptor subset for modeling; Step S3: independently using different types of machine learning models for comparative modeling for each risk endpoint, taking ROC-AUC as the main indicator in comparative modeling, and recording accuracy, precision, recall and F1 indicators for supplementary evaluation of performance; after determining the optimal model, retraining the optimal model on the training set and reporting the final result on the independent prediction set; Step S4: determining the model applicability range of the optimal model, including adopting the applicability domain framework based on the conformal prediction to construct the model, wherein the applicability domain framework is independent of the optimal model and is constructed through the model-independent prediction interval framework; then based on the test sample set, calculating the prediction set Γ α (x) of the test sample at a given significance level α (x i ), and determining that the test sample is within the applicability domain framework when |Γ α (x) | = 1, otherwise, the test sample is outside the applicability domain framework. Step S5: Shapley additive interpretation, individual conditional expectation and two-dimensional interaction dependency analysis are performed on the best model, and the importance of global and sample-level key descriptors is output; finally, batch reasoning and result export: the prediction label, prediction probability, applicable domain framework label, significance level and explanatory result of the target chemical data corresponding to the chemical list are output one by one.

2. The method according to claim 1, wherein, Step S1 comprises the following steps: In step S1, the chemical is an organic compound; the chemical does not include inorganic compounds and mixtures; the chemical data with risk endpoints is in SMILES format, which describes the molecular structure in the form of a string; the risk endpoints include toxicity endpoints for indicating the toxicity of the chemical, flammability endpoints for indicating the flammability of the chemical, reactivity endpoints for indicating the reactivity of the chemical, and water reactivity endpoints for indicating the water reactivity of the chemical. 3.The method of claim 1, wherein the method further comprises: determining a plurality of features of the chemical; and determining a plurality of weights of the features. Step S2 comprises the following steps: In step S2, the molecular descriptor and fingerprint calculation platform comprises one or more combinations of cheminformatics tools for generating physicochemical properties and structure topology features, which at least include molecular descriptors and structure fingerprints, and performs removal of constant or approximately constant features; the recursive feature elimination and model-based importance screening are two types of embedded feature selection strategies used in parallel or series, which are used to obtain a descriptor subset for modeling from a high-dimensional feature set.

4. The method of claim 1, wherein the method is characterized by: Step S3 comprises the following steps: Step S31: data division and parameter adjustment: hierarchical five-fold cross-validation is used for model selection and hyperparameter determination; wherein hyperparameter search is only performed within the training fold to avoid information leakage; Step S32: Test set report: Calculate and report ROC-AUC as the main indicator on the independently reserved test set, while giving the accuracy, recall rate, precision and F1 value to fully reflect the classification performance; wherein ROC-AUC represents the area under the receiver operating characteristic curve, and F1 value is a machine learning evaluation indicator.

5. The method according to claim 4, wherein, Step S3 further includes the following: Step S33: Class imbalance control: Introduce class weights related to class frequency in the training stage, and use stratified division and paired indicators in evaluation to jointly measure the recognition ability of the model for minority classes; wherein the paired indicators include recall rate and F1 value; Step S34: Model comparison and selection rule: In the candidate model set, the optimal model of each endpoint is determined according to the cross-validation ROC-AUC performance; the final performance is determined by the indicators of the optimal model on the test set; Step S35: Preprocessing robustness check: Control experiments are conducted on missing value filling and feature scale processing, and test set reports are obtained, wherein the optimal model configuration is determined within the training fold; the test set report corresponds to the result of the optimal preprocessing and model combination.

6. The method according to claim 5, wherein, Step S3 further includes the following: Step S36: Use response shuffling to verify that the final result comes from the true structural property signal: Randomly shuffle the labels multiple times while keeping the feature matrix unchanged, and repeat the training and evaluation; wherein when the AUC of the shuffled model falls significantly to near random level, it is proved that the performance of the optimal model comes from the true structural property signal rather than data noise or label contingency.

7. The method according to claim 1, wherein, Step S4 includes the following: Step S41: Set classifier f: x→y, output each class probability f k The prediction set of the test sample x i is defined as: Where is the p-value of the class k, which is calculated based on the consistency score of the calibration set. Wherein α is the significance level, y is the true hazard level label of the chemical, i is the test sample index number, j is the calibration set sample index number, and n is the size of the calibration set; When |Γ α (x i ) = 1, the test sample is determined to be within the applicability domain framework, otherwise, outside the applicability domain framework.

8. The method according to claim 7, wherein the method is characterized by, Step S4 further includes the following: Step S42: Select a number of groups of significance levels α to calculate the coverage rate and the accuracy within the applicable domain framework respectively to determine the optimal confidence threshold; a composite evaluation indicator is introduced, and the significance level α that maximizes the score is selected, and the most robust confidence boundary is obtained according to the following content: Score α = Coverage α x Accuracy ln-AD where Coverage α is coverage; Accuracy ln-AD is in-domain accuracy; Out-of-domain α (x i ) = 1 sample outputs a final conclusion and a confidence level, |Γ α (x i ) ≠ 1 sample is marked as uncertain. 9.The method of claim 1, wherein the method further comprises: determining a plurality of features of the chemical; and determining a plurality of weights of the features. Step S5 includes the following: Step S51: The explanation method includes one or more of Shapley additive explanation, individual conditional expectation and two-dimensional interaction bias dependence, which is used to give the global feature importance and sample-level key descriptor importance; wherein the explanation result is used to show the feature and response relationship and potential interaction related to each endpoint, and is derived together with the batch reasoning result for audit and traceability.

10. A chemical risk prediction model based on interpretable machine learning, implemented by constructing a chemical risk prediction model based on interpretable machine learning according to any one of claims 1 to 9, characterized in that, The chemical risk prediction model based on interpretable machine learning includes the following: The feature generation module is used to generate molecular structures containing a feature set including physicochemical properties and structural topology, and to complete constant feature elimination; The feature selection module is used to perform recursive feature elimination and / or model-based importance screening; The model training and comparison module is used to train and search hyperparameters for the model set according to stratified five-fold cross-validation and ROC-AUC main indicator; The applicable domain determination module is used to perform conformal prediction and output applicable domain framework labels; The explanation generation module is used to output global and sample-level explanations; An output module is configured to output the predicted label, the probability, the applicable domain framework label, the significance level a and the explanatory result.