Method and device for predicting and modeling the frequency of horizontal migration of resistance genes
By combining the Stacking model with multiple base learners and meta-learners, a resistance gene horizontal migration frequency prediction model is constructed, which solves the problems of insufficient model adaptability and interpretability in existing technologies, and realizes efficient, reliable prediction and visual analysis of the horizontal migration frequency of antibiotic resistance genes.
Patent Information
- Application Number
- CN202510021124.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-01-07
AI Technical Summary
In existing technologies, single machine learning models lack adaptability and generalization capabilities for complex data structures, have limited explanatory power for feature importance, lack standardized processes for data integration and preprocessing, and have weak interpretability and visualization capabilities for model results.
A Stacking model is combined with multiple base learners and meta-learners. By acquiring and preprocessing the target historical sample test data, a resistance gene horizontal migration frequency prediction model is trained and constructed, including random forest, GradientBoosting and XGBoost as base learners, and regularized linear regression as a meta-learner. Data integration and preprocessing are performed to improve the model's training success rate and prediction accuracy.
The accuracy and reliability of the prediction of the frequency of horizontal migration of resistance genes have been significantly improved. It can quickly assess the risk of horizontal migration of antibiotic resistance genes under various water sample conditions, and provide support for risk management and decision-making through the importance ranking of stress factors and visualization of prediction results.
Smart Images

Figure CN119993278B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of resistance gene horizontal migration frequency prediction, and in particular to a method and device for resistance gene horizontal migration frequency prediction and model construction. Background Art
[0002] Current research indicates that antibiotic resistance genes (ARGs) spread between different organisms through horizontal gene transfer (HGT), posing a significant threat to public health and environmental safety. Therefore, accurately monitoring the presence of ARGs in the environment and assessing their transmission risk are crucial for protecting human health. Existing techniques for assessing the risk of ARG transmission primarily include statistical analysis, laboratory simulation studies, and simple machine learning models. While some progress has been made, these techniques still have significant limitations. For example, traditional statistical methods struggle to handle nonlinear and multifactor interactions; laboratory simulation studies are time-consuming and difficult to scale; single machine learning models lack adaptability and generalization capabilities for complex data structures, and have limited explanatory power for feature importance. Furthermore, data integration and preprocessing lack standardized processes, hyperparameter optimization strategies are imperfect, and model results are less interpretable and visualizable. Summary of the Invention
[0003] In response to the above problems, the present invention proposes a method and device for predicting the frequency of horizontal migration of resistance genes and constructing a model to solve the following problems in the prior art: a single machine learning model has insufficient adaptability and generalization ability to complex data structures, and has limited explanatory power for feature importance. In addition, data integration and preprocessing lack standardized processes, hyperparameter optimization strategies are imperfect, and the interpretability and visualization capabilities of model results are weak.
[0004] The first technical solution of the embodiment of the present invention is:
[0005] The method for constructing a resistance gene horizontal migration frequency prediction model comprises: obtaining a preset number of target historical sample test data, and labeling all of the target historical sample test data; wherein each group of the target historical sample test data comprises a target stress factor concentration corresponding to a target resistance gene stress factor and a target resistance gene horizontal migration frequency that matches the target stress factor concentration; preprocessing each group of the target historical sample test data to obtain multiple groups of target historical preprocessed sample test data, wherein each group of the target historical preprocessed sample test data comprises a target preprocessed stress factor concentration and a target resistance gene horizontal migration frequency that matches the target stress factor concentration. The target pretreatment resistance gene horizontal migration frequency is matched with the pretreatment stress factor concentration; all the target historical pretreatment sample test data are simultaneously input into the target learner model to be trained for training and output target prediction result data, the target learner model includes a first-layer learner and a second-layer learner, the first-layer learner is a plurality of different and independent target base learners, and the second-layer learner is a target meta-learner; according to the target prediction result data, it is judged whether the target learner model has been successfully trained; if so, the target learner model after successful training is used as the target resistance gene horizontal migration frequency prediction model.
[0006] The second technical solution of the embodiment of the present invention is:
[0007] A method for predicting the frequency of horizontal migration of antibiotic resistance genes is implemented based on a target resistance gene horizontal migration frequency prediction model constructed by the method for constructing a resistance gene horizontal migration frequency prediction model according to any one of the above claims, and comprises: obtaining all target resistance gene stress factor concentrations corresponding to a target antibiotic water sample to be predicted; pre-treating all the target resistance gene stress factor concentrations to obtain target pre-treated resistance gene stress factor concentrations; inputting all the target pre-treated resistance gene stress factor concentrations into the target resistance gene horizontal migration frequency prediction model for processing, and outputting the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample.
[0008] The third technical solution of the embodiment of the present invention is:
[0009] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0010] Obtain a preset number of groups of target historical sample test data, and label all of the target historical sample test data; wherein each group of the target historical sample test data includes a target stress factor concentration corresponding to a target resistance gene stress factor and a target resistance gene horizontal migration frequency that matches the target stress factor concentration; preprocess each group of the target historical sample test data to obtain multiple groups of target historical preprocessed sample test data, wherein each group of the target historical preprocessed sample test data includes a target preprocessed stress factor concentration and a target preprocessed resistance gene horizontal migration frequency that matches the target preprocessed stress factor concentration; simultaneously input all of the target historical preprocessed sample test data into a target learner model to be trained for training and output target prediction result data, wherein the target learner model includes a first-layer learner and a second-layer learner, the first-layer learner being a plurality of different and independent target base learners, and the second-layer learner being a target meta-learner; judging whether the target learner model has been successfully trained based on the target prediction result data; if so, using the successfully trained target learner model as a target resistance gene horizontal migration frequency prediction model; or performing the following steps:
[0011] Obtain all target resistance gene stress factor concentrations corresponding to the target antibiotic water sample to be predicted; pre-treat all the target resistance gene stress factor concentrations to obtain target pre-treatment resistance gene stress factor concentrations; input all the target pre-treatment resistance gene stress factor concentrations into the target resistance gene horizontal migration frequency prediction model for processing, and output the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample.
[0012] The fourth technical solution of the embodiment of the present invention is:
[0013] A computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the following steps:
[0014] Obtain a preset number of groups of target historical sample test data, and label all of the target historical sample test data; wherein each group of the target historical sample test data includes a target stress factor concentration corresponding to a target resistance gene stress factor and a target resistance gene horizontal migration frequency that matches the target stress factor concentration; preprocess each group of the target historical sample test data to obtain multiple groups of target historical preprocessed sample test data, wherein each group of the target historical preprocessed sample test data includes a target preprocessed stress factor concentration and a target preprocessed resistance gene horizontal migration frequency that matches the target preprocessed stress factor concentration; simultaneously input all of the target historical preprocessed sample test data into a target learner model to be trained for training and output target prediction result data, wherein the target learner model includes a first-layer learner and a second-layer learner, the first-layer learner being a plurality of different and independent target base learners, and the second-layer learner being a target meta-learner; judging whether the target learner model has been successfully trained based on the target prediction result data; if so, using the successfully trained target learner model as a target resistance gene horizontal migration frequency prediction model; or performing the following steps:
[0015] Obtain all target resistance gene stress factor concentrations corresponding to the target antibiotic water sample to be predicted; pre-treat all the target resistance gene stress factor concentrations to obtain target pre-treatment resistance gene stress factor concentrations; input all the target pre-treatment resistance gene stress factor concentrations into the target resistance gene horizontal migration frequency prediction model for processing, and output the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample.
[0016] Compared with the prior art, the present invention has the following beneficial effects:
[0017] In the model building stage of the embodiment of the present invention, a preset number of target historical sample test data are first obtained, and then each group of the target historical sample test data is preprocessed to obtain multiple groups of target historical preprocessed sample test data. Then, all of the target historical preprocessed sample test data are simultaneously input into the target learner model to be trained for training and output target prediction result data. The target learner model includes a first-layer learner and a second-layer learner. The first-layer learner is a plurality of different and independent target base learners, and the second-layer learner is a target meta-learner. Finally, according to the target prediction result data, it is judged whether the target learner model has been successfully trained. If so, the target learner model after successful training is used as the target resistance gene horizontal migration frequency prediction model.
[0018] In the prediction stage, the present invention inputs all the target pretreatment resistance gene stress factor concentrations into the target resistance gene horizontal migration frequency prediction model for processing, and outputs the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample. It can quickly evaluate the risk of antibiotic resistance gene horizontal migration under various water quality conditions of the water samples to be tested (pH, disinfectants, heavy metals and antibiotics and other organic substances), significantly improve the accuracy and reliability of the resistance gene horizontal migration frequency prediction, and provide strong support for the management and decision-making of the antibiotic resistance gene horizontal migration risk through the importance ranking of stress factors and the visualization of prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] in:
[0021] Figure 1 1 is a flowchart of an implementation method of a method for constructing a resistance gene horizontal migration prediction model in an embodiment;
[0022] Figure 2 FIG1 is a flow chart of an implementation method of an embodiment of a method for predicting the frequency of horizontal migration of antibiotic resistance genes in an embodiment;
[0023] Figure 3 A flowchart of a prediction model construction method for an embodiment of a resistance gene horizontal migration prediction model;
[0024] Figure 4 This is a ranking diagram of the importance of resistance gene stress factors in an embodiment of a method for predicting the horizontal migration frequency of antibiotic resistance genes;
[0025] Figure 5 This is a comparison chart of actual and predicted values of the horizontal migration frequency of antibiotic resistance genes in an embodiment of a method for predicting the horizontal migration frequency of antibiotic resistance genes;
[0026] Figure 6 This is a residual distribution diagram of the actual value and predicted value of the horizontal migration frequency of antibiotic resistance genes in an embodiment of a method for predicting the horizontal migration frequency of antibiotic resistance genes;
[0027] Figure 7 It is a structural block diagram of an implementation scheme of a computer device in one embodiment. DETAILED DESCRIPTION
[0028] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0029] See also Figure 1 , combined with Figure 1 It can be seen that the method for constructing the resistance gene horizontal migration prediction model in the embodiment of the present invention includes the following steps:
[0030] Step S101: Obtain a preset number of groups of target historical sample test data, and label all of the target historical sample test data; wherein each group of the target historical sample test data includes a target stress factor concentration corresponding to a target resistance gene stress factor and a target resistance gene horizontal migration frequency that matches the target stress factor concentration.
[0031] Among them, the target resistance gene stress factors include water pollutants such as heavy metals and disinfectants, and the type, quantity and concentration of the target resistance gene stress factors corresponding to each group of the above-mentioned target historical sample test data are different.
[0032] Among them, labeling all the target historical sample test data means marking the target stress factor concentration of each group and the target resistance gene horizontal migration frequency matching it to distinguish them from other data, and associating the target stress factor concentration of each group and the target resistance gene horizontal migration frequency matching it, and corresponding them one to one.
[0033] Among them, the preset number of groups can be selected to be more than 100 groups. The more historical sample test data of water samples, the more accurate the training results will be.
[0034] Step S102: preprocess each group of the target historical sample test data to obtain multiple groups of target historical preprocessed sample test data, wherein each group of the target historical preprocessed sample test data includes a target pretreatment stress factor concentration and a target pretreatment resistance gene horizontal migration frequency that matches the target pretreatment stress factor concentration.
[0035] The purpose of preprocessing each group of target historical sample test data is to delete unreasonable data from the original data. In addition, the preprocessing is to unify the data units and perform standardized conversion on the data to facilitate subsequent model training.
[0036] Step S103: All of the target historical preprocessing sample test data are simultaneously input into the target learner model to be trained for training and output target prediction result data, wherein the target learner model includes a first-layer learner and a second-layer learner, wherein the first-layer learner is a plurality of different and independent target base learners, and the second-layer learner is a target meta-learner.
[0037] Among them, this step uses the Stacking model to combine multiple base learners and meta-learners as the target learner model to be trained. The Stacking model is a model fusion algorithm. Its basic idea is to reduce the generalization error of a single model by combining the prediction results of multiple models. The Stacking model fusion method is widely used in machine learning. The core idea of the Stacking model fusion method is to use the output data of multiple base learners as new features and input them into a meta-learner for final prediction. The specific steps are as follows:
[0038] First, base learner training: First, multiple base learners (also called individual learners) are trained using the original data (all the target historical preprocessed sample test data). These base learners can be different types of models, such as random forests and support vector machines. Then, new features are generated: each base learner makes predictions on the training set and validation set, generating a new feature matrix. These feature matrices are composed of the prediction results of each base learner.
[0039] Second, meta-learner training: First, a meta-learner (also called the final model) is trained using the new feature matrix and the original labels. The meta-learner typically uses a simple but highly interpretable model, such as a decision tree or linear regression. Predictions are then made, and the output of the final model becomes the prediction of the stacking model.
[0040] Among them, Figure 3 As shown, the multiple base learners of the first layer learner in this step can be selected from three regression algorithms: random forest, GradientBoosting (gradient boosting) and XGBoost (optimized distributed gradient boosting library), and the meta learner of the second layer learner in this step can be selected from linear regression with regularization.
[0041] Step S104: judging whether the target learner model has been successfully trained based on the target prediction result data.
[0042] Among them, only when the target prediction result data shown meets the preset conditions can it be said that the target learner model has been successfully trained.
[0043] Step S105: If the target learner model has been successfully trained, the successfully trained target learner model is used as a target resistance gene horizontal migration frequency prediction model.
[0044] Among them, the target learner model after successful training can be directly used as a prediction model to predict the water samples for which the horizontal migration frequency of resistance genes is to be predicted.
[0045] In this embodiment, optionally, preprocessing each set of target historical sample test data to obtain multiple sets of target historical preprocessed sample test data includes:
[0046] First, delete the abnormal values of the horizontal migration frequency of the target resistance gene in each group of the target historical sample test data, where the order of magnitude of the abnormal values of the horizontal migration frequency of the target resistance gene is different from the order of magnitude of the remaining normal horizontal migration frequencies of the target resistance gene.
[0047] Table 1 below shows a portion of the target historical sample test data, totaling 12 sets of sample data. Copper, zinc, lead, glutaraldehyde, decanalium bromide, and a combination of glutaraldehyde and decanalium bromide are the target resistance gene stress factors; copper, zinc, and lead are heavy metals; and glutaraldehyde, decanalium bromide, and a combination of glutaraldehyde and decanalium bromide are disinfectants.
[0048]
[0049] Table 1
[0050] Among them, the different target resistance gene stress factors (copper, zinc, lead, glutaraldehyde, decanalium bromide and glutaraldehyde-decanalium bromide combination) in Table 1 are used as input features to predict the output variable (i.e., the horizontal migration frequency of the resistance gene).
[0051] Among them, for example, the data corresponding to number 8 in Table 1, since the horizontal migration frequency of the resistance gene of the target resistance gene stress factor has a large abnormal fluctuation compared with the values of other cases (3.99% is quite different from 25.43%, 28.16%, etc., which is not of the same order of magnitude, and there is obviously a large deviation, which is abnormal data), the entire row of number 8 is directly deleted, and the number of sample groups is changed from 12 to 11, which becomes the following Table 2.
[0052]
[0053] Table 2
[0054] Second, the number 0 is used to fill in the null value in the target stress factor concentration.
[0055] Among them, zinc, lead, decylmethylammonium bromide and glutaraldehyde-decylmethylammonium bromide composite in No. 1 in Table 1 are all null values, indicating that these types of stress factors are not present in this case, so the "0" value is directly used to supplement and obtain the data of No. 1 in Table 2.
[0056] Third, the average value of the horizontal migration frequency of the target resistance gene is used to supplement the null value of the horizontal migration frequency of the target resistance gene, and the average value of the horizontal migration frequency of the target resistance gene is the average value of all normal horizontal migration frequencies of the target resistance gene.
[0057] Among them, as in No. 11 in Table 1, the horizontal migration frequency of the resistance gene is a null value, so the average value of the horizontal migration frequency of the resistance gene of the collected data is calculated to be 31.43%, and the average value is filled in the null value. In Table 2, the data 31.43% in No. 11 is expressed as 0.3143.
[0058] Fourth, the concentration units of all target stress factors are unified as mg / L.
[0059] The concentration units of the collected data are all μg / mL, and the concentration units of all the target stress factors are unified into mg / L. The unified concentration values are conducive to training and ensure the consistency and comparability between the data.
[0060] Fifth, the numerical types of all the horizontal migration frequencies of the target resistance genes are unified into decimals.
[0061] Among them, if the horizontal migration frequency of the resistance gene in No. 1 is converted from 21.95% to the decimal form 0.2195, it will be beneficial for statistics and training.
[0062] In this embodiment, optionally, preprocessing each set of target historical sample test data to obtain multiple sets of target historical preprocessed sample test data includes:
[0063] The target stress factor concentration is standardized according to a target preset formula, and the target preset formula is:
[0064] Among them, x new is the target pretreatment stress factor concentration obtained after standardized conversion, x is the target stress factor concentration, μ is the average value of all the target stress factor concentrations, and is the standard deviation of all the target stress factor concentrations.
[0065] In this embodiment, optionally, the step of simultaneously inputting all of the target historical preprocessed sample test data into the target learner model to be trained for training and outputting target prediction result data includes:
[0066] First, all the target historical preprocessed sample test data are divided into a target preprocessed sample training data set and a target preprocessed sample test data set, wherein the number of groups in the target preprocessed sample training data set is greater than the number of groups in the target preprocessed sample test data set.
[0067] The number of the target preprocessed sample training data set may be selected to account for 80% of the total number of target historical preprocessed sample trials, and the number of the target preprocessed sample test data set may be selected to account for 20% of the total number of target historical preprocessed sample trials.
[0068] Second, the target preprocessed sample training data set and the target preprocessed sample test data set are simultaneously input into multiple different and independent target base learners corresponding to the first layer learner for training, and the target base learner training result data and the target base learner test result data are output.
[0069] Among them, Figure 3 As shown, the multiple different and independent target base learners corresponding to the first-layer learners are independent of each other, and their training does not interfere with each other. The training results output by each base learner are also independent of each other. Model 1, Model 2 and Model 3 are different from each other, and the output prediction results of Model 1, Model 2 and Model 3 are also independent of each other.
[0070] Third, the target base learner training result data and the target base learner test result data are input into the target meta-learner corresponding to the second-layer learner for training to obtain target training set prediction result data and target test set prediction result data, and the target training set prediction result data and the target test set prediction result data are collectively used as the target prediction result data.
[0071] The prediction results of Model 1, Model 2, and Model 3 constitute a new data set, which is then input into the target meta-learner corresponding to the second-layer learner for training. The prediction results of Model 1, Model 2, and Model 3 are each composed of the predicted frequency of horizontal migration of resistance genes output by the base learner and the target pretreatment stress factor concentration that matches it.
[0072] In this embodiment, optionally, judging whether the target learner model has been successfully trained based on the target prediction result data includes:
[0073] First, the target prediction result data is input into the following target preset verification formula for calculation to obtain the target verification result data;
[0074]
[0075] Second, determine whether the target result data meets the target conditions: R 2 Whether the absolute value of the difference between RMSE and MSE and 1 is less than the target preset regression coefficient difference threshold, and whether the absolute value of the difference between RMSE and MSE and the target preset verification value is less than the target preset variance difference threshold.
[0076] Among them, as shown in Table 3, it is one of the conditions that the target result data meets simultaneously. The training set in Table 3 corresponds to the target preprocessed sample training data set, and the test set in Table 3 corresponds to the target preprocessed sample test data set.
[0077]
[0078] Table 3
[0079] Third, if the target result data satisfies the target conditions at the same time, it is determined that the target learner model has been trained successfully.
[0080] Among them, y i represents the horizontal migration frequency of the target pretreatment resistance gene in the i-th group of the target historical pretreatment sample test data; represents the predicted value of the horizontal migration frequency of the resistance gene corresponding to the target pretreatment stress factor concentration of the i-th group of the target historical pretreatment sample test data; N represents the total number of samples corresponding to the target historical pretreatment sample test data; is the average value corresponding to the horizontal migration frequency of all the target pretreatment resistance genes, R 2 is the regression coefficient, RMSE is the root mean square error, and MSE is the mean square error.
[0081] See also Figure 2 , combined with Figure 2 It can be seen that a method for predicting the horizontal migration frequency of an antibiotic resistance gene in an embodiment of the present invention is implemented based on the target resistance gene horizontal migration frequency prediction model constructed by the method for constructing the resistance gene horizontal migration frequency prediction model according to any one of the above claims, and includes:
[0082] Step S201: Obtain the concentrations of all target resistance gene stress factors corresponding to the target antibiotic water sample to be predicted.
[0083] Step S202: pre-treating all the target resistance gene stress factor concentrations to obtain target pre-treated resistance gene stress factor concentrations.
[0084] The preprocessing method in this step is the same as that in the above step S102.
[0085] Step S203: inputting all the target pretreatment resistance gene stress factor concentrations into the target resistance gene horizontal migration frequency prediction model for processing, and outputting the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample.
[0086] In this embodiment, optionally, the step of inputting all of the target pretreatment resistance gene stress factor concentrations into the target resistance gene horizontal migration frequency prediction model for processing, and outputting the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample, followed by:
[0087] According to the predicted frequency of horizontal migration of the target antibiotic resistance gene, an importance ranking diagram of the target resistance gene stress factor corresponding to the target antibiotic water sample, a comparison diagram of the actual value and predicted value of the horizontal migration frequency of the target resistance gene, and a residual distribution diagram of the actual value and predicted value of the horizontal migration frequency of the target resistance gene are generated, such as Figure 4 、 5 and 6.
[0088] in, Figure 5 The actual value of the horizontal migration frequency of antibiotic resistance genes is the horizontal axis, and the predicted value is the vertical axis, so Python's p lt.scatter is used for plotting; Figure 6 The predicted value is the horizontal axis, the residual (that is, the actual value of the horizontal migration frequency of antibiotic resistance genes - the predicted value) is the vertical axis, and Python's plt.scatter is used for plotting.
[0089] In this embodiment, optionally, the pretreatment of all the target resistance gene stress factor concentrations to obtain the target pretreated resistance gene stress factor concentration comprises:
[0090] First, the null values in all the target resistance gene stress factor concentrations are supplemented with the number 0, and the concentration units of all the target resistance gene stress factor concentrations are unified into mg / L to obtain the target pretreatment resistance gene stress factor concentration data.
[0091] Second, all target resistance gene stress factor concentrations are standardized according to a target preset formula, which is:
[0092] Among them, x new is the target pretreatment stress factor concentration obtained after standardized conversion, x is the target stress factor concentration, μ is the average value of all the target stress factor concentrations, and is the standard deviation of all the target stress factor concentrations.
[0093] Figure 7FIG1 shows an internal structure diagram of a computer device in an embodiment. The computer device can be a terminal or a server. Figure 3 As shown, the computer device includes a processor, a memory and a network interface connected via a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor can implement the above-mentioned method for constructing a horizontal migration prediction model of resistance genes. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can execute the above-mentioned method for constructing a horizontal migration prediction model of resistance genes. Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0094] In another embodiment, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0095] Obtain a preset number of groups of target historical sample test data, and label all of the target historical sample test data; wherein each group of the target historical sample test data includes a target stress factor concentration corresponding to a target resistance gene stress factor and a target resistance gene horizontal migration frequency that matches the target stress factor concentration; preprocess each group of the target historical sample test data to obtain multiple groups of target historical preprocessed sample test data, wherein each group of the target historical preprocessed sample test data includes a target preprocessed stress factor concentration and a target preprocessed resistance gene horizontal migration frequency that matches the target preprocessed stress factor concentration; simultaneously input all of the target historical preprocessed sample test data into a target learner model to be trained for training and output target prediction result data, wherein the target learner model includes a first-layer learner and a second-layer learner, the first-layer learner being a plurality of different and independent target base learners, and the second-layer learner being a target meta-learner; judging whether the target learner model has been successfully trained based on the target prediction result data; if so, using the successfully trained target learner model as a target resistance gene horizontal migration frequency prediction model; or performing the following steps:
[0096] Obtain all target resistance gene stress factor concentrations corresponding to the target antibiotic water sample to be predicted; pre-treat all the target resistance gene stress factor concentrations to obtain target pre-treatment resistance gene stress factor concentrations; input all the target pre-treatment resistance gene stress factor concentrations into the target resistance gene horizontal migration frequency prediction model for processing, and output the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample.
[0097] In another embodiment, a computer-readable storage medium is provided, storing a computer program. When the computer program is executed by a processor, the processor is caused to perform the following steps:
[0098] Obtain a preset number of groups of target historical sample test data, and label all of the target historical sample test data; wherein each group of the target historical sample test data includes a target stress factor concentration corresponding to a target resistance gene stress factor and a target resistance gene horizontal migration frequency that matches the target stress factor concentration; preprocess each group of the target historical sample test data to obtain multiple groups of target historical preprocessed sample test data, wherein each group of the target historical preprocessed sample test data includes a target preprocessed stress factor concentration and a target preprocessed resistance gene horizontal migration frequency that matches the target preprocessed stress factor concentration; simultaneously input all of the target historical preprocessed sample test data into a target learner model to be trained for training and output target prediction result data, wherein the target learner model includes a first-layer learner and a second-layer learner, the first-layer learner being a plurality of different and independent target base learners, and the second-layer learner being a target meta-learner; judging whether the target learner model has been successfully trained based on the target prediction result data; if so, using the successfully trained target learner model as a target resistance gene horizontal migration frequency prediction model; or performing the following steps:
[0099] Obtain all target resistance gene stress factor concentrations corresponding to the target antibiotic water sample to be predicted; pre-treat all the target resistance gene stress factor concentrations to obtain target pre-treatment resistance gene stress factor concentrations; input all the target pre-treatment resistance gene stress factor concentrations into the target resistance gene horizontal migration frequency prediction model for processing, and output the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample.
[0100] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0101] In the model building stage of the embodiment of the present invention, a preset number of target historical sample test data are first obtained, and then each group of the target historical sample test data is preprocessed to obtain multiple groups of target historical preprocessed sample test data. Then, all of the target historical preprocessed sample test data are simultaneously input into the target learner model to be trained for training and output target prediction result data. The target learner model includes a first-layer learner and a second-layer learner. The first-layer learner is a plurality of different and independent target base learners, and the second-layer learner is a target meta-learner. Finally, according to the target prediction result data, it is judged whether the target learner model has been successfully trained. If so, the target learner model after successful training is used as the target resistance gene horizontal migration frequency prediction model.
[0102] In the prediction stage, the present invention inputs all the target pretreatment resistance gene stress factor concentrations into the target resistance gene horizontal migration frequency prediction model for processing, and outputs the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample. It can quickly evaluate the risk of antibiotic resistance gene horizontal migration under various water quality conditions of the water samples to be tested (pH, disinfectants, heavy metals and antibiotics and other organic substances), significantly improve the accuracy and reliability of the resistance gene horizontal migration frequency prediction, and provide strong support for the management and decision-making of antibiotic resistance gene migration risks through the importance ranking of stress factors and visualization of prediction results.
[0103] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0104] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.
Claims
1. A method for constructing a resistance gene horizontal migration frequency prediction model, characterized in that: include: Obtaining a preset number of target historical sample test data sets, and performing labeling processing on all of the target historical sample test data sets; wherein each set of the target historical sample test data sets includes a target stress factor concentration corresponding to a target resistance gene stress factor and a target resistance gene horizontal migration frequency that matches the target stress factor concentration; Preprocessing each set of the target historical sample test data to obtain multiple sets of target historical preprocessed sample test data, wherein each set of the target historical preprocessed sample test data includes a target pretreatment stress factor concentration and a target pretreatment resistance gene horizontal migration frequency that matches the target pretreatment stress factor concentration; All of the target historical preprocessed sample test data are simultaneously input into a target learner model to be trained for training and outputting target prediction result data, wherein the target learner model includes a first layer learner and a second layer learner, wherein the first layer learner is a plurality of different and independent target base learners, and the second layer learner is a target meta learner; Determining whether the target learner model has been successfully trained based on the target prediction result data; If so, the target learner model after successful training is used as the target resistance gene horizontal migration frequency prediction model.
2. The method for constructing a resistance gene horizontal migration frequency prediction model according to claim 1, wherein: The preprocessing of each set of target historical sample test data to obtain multiple sets of target historical preprocessed sample test data includes: Deleting abnormal values of the horizontal migration frequency of the target resistance gene in each group of the target historical sample test data, where the order of magnitude of the abnormal values of the horizontal migration frequency of the target resistance gene is different from the order of magnitude of the remaining normal horizontal migration frequencies of the target resistance gene; The number 0 is used to fill the empty value in the target stress factor concentration; The null value of the target resistance gene horizontal migration frequency is supplemented by the average value of the target resistance gene horizontal migration frequency, and the average value of the target resistance gene horizontal migration frequency is the average value of all normal target resistance gene horizontal migration frequencies; The concentration units of all target stress factors are unified as mg / L; The numerical types of all the horizontal migration frequencies of the target resistance genes are unified into decimals.
3. The method for constructing a resistance gene horizontal migration frequency prediction model according to claim 1, wherein: The preprocessing of each set of target historical sample test data to obtain multiple sets of target historical preprocessed sample test data includes: The target stress factor concentration is standardized according to a target preset formula, and the target preset formula is: ; in, is the target pretreatment stress factor concentration obtained after standardization conversion, is the target stress factor concentration, is the average value of all the target stress factor concentrations, is the standard deviation of all the target stress factor concentrations.
4. The method for constructing a resistance gene horizontal migration frequency prediction model according to claim 1, wherein: The step of simultaneously inputting all of the target historical preprocessed sample test data into the target learner model to be trained for training and outputting target prediction result data includes: Dividing all of the target historical preprocessed sample test data into a target preprocessed sample training data set and a target preprocessed sample test data set, wherein the number of groups in the target preprocessed sample training data set is greater than the number of groups in the target preprocessed sample test data set; Inputting the target preprocessed sample training data set and the target preprocessed sample test data set into a plurality of different and independent target base learners corresponding to the first layer learner for training at the same time, and outputting target base learner training result data and target base learner test result data; The target base learner training result data and the target base learner test result data are input into the target meta-learner corresponding to the second-layer learner for training to obtain target training set prediction result data and target test set prediction result data, and the target training set prediction result data and the target test set prediction result data are collectively used as the target prediction result data.
5. The method for constructing a resistance gene horizontal migration frequency prediction model according to claim 1, wherein: The step of determining whether the target learner model has been successfully trained based on the target prediction result data includes: The target prediction result data is input into the following target preset verification formula for calculation to obtain the target verification result data; (1); (2); (3); Determine whether the target verification result data meets the target conditions at the same time: Is the absolute value of the difference between and 1 less than the target preset regression coefficient difference threshold, and and Whether the absolute values of the differences from the target preset verification values are all less than the target preset variance difference threshold; If so, it is determined that the target learner model has been trained successfully; in, The target historical preprocessing sample test data is represented by The horizontal migration frequency of the target pretreatment resistance gene in the group; The target historical preprocessing sample test data is represented by The predicted value of the horizontal migration frequency of the resistance gene corresponding to the concentration of the target pretreatment stress factor; Indicates the total number of samples corresponding to the target historical preprocessing sample test data; is the average value corresponding to the horizontal migration frequency of all the target pretreatment resistance genes, is the regression coefficient, is the root mean square error, is the mean square error.
6. A method for predicting the horizontal migration frequency of antibiotic resistance genes, which is based on a target resistance gene horizontal migration frequency prediction model constructed by the method for constructing a resistance gene horizontal migration frequency prediction model according to any one of claims 1 to 5, characterized in that: include: Obtaining the concentrations of all target resistance gene stress factors corresponding to the target antibiotic water sample to be predicted; pre-treating all of the target resistance gene stress factor concentrations to obtain target pre-treated resistance gene stress factor concentrations; All the target pretreatment resistance gene stress factor concentrations are input into the target resistance gene horizontal migration frequency prediction model for processing, and the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample is output.
7. The method for predicting the frequency of horizontal migration of antibiotic resistance genes according to claim 6, characterized in that: The method further comprises: inputting all the target pretreatment resistance gene stress factor concentrations into the target resistance gene horizontal migration frequency prediction model for processing, and outputting the target antibiotic resistance gene horizontal migration prediction frequency corresponding to the target antibiotic water sample, and then comprising: According to the predicted frequency of horizontal migration of the target antibiotic resistance gene, an importance ranking diagram of target resistance gene stress factors corresponding to the target antibiotic water sample, a comparison diagram of the actual value and predicted value of the horizontal migration frequency of the target resistance gene, and a residual distribution diagram of the actual value and predicted value of the horizontal migration frequency of the target resistance gene are generated.
8. The method for predicting the frequency of horizontal migration of antibiotic resistance genes according to claim 6, characterized in that: The pre-treating of all the target resistance gene stress factor concentrations to obtain target pre-treated resistance gene stress factor concentrations comprises: The null values in all the target resistance gene stress factor concentrations are supplemented with the number 0, and the concentration units of all the target resistance gene stress factor concentrations are unified into mg / L to obtain the target pretreatment resistance gene stress factor concentration data; All target resistance gene stress factor concentrations are standardized according to a target preset formula, which is: ; in, is the target pretreatment stress factor concentration obtained after standardization conversion, is the target stress factor concentration, is the average value of all the target stress factor concentrations, and is the standard deviation of all the target stress factor concentrations.
9. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed by a processor, the processor executes the method for constructing a resistance gene horizontal migration frequency prediction model as described in any one of claims 1 to 5, or executes the method for predicting the antibiotic resistance gene horizontal migration frequency as described in any one of claims 6 to 8.
10. A computer device, characterized in that: It includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the method for constructing a resistance gene horizontal migration frequency prediction model as described in any one of claims 1 to 5, or executes the method for predicting the antibiotic resistance gene horizontal migration frequency as described in any one of claims 6 to 8.