A multi-model cooperative data prediction method and device
By employing a multi-model collaborative data prediction method and a prediction model jointly trained with total loss, the accuracy and consistency issues of deep learning models in both short-term and long-term predictions are resolved. This approach effectively handles nonlinear mapping relationships at different time scales and improves prediction accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TSINGHUA UNIVERSITY
- Filing Date
- 2026-04-17
- Publication Date
- 2026-06-26
AI Technical Summary
Existing deep learning models cannot simultaneously take into account both long-term cumulative trends and short-term fluctuations in data prediction, resulting in low prediction accuracy. Furthermore, prediction methods with a single scale cannot fully consider the nonlinear mapping relationship between scales.
A multi-model collaborative approach is adopted, which uses the total loss of the sub-loss corresponding to each prediction model and the consistency loss of the time period to jointly train the model. This ensures that the multiple prediction models refer to the nonlinear mapping relationship between multiple time scales during the training process, and run independently during the inference phase to ensure the consistency of the output results.
This improved the prediction accuracy of each prediction model, ensured the physical consistency of the prediction model outputs across different time periods, and enhanced the overall accuracy of data prediction.
Smart Images

Figure CN122286183A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of model training technology, and in particular to a method and apparatus for multi-model collaborative data prediction. Background Technology
[0002] Currently, with the application and development of deep learning technology in the field of data prediction, existing deep learning models can predict specific output data based on specific input data, such as predicting precipitation based on convolutional neural networks. However, existing prediction methods are usually single-scale regression problems, that is, predicting precipitation data for the next 24 hours based on precipitation data from the previous 24 hours (daily scale), and predicting precipitation data for the next 6 hours based on precipitation data from the previous 6 hours (sub-daily scale). They cannot simultaneously take into account long-term cumulative trends and short-term fluctuation characteristics based on a single model. Moreover, due to the single scale, existing prediction methods cannot fully consider the complex nonlinear mapping relationships between data at different scales, thus resulting in low prediction accuracy. Summary of the Invention
[0003] This invention provides a multi-model collaborative data prediction method and apparatus. It uses prediction models jointly trained based on the sub-losses corresponding to each prediction model and the total loss of the consistency loss corresponding to each prediction model for each time period to perform data prediction. This can ensure that multiple prediction models corresponding to different time periods refer to the nonlinear mapping relationship between multiple time scales during the training process. Even if multiple prediction models run independently in the inference stage, the physical consistency of the output results of each prediction model can be guaranteed, thereby improving the prediction accuracy of each prediction model.
[0004] This invention provides a multi-model collaborative data prediction method, comprising the following steps: acquiring a task to be predicted; the task to be predicted indicates a prediction time period and target data for prediction; determining a target prediction model from multiple pre-trained prediction models according to the prediction time period; wherein, the time periods corresponding to each prediction model are different, and each prediction model is jointly trained based on a total loss, the total loss including the sub-loss corresponding to each prediction model and the consistency loss of each prediction model corresponding to the time period; inputting the target data into the target prediction model, and outputting target prediction data corresponding to the target data.
[0005] Optionally, the prediction model includes a first prediction model corresponding to a first time period and a second prediction model corresponding to a second time period; wherein the sum of multiple second time periods matches the first time period. The first prediction model and the second prediction model are obtained through synchronous training via the following process: acquiring training data; the training data includes first historical data and first target data corresponding to a first time period, and second historical data and second target data corresponding to multiple second time periods respectively; inputting the training data into the first model, the second model, and the constraint model respectively to obtain first prediction data corresponding to the first time period, multiple second prediction data corresponding to the second time period, and multiple third prediction data corresponding to the second time period; the first model indicates a first mapping relationship between the first historical data and the first prediction data; the second model indicates a second mapping relationship between multiple second historical data and multiple second prediction data of the second time period; the constraint model indicates a third mapping relationship between the first historical data and multiple third prediction data; determining a first sub-loss corresponding to the first model, a second sub-loss corresponding to the second model, a constraint loss corresponding to the constraint model, and a consistency loss between the first model and the second model based on the first target data, the first prediction data, the second target data, the second prediction data, and the third prediction data; determining a total loss based on the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss; and adjusting the parameters of the first model and the second model respectively based on the total loss to obtain the first prediction model and the second prediction model.
[0006] Optionally, the training data further includes: trend feature data indicating local change trends of multiple second historical data; The step of inputting the training data into a first model, a second model, and a constraint model respectively to obtain first predicted data, second predicted data, and third predicted data includes: inputting the first historical data, the trend feature data, and the first target data into the first model; inputting the second historical data, the trend feature data, and the second target data into the second model; and inputting the first historical data and the second target data into the constraint model; and after a preset number of joint training sessions, obtaining the first predicted data output by the first model, the second predicted data output by the second model, and the third predicted data output by the constraint model.
[0007] Optionally, the trend feature data is obtained through the following process: determining the trend feature data based on the spatial mean and spatial standard deviation corresponding to multiple second historical data.
[0008] Optionally, determining the first sub-loss corresponding to the first model, the second sub-loss corresponding to the second model, the constraint loss corresponding to the constraint model, and the consistency loss based on the first target data, the first predicted data, the second target data, the second predicted data, and the third predicted data includes at least one of the following steps: The first sub-loss corresponding to the first model is calculated based on the difference between the first predicted data and the first target data. The second sub-loss corresponding to the second model is calculated based on the difference between the second predicted data and the second target data. Based on the difference between the third predicted data and the second target data, the constraint loss corresponding to the constraint model is calculated; The consistency loss is determined based on the difference between the fourth prediction data for multiple second time periods obtained by calculating the first prediction data through the third mapping relationship and the multiple second prediction data. The consistency loss is determined based on the difference between the fifth predicted data for the first time period obtained by summing multiple second predicted data and the first predicted data.
[0009] Optionally, determining the total loss based on the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss includes: obtaining the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss respectively; and performing a weighted summation based on the loss weights to obtain the total loss.
[0010] Optionally, obtaining the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss respectively includes: Based on homoscedasticity uncertainty, the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss are determined respectively. or, Based on the importance of the first model, the second model, and the constraint model in business applications, the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss are determined respectively.
[0011] Optionally, the consistency loss includes cyclic consistency loss and reconstruction consistency loss; determining the total loss based on the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss further includes: determining the cyclic consistency loss based on the difference between the fourth prediction data of multiple second time periods obtained by calculating the first prediction data through the third mapping relationship and the multiple second prediction data, and determining the reconstruction consistency loss based on the difference between the fifth prediction data of the first time period obtained by summing the multiple second prediction data and the first prediction data; determining the sub-weights corresponding to the cyclic consistency loss and the reconstruction consistency loss respectively; and performing a weighted summation of the cyclic consistency loss and the reconstruction consistency loss based on the sub-weights to obtain the consistency loss.
[0012] Optionally, the prediction model is constructed using at least one of the following network forms: convolutional long short-term memory network, convolutional gated recurrent unit, geospatial transformer, residual convolutional long short-term memory adversarial generative network, and long short-term memory U-shaped network with attention mechanism.
[0013] Optionally, for the precipitation prediction scenario, the first historical data is cumulative precipitation data, and the second historical data is hourly precipitation data; For flood forecasting scenarios, the first historical data is the cumulative flow, and the second historical data is the time-of-day flow data.
[0014] The present invention also provides a multi-model collaborative data prediction device, comprising the following modules: The acquisition module is used to acquire the task to be predicted; the task to be predicted indicates the prediction time period and the target data used for prediction. The determination module is used to determine the target prediction model from multiple pre-trained prediction models according to the prediction time period; wherein, the time period corresponding to each prediction model is different, and each prediction model is jointly trained based on the total loss, the total loss including the loss corresponding to each prediction model, the constraint loss corresponding to the constraint model, and the consistency loss between the prediction models. The output module is used to input the target data into the target prediction model and output the target prediction data corresponding to the target data.
[0015] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the multi-model collaborative data prediction method as described above.
[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the multi-model collaborative data prediction method as described above.
[0017] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the multi-model collaborative data prediction method as described above.
[0018] The present invention provides a multi-model collaborative data prediction method and apparatus, which uses prediction models jointly trained based on the sub-losses corresponding to each prediction model and the total loss of the consistency loss corresponding to each prediction model for each time period to perform data prediction. This can ensure that multiple prediction models corresponding to different time periods refer to the nonlinear mapping relationship between multiple time scales during the training process. Even if multiple prediction models run independently in the inference stage, the physical consistency of the output results of each prediction model can be guaranteed, thereby improving the prediction accuracy of each prediction model. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating the multi-model collaborative data prediction method provided by the present invention.
[0021] Figure 2 This is a schematic diagram illustrating the training process of the first and second prediction models provided by the present invention.
[0022] Figure 3 This is a schematic diagram of the process for determining the total loss provided by the present invention.
[0023] Figure 4 This is a schematic diagram of the structure of the multi-model collaborative data prediction method device provided by the present invention.
[0024] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0026] Figure 1 This is a flowchart illustrating the multi-model collaborative data prediction method provided by the present invention, as shown below. Figure 1 As shown, the method includes the following: Step 101: Obtain the task to be predicted; the task to be predicted indicates the prediction time period and the target data used for prediction. Step 102: Determine the target prediction model from multiple pre-trained prediction models based on the prediction time period; wherein, the time period corresponding to each prediction model is different, and each prediction model is jointly trained based on the total loss, which includes the sub-loss corresponding to each prediction model and the consistency loss of each prediction model corresponding to the time period. Step 103: Input the target data into the target prediction model and output the target prediction data corresponding to the target data.
[0027] In existing technologies, each prediction model typically calculates its loss value based on its own loss function and determines whether the prediction model has completed training based on the convergence of the loss value. However, since the input and output data of each prediction model are usually fixed, that is, the scale that the model can predict is singular, the trained model can only make data predictions for a specific time period based on the input data of a specific time period. For example, prediction model A can predict the precipitation data for the next 24 hours based on the cumulative precipitation data of the previous day (daily scale), and prediction model B can predict the precipitation time series data for the next 4 consecutive 6-hour periods based on the precipitation time series data of the previous day (sub-daily scale). However, for prediction models A and B, their prediction accuracy focuses solely on whether they can predict future time periods based on data from individual historical time periods. They do not consider the consistency of prediction results among multiple models. Specifically, the predicted cumulative precipitation data for the next 24 hours (e.g., 0:00-24:00) is consistent with the sum of the predicted precipitation data for four consecutive 6-hour periods (e.g., 0:00-6:00, 6:00-12:00, 12:00-18:00, 18:00-24:00). Ignoring this constraint, even if the prediction results of each independent model reach their intended accuracy, there will still be some deviation. Therefore, this embodiment of the invention addresses this deficiency by jointly training multiple prediction models. During training, it simultaneously considers the sub-losses corresponding to each prediction model and the consistency losses for each model corresponding to different time periods. This allows for optimization and correction of the models based on the consistency of prediction results across multiple models with different time periods, thereby further improving the model's prediction accuracy.
[0028] It should be noted that, in the embodiments of the present invention, multiple prediction models are preferably multiple models that predict the same data or indicator but have different corresponding time periods. For example, the aforementioned prediction model A and prediction model B are both models that predict precipitation, and they predict precipitation in different time periods. Only when predicting the same data or indicator and having different time periods will there be physical consistency between the results of multiple prediction models. When predicting different data or indicators, consistency loss can also be set based on the correlation (e.g., positive or negative correlation) between different data or indicators. The present invention does not make specific limitations on this and can make corresponding settings according to the actual situation.
[0029] In addition, the multiple prediction models in the embodiments of the present invention are jointly trained but independently inferred based on the total loss. That is, multiple prediction models are trained synchronously during the training process, while in the application inference process, the target prediction model that matches the prediction time period is determined from multiple pre-trained prediction models based on the prediction time period indicated by the task to be predicted, and the target data is directly input into the target prediction model for prediction.
[0030] In one optional embodiment, the data prediction method provided by this invention can be applied to various scenarios, and the predicted data can be set according to actual needs. Specifically, for the precipitation prediction scenario, the first historical data is cumulative precipitation data, and the second historical data is hourly precipitation data; for the flood prediction scenario, the first historical data is cumulative flow, and the second historical data is hourly flow data.
[0031] The training process of the prediction model in this embodiment of the invention is described in detail below. In one optional embodiment, there are two prediction models: a first prediction model corresponding to a first time period and a second prediction model corresponding to a second time period, to predict data for the first and second time periods respectively. The sum of multiple second time periods matches the first time period. For example, the first time period is 24 hours, and the second time period is 6 hours or 4 hours. When the second time period is 6 hours, the predicted data for 24 hours should match the data for four consecutive 6-hour periods; when the second time period is 4 hours, the predicted data for 24 hours should match the data for six consecutive 4-hour periods. Specifically, the training process of the first and second prediction models is as follows: Figure 2 As shown, it includes: Step 201: Obtain training data; the training data includes the first historical data and the first target data corresponding to the first time period, and the second historical data and the second target data corresponding to multiple second time periods respectively; In this invention, the first target data refers to the real data within the same time period corresponding to the first historical data, and the second target data refers to the real data within the same time period corresponding to the second historical data. For example, if the first historical data is the cumulative precipitation data for the previous day's 24 hours, and the first prediction model predicts the cumulative precipitation data for the next day's 24 hours, then the first target data is the actual cumulative precipitation data for the next day's 24 hours. Similarly, if the second historical data is the precipitation time series data for four consecutive 6-hour periods from the previous day, and the second prediction model predicts the precipitation time series data for four consecutive 6-hour periods from the next day, then the second target data is the actual precipitation time series data for four consecutive 6-hour periods from the next day. Since the prediction model in this embodiment includes a first prediction model corresponding to the first time period and a second prediction model corresponding to the second time period, the acquired training data also includes data corresponding to the first and second time periods respectively. It is understood that if there are three or more prediction models, the training data will be set accordingly based on the input data required by each prediction model.
[0032] Step 202: Input the training data into the first model, the second model, and the constraint model respectively to obtain the first predicted data corresponding to the first time period, multiple second predicted data corresponding to the second time period, and multiple third predicted data corresponding to the second time period; the first model indicates the first mapping relationship between the first historical data and the first predicted data; the second model indicates the second mapping relationship between multiple second historical data and multiple second predicted data of the second time period; the constraint model indicates the third mapping relationship between the first historical data and multiple third predicted data. The constraint model is specifically designed to enable joint training of the first and second models. Since both the first and second models make predictions for the same time period, they cannot learn the inherent relationship between different time periods. Therefore, in this embodiment of the invention, a constraint model is specially set up to independently learn the mapping relationship between the first historical data of the first time period and the third predicted data of the second time period. Subsequently, the constraint loss corresponding to the constraint model is added to the total loss to incorporate the constraint factors of different time periods into the training process of the first and second models.
[0033] For example, the training data in this embodiment of the invention is obtained based on IMERG-V7 global precipitation data in HDF5 format, with the original spatial resolution of 0.1° (data dimension) of IMERG-V7 reduced. The data is downsampled to a spatial resolution of 1°, and the matrix dimension for each data set can be defined as follows: (Among them, height) )width The time resolution is Hour.
[0034] Specifically, the obtained time-series data of four consecutive 6-hour precipitation events from the previous day are as follows: (Second historical data), the time series data of precipitation for four consecutive 6-hour periods on the following day are as follows: (Second target data) The cumulative precipitation data for the previous day's 24 hours can be calculated using the following formulas (1) and (2) respectively. (First historical data) and the actual cumulative precipitation data for the following 24 hours. (First target data).
[0035] Equation (1) Equation (2) In this step, in an optional embodiment, the training data further includes: trend feature data indicating the local change trends of multiple second historical data; the above step 202 may specifically include: inputting the first historical data, trend feature data and the first target data into the first model, inputting the second historical data, trend feature data and the second target data into the second model, and inputting the first historical data and the second target data into the constraint model; after a preset number of joint training sessions, obtaining the first predicted data output by the first model, the second predicted data output by the second model and the third predicted data output by the constraint model.
[0036] In the context of precipitation prediction, precipitation changes are slow and continuous based on cloud movement, without abrupt changes. Therefore, in this embodiment, incorporating trend feature data into the input data of the first and second models helps the models learn the continuity trend of precipitation, enabling precipitation prediction based on this trend feature data. For example, if the precipitation trend is gradually increasing, there is no possibility of a sudden cessation of precipitation, thereby adjusting the accuracy of the model's prediction. In an optional embodiment, the characteristic trend data in this embodiment is determined based on the spatial mean and spatial standard deviation corresponding to multiple second historical data.
[0037] For example, the local change trend corresponding to the last two adjacent second time periods among multiple second time periods can be determined first based on the following equation (3). Then, based on the local change trend, the spatial mean and standard deviation mean are calculated respectively, and the characteristic trend data are extracted based on formula (4). .
[0038] Equation (3) Equation (4) in, Represents the spatial mean operator. The spatial standard deviation operator is calculated based on equations (5) and (6) below, respectively.
[0039] Equation (5) Equation (6) in, Indicates the height of the precipitation data matrix. This indicates the width of the precipitation data matrix. The variable representing the height dimension of the precipitation matrix, The variable representing the width dimension of the precipitation matrix.
[0040] In summary, by inputting the acquired training data into the first model, the second model, and the constraint model respectively, the present invention can obtain the prediction data (i.e., the first prediction data, the second prediction data, and the third prediction data) corresponding to each model, so as to calculate the loss in the subsequent step 203.
[0041] Step 203: Based on the first target data, the first prediction data, the second target data, the second prediction data, and the third prediction data, determine the first sub-loss corresponding to the first model, the second sub-loss corresponding to the second model, the constraint loss corresponding to the constraint model, and the consistency loss between the first model and the second model. The calculation of the first loss, second loss, and constraint loss in this step can all be obtained based on the type of prediction model selected, using commonly used loss functions that match the prediction model in existing technologies, and calculated using the prediction data and target data. In one optional embodiment, a first sub-loss corresponding to the first model is calculated based on the difference between the first predicted data and the first target data; In one optional embodiment, the second sub-loss corresponding to the second model is calculated based on the difference between the second predicted data and the second target data; In one optional embodiment, the constraint loss corresponding to the constraint model is calculated based on the difference between the third predicted data and the second target data.
[0042] The prediction model is constructed using at least one of the following network forms: convolutional long short-term memory network, convolutional gated recurrent unit, geospatial transformer, residual convolutional long short-term memory adversarial generative network, and long short-term memory U-shaped network with attention mechanism.
[0043] Regarding consistency loss, in one optional embodiment, the consistency loss is determined by the difference between the fourth prediction data of multiple second time periods calculated from the first prediction data through a third mapping relationship and the multiple second prediction data. In another optional embodiment, the consistency loss is determined by the difference between the fifth prediction data of the first time period obtained by summing the multiple second prediction data and the first prediction data. Specifically, the consistency loss includes cyclic consistency loss and reconstruction consistency loss. The first embodiment refers to cyclic consistency loss, which can constrain the first prediction result output by the first model and the second prediction result output by the second model to be reversible. Specifically, since the constraint model can learn the third mapping relationship between the first time period and the second time period, after inputting the first prediction data into the constraint model, the fourth prediction data after the first time period calculated through the third mapping relationship is decomposed into multiple second time periods can be obtained. Then, by comparing the difference between the fourth prediction data and the second prediction data, it can be determined whether the first prediction data output by the first model and the second prediction data output by the second model are consistent. The second embodiment refers to reconstruction consistency loss, which can constrain whether the sum of the second prediction data of multiple second time periods output by the second model is consistent with the first prediction data output by the first model. It is understandable that in practical applications, both cycle consistency loss and reconstruction consistency loss can constrain the consistency of prediction results and can be selected according to actual needs. When the number of prediction models increases, it is also necessary to add other consistency losses that can constrain the consistency of results among multiple prediction models. This invention does not make specific limitations in this regard.
[0044] Step 204: Determine the total loss based on the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss; In an optional embodiment, this step specifically includes: obtaining the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss; and performing a weighted sum based on the loss weights to obtain the total loss. For example, the total loss function can be shown in equation (7) below: Equation (7) in, For the loss of the first child, For the loss of the second child, To limit losses, For cycle consistency loss, To reconstruct consistency loss, , , , as well as These are the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, the cycle consistency loss, and the reconstruction consistency loss, respectively. The cycle consistency loss and the reconstruction consistency loss can be calculated using the following equations (8) and (9), respectively: Equation (8) Equation (9) in, Representing the constraint model, This represents the first predicted data. This represents the fourth predicted data obtained by mapping the first predicted data through the third mapping relationship. This represents the second predicted data. This represents the sum of multiple second-prediction data.
[0045] In an alternative embodiment, the individual loss weights can be static hyperparameters ( In another alternative embodiment, the loss weights can also be dynamically adjusted. Specifically, the steps of obtaining the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss can include: (1) Determine the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss and the consistency loss based on the homoscedasticity uncertainty.
[0046] For example, the total loss function can be represented by the following equation (10): Equation (10) in, These are learnable noise parameters, representing the uncertainty of each term. When the first model is training stably and the loss is low, Automatic reduction increases the weight of this loss term; conversely, if it hinders convergence during time-series decomposition, its uncertainty increases. As the gradient increases, the corresponding loss weight will automatically decrease, thereby preventing gradient dominance from interfering with the training and optimization of other terms.
[0047] (2) Based on the importance of the first model, the second model and the constraint model in business applications, determine the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss and the consistency loss respectively.
[0048] For example, the first model, as the core prediction task (i.e., predicting the cumulative precipitation for the next 24 hours), is the most important and therefore has the largest corresponding loss weight. The constraining model is a self-supervised decomposition task that serves intermediate representation learning. The loss of the constraining model directly determines whether consistency constraints can be effectively implemented, so the loss weight of the constraining model is the second largest. The second model, as a refined time series prediction, is less important than the first model, but it still has a certain degree of importance. Therefore, its loss weight can be set to... , , As for consistency loss, the overall loss weight can be set to 1. When both cyclic consistency loss and reconstruction consistency loss exist, the sub-weights corresponding to cyclic consistency loss and reconstruction consistency loss are dynamically allocated.
[0049] In one optional embodiment, the process of determining the total loss based on the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss can also be as follows: Figure 3 As shown, it includes: Step 301: Determine the cycle consistency loss based on the difference between the fourth prediction data of multiple second time periods obtained by calculating the first prediction data through the third mapping relationship and the multiple second prediction data; and determine the reconstruction consistency loss based on the difference between the fifth prediction data of the first time period obtained by summing the multiple second prediction data and the first prediction data. Step 302: Determine the sub-weights corresponding to the cycle consistency loss and the reconstruction consistency loss, respectively; Step 303: Based on the sub-weights, perform a weighted summation of the cycle consistency loss and the reconstruction consistency loss to obtain the consistency loss.
[0050] Specifically, the cyclic consistency loss and the reconstruction consistency loss constrain different physical consistency paths, and their weights can be set independently to reflect different levels of confidence in bidirectional consistency. For example, the sub-weights corresponding to the cyclic consistency loss and the reconstruction consistency loss can be determined based on the confidence levels of the first and second models. For instance, when the prediction confidence of the first model is high, the sub-weights corresponding to the cyclic consistency loss are set higher, reinforcing the alignment of the second predicted data with the time-sharing results of the first predicted data. Conversely, if the prediction confidence of the second model is high, the sub-weights corresponding to the reconstruction consistency loss are set higher, forcing the first predicted data to conform to the sum of multiple second predicted data.
[0051] Step 205: Adjust the parameters of the first model and the second model according to the total loss to obtain the first prediction model and the second prediction model.
[0052] Specifically, in this embodiment of the invention, a gradient freezing backpropagation mechanism can be used for the cycle consistency loss, while a full gradient propagation backpropagation mechanism can be used for the reconstruction consistency loss. Specifically, when calculating the cycle consistency loss, the weights constraining the model can be frozen, and the gradient flow direction is: the first model receives the gradient. This forces the first predicted data output by the first model to be time-divided by the constrained model, and the second model receives the gradient. This forces the second model's output of the second predicted data to approximate the constraint model's splitting result of the first predicted data. The constraint model does not accept gradients, ensuring that it optimizes only through self-supervised loss and avoids interference from the optimization directions of the first and second models. When calculating the reconstruction consistency loss, since the reconstruction consistency loss also involves the reverse model of the constraint model, gradient masking is not required. At this time, the gradient flows simultaneously to the reverse model of the constraint model, the first model, and the second model, forming a closed-loop constraint.
[0053] The following is a detailed description of the process by which the first model and the second model are adjusted based on the total loss to obtain the first prediction model and the second prediction model according to the embodiments of the present invention. For example, the following optimization situations may exist: (1) Normal collaborative optimization At this point, the first sub-loss, the second sub-loss, and the constraint loss in the total loss function all decrease significantly, and the consistency loss also decreases. The specific optimization process is as follows: the constrained model learns the decomposition mapping from the first time period to the second time period through the constrained loss, and adjusts the accuracy of the decomposition-reconstruction inverse mapping through the reconstruction consistency loss; the first model is simultaneously constrained by the first sub-loss and the cyclic consistency loss for gradient optimization, and the second model is simultaneously constrained by the second sub-loss, the cyclic consistency loss and the reconstruction consistency loss for gradient optimization.
[0054] (2) Constraints on model pre-convergence stagnation At this point, the constraint loss is less than the convergence threshold, and the validation error is stable through the validation set. The specific optimization process is as follows: the constraint model enters a local optimum and enters an early stopping state, but the first model and the second model are continuously forced to adjust through the consistency loss so that their prediction results are adapted to the fixed constraint model.
[0055] (3) Counter-optimization period At this point, the first and second prediction results output by the first and second models, respectively, conflict and the conflict intensifies. The specific optimization process is as follows: consistency loss is used as the dominant optimization method. As the main component of the total loss, the parameter updates of the first and second models exhibit game-like characteristics, when When the consistency loss converges, the first and second models are considered to have transitioned from an adversarial state to a cooperative state.
[0056] (4) The dominant period of the main model At this point, the consistency loss has converged, but the loss corresponding to the first or second model, which is the main model, is still relatively high (e.g., the first sub-loss of the first model is too large due to precipitation during extreme typhoon weather). The specific optimization process is as follows: Since the consistency loss has disappeared, the first model is mainly driven by the first sub-loss, and we only need to focus on reducing the error between the first predicted data and the first target data.
[0057] (5) Global early termination At this point, the total loss on the validation set does not improve within the preset number of iterations, all model parameters are frozen, and the entire training cycle is terminated.
[0058] In summary, the multi-model collaborative data prediction method and apparatus provided in this embodiment of the invention use prediction models jointly trained based on the sub-losses corresponding to each prediction model and the total loss of the consistency loss corresponding to each prediction model for each time period to perform data prediction. This can ensure that multiple prediction models corresponding to different time periods refer to the nonlinear mapping relationship between multiple time scales during the training process. Even if multiple prediction models run independently in the inference stage, the physical consistency of the output results of each prediction model can be guaranteed, thereby improving the prediction accuracy of each prediction model.
[0059] The multi-model collaborative data prediction device provided by the present invention is described below. The multi-model collaborative data prediction device described below and the multi-model collaborative data prediction method described above can be referred to in correspondence.
[0060] like Figure 4 As shown, the multi-model collaborative data prediction device 400 provided by the present invention may specifically include: The acquisition module 401 is used to acquire the task to be predicted; the task to be predicted indicates the prediction time period and the target data used for prediction. The determining module 402 is used to determine the target prediction model from multiple pre-trained prediction models according to the prediction time period; wherein, the time period corresponding to each prediction model is different, and each prediction model is jointly trained based on the total loss, the total loss including the loss corresponding to each prediction model, the constraint loss corresponding to the constraint model, and the consistency loss between the prediction models. The output module 403 is used to input the target data into the target prediction model and output target prediction data corresponding to the target data.
[0061] In an optional embodiment of the present invention, the prediction model includes a first prediction model corresponding to a first time period and a second prediction model corresponding to a second time period; wherein the sum of multiple second time periods matches the period of the first time period; the multi-model collaborative data prediction device 400 further includes a training module, wherein the first prediction model and the second prediction model are synchronously trained by the training module through the following process: acquiring training data; the training data includes first historical data and first target data corresponding to the first time period, and second historical data and second target data corresponding to multiple second time periods respectively; inputting the training data into the first model, the second model and the constraint model respectively to obtain the first prediction data corresponding to the first time period and the second prediction model corresponding to the second time period. The system comprises multiple second predicted data points and multiple third predicted data points corresponding to a second time period; the first model indicates a first mapping relationship between the first historical data and the first predicted data; the second model indicates a second mapping relationship between multiple second historical data points and multiple second predicted data points for a second time period; the constraint model indicates a third mapping relationship between the first historical data and the multiple third predicted data points; based on the first target data, the first predicted data, the second target data, the second predicted data, and the third predicted data, the system determines a first sub-loss corresponding to the first model, a second sub-loss corresponding to the second model, a constraint loss corresponding to the constraint model, and a consistency loss between the first model and the second model; based on the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss, the system determines a total loss; based on the total loss, the system adjusts the parameters of the first model and the second model respectively to obtain a first prediction model and a second prediction model.
[0062] In an optional embodiment of the present invention, the training data further includes: trend feature data indicating the local change trends of multiple second historical data; the training module is further configured to: input the first historical data, the trend feature data, and the first target data into the first model, input the second historical data, the trend feature data, and the second target data into the second model, and input the first historical data and the second target data into the constraint model; and after a preset number of joint training sessions, obtain the first predicted data output by the first model, the second predicted data output by the second model, and the third predicted data output by the constraint model.
[0063] In an optional embodiment of the present invention, the trend feature data is obtained through the following process: determining the trend feature data based on the spatial mean and spatial standard deviation corresponding to a plurality of second historical data.
[0064] In an optional embodiment of the present invention, the training module is further configured to perform at least one of the following steps: The first sub-loss corresponding to the first model is calculated based on the difference between the first predicted data and the first target data. The second sub-loss corresponding to the second model is calculated based on the difference between the second predicted data and the second target data. Based on the difference between the third predicted data and the second target data, the constraint loss corresponding to the constraint model is calculated; The consistency loss is determined based on the difference between the fourth prediction data for multiple second time periods obtained by calculating the first prediction data through the third mapping relationship and the multiple second prediction data. The consistency loss is determined based on the difference between the fifth predicted data for the first time period obtained by summing multiple second predicted data and the first predicted data.
[0065] In an optional embodiment of the present invention, the training module is further configured to obtain the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss respectively; and perform a weighted summation based on the loss weights to obtain the total loss.
[0066] In an optional embodiment of the present invention, the training module is further configured to: determine the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss based on homoscedasticity uncertainty; or, determine the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss based on the importance of the first model, the second model, and the constraint model in business applications.
[0067] In an optional embodiment of the present invention, the consistency loss includes a cyclic consistency loss and a reconstruction consistency loss; the training module is further configured to: determine the cyclic consistency loss based on the difference between the fourth prediction data of multiple second time periods calculated from the first prediction data through the third mapping relationship and the multiple second prediction data; determine the reconstruction consistency loss based on the difference between the fifth prediction data of the first time period obtained by summing the multiple second prediction data and the first prediction data; determine the sub-weights corresponding to the cyclic consistency loss and the reconstruction consistency loss respectively; and perform a weighted summation of the cyclic consistency loss and the reconstruction consistency loss based on the sub-weights to obtain the consistency loss.
[0068] In an optional embodiment of the present invention, the training module is further configured to determine the sub-weights corresponding to the cycle consistency loss and the reconstruction consistency loss, respectively, based on the confidence levels of the first model and the second model.
[0069] In an optional embodiment of the present invention, the prediction model is constructed using at least one of the following network forms: convolutional long short-term memory network, convolutional gated recurrent unit, geospatial-temporal transformer, residual convolutional long short-term memory adversarial generative network, and long short-term memory U-shaped network with attention mechanism.
[0070] In an optional embodiment of the present invention, for a precipitation prediction scenario, the first historical data is cumulative precipitation data and the second historical data is hourly precipitation data; for a flood prediction scenario, the first historical data is cumulative flow and the second historical data is hourly flow data.
[0071] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, communications interface 520, and memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a multi-model collaborative data prediction method. This method includes: acquiring a task to be predicted; the task to be predicted indicates a prediction time period and target data for prediction; determining a target prediction model from multiple pre-trained prediction models according to the prediction time period; wherein the time periods corresponding to each prediction model are different, and each prediction model is jointly trained based on a total loss, the total loss including sub-losses corresponding to each prediction model and consistency losses corresponding to each prediction model for the time period; inputting the target data into the target prediction model, and outputting target prediction data corresponding to the target data.
[0072] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0073] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the multi-model collaborative data prediction method provided by the above methods. The method includes: acquiring a task to be predicted; the task to be predicted indicates a prediction time period and target data for prediction; determining a target prediction model from multiple pre-trained prediction models according to the prediction time period; wherein the time periods corresponding to each prediction model are different, and each prediction model is jointly trained based on a total loss, the total loss including the sub-loss corresponding to each prediction model and the consistency loss of each prediction model corresponding to the time period; inputting the target data into the target prediction model, and outputting target prediction data corresponding to the target data.
[0074] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a multi-model collaborative data prediction method provided by the methods described above. The method includes: acquiring a task to be predicted; the task to be predicted indicating a prediction time period and target data for prediction; determining a target prediction model from multiple pre-trained prediction models according to the prediction time period; wherein the time periods corresponding to each prediction model are different, and each prediction model is jointly trained based on a total loss, the total loss including sub-losses corresponding to each prediction model and consistency losses corresponding to each prediction model for the time period; inputting the target data into the target prediction model, and outputting target prediction data corresponding to the target data.
[0075] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0076] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for data prediction based on multi-model cooperation, characterized in that, include: Obtain the task to be predicted; The task to be predicted indicates the prediction time period and the target data used for prediction; The target prediction model is determined from multiple pre-trained prediction models based on the prediction time period; wherein, the time period corresponding to each prediction model is different, and each prediction model is jointly trained based on the total loss, which includes the sub-loss corresponding to each prediction model and the consistency loss of each prediction model corresponding to the time period. The target data is input into the target prediction model, and the target prediction data corresponding to the target data is output.
2. The multi-model collaborative data prediction method according to claim 1, characterized in that, The prediction model includes a first prediction model corresponding to a first time period and a second prediction model corresponding to a second time period; wherein the sum of multiple second time periods matches the first time period. The first prediction model and the second prediction model are obtained through synchronous training via the following process: Acquire training data; the training data includes first historical data and first target data corresponding to a first time period, and second historical data and second target data corresponding to multiple second time periods respectively; The training data is input into a first model, a second model, and a constraint model, respectively, to obtain first predicted data corresponding to a first time period, multiple second predicted data corresponding to a second time period, and multiple third predicted data corresponding to a second time period. The first model indicates a first mapping relationship between the first historical data and the first predicted data. The second model indicates a second mapping relationship between multiple second historical data and multiple second predicted data for the second time period. The constraint model indicates a third mapping relationship between the first historical data and the multiple third predicted data. Based on the first target data, the first predicted data, the second target data, the second predicted data, and the third predicted data, determine the first sub-loss corresponding to the first model, the second sub-loss corresponding to the second model, the constraint loss corresponding to the constraint model, and the consistency loss between the first model and the second model; The total loss is determined based on the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss; The parameters of the first model and the second model are adjusted according to the total loss to obtain the first prediction model and the second prediction model.
3. The multi-model collaborative data prediction method according to claim 2, characterized in that, The training data also includes: trend feature data indicating the local change trends of multiple second historical data; The step of inputting the training data into the first model, the second model, and the constraint model respectively to obtain the first prediction data, the second prediction data, and the third prediction data includes: The first historical data, the trend feature data, and the first target data are respectively input into the first model; the second historical data, the trend feature data, and the second target data are input into the second model; and the first historical data and the second target data are input into the constraint model. After a preset number of joint training sessions, the first predicted data output by the first model, the second predicted data output by the second model, and the third predicted data output by the constraint model are obtained.
4. The multi-model collaborative data prediction method according to claim 3, characterized in that, The trend characteristic data is obtained through the following process: The trend feature data is determined based on the spatial mean and spatial standard deviation corresponding to multiple second historical data.
5. The multi-model collaborative data prediction method according to claim 2, characterized in that, The step of determining the first sub-loss corresponding to the first model, the second sub-loss corresponding to the second model, the constraint loss corresponding to the constraint model, and the consistency loss based on the first target data, the first predicted data, the second target data, the second predicted data, and the third predicted data includes performing at least one of the following steps: The first sub-loss corresponding to the first model is calculated based on the difference between the first predicted data and the first target data. The second sub-loss corresponding to the second model is calculated based on the difference between the second predicted data and the second target data. Based on the difference between the third predicted data and the second target data, the constraint loss corresponding to the constraint model is calculated; The consistency loss is determined based on the difference between the fourth prediction data for multiple second time periods obtained by calculating the first prediction data through the third mapping relationship and the multiple second prediction data. The consistency loss is determined based on the difference between the fifth predicted data for the first time period obtained by summing multiple second predicted data and the first predicted data.
6. The multi-model collaborative data prediction method according to claim 2, characterized in that, The step of determining the total loss based on the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss includes: Obtain the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss, respectively. The total loss is obtained by weighted summation based on the loss weights.
7. The multi-model collaborative data prediction method according to claim 6, characterized in that, The step of obtaining the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss includes: Based on homoscedasticity uncertainty, the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss are determined respectively. or, Based on the importance of the first model, the second model, and the constraint model in business applications, the loss weights corresponding to the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss are determined respectively.
8. The multi-model collaborative data prediction method according to claim 2, characterized in that, The consistency loss includes cyclic consistency loss and reconstruction consistency loss; determining the total loss based on the first sub-loss, the second sub-loss, the constraint loss, and the consistency loss further includes: The cyclic consistency loss is determined based on the difference between the fourth prediction data of multiple second time periods obtained by calculating the first prediction data through the third mapping relationship and the multiple second prediction data; and the reconstruction consistency loss is determined based on the difference between the fifth prediction data of the first time period obtained by summing the multiple second prediction data and the first prediction data. Determine the sub-weights corresponding to the cycle consistency loss and the reconstruction consistency loss, respectively; The consistency loss is obtained by weighted summation of the cyclic consistency loss and the reconstruction consistency loss based on the sub-weights.
9. The multi-model collaborative data prediction method according to claim 1, characterized in that, The prediction model is constructed using at least one of the following network forms: Convolutional Long Short-Term Memory Network, Convolutional Gated Recurrent Unit, Earth Spatiotemporal Transformer, Residual Convolutional Long Short-Term Memory Adversarial Generative Network, and Long Short-Term Memory U-Shaped Network with Attention Mechanism.
10. A multi-model collaborative data prediction device, characterized in that, include: The acquisition module is used to acquire the task to be predicted; the task to be predicted indicates the prediction time period and the target data used for prediction. The determination module is used to determine the target prediction model from multiple pre-trained prediction models according to the prediction time period; wherein, the time period corresponding to each prediction model is different, and each prediction model is jointly trained based on the total loss, the total loss including the loss corresponding to each prediction model, the constraint loss corresponding to the constraint model, and the consistency loss between the prediction models. The output module is used to input the target data into the target prediction model and output the target prediction data corresponding to the target data.