Processing method and device for predicting compound type based on model cluster
By constructing a model cluster framework and employing high-dimensional feature encoding and a two-way prediction complementary mechanism, the high cost and insufficient accuracy of traditional compound classification methods are solved, achieving efficient multidimensional classification of compound types and improving the accuracy and efficiency of scientific research.
Patent Information
- Application Number
- CN202511060377.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-30
- Publication Date
- 2025-11-25
AI Technical Summary
Traditional compound classification methods rely on manual rule bases, resulting in high labor costs and difficulty in handling compounds with mixed features. Furthermore, their accuracy is limited, especially in predicting rare and long-tail categories.
A multidimensional classification framework based on model clusters is constructed, employing a high-dimensional feature encoder and a two-way prediction complementary mechanism. By allocating rare class samples to the intersection of the training set and the feature clustering sample set, each compound type is trained independently. Combined with deep learning and machine learning models, the prediction accuracy and generalization ability are improved.
It reduces the cost of manual operation, improves the accuracy of multi-class prediction of mixed characteristic compounds and the generalization of models, and enhances the efficiency of scientific research in fields such as plant metabolite analysis, synthetic biology pathway design and molecular breeding.
Smart Images

Figure CN121011272A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, in particular to a processing method and device for predicting compound types based on a model cluster. BACKGROUND
[0002] In the fields of plant metabolite analysis, synthetic biology path design, and molecular breeding, the classification of compounds and the confirmation of their pathways (metabolic pathways, signal pathways) are of great significance in improving quality and resistance breeding, biological manufacturing, food science, and medical research. The core goal is to accurately identify compounds as specific categories through molecular structure characteristics. These categories are closely related to the function, nature, synthesis path, and substrate regulation of compounds, providing key guidance for related research and applications. Different compound classification systems exist for different compound analysis scenarios, such as drug analysis scenarios that classify compounds by mechanism of action, such as enzyme inhibitors, receptor agonists / antagonists, and ion channel modulators, and environmental analysis scenarios that classify compounds by toxicity, such as highly toxic substances, moderately toxic substances, and low toxic substances. That is, the same compound may have different classification results in different scenarios.
[0003] Currently, traditional classification methods are based on rule libraries. These rule libraries are composed of a series of artificially defined sub-rules, each sub-rule consisting of a set of molecular descriptors (such as topological structure, functional group distribution, molecular fingerprint, etc.) and corresponding compound types. Traditional classification methods have several shortcomings: 1) The need for manual addition of molecular descriptors results in high labor costs; 2) Traditional rules are based on "yes / no" logic, making it difficult to handle mixed feature compounds; 3) The accuracy of the rules needs to be further improved due to the limitations of human experience. SUMMARY
[0004] The present application aims at the defects of the prior art, and provides a processing method and device for predicting compound types based on a model cluster, electronic equipment and a computer readable storage medium. The present application constructs a model cluster framework for multi-dimensional classification of compounds based on a cluster mode; the framework deeply mines multi-dimensional representation of molecular features through a high-dimensional feature encoder, and introduces a two-way (one way composed of a deep learning model and one way composed of a machine learning model cluster) prediction complementary mechanism; the framework can reduce the risk of overfitting and improve the model generalization capability. When constructing a first branch data set, rare categories or long-tail categories are preferentially allocated to the training set, multi-category samples are allocated to the test set, and a set of corresponding training / verification / test sets is constructed for each compound type; when training and evaluating the first prediction branch, the training and evaluation are performed by type in a progressive manner from small sample categories to large sample categories based on the training / verification / test sets of each compound type, so that the prediction accuracy of rare categories and long-tail categories can be improved, and the training deviation caused by large sample categories can be reduced. When constructing a second branch data set, sample sampling is performed based on the intersection of the category sample set and the feature clustering sample set, which can improve the diversity of molecular feature distribution; when training and evaluating the second prediction branch, the corresponding binary classification model is independently trained and evaluated based on the training / verification / test sets of each compound type, so that the prediction accuracy of rare categories and long-tail categories can be improved, and the training deviation caused by large sample categories can be reduced. The present application can reduce the cost of manual operation, can process multi-category prediction of mixed feature compounds, and can improve the prediction accuracy through the two-way prediction complementary mechanism. The present application can further improve the prediction accuracy and generalization of the model through the construction and training mode of the data set. The present application helps to improve the efficiency of scientific research in the fields of plant metabolite analysis, synthetic biology path design and molecular breeding (such as improving quality and resistance breeding, biological manufacturing, food science and medical research, etc.).
[0005] To achieve the above object, a first aspect of an embodiment of the present application provides a processing method for predicting compound types based on a model cluster, the method comprising:
[0006] constructing a model cluster framework for classifying and predicting compounds according to a preset first type set; the first type set includes N first types, each first type is a compound type, and N is a preset positive integer; the model cluster framework includes a general encoder, a pooling module, a first prediction branch, a second prediction branch and a two-way merging output module; the second prediction branch includes N parallel binary classification models M i , 1≤index i≤N;
[0007] acquiring a target molecule library based on the first type set;
[0008] The class-independent molecule sequence balanced sampling rule is used to construct a first branch data set according to a preset training-validation-testing distribution ratio and the target molecule library; the training-validation-testing distribution ratio includes a training ratio α, a validation ratio β, and a testing ratio γ, and α+β+γ=1;
[0009] The first branch training framework is sequentially connected by the general encoder and the first prediction branch; and the first branch training framework is trained based on the first branch data set;
[0010] After the training of the first branch training framework is completed, a molecule feature library is constructed based on the general encoder, the pooling module, and the target molecule library;
[0011] The class-independent molecule feature balanced sampling rule is used to construct a second branch data set according to the training-validation-testing distribution ratio and the molecule feature library;
[0012] Each of the two-classification models M i is trained respectively;
[0013] The first prediction branch and the second prediction branch are tested and evaluated, and two-way weight parameters built in the two-way merging output module are set based on the evaluation results;
[0014] After all parameters of the model cluster framework are set, the model cluster framework is used to process a compound classification task of a user.
[0015] Preferably, the first type set is composed of all compound types corresponding to a preset compound analysis scene set; the compound analysis scene set includes multiple analysis scenes; each of the analysis scenes corresponds to a subdivided scene in the biological, chemical, medical, or new energy field; each of the analysis scenes includes multiple compound analysis tasks; the task types of the compound analysis tasks include function analysis, property analysis, synthesis path analysis, and matrix regulation analysis; each of the compound analysis tasks corresponds to one or more first types;
[0016] The target molecule library includes multiple first molecule records; each of the first molecule records corresponds to a compound molecule; the first molecule record includes a first molecule sequence and a first molecule type set; the first molecule sequence is a SMILES sequence of the current compound molecule; and the first molecule type set is composed of all first types corresponding to the current compound molecule;
[0017] The first branch data set includes a training set sequence S P1 , a validation set sequence S V1 , and a testing set sequence S T1The training set sequence S P1 The verification set sequence S V1 and the test set sequence S T1 Each has N corresponding training sets N check sets N test sets The training set is ordered sequentially, where 1 ≤ index j ≤ N; each of the training sets... The verification set or the test set Each type consists of multiple first data records; each first type corresponds to a set of training sets. The verification set and the test set And the training set mentioned in each group The verification set and the test set The ratio of the total number of records all satisfies α:β:γ;
[0018] The first data record includes the first molecular sequence and the first label vector; the first label vector includes N first label probabilities, each of which corresponds to one of the first types, and the probability value of each first label probability is set to 0 or 1; in the first label vector, the first label probabilities corresponding to each of the first types in the corresponding first molecular type set are all set to 1, and the remaining first label probabilities are all set to 0.
[0019] The molecular feature library includes multiple first feature records; each first feature record corresponds one-to-one with a first molecular record; each first feature record includes a first molecular feature and a first molecular type set; the first molecular feature is a molecular feature vector obtained by encoding the corresponding first molecular sequence through the general encoder and performing feature encoding and encoding pooling processing by the pooling module.
[0020] The second branch dataset includes the training set sequence S P2 , Check set sequence S V2 and test set sequence S T2 The training set sequence S P2 The verification set sequence S V2 and the test set sequence S T2 Each has N corresponding training sets N verification sets N test sets The training sets are ordered sequentially; each of the training sets... The verification set or the test set Each type consists of multiple second data records; each of the first types corresponds to a set of the training sets. The verification set and the test set And the training set mentioned in each group The verification set and the test set The ratio of the total number of records all satisfies α:β:γ;
[0021] The second data record includes the first molecular feature and the second label vector; the second label vector includes two label probabilities, namely the true value label probability and the false value label probability; the true value label probability of all the second data records is set to 1 and the false value label probability is set to 0.
[0022] Preferably, the model cluster framework is used to classify and predict the compound molecular sequence input to the framework and output the corresponding classification probability prediction vector; the compound molecular sequence is a SMILES sequence of a class of compound molecules; the classification probability prediction vector includes N classification prediction probabilities, each of which corresponds one-to-one with the first type, and the probability value of each classification prediction probability is between 0 and 1.
[0023] The first frame input of the model cluster framework is used to receive the compound molecule sequence, and the first frame output is used to output the classification probability prediction vector.
[0024] The input terminal of the general encoder is connected to the input terminal of the first frame, the first output terminal is connected to the input terminal of the first prediction branch, and the second output terminal is connected to the input terminal of the pooling module; the output terminal of the first prediction branch is connected to the first input terminal of the two-way combined output module; the output terminal of the pooling module is connected to the input terminal of the second prediction branch; the output terminal of the second prediction branch is connected to the second input terminal of the two-way combined output module; and the output terminal of the two-way combined output module is connected to the output terminal of the first frame.
[0025] The general encoder is implemented based on the encoder structure of the Transformer model; the general encoder is used to perform atomic-level feature encoding processing on the compound molecular sequence to obtain the corresponding encoded feature tensor and send it to the first prediction branch and the pooling module; the encoded feature tensor is composed of multiple atomic feature vectors;
[0026] The pooling module is used to perform global pooling on each feature dimension of the encoded feature tensor and send the resulting pooled feature vector as the corresponding molecule feature vector to the second prediction branch.
[0027] The first prediction branch consists of a feature decoder and a classification module; the input of the feature decoder is connected to the input of the first prediction branch, and the output is connected to the input of the classification module; the output of the classification module is connected to the output of the first prediction branch.
[0028] The feature decoder is implemented based on the decoder structure of the Transformer model; the feature decoder is used to perform compound type feature decoding processing on the encoded feature tensor to obtain the corresponding decoded feature tensor and send it to the classification module; the decoded feature tensor includes N decoded feature vectors; the decoded feature vectors correspond one-to-one with the first type;
[0029] The classification module is used to input each of the decoded feature vectors of the decoded feature tensor into the Sigmoid function for function calculation, and use the calculation result as the corresponding classification probability. And the obtained N classification probabilities Form the corresponding first classification probability vector P 1 Send to the two-way merged output module;
[0030] The second prediction branch is derived from N parallel binary classification models M. i And the fusion module; each of the binary classification models M i The input terminals of all are connected to the input terminal of the second prediction branch, and the output terminals of all are connected to the input terminal of the fusion module; the output terminal of the fusion module is connected to the output terminal of the second prediction branch.
[0031] The binary classification model M i It corresponds one-to-one with the first type;
[0032] Each of the binary classification models M i It is composed of a group of weak classifiers combined according to a corresponding first ensemble mode; the first ensemble mode includes Bagging ensemble mode, Boosting ensemble mode and Stacking ensemble mode; the model types of the weak classifiers include MLP model, LR model, GBDT model and RF model;
[0033] Each of the binary classification models M i Used to predict the type of a single compound based on the molecular feature vector, and obtain the corresponding single-class prediction probability vector. The single-class prediction probability vector is sent to the fusion module. Each of the first types corresponds one-to-one with the binary classification probability vector of the first type; the single-class prediction probability vector It consists of two predicted probabilities, namely the true probability and the true probability. and pseudo-value probability The truth probability and the pseudo-value probability The values of are all between 0 and 1, and
[0034] The fusion module is used to process N single-class prediction probability vectors received. Then, the individual class prediction probability vectors are... The truth probability As the corresponding classification probability And the obtained N classification probabilities Form the corresponding second classification probability vector P 2 Send to the two-way merged output module;
[0035] The two-way merging output module is used to convert the first classification probability vector P 1 and the second classification probability vector P 2 The weighted sum vector P 3 As the corresponding classification probability prediction vector output; P 3 =w1P 1 +w2P 2 w1 and w2 are the corresponding first-path weight parameters and second-path weight parameters, and w1+w2=1.
[0036] Preferably, the step of obtaining the target molecular library by collecting molecular library information based on the first type set specifically includes:
[0037] Step 41: Collect molecular sequence information of all compound types corresponding to the compound analysis scenario set through publicly available molecular information collection methods to obtain the corresponding collection information set;
[0038] The disclosed molecular information acquisition methods include multiple publicly available molecular information databases, molecular experimental databases, and scientific literature / technical paper databases in the fields of biology, chemistry, medicine, and new energy; the acquired information set includes N sub-information sets, each of which corresponds one-to-one with the first type; each sub-information set includes multiple acquired molecular sequences; each acquired molecular sequence is a SMILES sequence of a class of compound molecules;
[0039] Step 42: Each of the sub-information sets is taken as the corresponding current subset; and the type label of each of the collected molecular sequences in the current subset is set based on the first type corresponding to the current subset;
[0040] Step 43: Cluster all the collected molecular sequences in the collected information set, and cluster one or more collected molecular sequences with the same SMILES sequence into a class to form a corresponding first sequence set;
[0041] Step 44: Each first sequence set is taken as the corresponding current sequence set; and the SMILES sequence corresponding to the current sequence set is taken as a corresponding first molecular sequence; and the type tags of all the collected molecular sequences in the current sequence set are used to form the corresponding first molecular type set; and the first molecular sequence corresponding to the current sequence set and the first molecular type set are used to form a corresponding first molecular record.
[0042] Step 45: The target molecule library is composed of all the first molecule records obtained.
[0043] Preferably, the category-independent molecular sequence equalization sampling rule is as follows:
[0044] Let each of the first types in the first type set be denoted as type c. i ; and each of the aforementioned types c i As the corresponding current type; and the corresponding sample set X is composed of the first molecular sequence corresponding to the first molecular type set containing the current type in the target molecular library. i ; and the current sample set X i Each of the first molecular sequences is denoted as the corresponding sample. 1≤index For the sample set X i The total number of samples;
[0045] Each of the aforementioned sample sets X i As the corresponding current sample set; and for each sample in the current sample set. The total number of types in the first molecular type set is counted, and the statistical result is used as the total number of corresponding matching types. And according to the total number of the said matching types The current sample set is ordered from smallest to largest. The samples Sort the data to obtain the corresponding first sequence; then divide the first sequence into three consecutive sub-sequence segments according to the training-verification-test allocation ratio, denoted as the first segment, second segment, and third segment; and then divide each of the samples in the current sample set... The first molecular type set and its corresponding first molecular sequence generate a set of first molecular sequences and first label vectors to form a corresponding first data record; and all the first data records corresponding to the first segment form a corresponding training set. The corresponding verification set consists of all the first data records corresponding to the second segment. The corresponding test set consists of all the first data records corresponding to the third segment. The first, second, and third segments each consist of multiple samples. The total number of samples in the first, second, and third segments is composed of... The ratio of the total number of samples in the first, second, and third segments satisfies α:β:γ;
[0046] According to the total number of samples The N training sets are arranged in ascending order. The training sets are sorted to obtain the N sorted sets. The corresponding training set sequence S is formed. P1 For N of the aforementioned check sets The N check sets are obtained by sorting. The corresponding check set sequence S is formed. V1 For N test sets The test sets are sorted to obtain the N sorted test sets. The corresponding test set sequence S is formed. T1 ;
[0047] The obtained training set sequence S P1 The verification set sequence S V1 and the test set sequence S T1 The corresponding dataset for the first branch is formed.
[0048] Preferably, training the first branch training framework based on the first branch dataset specifically includes:
[0049] Step 61, take the training set sequence S of the first branch dataset. P1 The first training set in As the current training set;
[0050] Step 62, the verification set sequence S of the first branch dataset. V1 The verification set that has the same index j as the current training set As the corresponding current check set;
[0051] Step 63: Optimize the model parameters of the first branch training framework based on the current training set; use the multi-class cross-entropy loss function as the model loss function during this optimization process; optimize the model parameters of the first branch training framework based on the Adam optimizer and the model loss function during this optimization process; and optimize the learning rate parameter of the Adam optimizer in stages based on the cosine annealing strategy during this optimization process.
[0052] Step 64: At the end of this round of parameter optimization, perform an F1 evaluation on the first branch training framework based on the current verification set to obtain the corresponding first evaluation value; and identify whether the current first evaluation value meets the preset first evaluation value range; if it does not meet the range, return to step 63 to continue training; if it does meet the range, check whether the current training set is the training set sequence S. P1 The last training set mentioned Perform identification; otherwise, the training set sequence S will be... P1 The next training set The current training set is then used as the latest set, and the process returns to step 62; if so, training is stopped.
[0053] Preferably, the construction of the molecular feature library based on the general encoder, the pooling module, and the target molecule library specifically includes:
[0054] Each first molecule record in the target molecule library is taken as the corresponding current record; the first molecule sequence of the current record is taken as the corresponding compound molecule sequence and input into the general encoder for processing to obtain the corresponding encoding feature tensor; the current encoding feature tensor is input into the pooling module for pooling to obtain the corresponding molecular feature vector; the current molecular feature vector is taken as a corresponding first molecule feature; and the first molecule feature corresponding to the current record and the first molecule type set are combined to form a corresponding first feature record; and all the obtained first feature records are combined to form the corresponding molecular feature library.
[0055] Preferably, the category-independent molecular feature equalization sampling rule is specifically as follows:
[0056] Let each of the first types in the first type set be denoted as type c. i ; and each of the aforementioned types c i As the corresponding current type; and the corresponding sample set Y is composed of the first molecular features corresponding to the first molecular type set containing the current type in the molecular feature library. i ; and the current sample set Y i Each of the first molecular features is denoted as the corresponding sample. 1≤index For the sample set Y i The total number of samples;
[0057] Each clustering threshold K within the preset clustering threshold range * As the corresponding current threshold K * ; and with the current threshold K *Given the total number of clusters, the K clusters are obtained by clustering all the first molecular features in the molecular feature library using the K-means clustering algorithm. * Molecular feature clusters C k 1 ≤ index k ≤ K * ; and for each of the current molecular feature clusters C k The total number of samples N within the corresponding cluster is obtained by statistically analyzing the total number of the first molecular features. k ; and the current molecular feature clusters C k Each of the first molecular features within the sample is denoted as the corresponding sample. 1≤index q≤N k ; and for each of the current molecular feature clusters C k centroid characteristics μ k Perform calculations; and apply the Elbow method to the current threshold K. * The corresponding intra-cluster sum of squares SSE(K) * ) performs the calculation; and based on the current threshold K * and the sum of squares within the cluster SSE(K) * ) Calculate the corresponding clustering parameter Cp(K) * ); and from all clustering parameters Cp(K) corresponding to the clustering threshold range. * Select the clustering threshold K corresponding to the minimum value. * As the optimal threshold K opt ; and the optimal threshold K opt Corresponding K opt Molecular feature clusters Extract them to form the corresponding cluster set G;
[0058] The clustering threshold range includes multiple clustering thresholds K. * ;
[0059] μ k The calculation method is as follows:
[0060] SSE(K * The calculation method for ) is as follows:
[0061] Cp(K * The calculation method for Cp(K) is: * ) = SSE(K * )+λK * ;
[0062] K opt The calculation method is as follows:
[0063] The cluster set G includes Kopt The molecular feature cluster C k Each of the molecular feature clusters C k Includes multiple samples
[0064] Each of the aforementioned sample sets Y i As the corresponding current sample set; and for each of the molecular feature clusters C in the current sample set and the cluster set G. k The corresponding sample intersection R is obtained by identifying the sample intersection. i,k ; and for each of the sample intersections R i,k The total number of samples is counted and the statistical result is used as the corresponding total number n. i,k ; and the intersection R of all the samples i,k Each sample within is denoted as the corresponding sample. 1≤index g≤n i,k ;
[0065] Intersection of the samples As the corresponding current intersection; and sorting the n elements within the current intersection in ascending order of index g. i,k The samples The second sequence is obtained by sorting the data; and the second sequence is divided into three consecutive sub-sequence segments according to the training-verification-test allocation ratio, denoted as the fourth, fifth, and sixth segments; and the samples from the current intersection are then... A corresponding set of the first molecular features and the second label vector is generated to form a corresponding second data record; and all the second data records corresponding to the fourth segment are used to form a corresponding training set. The corresponding verification set consists of all the second data records corresponding to the fifth segment. The corresponding test set consists of all the second data records corresponding to the sixth segment. Among them, the fourth, fifth and sixth segments are each composed of multiple samples. The total number of samples in the three segments of the fourth, fifth, and sixth segments is n. i,k The ratio of the total number of samples in the fourth, fifth, and sixth segments satisfies α:β:γ;
[0066] Each of the aforementioned types c i As the corresponding current type; and by all the training sets corresponding to the current type. The corresponding training set is formed All corresponding check sets The corresponding verification set is formed. All the corresponding test sets The corresponding test set is formed.
[0067] The N training sets obtained are processed in ascending order of index i. The corresponding training set sequence S is obtained by sorting. P2 For the obtained N verification sets The corresponding check set sequence S is obtained by sorting. V2 For the obtained N test sets The corresponding test set sequence S is obtained by sorting. T2 ; and the obtained training set sequence S P2 The verification set sequence S V2 and the test set sequence S T2 This forms the corresponding second branch dataset.
[0068] Preferably, the training of each binary classification model M based on the second branch dataset and the AutoGluon ensemble training tool... i Training will be conducted separately, specifically including:
[0069] Step 91, classify each of the binary classification models M i As the corresponding current binary classification model; and the training set sequence S of the second branch dataset. P2 and the verification set sequence S V2 The training set corresponding to the current binary classification model and the verification set As the corresponding current training set and current verification set;
[0070] Step 92, and form a corresponding first basic parameter set from the model basic parameters of the current binary classification model; and form a corresponding first hyperparameter set from all hyperparameters of the current binary classification model; and perform parameter configuration combination on all the first hyperparameters of the first hyperparameter set based on the first parameter configuration range corresponding to each first hyperparameter of the first hyperparameter set to obtain a corresponding first combination set;
[0071] The first hyperparameter set includes multiple first hyperparameters; each first hyperparameter corresponds to a first parameter configuration range, and each first parameter configuration range includes one or more first parameter configurations; the first combination set includes multiple first configuration groups; each first configuration group consists of a set of first parameter configurations of all the first hyperparameters.
[0072] Step 93, and take the current binary classification model as the corresponding current base model; and count the total number of the first configuration groups in the first combination set to obtain the corresponding total number of combinations. And perform the following on the current base model: The second copy yields A first replication model; and based on each of the first configuration groups of the first combination set, set the first hyperparameter set of the corresponding first replication model;
[0073] The first replication model corresponds one-to-one with the first configuration group;
[0074] Step 94: Use the AutoGluon ensemble training tool to perform a round of basic parameter optimization on each of the first replica models based on the current training set, and use the binary cross-entropy loss function as the model loss function during this round of optimization; and at the end of this round of optimization of all the first replica models, use the AutoGluon ensemble training tool to perform a round of F1 evaluation on each of the first replica models based on the current validation set to obtain the corresponding second evaluation value.
[0075] Step 95: Identify whether all the obtained second evaluation values meet the preset second evaluation value range; if not, return to step 94 to continue training; if yes, set the parameters of the current binary classification model using the first basic parameter set and the first configuration group of the first replicated model corresponding to the smallest second evaluation value, and stop training the current binary classification model.
[0076] Preferably, the step of testing and evaluating the first and second predicted branches and setting the two-way weight parameters built into the two-way merging output module based on the evaluation results specifically includes:
[0077] Step 101, based on the test set sequence S of the first branch dataset. T1 The N test sets The first branch training framework is evaluated using N rounds of F1 scores to obtain N corresponding evaluation values. And the obtained N evaluation values Calculate the mean and record the result as the average.
[0078] Step 102, using the AutoGluon ensemble training tool, based on the test set sequence S of the second branch dataset. T2 The N test sets For N binary classification models M i Perform the corresponding N rounds of F1 score evaluation to obtain the corresponding N evaluation values. And the obtained N evaluation values Calculate the mean and record the result as the average.
[0079] Step 103, based on the average value and the average value Set the first weight parameter w1 and the second weight parameter w2 built into the two-way merging output module;
[0080] in, λ1 and λ2 are two preset temperature coefficients.
[0081] Preferably, the step of using the model cluster framework to process the user's compound classification task specifically includes:
[0082] The first SMILES sequence, first scenario type, and first task type input by the user are used as the corresponding current molecular sequence, current scenario type, and current task type;
[0083] The current molecular sequence is input into the model cluster framework as the current compound molecular sequence for prediction to obtain the corresponding classification probability prediction vector; the N classification prediction probabilities of the classification probability prediction vector are sorted in descending order of probability, and the top H classification prediction probabilities are extracted to form the corresponding current probability set; and the first type corresponding to all the classification prediction probabilities in the current probability set is formed into the corresponding first set; the preset number H is a positive integer, 0 < H < N.
[0084] The analysis scenario corresponding to the current scenario type in the compound analysis scenario set is taken as the current scenario; the compound analysis task corresponding to the current task type in the current scenario is taken as the current task; and all the first types corresponding to the current task form a corresponding second set;
[0085] The intersection of the types of the first and second sets is taken as the corresponding first intersection; the first intersection is identified; if the first intersection is empty, the largest classification prediction probability in the current probability set is taken as the current probability; if the first intersection is not empty, the largest probability among one or more classification prediction probabilities corresponding to the first intersection in the current probability set is taken as the current probability; and the first type corresponding to the current probability is fed back to the current user.
[0086] A second aspect of the present invention provides an apparatus for implementing the processing method for predicting compound types based on model clusters as described in the first aspect above. The apparatus includes: a cluster framework construction module, a molecular library acquisition module, a first dataset construction module, a first branch training module, a feature library construction module, a second dataset construction module, a second branch training module, a two-way weight setting module, and a framework application module.
[0087] The cluster framework construction module is used to construct a model cluster framework for classifying and predicting compounds based on a preset first type set; the first type set includes N first types, each first type being a class of compounds, and N being a preset positive integer; the model cluster framework includes a general encoder, a pooling module, a first prediction branch, a second prediction branch, and a two-way merged output module; the second prediction branch includes N parallel binary classification models M i , 1 ≤ index i ≤ N;
[0088] The molecular library acquisition module obtains the target molecular library by acquiring molecular library information based on the first type set;
[0089] The first dataset construction module is used to construct a first branch dataset according to a preset training-verification-test allocation ratio and the target molecule library based on a category-independent molecular sequence balanced sampling rule; the training-verification-test allocation ratio includes a training ratio α, a verification ratio β, and a test ratio γ, where α+β+γ=1;
[0090] The first branch training module is used to form a first branch training framework by sequentially connecting the general encoder and the first predicted branch; and to train the first branch training framework based on the first branch dataset;
[0091] The feature library construction module is used to construct a molecular feature library based on the general encoder, the pooling module, and the target molecule library after the training of the first branch training framework is completed.
[0092] The second dataset construction module constructs the second branch dataset according to the training-verification-test allocation ratio and the molecular feature library based on the category-independent molecular feature equalization sampling rule.
[0093] The second branch training module trains each of the binary classification models M based on the second branch dataset and the AutoGluon ensemble training tool. i Training should be conducted separately;
[0094] The two-way weight setting module is used to test and evaluate the first and second predicted branches and set the two-way weight parameters built into the two-way merging output module based on the evaluation results;
[0095] The framework application module is used to process the user's compound classification task using the model cluster framework after all parameters of the model cluster framework have been set.
[0096] A third aspect of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;
[0097] The processor is used to couple with the memory, read and execute instructions in the memory to implement the steps of the method described in the first aspect above;
[0098] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.
[0099] A fourth aspect of the present invention provides a computer-readable storage medium storing computer instructions that, when executed by a computer, cause the computer to perform the instructions described in the first aspect.
[0100] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for predicting compound types based on model clusters. As described above, this invention constructs a model cluster framework for multidimensional classification of compounds based on a cluster approach. This framework deeply mines the multidimensional representation of molecular features through a high-dimensional feature encoder and introduces a two-way (one route consists of deep learning models, and the other route consists of machine learning model clusters) complementary prediction mechanism. This framework can reduce the risk of overfitting and improve the model's generalization ability. When constructing the first branch dataset, rare or long-tail category samples are preferentially allocated to the training set, multi-category samples are allocated to the test set, and a corresponding training / validation / test set is constructed for each compound type. When training and evaluating the first prediction branch, training and evaluation are performed type-by-type according to the training / validation / test set for each compound type, progressing from small sample categories to large sample categories. This improves the prediction accuracy of rare and long-tail categories and reduces the training bias caused by large sample categories. When constructing the second branch dataset, sampling is performed based on the intersection of the category sample set and the feature clustering sample set, which can improve the diversity of molecular feature distribution. When training and evaluating the second prediction branch, the corresponding binary classification model is independently trained / evaluated based on the training / validation / test set for each compound type. This improves the prediction accuracy for rare and long-tail categories while reducing training bias caused by large sample categories. This invention reduces manual operation costs, enhances multi-class prediction capabilities, and improves prediction accuracy and model generalization. This invention helps improve the efficiency of research work in fields such as plant metabolite analysis, synthetic biology pathway design, and molecular breeding (e.g., quality and resistance breeding, biomanufacturing, food science, and pharmaceutical research and development). Attached Figure Description
[0101] Figure 1 This is a schematic diagram of a method for predicting compound types based on model clusters, provided in Embodiment 1 of the present invention.
[0102] Figure 2 This is a schematic diagram of the module of the model cluster framework provided in Embodiment 1 of the present invention;
[0103] Figure 3 The binary classification model M provided in Embodiment 1 of the present invention i A schematic diagram of the three types of integration modes;
[0104] Figure 4 This is a schematic diagram of the first branch training framework provided in Embodiment 1 of the present invention;
[0105] Figure 5 This is a module structure diagram of a processing device for predicting compound types based on model clusters, provided in Embodiment 2 of the present invention.
[0106] Figure 6 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. Detailed Implementation
[0107] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0108] Embodiment 1 of the present invention provides a processing method for predicting compound types based on model clusters, such as... Figure 1 The schematic diagram of a method for predicting compound types based on model clusters provided in Embodiment 1 of the present invention is shown. The method mainly includes the following steps:
[0109] Step 1: Construct a model cluster framework for classifying and predicting compounds based on a pre-defined first type set.
[0110] Here, the first type set in this embodiment of the invention includes N first types, each first type being a class of compound types, where N is a preset positive integer. Simply put, the first type set consists of all compound types corresponding to a preset set of compound analysis scenarios; the set of compound analysis scenarios includes multiple analysis scenarios; each analysis scenario corresponds to a sub-scenario in the fields of biology, chemistry, medicine, or new energy; each analysis scenario further includes multiple compound analysis tasks; the task types of compound analysis tasks include functional analysis, property analysis, synthetic pathway analysis, and matrix regulation analysis; each type of compound analysis task corresponds to one or more first types.
[0111] like Figure 2 The schematic diagram of the model cluster framework provided in Embodiment 1 of the present invention shows that the model cluster framework is used to classify and predict the compound molecular sequence input to the framework and output the corresponding classification probability prediction vector. The compound molecular sequence is a SMILES sequence of a class of compound molecules; the classification probability prediction vector includes N classification prediction probabilities, each corresponding one-to-one with a first type, and the probability value of each classification prediction probability is between 0 and 1.
[0112] like Figure 2 As shown, the framework components of the model cluster framework include: a general encoder, a pooling module, a first prediction branch, a second prediction branch, and a two-way merged output module; wherein, the second prediction branch includes N parallel binary classification models M i 1 ≤ index i ≤ N, binary classification model M iIt corresponds one-to-one with the first type.
[0113] The first frame input of the model cluster framework is used to receive the compound molecule sequence, and the first frame output is used to output the classification probability prediction vector.
[0114] The connection relationships of the framework components of the model cluster framework are as follows: the input end of the general encoder is connected to the input end of the first framework; the first output end is connected to the input end of the first prediction branch; the second output end is connected to the input end of the pooling module; the output end of the first prediction branch is connected to the first input end of the two-way merged output module; the output end of the pooling module is connected to the input end of the second prediction branch; the output end of the second prediction branch is connected to the second input end of the two-way merged output module; and the output end of the two-way merged output module is connected to the output end of the first framework.
[0115] The framework components of the model cluster framework have the following functionalities.
[0116] 1) General-purpose encoder:
[0117] The general encoder is implemented based on the Transformer model. It performs atomic-level feature encoding on compound molecular sequences to obtain corresponding encoded feature tensors, which are then sent to the first prediction branch and the pooling module.
[0118] The encoded feature tensor is composed of multiple atomic feature vectors.
[0119] 2) Pooling module:
[0120] The pooling module is used to perform global pooling on each feature dimension of the encoded feature tensor and send the resulting pooled feature vector as the corresponding molecule feature vector to the second prediction branch.
[0121] 3) First predicted branch:
[0122] The first predictive branch consists of a feature decoder and a classification module.
[0123] The internal component connections of the first prediction branch are as follows: the input of the feature decoder is connected to the input of the first prediction branch, and its output is connected to the input of the classification module; the output of the classification module is connected to the output of the first prediction branch.
[0124] The internal component functions of the first predictive branch are shown below.
[0125] a) Feature decoder:
[0126] The feature decoder is implemented based on the decoder structure of the Transformer model. The feature decoder performs compound-type feature decoding on the encoded feature tensor to obtain the corresponding decoded feature tensor, which is then sent to the classification module.
[0127] The decoded feature tensor includes N decoded feature vectors; each decoded feature vector corresponds one-to-one with the first type.
[0128] b) Classification module:
[0129] The classification module takes each decoded feature vector of the decoded feature tensor as input to the Sigmoid function for function calculation and uses the result as the corresponding classification probability. And from the obtained N classification probabilities Form the corresponding first classification probability vector P 1 Send to the two-way merged output module.
[0130] 4) Second predicted branch:
[0131] The second prediction branch consists of N parallel binary classification models M. i It consists of a fusion module.
[0132] The internal component connectivity of the second prediction branch is as follows: Each binary classification model M i The input terminals of all are connected to the input terminals of the second prediction branch, and the output terminals of all are connected to the input terminals of the fusion module; the output terminal of the fusion module is connected to the output terminal of the second prediction branch.
[0133] The internal component functions of the second predictive branch are shown below.
[0134] a) Binary classification model M i :
[0135] Each binary classification model M i It consists of a set of weak classifiers combined according to the corresponding first ensemble mode; the first ensemble mode includes Bagging ensemble mode, Boosting ensemble mode and Stacking ensemble mode; the model types of weak classifiers include MLP model, LR model, GBDT model and RF model, and each weak classifier is a binary classifier.
[0136] Three types of integration modes, such as Figure 3 The binary classification model M provided in Embodiment 1 of the present invention i The diagram illustrates the three types of ensemble modes. In the Bagging ensemble mode, the binary classification model M... i It consists of a set of parallel weak classifiers and a voting module. The voting module fuses the binary classification results of all weak classifiers according to the majority rule. In the Boosting ensemble mode, the binary classification model M... iIt consists of a set of parallel weak classifiers and a weighting module. Each weak classifier corresponds to a weight coefficient. The weighting module is used to weight the assigned probability vectors of each weak classifier according to their weight coefficients, sum all the weighted assigned probability vectors, and perform the final binary classification based on the calculation result. In Stacking ensemble mode, the binary classification model M... i It consists of a two-stage classifier. The first stage uses a set of parallel weak classifiers as base models, and the second stage uses another weak classifier as a meta-model. The meta-model predicts the final binary classification result based on the binary classification prediction vectors of all base models. The various binary classification models M in this embodiment of the invention... i There is a separate configuration parameter for the first integration mode, which is set to Stacking integration mode by default. You can also choose one of the other two models based on your actual application needs.
[0137] Each binary classification model M i Used to predict the type of a single compound based on its molecular feature vector, and obtain the corresponding single-class prediction probability vector. Send to the fusion module. This includes the single-class prediction probability vector. Each type corresponds one-to-one with the first type, representing the binary classification probability vector of the corresponding first type; the single-class prediction probability vector... It consists of two predicted probabilities, namely the true probability and the true probability. and pseudo-value probability True probability and pseudo-value probability The values of are all between 0 and 1, and
[0138] b) Fusion module:
[0139] The fusion module is used to process N single-class predicted probability vectors. Next, the prediction probability vectors of each class will be... The true probability As the corresponding classification probability And from the obtained N classification probabilities Form the corresponding second classification probability vector P 2 Send to the two-way merged output module.
[0140] 5) Two-way merged output module:
[0141] The two-way merged output module is used to merge the first classification probability vector P 1 The second classification probability vector P 2 The weighted sum vector P 3 This is output as the corresponding classification probability prediction vector. Where P3 =w1P 1 +w2P 2 w1 and w2 are the corresponding first-path weight parameters and second-path weight parameters, and w1+w2=1.
[0142] Step 2: Obtain the target molecular library by collecting molecular library information based on the first type set;
[0143] The target molecule library includes multiple first molecule records; each first molecule record corresponds to a class of compound molecules; each first molecule record includes a first molecule sequence and a first molecule type set; the first molecule sequence is the SMILES sequence of the current compound molecule; the first molecule type set consists of all the first types corresponding to the current compound molecule;
[0144] Specifically, this includes: Step 21, using publicly available molecular information collection methods to collect molecular sequence information of all compound types corresponding to the compound analysis scenario set through big data collection to obtain the corresponding collection information set;
[0145] The publicly available molecular information acquisition methods include multiple publicly available molecular information databases, molecular experimental databases, and scientific literature / technical paper databases in the fields of biology, chemistry, medicine, and new energy; the acquired information set includes N sub-information sets, each of which corresponds one-to-one with the first type; each sub-information set includes multiple acquired molecular sequences; each acquired molecular sequence is a SMILES sequence of a class of compound molecules;
[0146] Step 22: Take each sub-information set as the corresponding current subset; and set the type label of each collected molecular sequence in the current subset based on the first type corresponding to the current subset;
[0147] Step 23: Cluster all collected molecular sequences in the collected information set, and cluster one or more collected molecular sequences with the same SMILES sequence into a class to form the corresponding first sequence set;
[0148] Step 24: Each first sequence set is taken as the corresponding current sequence set; the SMILES sequence corresponding to the current sequence set is taken as a corresponding first molecular sequence; the type labels of all collected molecular sequences in the current sequence set are used to form the corresponding first molecular type set; and the first molecular sequence and the first molecular type set corresponding to the current sequence set are used to form a corresponding first molecular record.
[0149] Step 25: The obtained first molecule records are used to form the corresponding target molecule library.
[0150] Step 3: Construct the first branch dataset according to the preset training-verification-test allocation ratio and the target molecular library by the molecular sequence equalization sampling rule that is independent by category.
[0151] The training-verification-test allocation ratio includes the training ratio α, the verification ratio β, and the test ratio γ, where α + β + γ = 1. For example, α is 80%, β is 10%, and γ is 10%.
[0152] The first branch dataset includes the training set sequence S. P1 , Check set sequence S V1 and test set sequence S T1 Training set sequence S P1 , Check set sequence S V1 and test set sequence S T1 Each has N corresponding training sets N verification sets
[0153] N test sets The training set is ordered sequentially, where 1 ≤ index j ≤ N; each training set Check set or test set Each type consists of multiple first data records; each first type corresponds to a training set. Check set and test set And each training set Check set and test set The ratio of the total number of records all satisfies α:β:γ.
[0154] The first data record includes a first molecular sequence and a first label vector; the first label vector includes N first label probabilities, each of which corresponds one-to-one with a first type, and the probability value of each first label probability is set to 0 or 1; in the first label vector, the first label probabilities corresponding to each first type of the corresponding first molecular type set are all set to 1, and the remaining first label probabilities are all set to 0.
[0155] Here, the category-independent molecular sequence equalization sampling rule of this invention is specifically as follows:
[0156] Step 31, denote each of the first types in the first type set as type c. i ; and each type c i As the corresponding current type; and the corresponding sample set X is composed of the first molecular sequence corresponding to the first molecular type set containing the current type in the target molecular library. i ; and the current sample set X i The first molecular sequence of each sample is denoted as the corresponding sample. 1≤index For sample set X i The total number of samples;
[0157] Step 32, divide each sample set X i As the corresponding current sample set; and for each sample in the current sample set The total number of types in the corresponding first molecular type set is counted, and the statistical result is used as the total number of corresponding matching types. And by total number of matching types The order of the current sample set from smallest to largest Sample Sort the data to obtain the corresponding first sequence; then divide the first sequence into three consecutive subsequence segments according to the training-validation-test allocation ratio, denoted as the first segment, second segment, and third segment; and then divide the data into segments based on the samples in the current sample set. The first molecular type set and its corresponding first molecular type set generate a set of corresponding first molecular sequences and first label vectors to form a corresponding first data record; and all the first data records corresponding to the first segment form the corresponding training set. The corresponding check set consists of all the first data records corresponding to the second segment. The test set consists of all the first data records corresponding to the third segment.
[0158] The first, second, and third segments each consist of multiple samples. The total number of samples in the first, second, and third segments is composed of... The ratio of the total number of samples in the first, second, and third segments satisfies α:β:γ;
[0159] Step 33, according to the total number of samples In ascending order, N training sets Sort the data to obtain N training sets. Form the corresponding training set sequence S P1 For N check sets Sort the data to obtain N sorted check sets. Form the corresponding check set sequence S V1 For N test sets Sort the data to obtain N sorted test sets. Form the corresponding test set sequence S T1 ;
[0160] Step 34, from the obtained training set sequence S P1 , Check set sequence S V1 and test set sequence S T1 This forms the corresponding first branch dataset.
[0161] Step 4: The first branch training framework is formed by sequentially connecting the general encoder and the first prediction branch; and the first branch training framework is trained based on the first branch dataset.
[0162] Specifically, it includes: Step 41, which consists of a first branch training framework formed by sequentially connecting a general encoder and a first prediction branch;
[0163] Here, the first branch training framework is as follows: Figure 4 The diagram shows the first branch training framework provided in Embodiment 1 of the present invention;
[0164] Step 42, and train the first branch training framework based on the first branch dataset;
[0165] Specifically, this includes: Step 421, taking the training set sequence S of the first branch dataset... P1 The first training set As the current training set;
[0166] Step 422, the verification set sequence S of the first branch dataset. V1 The validation set with the same index j as the current training set As the corresponding current check set;
[0167] Step 423: Optimize the model parameters of the first branch training framework based on the current training set; use the multi-class cross-entropy loss function as the model loss function in this optimization process; optimize the model parameters of the first branch training framework based on the Adam optimizer and the model loss function in this optimization process; and optimize the learning rate parameter of the Adam optimizer in stages based on the cosine annealing strategy in this optimization process.
[0168] Step 424: At the end of this round of parameter optimization, perform an F1 evaluation on the first branch training framework based on the current verification set to obtain the corresponding first evaluation value; and identify whether the current first evaluation value meets the preset first evaluation value range; if it does not meet the range, return to step 423 to continue training; if it does meet the range, check whether the current training set is the training set sequence S. P1 The last training set Perform identification; otherwise, remove the training set sequence S. P1 The next training set Use the latest current training set and return to step 422; otherwise, stop training.
[0169] Here, the first evaluation value range is a pre-set numerical range.
[0170] Step 5: After the training of the first branch training framework is completed, a molecular feature library is constructed based on the general encoder, pooling module and target molecule library;
[0171] The molecular feature library includes multiple first feature records; each first feature record corresponds one-to-one with a first molecule record; each first feature record includes a first molecule feature and a first molecule type set; the first molecule feature is a molecular feature vector obtained by encoding and pooling the corresponding first molecule sequence through a general encoder and pooling module.
[0172] Specifically, this includes: taking each first molecular record of the target molecular library as the corresponding current record; inputting the first molecular sequence of the current record as the corresponding compound molecular sequence into a general encoder for processing to obtain the corresponding encoded feature tensor; inputting the current encoded feature tensor into a pooling module for pooling to obtain the corresponding molecular feature vector; taking the current molecular feature vector as a corresponding first molecular feature; and forming a corresponding first feature record by combining the first molecular feature corresponding to the current record and the first molecular type set; and forming a corresponding molecular feature library by combining all the obtained first feature records.
[0173] Step 6: Construct the second branch dataset according to the molecular feature equalization sampling rule based on the training-verification-test allocation ratio and the molecular feature library.
[0174] The second branch dataset includes the training set sequence S. P2 , Check set sequence S V2 and test set sequence S T2 Training set sequence S P2 , Check set sequence S V2 and test set sequence S T2 Each has N corresponding training sets N verification sets N test sets Arranged sequentially; each training set Check set or test set Each type consists of multiple second data records; each first type corresponds to a training set. Check set and test set And each training set Check set and test set The ratio of the total number of records all satisfies α:β:γ;
[0175] The second data record includes a first molecular feature and a second label vector; the second label vector includes two label probabilities, namely the true value label probability and the false value label probability; the true value label probability of all second data records is set to 1 and the false value label probability is set to 0.
[0176] The category-independent molecular feature equalization sampling rule of this invention is as follows:
[0177] Step 61, denote each of the first types in the first type set as type c. i ; and each type c i As the corresponding current type; and composed of the first molecular features corresponding to the first molecular type set in the molecular feature library containing the current type, forming the corresponding sample set Y. i ; and the current sample set Y i Each of the first molecular features is denoted as the corresponding sample. 1≤index For sample set Y i The total number of samples;
[0178] Step 62, select each clustering threshold K within the preset clustering threshold range. * As the corresponding current threshold K * ; and with the current threshold K * The total number of clusters is given by the K-means clustering algorithm, which is used to cluster all the first molecular features in the molecular feature library to obtain the corresponding K clusters. * Molecular feature clusters C k 1 ≤ index k ≤ K * ; and for the current molecular feature clusters C k The total number of samples N within the corresponding cluster is obtained by statistically analyzing the total number of the first molecular features. k ; and the current molecular feature clusters C k Each first molecular feature within is denoted as the corresponding sample. 1≤index q≤N k ; and for the current molecular feature clusters C k centroid characteristics μ k Perform calculations; and apply the Elbow method to the current threshold K. * The corresponding intra-cluster sum of squares SSE(K) * ) Perform calculations; and based on the current threshold K * Sum of squares within a cluster SSE(K) * ) Calculate the corresponding clustering parameter Cp(K) * ); and from all clustering parameters Cp(K) corresponding to the clustering threshold range * Select the clustering threshold K corresponding to the minimum value. * As the optimal threshold K opt ; and the optimal threshold K opt Corresponding K opt Molecular feature clusters Extract them to form the corresponding cluster set G;
[0179] The clustering threshold range includes multiple clustering thresholds K. * ;
[0180] μ k The calculation method is as follows:
[0181] SSE(K * The calculation method for ) is as follows:
[0182] Cp(K * The calculation method for Cp(K) is: * ) = SSE(K * )+λK * ;
[0183] K opt The calculation method is as follows:
[0184] Cluster set G includes K opt Molecular feature clusters C k Each molecular feature cluster C k Includes multiple samples
[0185] Step 63, divide each sample set Y i This serves as the corresponding current sample set; and it relates the current sample set and each molecular feature cluster C of the cluster set G to the current sample set. k The corresponding sample intersection R is obtained by identifying the sample intersection. i,k And the intersection R of each sample i,k The total number of samples is counted and the statistical result is used as the corresponding total number n. i,k ; and intersect the samples R i,k Each sample within is denoted as the corresponding sample. 1≤index g≤n i,k ;
[0186] Step 64: Intersect the samples. As the corresponding current intersection; and sort the n elements in the current intersection in ascending order of index g. i,k Sample Sort the data to obtain the corresponding second sequence; then divide the second sequence into three consecutive subsequence segments according to the training-validation-test allocation ratio, denoted as the fourth, fifth, and sixth segments; and finally divide the data into segments based on the current intersection of the samples. A set of corresponding first molecular features and second label vectors is generated to form a corresponding second data record; and all the second data records corresponding to the fourth segment form the corresponding training set. The corresponding check set consists of all the second data records corresponding to the fifth segment. The corresponding test set consists of all the second data records corresponding to the sixth segment.
[0187] Among them, the fourth, fifth and sixth segments each consist of multiple samples. The total number of samples in the three segments of the fourth, fifth, and sixth segments is n. i,k The ratio of the total number of samples in the fourth, fifth, and sixth segments satisfies α:β:γ;
[0188] Step 65, sort the various types of c i As the corresponding current type; and based on all training sets corresponding to the current type. Form the corresponding training set All corresponding check sets Form the corresponding check set All corresponding test sets Form the corresponding test set
[0189] Step 66: Process the obtained N training sets in ascending order of index i. Sort the sequences to obtain the corresponding training set sequence S P2 For the obtained N check sets Sort the results to obtain the corresponding check set sequence S V2 For the obtained N test sets Sort the data to obtain the corresponding test set sequence S. T2 ; and from the obtained training set sequence S P2 , Check set sequence S V2 and test set sequence S T2 This forms the corresponding second branch dataset.
[0190] Step 7: Based on the second branch dataset and the AutoGluon ensemble training tool, train each binary classification model M. i Training should be conducted separately;
[0191] Specifically, this includes: Step 71, which involves configuring each binary classification model M... i As the corresponding current binary classification model; and the training set sequence S of the second branch dataset. P2 S and check set sequence S V2 The training set corresponding to the current binary classification model Sum check set As the corresponding current training set and current verification set;
[0192] Step 72, and form a corresponding first basic parameter set from the model basic parameters of the current binary classification model; and form a corresponding first hyperparameter set from all hyperparameters of the current binary classification model; and perform parameter configuration combination on all first hyperparameters of the first hyperparameter set based on the first parameter configuration range corresponding to each first hyperparameter of the first hyperparameter set to obtain a corresponding first combination set;
[0193] The first hyperparameter set includes multiple first hyperparameters; each first hyperparameter corresponds to a first parameter configuration range, and each first parameter configuration range includes one or more first parameter configurations; the first combination set includes multiple first configuration groups; each first configuration group consists of a set of first parameter configurations for all first hyperparameters.
[0194] Step 73, and take the current binary classification model as the corresponding current base model; and count the total number of the first configuration group in the first combination set to obtain the corresponding total number of combinations. And perform the following on the current base model: The second copy yields A first replication model; and based on each first configuration group of the first combination set, set the first hyperparameter set of the corresponding first replication model;
[0195] Among them, the first replication model corresponds one-to-one with the first configuration group;
[0196] Step 74: Use the AutoGluon ensemble training tool to perform a round of basic parameter optimization on each first replica model based on the current training set, and use the binary classification cross-entropy loss function as the model loss function during this round of optimization; and at the end of this round of optimization of all first replica models, use the AutoGluon ensemble training tool to perform a round of F1 evaluation on each first replica model based on the current validation set to obtain the corresponding second evaluation value.
[0197] Step 75: Identify whether all the obtained second evaluation values meet the preset second evaluation value range; if not, return to step 74 to continue training; if yes, set the parameters of the current binary classification model using the first basic parameter set and the first configuration group of the first replicated model corresponding to the smallest second evaluation value, and stop training the current binary classification model.
[0198] Here, the second evaluation value range is a pre-set numerical range.
[0199] Step 8: Test and evaluate the first and second predicted branches, and set the weight parameters of the two branches built into the two-way merged output module based on the evaluation results;
[0200] Specifically, this includes: Step 81, based on the test set sequence S of the first branch dataset. T1 N test sets The first branch training framework is evaluated using N rounds of F1 scores to obtain N corresponding evaluation values. And the obtained N evaluation values Calculate the mean and record the result as the average.
[0201] Step 82, using the AutoGluon ensemble training tool, based on the test set sequence S of the second branch dataset. T2 N test sets For N binary classification models M i Perform the corresponding N rounds of F1 score evaluation to obtain the corresponding N evaluation values. And the obtained N evaluation values Calculate the mean and record the result as the average.
[0202] Step 83, based on the average value and average Set the first weight parameter w1 and the second weight parameter w2 built into the two-way merged output module;
[0203] in,
[0204]
[0205] λ1 and λ2 are two preset temperature coefficients.
[0206] Step 9: After all parameters of the model cluster framework have been set, use the model cluster framework to process the user's compound classification task.
[0207] Specifically, this includes: Step 91, taking the first SMILES sequence, first scenario type and first task type input by the user as the corresponding current molecular sequence, current scenario type and current task type;
[0208] Step 92: Input the current molecular sequence as the current compound molecular sequence into the model cluster framework to predict the corresponding classification probability prediction vector; sort the N classification prediction probabilities of the classification probability prediction vector in descending order of probability, and extract the top H classification prediction probabilities to form the corresponding current probability set; and form the corresponding first set by the first type corresponding to all classification prediction probabilities in the current probability set.
[0209] The preset quantity H is a positive integer, where 0 < H < N;
[0210] Step 93: The analysis scenarios in the compound analysis scenario set that correspond to the current scenario type are taken as the current scenario; the compound analysis tasks in the current scenario that correspond to the current task type are taken as the current tasks; and the corresponding second set is composed of all the first types corresponding to the current tasks.
[0211] Step 94, and take the intersection of the types of the first and second sets as the corresponding first intersection; and identify the first intersection; if the first intersection is empty, take the largest classification prediction probability in the current probability set as the current probability; if the first intersection is not empty, take the largest probability among one or more classification prediction probabilities in the current probability set corresponding to the first intersection as the current probability; and feed back the first type corresponding to the current probability to the current user.
[0212] Figure 5 This is a module structure diagram of a processing device for predicting compound types based on model clusters, provided in Embodiment 2 of the present invention. This device can be a terminal device or server implementing the aforementioned method embodiments, or it can be a device that enables the aforementioned terminal device or server to implement the aforementioned method embodiments. For example, the device can be a device or chip system of the aforementioned terminal device or server. Figure 5 As shown, the device includes: a cluster framework construction module 201, a molecular library acquisition module 202, a first dataset construction module 203, a first branch training module 204, a feature library construction module 205, a second dataset construction module 206, a second branch training module 207, a two-way weight setting module 208, and a framework application module 209.
[0213] The cluster framework construction module 201 is used to construct a model cluster framework for classifying and predicting compounds based on a preset first type set; the first type set includes N first types, each first type being a class of compounds, and N being a preset positive integer; the model cluster framework includes a general encoder, a pooling module, a first prediction branch, a second prediction branch, and a two-way merged output module; the second prediction branch includes N parallel binary classification models M i , 1≤index i≤N.
[0214] The molecular library acquisition module 202 acquires the target molecular library by acquiring molecular library information based on the first type set.
[0215] The first dataset construction module 203 is used to construct the first branch dataset according to the molecular sequence balanced sampling rules of category independence and the target molecular library; the training-verification-test allocation ratio includes training ratio α, verification ratio β, and test ratio γ, α+β+γ=1.
[0216] The first branch training module 204 is used to form a first branch training framework by sequentially connecting a general encoder and a first predicted branch; and to train the first branch training framework based on the first branch dataset.
[0217] The feature library construction module 205 is used to construct a molecular feature library based on the general encoder, pooling module and target molecule library after the training of the first branch training framework is completed.
[0218] The second dataset construction module 206 constructs the second branch dataset according to the category-independent molecular feature equalization sampling rule based on the training-verification-test allocation ratio and the molecular feature library.
[0219] The second branch training module 207 trains various binary classification models M based on the second branch dataset and the AutoGluon ensemble training tool. i Training was conducted separately.
[0220] The two-way weight setting module 208 is used to test and evaluate the first and second prediction branches and set the two-way weight parameters built into the two-way merged output module based on the evaluation results.
[0221] The framework application module 209 is used to process the user's compound classification task using the model cluster framework after all parameters of the model cluster framework have been set.
[0222] The present invention provides a processing device for predicting compound types based on model clusters, which can execute the method steps in the above method embodiments. Its implementation principle and technical effect are similar, and will not be repeated here.
[0223] It should be noted that the division of the various modules in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software via processing element calls; they can be fully implemented in hardware; or some modules can be implemented by processing element calls to software, while others are implemented in hardware. For example, the cluster framework building module can be a separate processing element, or it can be integrated into a chip in the above device. Alternatively, it can be stored as program code in the memory of the above device, and called and executed by a processing element of the device. The implementation of other modules is similar. Moreover, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0224] For example, these modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more Digital Signal Processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). As another example, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a System-on-a-Chip (SOC).
[0225] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the foregoing method embodiments are generated. The computer described above can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The aforementioned computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the aforementioned computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, Bluetooth, microwave, etc.) means. The aforementioned computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that integrates one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks (SSDs)).
[0226] Figure 6 This is a schematic diagram of an electronic device provided in Embodiment 3 of the present invention. This electronic device can be a terminal device or server implementing the methods of the aforementioned embodiments, or it can be a terminal device or server connected to the aforementioned terminal device or server implementing the methods of the aforementioned embodiments. Figure 6As shown, the electronic device may include: a processor 301 (e.g., CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transmission and reception operations of the transceiver 303. The memory 302 may store various instructions for performing various processing functions and implementing the processing steps described in the foregoing embodiments. Preferably, the electronic device involved in the embodiments of the present invention further includes: a power supply 304, a system bus 305, and a communication port 306. The system bus 305 is used to realize communication connections between components. The communication port 306 is used for communication between the electronic device and other peripherals.
[0227] exist Figure 6 The system bus 305 mentioned can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This system bus can be divided into address bus, data bus, control bus, etc. For ease of representation, it is represented by only one thick line in the figure, but this does not indicate that there is only one bus or one type of bus. The communication interface is used to enable communication between the database access device and other devices (e.g., clients, read-write libraries, and read-only libraries). Memory may include Random Access Memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.
[0228] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), graphics processing units (GPUs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0229] It should be noted that the embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when run on a computer, cause the computer to perform the methods and processes provided in the above embodiments.
[0230] This invention provides a method, apparatus, electronic device, and computer-readable storage medium for predicting compound types based on model clusters. As described above, this invention constructs a model cluster framework for multidimensional classification of compounds based on a cluster approach. This framework deeply mines the multidimensional representation of molecular features through a high-dimensional feature encoder and introduces a two-way (one route consists of deep learning models, and the other route consists of machine learning model clusters) complementary prediction mechanism. This framework can reduce the risk of overfitting and improve the model's generalization ability. When constructing the first branch dataset, rare or long-tail category samples are preferentially allocated to the training set, multi-category samples are allocated to the test set, and a corresponding training / validation / test set is constructed for each compound type. When training and evaluating the first prediction branch, training and evaluation are performed type-by-type according to the training / validation / test set for each compound type, progressing from small sample categories to large sample categories. This improves the prediction accuracy of rare and long-tail categories and reduces the training bias caused by large sample categories. When constructing the second branch dataset, sampling is performed based on the intersection of the category sample set and the feature clustering sample set, which can improve the diversity of molecular feature distribution. When training and evaluating the second prediction branch, the corresponding binary classification model is independently trained / evaluated based on the training / validation / test set for each compound type. This improves the prediction accuracy for rare and long-tail categories while reducing training bias caused by large sample categories. This invention reduces manual operation costs, enhances multi-class prediction capabilities, and improves prediction accuracy and model generalization. This invention helps improve the efficiency of research work in fields such as plant metabolite analysis, synthetic biology pathway design, and molecular breeding (e.g., quality and resistance breeding, biomanufacturing, food science, and pharmaceutical research and development).
[0231] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0232] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for predicting compound types based on model clusters, characterized in that, The method includes: A model cluster framework is constructed for classifying and predicting compounds based on a preset first type set. The first type set includes N first types, each representing a class of compounds, where N is a preset positive integer. The model cluster framework includes a general encoder, a pooling module, a first prediction branch, a second prediction branch, and a two-way merged output module. The second prediction branch includes N parallel binary classification models M. i , 1 ≤ index i ≤ N; The target molecular library is obtained by collecting molecular library information based on the first type set; The molecular sequence equalization sampling rule based on category independence constructs the first branch dataset according to the preset training-verification-test allocation ratio and the target molecular library; the training-verification-test allocation ratio includes training ratio α, verification ratio β, and test ratio γ, where α+β+γ=1; The first branch training framework is formed by sequentially connecting the general encoder and the first predicted branch; and the first branch training framework is trained based on the first branch dataset. After the training of the first branch training framework is completed, a molecular feature library is constructed based on the general encoder, the pooling module, and the target molecule library; The molecular feature equalization sampling rule based on category independence constructs a second branch dataset according to the training-verification-test allocation ratio and the molecular feature library; Based on the second branch dataset and the AutoGluon ensemble training tool, each of the binary classification models M was trained. i Training should be conducted separately; The first and second predicted branches are tested and evaluated, and the weight parameters of the two branches built into the two-way merging output module are set based on the evaluation results; After all parameters of the model cluster framework have been set, the model cluster framework is used to process the user's compound classification task.
2. The processing method for predicting compound types based on model clusters according to claim 1, characterized in that, The first type set consists of all compound types corresponding to a preset set of compound analysis scenarios; the set of compound analysis scenarios includes multiple types of analysis scenarios; each type of analysis scenario corresponds to a sub-scenarios in the fields of biology, chemistry, medicine, or new energy; each type of analysis scenario includes multiple types of compound analysis tasks; the task types of the compound analysis tasks include functional analysis, property analysis, synthetic pathway analysis, and matrix regulation analysis; each type of compound analysis task corresponds to one or more of the first type. The target molecule library includes multiple first molecule records; each first molecule record corresponds to a class of compound molecules; each first molecule record includes a first molecule sequence and a first molecule type set; the first molecule sequence is the SMILES sequence of the current compound molecule; the first molecule type set consists of all the first types corresponding to the current compound molecule; The first branch dataset includes training set sequence S P1 , Check set sequence S V1 and test set sequence S T1 The training set sequence S P1 The verification set sequence S V1 and the test set sequence S T1 Each has N training sets D corresponding to it. N verification sets N test sets The training set is ordered sequentially, where 1 ≤ index j ≤ N; each of the training sets... The verification set or the test set Each type consists of multiple first data records; each first type corresponds to a set of training sets. The verification set and the test set And the training set mentioned in each group The verification set and the test set The ratio of the total number of records all satisfies α:β:γ; The first data record includes the first molecular sequence and the first label vector; the first label vector includes N first label probabilities, each of which corresponds to one of the first types, and the probability value of each first label probability is set to 0 or 1; in the first label vector, the first label probabilities corresponding to each of the first types in the corresponding first molecular type set are all set to 1, and the remaining first label probabilities are all set to 0. The molecular feature library includes multiple first feature records; each first feature record corresponds one-to-one with a first molecular record; each first feature record includes a first molecular feature and a first molecular type set; the first molecular feature is a molecular feature vector obtained by encoding the corresponding first molecular sequence through the general encoder and performing feature encoding and encoding pooling processing by the pooling module. The second branch dataset includes the training set sequence S P2 , Check set sequence S V2 and test set sequence S T2 The training set sequence S P2 The verification set sequence S V2 and the test set sequence S T2 Each has N corresponding training sets N verification sets N test sets The training sets are ordered sequentially; each of the training sets... The verification set or the test set Each type consists of multiple second data records; each of the first types corresponds to a set of the training sets. The verification set and the test set And the training set mentioned in each group The verification set and the test set The ratio of the total number of records all satisfies α:β:γ; The second data record includes the first molecular feature and the second label vector; the second label vector includes two label probabilities, namely the true value label probability and the false value label probability; the true value label probability of all the second data records is set to 1 and the false value label probability is set to 0.
3. The processing method for predicting compound types based on model clusters according to claim 2, characterized in that, The model cluster framework is used to classify and predict the compound molecular sequence input to the framework and output the corresponding classification probability prediction vector; the compound molecular sequence is a SMILES sequence of a class of compound molecules; the classification probability prediction vector includes N classification prediction probabilities, each of which corresponds one-to-one with the first type, and the probability value of each classification prediction probability is between 0 and 1. The first frame input of the model cluster framework is used to receive the compound molecule sequence, and the first frame output is used to output the classification probability prediction vector. The input terminal of the general encoder is connected to the input terminal of the first frame, the first output terminal is connected to the input terminal of the first prediction branch, and the second output terminal is connected to the input terminal of the pooling module; the output terminal of the first prediction branch is connected to the first input terminal of the two-way combined output module; the output terminal of the pooling module is connected to the input terminal of the second prediction branch; the output terminal of the second prediction branch is connected to the second input terminal of the two-way combined output module; and the output terminal of the two-way combined output module is connected to the output terminal of the first frame. The general encoder is implemented based on the encoder structure of the Transformer model; the general encoder is used to perform atomic-level feature encoding processing on the compound molecular sequence to obtain the corresponding encoded feature tensor and send it to the first prediction branch and the pooling module; the encoded feature tensor is composed of multiple atomic feature vectors; The pooling module is used to perform global pooling on each feature dimension of the encoded feature tensor and send the resulting pooled feature vector as the corresponding molecule feature vector to the second prediction branch. The first prediction branch consists of a feature decoder and a classification module; the input of the feature decoder is connected to the input of the first prediction branch, and the output is connected to the input of the classification module; the output of the classification module is connected to the output of the first prediction branch. The feature decoder is implemented based on the decoder structure of the Transformer model; the feature decoder is used to perform compound type feature decoding processing on the encoded feature tensor to obtain the corresponding decoded feature tensor and send it to the classification module; the decoded feature tensor includes N decoded feature vectors; the decoded feature vectors correspond one-to-one with the first type; The classification module is used to input each of the decoded feature vectors of the decoded feature tensor into the Sigmoid function for function calculation, and use the calculation result as the corresponding classification probability. And the obtained N classification probabilities Form the corresponding first classification probability vector P 1 Send to the two-way merged output module; The second prediction branch is derived from N parallel binary classification models M. i And the fusion module; each of the binary classification models M i The input terminals of all are connected to the input terminal of the second prediction branch, and the output terminals of all are connected to the input terminal of the fusion module; the output terminal of the fusion module is connected to the output terminal of the second prediction branch. The binary classification model M i It corresponds one-to-one with the first type; Each of the binary classification models M i It is composed of a group of weak classifiers combined according to a corresponding first ensemble mode; the first ensemble mode includes Bagging ensemble mode, Boosting ensemble mode and Stacking ensemble mode; the model types of the weak classifiers include MLP model, LR model, GBDT model and RF model; Each of the binary classification models M i Used to predict the type of a single compound based on the molecular feature vector, and obtain the corresponding single-class prediction probability vector. The single-class prediction probability vector is sent to the fusion module. Each of the first types corresponds one-to-one with the binary classification probability vector of the first type; the single-class prediction probability vector It consists of two predicted probabilities, namely the true probability and the true probability. and pseudo-value probability The truth probability and the pseudo-value probability The values of are all between 0 and 1, and The fusion module is used to process N single-class prediction probability vectors received. Then, the individual class prediction probability vectors are... The truth probability As the corresponding classification probability And the obtained N classification probabilities Form the corresponding second classification probability vector P 2 Send to the two-way merged output module; The two-way merging output module is used to convert the first classification probability vector P 1 and the second classification probability vector P 2 The weighted sum vector P 3 As the corresponding classification probability prediction vector output; P 3 =w1P 1 +w2P 2 w1 and w2 are the corresponding first-path weight parameters and second-path weight parameters, and w1+w2=1.
4. The processing method for predicting compound types based on model clusters according to claim 2, characterized in that, The process of obtaining the target molecular library based on the first type set specifically includes: Step 41: Collect molecular sequence information of all compound types corresponding to the compound analysis scenario set through publicly available molecular information collection methods to obtain the corresponding collection information set; The disclosed molecular information acquisition methods include multiple publicly available molecular information databases, molecular experimental databases, and scientific literature / technical paper databases in the fields of biology, chemistry, medicine, and new energy; the acquired information set includes N sub-information sets, each of which corresponds one-to-one with the first type; each sub-information set includes multiple acquired molecular sequences; each acquired molecular sequence is a SMILES sequence of a class of compound molecules; Step 42: Each of the sub-information sets is taken as the corresponding current subset; and the type label of each of the collected molecular sequences in the current subset is set based on the first type corresponding to the current subset; Step 43: Cluster all the collected molecular sequences in the collected information set, and cluster one or more collected molecular sequences with the same SMILES sequence into a class to form a corresponding first sequence set; Step 44: Each first sequence set is taken as the corresponding current sequence set; and the SMILES sequence corresponding to the current sequence set is taken as a corresponding first molecular sequence; and the type tags of all the collected molecular sequences in the current sequence set are used to form the corresponding first molecular type set; and the first molecular sequence corresponding to the current sequence set and the first molecular type set are used to form a corresponding first molecular record. Step 45: The target molecule library is composed of all the first molecule records obtained.
5. The processing method for predicting compound types based on model clusters according to claim 2, characterized in that, The category-independent molecular sequence equalization sampling rule is as follows: Let each of the first types in the first type set be denoted as type c. i ; and each of the aforementioned types c i As the corresponding current type; and the corresponding sample set X is composed of the first molecular sequence corresponding to the first molecular type set containing the current type in the target molecular library. i ; and the current sample set X i Each of the first molecular sequences is denoted as the corresponding sample. 1≤index For the sample set X i The total number of samples; Each of the aforementioned sample sets X i As the corresponding current sample set; and for each sample in the current sample set. The total number of types in the first molecular type set is counted, and the statistical result is used as the total number of corresponding matching types. And according to the total number of the said matching types The current sample set is ordered from smallest to largest. The samples Sort the data to obtain the corresponding first sequence; then divide the first sequence into three consecutive sub-sequence segments according to the training-verification-test allocation ratio, denoted as the first segment, second segment, and third segment; and then divide each of the samples in the current sample set... The first molecular type set and its corresponding first molecular sequence generate a set of first molecular sequences and first label vectors to form a corresponding first data record; and all the first data records corresponding to the first segment form a corresponding training set. The corresponding verification set consists of all the first data records corresponding to the second segment. The corresponding test set consists of all the first data records corresponding to the third segment. The first, second, and third segments each consist of multiple samples. The total number of samples in the first, second, and third segments is composed of... The ratio of the total number of samples in the first, second, and third segments satisfies α:β:γ; According to the total number of samples The N training sets are arranged in ascending order. The training sets are sorted to obtain the N sorted sets. The corresponding training set sequence S is formed. P1 For N of the aforementioned check sets The N check sets are obtained by sorting. The corresponding check set sequence S is formed. V1 For N test sets The test sets are sorted to obtain the N sorted test sets. The corresponding test set sequence S is formed. T1 ; The obtained training set sequence S P1 The verification set sequence S V1 and the test set sequence S T1 The corresponding dataset for the first branch is formed.
6. The processing method for predicting compound types based on model clusters according to claim 3, characterized in that, The step of training the first branch training framework based on the first branch dataset specifically includes: Step 61, take the training set sequence S of the first branch dataset. P1 The first training set in As the current training set; Step 62, the verification set sequence S of the first branch dataset. V1 The verification set that has the same index j as the current training set As the corresponding current check set; Step 63: Optimize the model parameters of the first branch training framework based on the current training set; use the multi-class cross-entropy loss function as the model loss function during this optimization process; optimize the model parameters of the first branch training framework based on the Adam optimizer and the model loss function during this optimization process; and optimize the learning rate parameter of the Adam optimizer in stages based on the cosine annealing strategy during this optimization process. Step 64: At the end of this round of parameter optimization, perform an F1 evaluation on the first branch training framework based on the current verification set to obtain the corresponding first evaluation value; and identify whether the current first evaluation value meets the preset first evaluation value range; if it does not meet the range, return to step 63 to continue training; if it does meet the range, check whether the current training set is the training set sequence S. P1 The last training set mentioned Perform identification; otherwise, the training set sequence S will be... P1 The next training set The current training set is then used as the latest set, and the process returns to step 62; if so, training is stopped.
7. The processing method for predicting compound types based on model clusters according to claim 3, characterized in that, The construction of the molecular feature library based on the general encoder, the pooling module, and the target molecule library specifically includes: Each first molecule record in the target molecule library is taken as the corresponding current record; the first molecule sequence of the current record is taken as the corresponding compound molecule sequence and input into the general encoder for processing to obtain the corresponding encoding feature tensor; the current encoding feature tensor is input into the pooling module for pooling to obtain the corresponding molecular feature vector; the current molecular feature vector is taken as a corresponding first molecule feature; and the first molecule feature corresponding to the current record and the first molecule type set are combined to form a corresponding first feature record; and all the obtained first feature records are combined to form the corresponding molecular feature library.
8. The processing method for predicting compound types based on model clusters according to claim 2, characterized in that, The category-independent molecular feature equalization sampling rule is specifically as follows: Let each of the first types in the first type set be denoted as type c. i ; and each of the aforementioned types c i As the corresponding current type; and the corresponding sample set Y is composed of the first molecular features corresponding to the first molecular type set containing the current type in the molecular feature library. i ; and the current sample set Y i Each of the first molecular features is denoted as the corresponding sample. 1≤index For the sample set Y i The total number of samples; Each clustering threshold K within the preset clustering threshold range * As the corresponding current threshold K * ; and with the current threshold K * Given the total number of clusters, the K clusters are obtained by clustering all the first molecular features in the molecular feature library using the K-means clustering algorithm. * Molecular feature clusters C k 1 ≤ index k ≤ K * ; and for each of the current molecular feature clusters C k The total number of samples N within the corresponding cluster is obtained by statistically analyzing the total number of the first molecular features. k ; and the current molecular feature clusters C k Each of the first molecular features within the sample is denoted as the corresponding sample. 1≤index q≤N k ; and for each of the current molecular feature clusters C k centroid characteristics μ k Perform calculations; and apply the Elbow method to the current threshold K. * The corresponding intra-cluster sum of squares SSE(K) * ) performs the calculation; and based on the current threshold K * and the sum of squares within the cluster SSE(K) * ) Calculate the corresponding clustering parameter Cp(K) * ); and from all clustering parameters Cp(K) corresponding to the clustering threshold range. * Select the clustering threshold K corresponding to the minimum value. * As the optimal threshold K opt ; and the optimal threshold K opt Corresponding K opt Molecular feature clusters Extract them to form the corresponding cluster set G; The clustering threshold range includes multiple clustering thresholds K. * ; μ k The calculation method is as follows: SSE(K * The calculation method for ) is as follows: Cp(K * The calculation method for Cp(K) is: * ) = SSE(K * )+λK * ; K opt The calculation method is as follows: The cluster set G includes K opt The molecular feature cluster C k Each of the molecular feature clusters C k Includes multiple samples Each of the aforementioned sample sets Y i As the corresponding current sample set; and for each of the molecular feature clusters C in the current sample set and the cluster set G. k The corresponding sample intersection R is obtained by identifying the sample intersection. i,k ; and for each of the sample intersections R i,k The total number of samples is counted and the statistical result is used as the corresponding total number n. i,k ; and the intersection R of all the samples i,k Each sample within is denoted as the corresponding sample. 1≤index g≤n i,k ; Intersection of the samples As the corresponding current intersection; and sorting the n elements within the current intersection in ascending order of index g. i,k The samples The second sequence is obtained by sorting the data; and the second sequence is divided into three consecutive sub-sequence segments according to the training-verification-test allocation ratio, denoted as the fourth, fifth, and sixth segments; and the samples from the current intersection are then... A corresponding set of the first molecular features and the second label vector is generated to form a corresponding second data record; and all the second data records corresponding to the fourth segment are used to form a corresponding training set. The corresponding verification set consists of all the second data records corresponding to the fifth segment. The corresponding test set consists of all the second data records corresponding to the sixth segment. Among them, the fourth, fifth and sixth segments are each composed of multiple samples. The total number of samples in the three segments of the fourth, fifth, and sixth segments is n. i,k The ratio of the total number of samples in the fourth, fifth, and sixth segments satisfies α:β:γ; Each of the aforementioned types c i As the corresponding current type; and by all the training sets corresponding to the current type. The corresponding training set is formed All corresponding check sets The corresponding verification set is formed. All the corresponding test sets The corresponding test set is formed. The N training sets obtained are processed in ascending order of index i. The corresponding training set sequence S is obtained by sorting. P2 For the obtained N verification sets The corresponding check set sequence S is obtained by sorting. V2 For the obtained N test sets The corresponding test set sequence S is obtained by sorting. T2 ; and the obtained training set sequence S P2 The verification set sequence S V2 and the test set sequence S T2 This forms the corresponding second branch dataset.
9. The processing method for predicting compound types based on model clusters according to claim 2, characterized in that, The binary classification models M are trained based on the second branch dataset and the AutoGluon ensemble training tool. i Training will be conducted separately, specifically including: Step 91, classify each of the binary classification models M i As the corresponding current binary classification model; and the training set sequence S of the second branch dataset. P2 and the verification set sequence S V2 The training set corresponding to the current binary classification model and the verification set As the corresponding current training set and current verification set; Step 92, and form a corresponding first basic parameter set from the model basic parameters of the current binary classification model; and form a corresponding first hyperparameter set from all hyperparameters of the current binary classification model; and perform parameter configuration combination on all the first hyperparameters of the first hyperparameter set based on the first parameter configuration range corresponding to each first hyperparameter of the first hyperparameter set to obtain a corresponding first combination set; The first hyperparameter set includes multiple first hyperparameters; each first hyperparameter corresponds to a first parameter configuration range, and each first parameter configuration range includes one or more first parameter configurations; the first combination set includes multiple first configuration groups; each first configuration group consists of a set of first parameter configurations of all the first hyperparameters. Step 93, and take the current binary classification model as the corresponding current base model; and count the total number of the first configuration groups in the first combination set to obtain the corresponding total number of combinations. And perform the following on the current base model: The second copy yields A first replication model; and based on each of the first configuration groups of the first combination set, set the first hyperparameter set of the corresponding first replication model; The first replication model corresponds one-to-one with the first configuration group; Step 94: Use the AutoGluon ensemble training tool to perform a round of basic parameter optimization on each of the first replica models based on the current training set, and use the binary cross-entropy loss function as the model loss function during this round of optimization; and at the end of this round of optimization of all the first replica models, use the AutoGluon ensemble training tool to perform a round of F1 evaluation on each of the first replica models based on the current validation set to obtain the corresponding second evaluation value. Step 95: Identify whether all the obtained second evaluation values meet the preset second evaluation value range; if not, return to step 94 to continue training; if yes, set the parameters of the current binary classification model using the first basic parameter set and the first configuration group of the first replicated model corresponding to the smallest second evaluation value, and stop training the current binary classification model.
10. The processing method for predicting compound types based on model clusters according to claim 3, characterized in that, The process of testing and evaluating the first and second predicted branches, and setting the two weight parameters built into the two-way merging output module based on the evaluation results, specifically includes: Step 101, based on the test set sequence S of the first branch dataset. T1 The N test sets The first branch training framework is evaluated using N rounds of F1 scores to obtain N corresponding evaluation values. And the obtained N evaluation values Calculate the mean and record the result as the average. Step 102, using the AutoGluon ensemble training tool, based on the test set sequence S of the second branch dataset. T2 The N test sets For N binary classification models M i Perform the corresponding N rounds of F1 score evaluation to obtain the corresponding N evaluation values. And the obtained N evaluation values Calculate the mean and record the result as the average. Step 103, based on the average value and the average value Set the first weight parameter w1 and the second weight parameter w2 built into the two-way merging output module; in, λ1 and λ2 are two preset temperature coefficients.
11. The processing method for predicting compound types based on model clusters according to claim 2, characterized in that, The process of using the model cluster framework to handle the user's compound classification task specifically includes: The first SMILES sequence, first scenario type, and first task type input by the user are used as the corresponding current molecular sequence, current scenario type, and current task type; The current molecular sequence is input into the model cluster framework as the current compound molecular sequence for prediction to obtain the corresponding classification probability prediction vector; the N classification prediction probabilities of the classification probability prediction vector are sorted in descending order of probability, and the top H classification prediction probabilities are extracted to form the corresponding current probability set; and the first type corresponding to all the classification prediction probabilities in the current probability set is formed into the corresponding first set; the preset number H is a positive integer, 0 < H < N. The analysis scenario corresponding to the current scenario type in the compound analysis scenario set is taken as the current scenario; the compound analysis task corresponding to the current task type in the current scenario is taken as the current task; and all the first types corresponding to the current task form a corresponding second set; The intersection of the types of the first and second sets is taken as the corresponding first intersection; the first intersection is identified; if the first intersection is empty, the largest classification prediction probability in the current probability set is taken as the current probability; if the first intersection is not empty, the largest probability among one or more classification prediction probabilities corresponding to the first intersection in the current probability set is taken as the current probability; and the first type corresponding to the current probability is fed back to the current user.
12. An apparatus for performing the processing method for predicting compound types based on model clusters according to any one of claims 1-11, characterized in that, The device includes: a cluster framework construction module, a molecular library acquisition module, a first dataset construction module, a first branch training module, a feature library construction module, a second dataset construction module, a second branch training module, a two-way weight setting module, and a framework application module; The cluster framework construction module is used to construct a model cluster framework for classifying and predicting compounds based on a preset first type set; the first type set includes N first types, each first type being a class of compounds, and N being a preset positive integer; the model cluster framework includes a general encoder, a pooling module, a first prediction branch, a second prediction branch, and a two-way merged output module; the second prediction branch includes N parallel binary classification models M i , 1 ≤ index i ≤ N; The molecular library acquisition module obtains the target molecular library by acquiring molecular library information based on the first type set; The first dataset construction module is used to construct a first branch dataset according to a preset training-verification-test allocation ratio and the target molecule library based on a category-independent molecular sequence balanced sampling rule; the training-verification-test allocation ratio includes a training ratio α, a verification ratio β, and a test ratio γ, where α+β+γ=1; The first branch training module is used to form a first branch training framework by sequentially connecting the general encoder and the first predicted branch; and to train the first branch training framework based on the first branch dataset; The feature library construction module is used to construct a molecular feature library based on the general encoder, the pooling module, and the target molecule library after the training of the first branch training framework is completed. The second dataset construction module constructs the second branch dataset according to the training-verification-test allocation ratio and the molecular feature library based on the category-independent molecular feature equalization sampling rule. The second branch training module trains each of the binary classification models M based on the second branch dataset and the AutoGluon ensemble training tool. i Training should be conducted separately; The two-way weight setting module is used to test and evaluate the first and second predicted branches and set the two-way weight parameters built into the two-way merging output module based on the evaluation results; The framework application module is used to process the user's compound classification task using the model cluster framework after all parameters of the model cluster framework have been set.
13. An electronic device, characterized in that, include: Memory, processor, and transceiver; The processor is configured to be coupled to the memory, read and execute instructions in the memory to implement the method according to any one of claims 1-11; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a computer, cause the computer to perform the method according to any one of claims 1-11.
