A data prediction method and apparatus
By combining multiple sub-models and correction models in the prediction method, the problem of insufficient accuracy of artificial intelligence models in predicting complex chaotic systems is solved, achieving higher accuracy and reliability in data prediction and adapting to prediction needs at different time scales.
Patent Information
- Application Number
- CN202510581644.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-06
- Publication Date
- 2026-11-06
AI Technical Summary
In existing technologies, artificial intelligence models have limited accuracy when predicting the future state of complex chaotic systems, resulting in low reliability of the prediction process.
A combined prediction method using multiple sub-models and at least one first correction model is adopted. By acquiring first data and time information, multiple sub-models are used for inference, and the first correction model is used to correct the data output by the sub-models, thereby improving the accuracy and reliability of the prediction results.
By combining multiple sub-models with calibration models, the accuracy and reliability of data prediction can be improved, the prediction needs of different time scales can be adapted, error accumulation can be reduced, and the usability and practicality of prediction results can be enhanced.
Smart Images

Figure CN123050699A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence (AI) technology, and in particular to a data prediction method and apparatus. Background Technology
[0002] In fields such as meteorological disaster early warning, energy management, agricultural planning, and traffic scheduling, it is often necessary to infer and predict the state of complex chaotic systems at future points in time (such as weeks, months, or even years later) in order to take appropriate countermeasures in a timely manner to reduce losses. Currently, artificial intelligence models can be used to predict the future state of systems, but the inference accuracy of these models is limited, resulting in low overall reliability of the prediction process. Summary of the Invention
[0003] This application provides a data prediction method to improve the reliability of data prediction. This application also provides corresponding apparatus, computer-readable storage media, and computer program products.
[0004] The first aspect of this application provides a data prediction method, which can be executed by a terminal device or a cloud system. The method includes: acquiring first data and time information; wherein the time information is used to indicate the time for predicting future data related to the first data; inputting the first data into a prediction model; wherein the prediction model includes multiple sub-models and at least one first correction model, the multiple sub-models corresponding to at least one time step, the time step being used to indicate the time length for which the sub-models predict the data, each of the multiple sub-models being used to predict second data corresponding to the time step, the second data output by each sub-model being related to the first data, and at least one first correction model being used to correct the second data output by each sub-model; and outputting a prediction result, the prediction result being obtained based on at least one of the multiple second data output by the multiple sub-models, the prediction result being used to indicate future data.
[0005] In this application, the first data may include one or more data observed before a reference time, where the reference time may be the time of the most recently observed historical data, and the future data may be data after the reference time. The first data is related to the future data; for example, if the first data is a meteorological parameter, then the future data is also a meteorological parameter. Here, time information can be used to indicate the time of the future data, and the time information may include at least two of the following: reference time, second time, and first time length; wherein, the second time is the time of the future data to be predicted, and the first time length is the time length between the reference time and the second time.
[0006] In this application, the data prediction task can be triggered by the user through the interactive interface of the terminal device, and the first data and time information can also be actively submitted by the user through the terminal device; the data prediction task can also be triggered by the relevant system (or device) according to a preset schedule, and the first data can be obtained by the terminal device from local memory according to the task, or the terminal device can obtain it from the cloud (such as a server, online website, etc.); this application does not limit the method of obtaining the first data; the time information can be determined according to the information of the prediction task.
[0007] In this application, the prediction model can be obtained by combining multiple sub-models and at least one first correction model. Each sub-model can output prediction data (second data) of a corresponding time length, and the first correction model can be used to correct the output of the sub-model. The first correction model corresponding to each sub-model can be trained based on the sub-model with higher inference accuracy, and can correct the results from the output level. Specifically, the sub-model with higher inference accuracy is the sub-model with a shorter time step. In some cases, each sub-model in the multiple sub-models can correspond to a first correction model.
[0008] The solution provided in the first aspect above can use multiple sub-models in the prediction model for inference. In this process, the first correction model will correct the data output by each sub-model. Compared with the data before correction, the corrected data can obtain more accurate prediction results, which helps to improve the reliability of data prediction.
[0009] In one possible implementation, the method further includes: selecting multiple sub-models from a database based on time information, and at least one first correction model corresponding to the multiple sub-models; combining the multiple sub-models and at least one first correction model to obtain a prediction model.
[0010] In this application, the database may include multiple sub-models with different time steps and at least one first calibration model. The multiple sub-models are trained based on the same or different backbone networks, and the first calibration model corresponding to each sub-model is trained based on that sub-model and at least one sub-model with a smaller time step.
[0011] In this application, the time information may include a first time length, or information required to determine the first time length; based on the first time length, the selection criteria for the sub-model can be determined, and based on the selection criteria, multiple sub-models can be selected from the database.
[0012] In this application, the prediction model can be obtained by combining multiple determined sub-models and at least one first correction model in a specific arrangement.
[0013] In this possible implementation, appropriate sub-models can be selected from the database for different time scales, thereby enabling dynamic adjustment of the prediction model according to specific prediction needs, which helps to improve the flexibility and adaptability of data prediction methods.
[0014] In one possible implementation, the first time length indicated by the time information is the sum of the time steps of each of the multiple sub-models; correspondingly, the multiple sub-models and at least one first correction model in the prediction model are arranged alternately in the order of sub-model first and first correction model second, wherein the input of each first correction model is the output of the previous sub-model, and the output of each first correction model is the input of the next sub-model.
[0015] In this application, the first time length can be the sum of the time steps of each of the multiple sub-models as a selection criterion to determine multiple sub-models and at least one first correction model from the database; for example, based on the selection criterion, a greedy algorithm or a dynamic programming algorithm can be used to determine the minimum number of multiple sub-models required from the database.
[0016] In this application, the multiple sub-models and at least one first correction model in the prediction model are arranged alternately in the order of sub-model first and first correction model second; that is, the various sub-models and the first correction model in the prediction model can be connected in a serial arrangement. When making data prediction, each sub-model can predict future data for a certain time, and the next sub-model can make a prediction for the next time based on the prediction data of the previous sub-model.
[0017] In this possible implementation, multiple sub-models and at least one first correction model in the prediction model are arranged alternately in the order of sub-model first and first correction model last. This allows the first correction model to be used to correct the prediction immediately after each sub-model, reducing the accumulation of errors in subsequent processing and helping to improve the accuracy and reliability of data prediction.
[0018] In one possible implementation, the input to the first sub-model in the prediction model is the first data, and the prediction result is the second data output by the last sub-model in the prediction model.
[0019] In this application, the first data is used as the input to the first sub-model in the prediction model; that is, when using the above prediction model to perform data prediction, the first data required for the data prediction process can be determined based on the first sub-model in the prediction model.
[0020] In this possible implementation, during data prediction, the first sub-model in the prediction model takes the first data as input and outputs the second data, which can then be used as input for the next first correction model. In other words, this method divides the data prediction process into stages, with each sub-model predicting one stage at a time, gradually predicting the required future data. In this way, it is possible to predict future data with a long time horizon and achieve long-term prediction.
[0021] In one possible implementation, the first time length indicated by the time information is less than or equal to the time step of each of the multiple sub-models; correspondingly, the multiple sub-models in the prediction model are arranged in parallel, and the output of each sub-model is the input of a first correction model.
[0022] In this application, the first time length can be less than or equal to the time step length of each of the multiple sub-models as a selection criterion, and multiple sub-models with a time step length less than the first time step length can be selected from the database.
[0023] In this application, when making data predictions, each sub-model in the prediction model can independently make data predictions for the required future data, and the output of the sub-model can be corrected using at least one first correction model.
[0024] In this possible implementation, multiple sub-models in the prediction model can be combined in parallel. During data prediction, each sub-model directly predicts future data at the same time. That is, multiple sub-models run in parallel and can correct the output through the first correction model. Since the input of the sub-model does not depend on the output of the previous step, the accumulation of errors can be avoided, which helps to improve the accuracy and reliability of data prediction.
[0025] In one possible implementation, the input to each sub-model in the prediction model is first data, and the prediction result includes multiple third data corresponding to multiple second data. The third data are the second data corrected by the first correction model corresponding to each sub-model.
[0026] In this application, the first data corresponding to each sub-model needs to be determined by the time step corresponding to the sub-model; specifically, for a certain sub-model, the time of the first data required by the sub-model can be obtained by backtracking the time length corresponding to the time of future data.
[0027] The prediction results include multiple third data points corresponding to multiple second data points. For example, each of the multiple second data points can correspond to one third data point; or, for example, multiple second data points of the same size can correspond to one third data point, and multiple second data points of different sizes can each correspond to one third data point.
[0028] In this possible implementation, each sub-model can directly predict future data at the same time based on the corresponding first data, and the output of each sub-model is corrected by at least one first correction model; then, multiple third data can be determined based on multiple second data; by integrating the outputs of different sub-models, more robust prediction results can be obtained, and the usability of the prediction results can be improved.
[0029] In one possible implementation, the prediction results also include the probabilities of different types of future data indicated by multiple third-party data.
[0030] In this application, the type of future data is related to the application field of the data prediction method. For example, if the future data is related to meteorology, then the type of future data is also related to meteorology. For example, if the future data is precipitation, then the type of future data can be one of no rain, light rain, moderate rain, heavy rain, and rainstorm.
[0031] In this possible implementation, the prediction results can also include the probabilities of different types of future data indicated by third data. Compared with prediction results that only include multiple third data, the above method can enhance the interpretability of the results through probabilistic prediction, which helps to improve the practicality of data prediction and decision support capabilities.
[0032] In one possible implementation, the first data is meteorological parameters.
[0033] In this application, the data prediction method can be applied to the field of meteorological forecasting, where the first data is a meteorological-related parameter; for example, the first data can be parameters such as precipitation, humidity, temperature, air pressure, wind speed, wind direction, dew point temperature, or cloud cover.
[0034] In one possible implementation, the data prediction method can be applied to the field of energy management, where the first data is energy-related parameters; for example, the first data can be parameters such as electricity consumption and renewable energy power generation.
[0035] In one possible implementation, the data prediction method can be applied to the field of agricultural planning, where the first data is agricultural-related parameters; for example, the first data can be parameters such as crop yield, pest and disease records, and crop type.
[0036] In one possible implementation, the data prediction method can be applied to the field of traffic scheduling, where the first data is traffic-related parameters; for example, the first data can be parameters such as vehicle flow, pedestrian flow, and frequency of traffic accidents.
[0037] A second aspect of this application provides a model training method, which can be executed by a terminal device or a cloud system. The method includes: acquiring first output data of a first sub-model and second output data of a second sub-model, wherein the first output data and the second output data correspond to the same time, and the time step of the second sub-model is smaller than the time step of the first sub-model; inputting the first output data into a second calibration model to obtain third output data; and updating the second calibration model based on the second output data and the third output data to obtain a first calibration model.
[0038] In this application, the second calibration model is the initial calibration model (i.e., the calibration model before training).
[0039] In one possible implementation, the second correction model may include a feature fusion module, a patch embedding module, a self-attention module, and a multilayer perception layer module, each of which may include one or more layers. The feature fusion module takes the first output data as input and is specifically used to enhance the details of the prediction; for example, it can retain high-frequency information in the first output data through residual connections or multi-scale feature fusion. The patch embedding module takes the output of the feature fusion module as input and is specifically used to divide the output of the feature fusion module into multiple small patches and map them to a low-dimensional vector sequence. The self-attention module takes the low-dimensional vector sequence output by the patch embedding module as input and is specifically used to calculate the global dependencies between patches. The multilayer perception layer module takes the output of the self-attention module as input and is specifically used to enhance nonlinear expressive power and refine the details of the prediction. The data output by the multilayer perception layer module is restored to the same dimension as the first output data to obtain the third output data.
[0040] In one possible implementation, the second correction model can be a linear regression model.
[0041] In this application, the loss during training can be determined based on the distance between the second output data and the third output data, and the parameters of the second calibration model can be updated based on this loss (e.g., through backpropagation) to obtain the first calibration model. In other words, the training process of the first calibration model is performed using the second output data as the true value.
[0042] In this application, the first correction model trained based on the above process is the first correction model corresponding to the first sub-model; when performing data prediction, the first correction model can be used to correct the output of the first sub-model.
[0043] In one possible implementation, during the training of the first calibration model corresponding to the first sub-model, a second sub-model can be used in conjunction with the first sub-model.
[0044] In one possible implementation, during the training of the first calibration model corresponding to the first sub-model, multiple second sub-models can be used in conjunction with the first sub-model. Specifically, the first calibration model can be trained using the first second sub-model and the first sub-model. Based on this, the first calibration model can be trained again using the next second sub-model and the first sub-model to obtain an updated first calibration model. Each second sub-model can train the previously updated first calibration model, and the first calibration model trained by the last second sub-model is the first calibration model used in the actual data prediction process.
[0045] The solution provided in the second aspect above can use the sub-model with a small time step (the second sub-model) as a benchmark to update the second correction model and obtain the first correction model corresponding to the sub-model with a large time step (the first sub-model). The inference accuracy of the sub-model with a small time step is often higher than that of the sub-model with a large time step. Therefore, the first correction model trained according to the above method can correct the output of the first sub-model to a more accurate result, thereby improving the prediction accuracy of the first sub-model.
[0046] In one possible implementation, updating the second correction model based on the second output data and the third output data to obtain the first correction model includes: determining the training loss based on the distance between the second output data and the third output data; and updating the second correction model based on the training loss to obtain the first correction model.
[0047] In this application, the training loss can be determined based on the second output data, the third output data, and a preset loss function.
[0048] For example, the difference between the second and third output data can be used as the training loss.
[0049] For example, the difference between the residual corresponding to the second output data and the residual corresponding to the third output data can be used as the training loss. In this example, the corresponding loss function can be expressed as follows:
[0050]
[0051] Among them, L adjusted Let N represent the loss during the training of the first calibration model, and let N represent the number of samples used by the second calibration model in this iteration. m1 (t i ) represents the second output data corresponding to the i-th sample and the corresponding label result (i.e., time t). iThe difference (also called residual) between the corresponding observed data, e m2 (t i ) represents the third output data corresponding to the i-th sample and the corresponding labeled data (i.e., time t). i The difference between the actual data and the residual (also known as the residual).
[0052] Specifically, the gradient (i.e., the partial derivative of the loss function with respect to the model parameters) can be determined based on the training loss, and the gradient can be propagated layer by layer to different layers of the second calibration model through backpropagation to adjust the parameters of each layer of the second calibration model. After each iteration, the updated second calibration model can be obtained, and the next round of iteration can be carried out based on the updated second calibration model. After the iteration stops, the first calibration model can be obtained. Here, the condition for stopping the iteration can be that the number of iterations reaches a preset threshold (e.g., tens of thousands of times), or that the second calibration model converges.
[0053] In this possible implementation, the training loss can be determined based on the third output data and the first output data. Thus, the second correction model can learn the difference pattern between the outputs of the first sub-model and the second sub-model and continuously update the model parameters to obtain the first correction model. Since the inference accuracy of the second sub-model is higher than that of the first sub-model, the trained first correction model can correct the data output by the first sub-model to data with higher accuracy, which helps to improve the prediction accuracy of the first sub-model.
[0054] It should be understood that the first aspect or any possible implementation of the first aspect, as well as the second aspect or any possible implementation of the second aspect, may be executed by the same executing entity or by different executing entities, and this application does not limit this.
[0055] A third aspect of this application provides a data prediction apparatus, the apparatus comprising:
[0056] The acquisition module is used to acquire first data and time information; wherein, the time information is used to indicate the time for predicting future data related to the first data;
[0057] An input module is used to input first data into a prediction model; wherein the prediction model includes multiple sub-models and at least one first correction model, the multiple sub-models correspond to at least one time step, the time step is used to indicate the time length of the data predicted by the sub-model, each of the multiple sub-models is used to predict second data at the corresponding time step, the second data output by each sub-model is related to the first data, and at least one first correction model is used to correct the second data output by each sub-model.
[0058] The output module is used to output the prediction results, which are obtained based on at least one of the multiple second data from multiple sub-models. The prediction results are used to indicate future data.
[0059] In one possible implementation, the model training device further includes:
[0060] The selection module is used to select multiple sub-models from the database based on time information, as well as at least one first correction model corresponding to the multiple sub-models; the combination module is used to combine multiple sub-models and at least one first correction model to obtain a prediction model.
[0061] In one possible implementation, the first time length indicated by the time information is the sum of the time steps of each of the multiple sub-models; correspondingly, the multiple sub-models and at least one first correction model in the prediction model are arranged alternately in the order of sub-model first and first correction model second, wherein the input of each first correction model is the output of the previous sub-model, and the output of each first correction model is the input of the next sub-model.
[0062] In one possible implementation, the input to the first sub-model in the prediction model is the first data, and the prediction result is the second data output by the last sub-model in the prediction model.
[0063] In one possible implementation, the first time length indicated by the time information is less than or equal to the time step of each of the multiple sub-models; correspondingly, the multiple sub-models in the prediction model are arranged in parallel, and the output of each sub-model is the input of a first correction model.
[0064] In one possible implementation, the input to each sub-model in the prediction model is first data, and the prediction result includes multiple third data corresponding to multiple second data. The third data are the second data corrected by the first correction model corresponding to each sub-model.
[0065] In one possible implementation, the prediction results also include the probabilities of different types of future data indicated by multiple third-party data.
[0066] In one possible implementation, the first data is meteorological parameters.
[0067] A fourth aspect of this application provides a model training apparatus, the apparatus comprising:
[0068] The acquisition module is used to acquire the first output data of the first sub-model and the second output data of the second sub-model. The first output data and the second output data correspond to the same time. The time step of the second sub-model is smaller than the time step of the first model.
[0069] The input module is used to input the first output data into the second correction model to obtain the third output data;
[0070] The update module is used to update the second correction model based on the second and third output data to obtain the first correction model.
[0071] In one possible implementation, the update module is specifically used to: determine the training loss based on the distance between the second output data and the third output data; and update the second correction model based on the training loss to obtain the first correction model.
[0072] A fifth aspect of this application provides a computer device, including a storage medium, a processing circuit, and a bus system; wherein the storage medium is used to store instructions, and the processing circuit is used to execute the instructions in the memory to perform the first aspect described above and any implementation thereof.
[0073] The sixth aspect of this application provides a computer device, including a storage medium, a processing circuit, and a bus system; wherein the storage medium is used to store instructions, and the processing circuit is used to execute the instructions in the memory to perform the second aspect described above and any of its implementations.
[0074] The seventh aspect of this application provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the first aspect or any possible implementation thereof, or causes the computer to perform the second aspect or any possible implementation thereof.
[0075] The eighth aspect of this application provides a computer program that, when run on a computer, causes the computer to perform the first aspect or any possible implementation thereof, or causes a computer device to perform the second aspect or any possible implementation thereof.
[0076] A ninth aspect of this application provides a chip system including a processor for supporting a computer device in implementing the functions involved in the first aspect or any possible implementation thereof, and / or the second aspect or any possible implementation thereof, such as transmitting or processing data and / or information involved in the above methods. In one possible design, the chip system further includes a memory for storing program instructions and data necessary for the computer device. The chip system may be composed of chips or may include chips and other discrete devices.
[0077] The technical effects of the third aspect, the fifth aspect, or any possible implementation of the third aspect and the fifth aspect, as well as the technical effects of the seventh to ninth aspects, can be found in the first aspect or the technical effects of different possible implementations of the first aspect, and will not be repeated here.
[0078] The technical effects of aspects four, six, or any possible implementation of aspects four and six, as well as aspects seven through nine, can be found in the technical effects of aspects two or different possible implementations of aspects two, and will not be repeated here. Attached Figure Description
[0079] Figure 1A This is a schematic diagram of the data prediction process;
[0080] Figure 1B This is another schematic diagram of the data prediction process;
[0081] Figure 1C This is another schematic diagram of the data prediction process;
[0082] Figure 2 A schematic diagram of a system architecture provided for an embodiment of this application;
[0083] Figure 3A A schematic diagram of the sub-model training process provided in the embodiments of this application;
[0084] Figure 3B Another schematic diagram illustrating the sub-model training process provided in the embodiments of this application;
[0085] Figure 4 A schematic flowchart illustrating a model training method provided in an embodiment of this application;
[0086] Figure 5 A schematic diagram of the first correction model provided in the embodiments of this application;
[0087] Figure 6 A schematic diagram of the first calibration model training process provided in the embodiments of this application;
[0088] Figure 7 A schematic flowchart illustrating a data prediction method provided in an embodiment of this application;
[0089] Figure 8A A schematic diagram of a prediction model for serial arrangement provided in an embodiment of this application;
[0090] Figure 8B Another schematic diagram of the prediction model for serial arrangement provided in the embodiments of this application;
[0091] Figure 8C A schematic diagram of a prediction model for parallel arrangement provided in an embodiment of this application;
[0092] Figure 8D Another schematic diagram of the prediction model for parallel arrangement provided in the embodiments of this application;
[0093] Figure 9 A schematic diagram of the correction process of the first correction model provided in the embodiments of this application;
[0094] Figure 10A A schematic diagram of the data prediction process provided in the embodiments of this application;
[0095] Figure 10B Another schematic diagram of the data prediction process provided in the embodiments of this application;
[0096] Figure 11 A schematic diagram of a model training device provided in an embodiment of this application;
[0097] Figure 12A A schematic diagram of a data prediction device provided in an embodiment of this application;
[0098] Figure 12B This is another schematic diagram of a data prediction device provided in an embodiment of this application;
[0099] Figure 13 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0100] The technical solutions of the embodiments of the present invention will now be described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0101] The descriptions of "first," "second," etc., appearing in the embodiments of this application are for illustrative purposes and to distinguish the objects described, and do not indicate any order, nor do they imply a special limitation on the number of devices in the embodiments of this application, and cannot constitute any limitation on the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. The reference to "embodiment" herein means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0102] It should be noted that, in this application, the terms "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or illustration. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0103] In fields such as weather forecasting, energy management, agricultural planning, and traffic scheduling, it is often necessary to predict the state of complex dynamic systems at future points in time (such as days, weeks, months, or even years) in order to take timely and appropriate countermeasures to reduce losses. For example, in weather forecasting, it is necessary to predict precipitation several weeks in advance to prevent disasters such as floods and droughts; in energy management, it is necessary to predict electricity consumption several months in advance to plan for energy storage; in agricultural planning, it is necessary to predict crop yields several months or even years in advance to adjust crop varieties accordingly; and in traffic scheduling, it is necessary to predict traffic congestion several weeks in advance to develop traffic diversion plans.
[0104] Currently, artificial intelligence models (hereinafter referred to as models) can be used to predict the future state of a system.
[0105] In one specific implementation, an autoregressive approach can be used to predict the future state of the system. Specifically, a model can be used to make multiple predictions, with the output of each prediction serving as the input for the next prediction. Each prediction yields the state of the system at a future time, and thus, the state of the system at a specific future time can be predicted step by step.
[0106] Figure 1A As an example of the above data prediction process, when it is necessary to predict the state of the system on the 3rd day after time 1, the initial state of the system can be input into Model 1 to predict the state of the system after 1 day, resulting in Result 1; then Result 1 is used as input to Model 1 to predict the state of the system after 2 days, resulting in Result 2; then Result 2 is used as input to Model 1 to predict the state of the system after 3 days, resulting in Result 3; Result 3 is the state of the system on the 3rd day after time 1.
[0107] In another specific implementation, multiple sub-models with different time steps can be combined. The time step of a sub-model indicates the duration of the data it predicts. For example, if sub-model 1 has a time step of 3 days, it means that sub-model 1 can predict the state of the system on the 3rd day after the system's state at a certain point in time. Similarly, if sub-model 2 has a time step of 1 day, it means that sub-model 2 can predict the state of the system on the 1st day after the system's state at a certain point in time. Each sub-model can predict the state of the system at a future time. During the prediction process, the output of each sub-model is used as the input of the next sub-model, and so on, to predict the state of the system at a specific future time.
[0108] Figure 1B As an example of the above data prediction process, when it is necessary to predict the state of the system on the 8th day after time 1, Model 1 with a time step of 5 days, Model 2 with a time step of 2 days, and Model 3 with a time step of 1 day can be used to predict the state of the system at the corresponding time. Specifically, the state of the system at time 1 can be used as the input of Model 1 to predict the state of the system on the 5th day after time 1, resulting in Result 1; then Result 1 can be used as the input of Model 2 to predict the state of the system on the 7th day after time 1, resulting in Result 2; finally, Result 2 can be used as the input of Model 3 to predict the state of the system on the 8th day after time 1, resulting in Result 3.
[0109] In another specific implementation, multiple sub-models with different time steps can be combined. Each sub-model predicts the state of the system at the same time in the future, resulting in multiple outcomes. The final outcome can then be determined based on these multiple outcomes.
[0110] Figure 1C As an example of the above data prediction process, when it is necessary to predict the state of the system on the 3rd day after time 1, Model 1 with a time step of 4 days, Model 2 with a time step of 5 days, and Model 3 with a time step of 7 days can be used to predict the state of the system 3 days later, respectively. Specifically, the state of the system on the 1st day before time 1 (denoted as initial state 1) can be used as the input of Model 1 to predict result 1; the state of the system on the 2nd day before time 1 (denoted as initial state 2) can be used as the input of Model 2 to predict result 2; and the state of the system on the 4th day before time 1 (denoted as initial state 3) can be used as the input of Model 3 to predict result 3. Then, the state of the system 8 days later can be finally determined based on result 1, result 2, and result 3.
[0111] However, models tend to smooth out or ignore details within their corresponding time steps during prediction, and limited accuracy leads to low overall reliability of the prediction process. In view of this, embodiments of this application provide a data prediction method and apparatus to improve the accuracy and reliability of data prediction.
[0112] In this embodiment, multiple sub-models can be trained, each sub-model corresponding to a time step, and a model combination can be constructed based on multiple sub-models with different time steps. Then, the model combination can be used for inference and prediction. In order to improve the inference accuracy of the sub-models, this embodiment can train a corresponding first correction model for the sub-model to correct the data output by the sub-model, thereby improving the prediction accuracy.
[0113] See Figure 2 This invention provides a system architecture 200. A data acquisition device 260 collects observed data and stores it in a database 230. A training device 220 (e.g., a terminal device or a cloud system) generates a target model / rule 201 (i.e., a sub-model / first calibration model) based on the observed data maintained in the database 230. The observed data may be related to the application scenario; for example, in a weather forecasting application scenario, the observed data may be weather-related parameters. The target model / rule obtained by the training device 220 can be applied to different systems or devices. (See attached...) Figure 2 In this system, the execution device 210 (e.g., a terminal device or a cloud system) is equipped with an I / O interface 212 to interact with external devices. The "user" can input data to the I / O interface 212 through the client device 240.
[0114] The execution device 210 can call data, code, etc. in the data storage system 250, and can also store data, instructions, etc. in the data storage system 250. The calculation module 211 uses the target model / rule 201 to process the input data and obtain the processing result; optionally, the system architecture 200 may also include an association function module 213 and / or an association function module 214. The association function module 213 can preprocess the input data, and the association function module 214 can integrate the processing result; finally, the I / O interface 212 returns the processing result to the client device 240 for the user.
[0115] At a deeper level, the training device 220 can generate corresponding target models / rules 201 based on different data for different objectives, in order to provide users with better results.
[0116] In the appendix Figure 2In the scenario shown, the user can manually specify the data input to execution device 210, for example, by operating through the interface provided by I / O interface 212. Alternatively, client device 240 can automatically input data to I / O interface 212 and obtain results. If automatic data input by client device 240 requires user authorization, the user can set appropriate permissions within client device 240. The user can view the output results of execution device 210 on client device 240, which can be presented through display, sound, animation, or other specific methods. Client device 240 can also act as a data acquisition terminal, storing the collected observation data into database 230.
[0117] It is worth noting that, attached Figure 2 This is merely a schematic diagram of a system architecture provided by an embodiment of the present invention. The positional relationships between the devices, components, modules, etc. shown in the diagram do not constitute any limitation. For example, in the attached diagram... Figure 2 In this context, the data storage system 250 is an external memory relative to the execution device 210. In other cases, the data storage system 250 may also be placed within the execution device 210.
[0118] Based on the above system architecture, the training process of the sub-model and the first calibration model will be described in more detail below; the training process of the sub-model can be referred to in the following description:
[0119] In this embodiment, various sub-models with different time steps can be obtained based on the backbone network. The backbone network can be used for high-level feature extraction, and can specifically be a common deep learning model in the prior art; this embodiment does not specifically limit this. For example, the backbone network can be any deep learning model such as a convolutional neural network, a long short-term memory network (LSTM), a gated recurrent unit (GRU), a residual neural network (ResNet), or a Transformer.
[0120] In the embodiments of this application, multiple sub-models with different time steps can be trained based on the same backbone network (denoted as Method 1), or multiple sub-models with different time steps can be trained based on different backbone networks (denoted as Method 2). The two methods will be described below:
[0121] Method 1:
[0122] In this implementation, multiple sub-models with different time steps can be trained based on the same backbone network. Specifically, the structure of the backbone network can be used as a shared structure for multiple sub-models. This shared structure is used to extract common features of the data. Based on the shared structure, corresponding unique structures can be set for sub-models with different time steps to flexibly adapt to the inference requirements of different time steps and obtain sub-models with corresponding time steps.
[0123] As an example, the backbone network can be used as a shared structure for multiple sub-models, with the unique structures of different sub-models set in the middle part of the backbone network.
[0124] Figure 3A The example above illustrates a sub-model. Specifically, learnable structures can be set in the intermediate layers of the backbone network, corresponding to the sub-models; that is, the learnable structures in the backbone network are unique to each sub-model, while the structures other than the learnable structures are shared structures. When training the sub-model at a certain time step, the parameters of the shared structures of the backbone network can be frozen, and only the parameters of the learnable structures can be adjusted. Figure 3A In the example, structures 1 and 3 in the backbone network can be used as shared structures, and structure 2 can be used as a learnable structure (a structure specific to the sub-model). When training the sub-model, the parameters of structures 1 and 3 can be frozen, and the parameters of structure 2 can be adjusted during training to obtain the corresponding sub-model. For example, during the training of sub-model 1, the parameters of structures 1 and 3 can be frozen, and the parameters of structure 2 can be adjusted to obtain structure 21. Then, structures 1, 21, and 3 can be combined to obtain sub-model 1 corresponding to time step 1. During the training of sub-model 2, the parameters of structures 1 and 3 can be frozen, and the parameters of structure 2 can be adjusted to obtain structure 22. Then, structures 1, 22, and 3 can be combined to obtain sub-model 2 corresponding to time step 2. During the training of sub-model 3, the parameters of structures 1 and 3 can be frozen, and the parameters of structure 2 can be adjusted to obtain structure 23. Then, structures 1, 23, and 3 can be combined to obtain sub-model 3 corresponding to time step 3.
[0125] As another example, the backbone network can be used as a shared structure for multiple sub-models, with each sub-model's specific structure connected after the backbone network.
[0126] Figure 3BThe example above illustrates a sub-model. Specifically, different prediction heads can be connected to the ends of the backbone network. Each prediction head corresponds to a sub-model for a given time step, thus fulfilling the inference requirements for that time step. That is, the backbone network is a shared structure, while each prediction head is a unique structure for its corresponding sub-model. Specifically, during sub-model training, the parameters of the backbone network can be frozen, and only the prediction heads can be adjusted. In this example, prediction head 1 can be connected to the end of the backbone network, and sub-model 1 corresponding to time step 1 can be trained. Prediction head 2 can also be connected to the end of the backbone network, and sub-model 2 corresponding to time step 2 can be trained. Prediction head 3 can be connected to the end of the backbone network, and sub-model 3 corresponding to time step 3 can be trained.
[0127] It is understandable that the above Figures 3A-3B The sub-models in this application are merely examples and do not constitute a unique limitation on the implementation of the sub-models in this application.
[0128] Method 2:
[0129] In this implementation, multiple sub-models with different time steps can be obtained based on different backbone networks. Specifically, multiple sub-models can be trained based on different backbone networks, where each backbone network can train one or more sub-models. For example, each backbone network can train one sub-model; specifically, sub-model 1 can be trained based on backbone network 1, sub-model 2 can be trained based on backbone network 2, ..., sub-model N can be trained based on backbone network N. As another example, each backbone network can train multiple sub-models; specifically, sub-model 1 and sub-model 2 can be trained based on backbone network 1, sub-model 3 can be trained based on backbone network 2, sub-model 4, sub-model 5 and sub-model 6 can be trained based on backbone network 3, ... In this example, when using one backbone network to train multiple sub-models, the structure of the backbone network can be used as a shared structure, as described above, and corresponding unique structures can be set for different sub-models; this will not be elaborated further here.
[0130] Before formal model training, it is necessary to construct the sample set required for the training process; the following will introduce the process of constructing the sample set required for sub-model training.
[0131] In the embodiments of this application, a corresponding sample set can be set for each sub-model for use in model training; for example, sample set 1 can be set for sub-model 1 and sample set 1 can be used to train sub-model 1; sample set 2 can be set for sub-model 2 and sample set 2 can be used to train sub-model 2... sample set N can be set for sub-model N and sample set N can be used to train sub-model N.
[0132] In this embodiment of the application, each sample set may include a preset number of samples and the labeling results corresponding to each sample; the number of samples included in the sample set can be set according to actual needs, and this embodiment of the application does not limit this; for example, each sample set may include tens of thousands of samples.
[0133] When constructing a sample set, a preset number of samples can be obtained; the specific method of obtaining samples can be set according to actual needs, and this application embodiment does not limit this; for example, samples can be obtained through public datasets; or, for example, data synthesis can be performed using relevant models (such as generative adversarial networks), and the synthesized data can be used as samples.
[0134] In this embodiment of the application, it is necessary to construct a sample set according to the actual application scenario of the sub-model.
[0135] As an example, when applying a sub-model to weather forecasting, a sample set can be constructed based on meteorological parameters. For instance, if rainfall needs to be predicted, the sample set of the sub-model can be constructed based on precipitation-related parameters (such as historical precipitation, humidity, temperature, air pressure, wind speed, wind direction, dew point temperature, or cloud cover). Similarly, if temperature needs to be predicted, the sample set of the sub-model can be constructed based on temperature-related parameters (such as historical temperature, dew point temperature, air pressure, wind speed, wind direction, relative humidity, or solar radiation flux).
[0136] As another example, when applying sub-models to energy management scenarios, a sample set can be constructed based on energy-related parameters. For instance, if it is necessary to predict electricity consumption, the sample set of the sub-model can be constructed based on parameters related to electricity consumption (such as historical electricity consumption, temperature, humidity, wind speed, solar radiation intensity, or industrial output). Similarly, if it is necessary to predict the power generation capacity of new energy sources, the sample set of the sub-model can be constructed based on parameters related to the power generation capacity of new energy sources (such as wind speed, irradiance, temperature, humidity, air pressure, or cloud cover).
[0137] As another example, when applying sub-models to agricultural planning scenarios, sample sets can be constructed based on agriculture-related parameters. For instance, if crop yield prediction is needed, the sample set of the sub-model can be constructed based on parameters related to crop yield (such as historical yield, soil pH, growth cycle, irrigation type, fertilization records, average annual temperature, or sunshine duration). Similarly, if pest and disease conditions need to be predicted, the sample set of the sub-model can be constructed based on parameters related to pests and diseases (such as historical pest and disease records, crop disease resistance genotypes, or crop plant architecture).
[0138] As another example, when applying sub-models to traffic scheduling, a sample set can be constructed based on traffic-related parameters. For instance, if traffic flow needs to be predicted, the sample set of the sub-model can be constructed based on parameters related to traffic flow (such as historical traffic flow, holiday schedules, peak hours, or traffic accident records). Similarly, if public transportation demand needs to be predicted, the sample set of the sub-model can be constructed based on parameters related to public transportation demand (such as historical public transportation demand, popular areas for shared bicycle rentals, or traffic flow).
[0139] After obtaining the samples, they can be labeled to obtain the corresponding labeling results, which are the observation results corresponding to the samples. For a sample in the sample set of a certain sub-model, the length between the time of the sample and the time of the corresponding labeling result is the same as the time step of the sub-model.
[0140] For example, the time step corresponding to sub-model 5 is 5 days. Here, the sample set used by sub-model 5 during training can be denoted as sample set 5. Then, a sample in sample set 5 can be the state of the system on day D. The labeling result corresponding to the sample is the state of the system on day 5 after day D (i.e., day D+5). The length between the time of the sample (day D) and the time of the corresponding labeling result (day D+5) is 5 days, which is the same as the time step corresponding to sub-model 5.
[0141] After obtaining a preset number of samples and their corresponding labeling results, a sample set can be constructed. Once the sample set is constructed, it can be used for training the sub-model. The following will use the training of any one sub-model (denoted as the first target sub-model) as an example to describe in detail the training process of the sub-model in this embodiment.
[0142] Specifically, the parameters of the initial sub-model can be adjusted using the corresponding sample set to obtain the first target sub-model. For ease of description, the sample set used for training the first target sub-model can be called the target sample set, and the initial sub-model used for training the first target sub-model can be called the second target sub-model. When training the first target sub-model, each sample in the target sample set can be used as the input to the second target sub-model to obtain its output. The distance between the output of the second target sub-model and the corresponding labeled result can be used to update the second target sub-model to obtain the first target sub-model. The second target sub-model can be constructed based on a backbone network; the specific process can be referred to the relevant description above, and will not be repeated here.
[0143] After obtaining the output data of the second target sub-model, the training loss can be determined based on the output data, the corresponding labeling results, and the preset loss function. The loss function here can be any loss function in the prior art, and this application embodiment does not limit it; for example, the loss function can be a common loss function such as the L1 loss function, L2 loss function, mean squared error loss function, or cross-entropy loss function.
[0144] Based on the loss during training, the model parameters of the second target sub-model can be updated. Specifically, the gradient (i.e., the partial derivative of the loss function with respect to the model parameters) can be determined according to the loss, and the gradient can be propagated layer by layer to different layers of the second target sub-model through backpropagation to adjust the parameters of each layer of the second target sub-model. After each iteration, the updated second target sub-model can be obtained, and the next round of iteration can be performed based on the updated second target sub-model. After the iteration stops, the first target sub-model can be obtained. Here, the condition for stopping the iteration can be that the number of iterations reaches a preset threshold (e.g., tens of thousands of times), or that the second target sub-model converges. Each iteration can use one or more samples from the target sample set.
[0145] It is understood that each sub-model in the embodiments of this application can be trained by referring to the above process, which will not be elaborated here.
[0146] In this embodiment, a corresponding first correction model can be set for each sub-model to correct the output of the sub-model and improve the prediction accuracy of the sub-model.
[0147] For ease of description, the training process of the first calibration model will be introduced below using the first calibration model of any sub-model (referred to as the first sub-model) as an example; specifically, it can be done using... Figure 4 The embodiment of this application shows a model training method for training a first calibration model; the model training method provided in this application embodiment may include S401 to S403:
[0148] S401. Obtain the first output data of the first sub-model and the second output data of the second sub-model. The first output data and the second output data correspond to the same time. The time step of the second sub-model is smaller than the time step of the first sub-model.
[0149] It is important to understand that sub-models with smaller time steps are better able to capture short-term dependencies and adapt to rapid changes. Therefore, sub-models with smaller time steps can retain more details during inference, resulting in higher inference accuracy. Sub-models with larger time steps, on the other hand, may smooth out short-term details, thus resulting in lower inference accuracy compared to sub-models with smaller time steps.
[0150] In this embodiment, a sub-model with better inference accuracy than the first sub-model (denoted as the second sub-model) can be used as a reference. Based on the distance between the output of the second sub-model and the output of the first sub-model, a first correction model of the first sub-model is trained under supervision. This allows the first correction model to learn the difference patterns in the outputs of the two sub-models and compensate for the output of the first sub-model during the correction process. This improves the prediction accuracy of the first sub-model from the output level without requiring reconstruction. Specifically, a sub-model with a time step smaller than that of the first sub-model can be used as the second sub-model. Here, the first correction model corresponding to the first sub-model can be trained using the first sub-model and at least one second sub-model.
[0151] In this embodiment of the application, the initial calibration model (referred to as the second calibration model) can be trained using a corresponding sample set; wherein, the sample set includes a preset number of samples and the labeling results corresponding to each sample; each sample may include the prediction data of the first sub-model and the second sub-model for the same time, and the labeling result corresponding to the sample is the observation data corresponding to the same time; for ease of description, the prediction data output by the first sub-model is referred to as the first output data, and the prediction data output by the second sub-model for the same time is referred to as the second output data.
[0152] For example, the data output by the first sub-model corresponding to time 1 can be used as the first output data, and the data output by the second sub-model corresponding to time 1 can be used as the second output data. The first output data and the second output data can be combined to obtain a sample, and the labeling result corresponding to the sample is the system's observation data at time 1.
[0153] For a sample in the sample set, the time of the first output data and the second output data included in the sample can be called the first time. When constructing the sample, the time of the data required by the first sub-model can be determined according to the first time and the time step of the first sub-model. Here, the first time can be taken as the starting point, and the length corresponding to the time step can be traced back to determine the time of the data required by the first sub-model. Then, the measured data corresponding to the time can be used as the input of the first sub-model to obtain the first output data.
[0154] For example, the time of the first output data and the second output data included in Sample 1 is time 1, and the time step of the first sub-model is 3 days. When constructing Sample 1, we can take time 1 as the starting point, backtrack 3 days, and determine the time corresponding to the backtracking as the time of the data required by the first sub-model. That is, the 3rd day before time 1 is the time of the data required by the first sub-model. After that, the observation data of the 3rd day before time 1 can be used as the input of the first sub-model to obtain the first output data.
[0155] Similarly, the time of the data required by the second sub-model can be determined based on the first time and the time step of the second sub-model. Then, the measured data corresponding to that time can be used as the input of the second sub-model to obtain the second output data.
[0156] For example, if the time of the first output data and the second output data included in Sample 1 is time 1, the time step of the first sub-model is 5 days, and the time step of the second sub-model is 3 days, then the observation data of the 5th day before time 1 can be input into the first sub-model to obtain the first output data of the first sub-model corresponding to time 1, and the data of the 3rd day before time 1 can be input into the second sub-model to obtain the second output data of the second sub-model corresponding to time 1.
[0157] After obtaining a preset number of samples and their corresponding labels, a sample set can be constructed. It is important to understand that the samples and labels in the sample set are related to the actual application scenario of the first calibration model.
[0158] As an example, when the first calibration model is applied to a weather forecast scenario, a sample set can be constructed based on relevant meteorological parameters. For instance, the first and second sub-models are used to predict precipitation. The first calibration model needs to correct the predicted precipitation. The time step of the first sub-model is 5 days, and the time step of the second sub-model is 3 days. When constructing the sample corresponding to time 1, the precipitation of the 5th day before time 1 can be input into the first sub-model to obtain the precipitation output of the first sub-model corresponding to time 1 (i.e., the first output data). The precipitation of the 3rd day before time 1 can also be input into the second sub-model to obtain the precipitation output of the second sub-model corresponding to time 1 (i.e., the second output data). Then, the first and second output data can be used as the sample corresponding to time 1, and the actual precipitation of time 1 can be used as the labeling result of the sample.
[0159] As another example, when the first calibration model is applied to an energy management scenario, a sample set can be constructed based on relevant energy parameters. For example, the first sub-model and the second sub-model are used to predict electricity consumption. That is, the first calibration model needs to correct the predicted electricity consumption. The time step of the first sub-model is 7 days, and the time step of the second sub-model is 2 days. When constructing the sample corresponding to time 1, the electricity consumption of the 7th day before time 1 can be input into the first sub-model to obtain the electricity consumption corresponding to time 1 (i.e., the first output data) output by the first sub-model. The electricity consumption of the 2nd day before time 1 can also be input into the second sub-model to obtain the electricity consumption corresponding to time 1 (i.e., the second output data) output by the second sub-model. Then, the first output data and the second output data can be used as the sample corresponding to time 1, and the actual electricity consumption of time 1 can be used as the labeling result of the sample.
[0160] As another example, when the first calibration model is applied to agricultural planning, a sample set can be constructed based on relevant agricultural parameters. For instance, the first and second sub-models are used to predict crop yield. The first calibration model needs to correct the predicted crop yield. The time step of the first sub-model is 3 months, and the time step of the second sub-model is 1 month. When constructing the sample corresponding to time 1, the crop yield of the 3rd month before time 1 can be input into the first sub-model to obtain the crop yield corresponding to time 1 (i.e., the first output data). Similarly, the crop yield of the 1st month before time 1 can be input into the second sub-model to obtain the crop yield corresponding to time 1 (i.e., the second output data). Then, the first output data and the second output data can be used as the sample corresponding to time 1, and the actual crop yield of time 1 can be used as the labeling result of the sample.
[0161] As another example, when the first calibration model is applied to a traffic scheduling scenario, a sample set can be constructed based on relevant traffic parameters. For example, the first sub-model and the second sub-model are used for traffic flow prediction. That is, the first calibration model needs to correct the predicted traffic flow. The time step of the first sub-model is 4 days, and the time step of the second sub-model is 2 days. When constructing the sample corresponding to time 1, the traffic flow of the 4th day before time 1 can be input into the first sub-model to obtain the traffic flow corresponding to time 1 (i.e., the first output data) output by the first sub-model. The traffic flow of the 2nd day before time 1 can also be input into the second sub-model to obtain the traffic flow corresponding to time 1 (i.e., the second output data) output by the second sub-model. Then, the first output data and the second output data can be used as a sample, and the actual traffic flow of time 1 can be used as the labeling result of the sample.
[0162] Once the sample set is constructed, it can be used to train the first calibration model.
[0163] S402. Input the first output data into the second correction model to obtain the third output data.
[0164] Taking any sample in the sample set as an example, the first output data included in the sample can be used as the input of the second correction model. The second correction model can process the first output data to obtain the third output data.
[0165] In this embodiment, the data processing procedure of the calibration model (including the first calibration model and the second calibration model) is related to the type of calibration model. Examples of the processing procedures for different types of calibration models will be given below:
[0166] Example 1: The second correction model is a linear regression model.
[0167] In this implementation, the calibration model is a linear regression model, and the third output data can be obtained by processing the first output data through the second calibration model.
[0168] As an example, the processing of the second correction model can be represented as: y adjusted =W·y long +b, where y adjusted This represents the third output data, y. long Let W represent the first output data, W represent the weight matrix, and b represent the bias term. Initial values can be set for W and b, and the values of the two parameters can be continuously adjusted during the training process. In this embodiment of the application, the initial values of W and b are not limited. For example, the initial value of W can be set to the identity matrix, and the initial value of b can be set to 0.
[0169] Example 2: The second calibration model is an artificial intelligence model.
[0170] In this implementation, the second correction model is an artificial intelligence model.
[0171] Figure 5A schematic diagram of a correction model is shown. Specifically, the correction model includes a feature fusion module, a patch embedding module, a self-attention module, and a multilayer perception layer module, each of which may include one or more layers. The input to the feature fusion module is the first output data. The feature fusion module is specifically used to enhance the details of the prediction. As an example, the feature fusion module can retain high-frequency information in the first output data through residual connections or multi-scale feature fusion. The dimension of the first output data is (V, H, W), where V represents the volume of the first output data, H represents the height of the first output data, and W represents the width of the first output data. The input to the patch embedding module is the output of the feature fusion module. The patch embedding module is specifically used to divide the output of the feature fusion module into multiple small patches and map them into a low-dimensional vector sequence. The dimension of the low-dimensional vector sequence can be represented as (L, C), where L... The input to the self-attention module is the low-dimensional vector sequence output by the block embedding module. The self-attention module is specifically used to calculate the global dependencies between blocks (such as the importance of a certain block to the overall prediction). The dimension of its output data can also be represented as (L, C). The input to the multilayer perceptron module is the output of the self-attention module. The multilayer perceptron module is specifically used to enhance the nonlinear expressive power and refine the details of the prediction. As an example, the multilayer perceptron module can adjust the feature weights through fully connected layers to optimize the first output data. The data output by the multilayer perceptron module will be restored to the same dimension (V, H, W) as the first output data to obtain the third output data.
[0172] It should be understood that the above examples are merely examples of the correction model and do not constitute the sole limitation on the implementation of the correction model in this application.
[0173] S403. Update the second correction model based on the second output data and the third output data to obtain the first correction model.
[0174] In this embodiment of the application, the loss of the training process can be determined based on the distance between the second output data and the third output data, and the second correction model can be updated based on the loss. After multiple iterations, the first correction model can be obtained.
[0175] The distance between the second and third output data can be determined based on the loss function, which may include, but is not limited to, common loss functions such as residual sum of squares loss function, L1 loss function, L2 loss function, mean squared error loss function, or cross-entropy loss function.
[0176] In one specific implementation of this application embodiment, the loss function used by the first correction model during training can be expressed as:
[0177]
[0178] Among them, L adjusted Let N represent the loss during the training of the first calibration model, and let N represent the number of samples used by the second calibration model in this iteration. m1 (t i ) represents the second output data corresponding to the i-th sample and the corresponding label result (i.e., time t). i The difference (also called residual) between the corresponding observed data, e m2 (t i ) represents the third output data corresponding to the i-th sample and the corresponding labeled data (i.e., time t). i The difference between the actual data and the residual (also known as the residual).
[0179] Figure 6 The training process of the first calibration model is illustrated. In this example, the time step of the first sub-model is N days, and the time step of the second sub-model is 1 day. The first and second sub-models need to predict the state of the system on day D+1. Here, the state of the system on day D can be used as the input of the second sub-model to obtain the state of the system on day D+1 (i.e., the second output data). The state of the system on day D-N+1 can be used as the input of the first sub-model to obtain the state of the system on day D+1 (i.e., the first output data). Then, the first output data needs to be used as the input of the second calibration model. The second calibration model will correct the first output data and output the third output data. Finally, the second and third output data are input into a preset loss function to calculate the loss of the training process, and the second calibration model can be updated based on this loss.
[0180] As an example, if the second calibration model is a linear regression model, the loss can be used as the objective, and the model parameters (e.g., W and b) corresponding to the minimum loss can be solved. Specifically, matrix operations can be used to solve for the model parameters corresponding to the minimum loss, and the first calibration model can be obtained based on these model parameters. Alternatively, gradient descent can be used to solve for the model parameters corresponding to the minimum loss. Specifically, the gradient (i.e., the partial derivative of the loss function with respect to the model parameters) can be determined based on the loss, and the model parameters can be adjusted along the negative direction of the gradient to obtain the updated second calibration model. The updated second calibration model can then be used for the next iteration. After the iteration stops, the first calibration model can be obtained. Here, the condition for stopping the iteration can be that the number of iterations reaches a preset threshold (e.g., tens of thousands of times), or that the second calibration model converges. Each iteration can use one or more samples from the sample set.
[0181] As another example, if the second calibration model is an artificial intelligence model, the gradient (i.e., the partial derivative of the loss function with respect to the model parameters) can be determined based on the loss, and the gradient can be propagated layer by layer to different layers of the second calibration model through backpropagation to adjust the parameters of each layer of the second calibration model. After each iteration, the parameters of the updated second calibration model can be obtained, and the next round of iteration can be performed based on the updated second calibration model following the above process. After multiple iterations, the first calibration model can be obtained. Here, the iteration can stop when the number of iterations reaches a preset threshold (e.g., tens of thousands of times), or when the second calibration model converges. Each iteration can use one or more samples from the sample set.
[0182] In one specific implementation of this application, a second sub-model can be used to train the first correction model to obtain the first correction model used in the data prediction process.
[0183] In another specific implementation of the embodiments of this application, multiple second sub-models can be used to train the first correction model; specifically, the first correction model can be trained by incremental optimization, and each training can use one second sub-model (refer to the above method for details). The first correction model obtained each time can be used as the (second) correction model used in the next training. After the last training is completed, the first correction model used in the data prediction process is obtained.
[0184] For example, the time step of the first sub-model is 4 days, and the second sub-model includes: Model 1, Model 2, and Model 3; the time steps of the three second sub-models are 3 days, 2 days, and 1 day, respectively; during training, Model 1 can be used to train the first correction model; specifically, Model 1 can be used to train the first sub-model to obtain the first correction model 1, and the first correction model 1 can be applied in the data prediction process; or, Model 1, Model 2, and Model 3 can be used to train the first correction model separately; specifically, Model 1 can be used to train the first correction model to obtain the first correction model 1; then, Model 2 can be used to train (update) the first correction model 1 to obtain the first correction model 2; or Model 3 can be used to train the first correction model 2 to obtain the first correction model 3, and the first correction model 3 can be applied in the data prediction process.
[0185] Optionally, if a second sub-model that has not participated in the training of the first calibration model is trained during the updating and maintenance of the sub-model, then this second sub-model can be used to train the original first calibration model to obtain an updated first calibration model, which can then be used in subsequent data prediction processes. Continuing with the above example, in the above example, if a sub-model 4 with a time step of 0.5 days is trained, and this sub-model 4 is a second sub-model that has not participated in the training of the first calibration model, then this sub-model 4 can be used to train the first calibration model 3 to obtain the first calibration model 4, which can then be used in subsequent data prediction processes.
[0186] It should be understood that if there is no corresponding second sub-model for a certain first sub-model, that is, if the first sub-model is the sub-model with the smallest time step in the database, then it can be determined that there is no corresponding first calibration model for the first sub-model, and there is no need to perform the above-mentioned first calibration model training process.
[0187] After training the sub-models and the first calibration model, the sub-models and calibration models can be applied to actual inference and prediction.
[0188] like Figure 7 As shown, one embodiment of the data prediction method provided in this application may specifically include the following steps S701 to S703:
[0189] S701. Obtain first data and time information; wherein, the time information is used to indicate the time for predicting future data related to the first data.
[0190] In this embodiment, future data can be predicted based on historical data. Here, the historical data used for prediction can be referred to as the first data, and the time of the most recently observed historical data can be referred to as the base time. The first data consists of one or more data points observed before the base time, and the future data consists of data related to the first data that occurs after the base time. For example, if the most recently observed historical data occurred on March 1st, then the first data consists of one or more data points observed before March 1st, and the future data consists of data related to the first data that occurs after March 1st.
[0191] Here, time information can be used to indicate the time of future data related to the first data; specifically, the time information may include at least two of the following: a base time, a second time, and a first time length; wherein the second time is the time of the future data to be predicted, and the first time length is the time length between the base time and the second time.
[0192] For example, if the base time is March 7, and the application scenario for weather forecasting requires predicting the precipitation on March 10, then the first time length is 3 days (the time length between March 7 and March 10). The time information can include March 7 (i.e., the base time) and 3 days (i.e., the first time length), and the first data can include one or more precipitation data observed before March 7.
[0193] For example, if the base time is September 10, in the application scenario of energy management, the future data to be predicted is the amount of renewable energy generated on October 10. The time information can include September 10 (i.e., the base time) and October 10 (i.e., the second time). The first data can include one or more renewable energy generation data observed before September 10.
[0194] For example, if the base date is April 8th, and the application scenario in agricultural planning requires predicting the crop yield on October 8th, then the first time length is 6 months (the time length between April 8th and October 8th). The time information can include October 8th (i.e., the second time) and 6 months (i.e., the first time length). The first data can include one or more crop yields observed before April 8th.
[0195] For example, if the base time is December 2nd, and the application scenario for traffic scheduling requires predicting the traffic flow on December 3rd, then the first time length is 1 day (the time length between December 2nd and December 3rd). The time information can include December 2nd (i.e., the base time), December 3rd (i.e., the second time), and 1 day (i.e., the first time length). The first data can include one or more traffic flows observed before December 2nd.
[0196] In one specific implementation of this application, time information can be actively submitted by the user (e.g., end user or developer) through the interactive interface of the terminal device.
[0197] In another specific implementation of this application embodiment, the data prediction process can be triggered by a business system (e.g., a meteorological business system) according to a preset schedule, and time information can be obtained from the schedule.
[0198] In this embodiment, a prediction model can be determined based on time information. Then, historical data included in the first data can be determined based on the prediction model and the time information. The prediction model includes multiple sub-models and at least one first correction model, with each sub-model corresponding to at least one time step. Specifically, multiple sub-models and at least one first correction model corresponding to each sub-model can be selected from a database based on the first time length. Here, the database may include each sub-model and the first correction model trained using the method described above. If the time information includes the first time length, it can be directly obtained from the time information. If the time information does not include the first time length, it can be calculated based on the time information. For example, if the time information includes a base time and a second time, the time length between the base time and the second time can be calculated to obtain the first time length.
[0199] The process of determining the prediction model based on time information will be described in detail below:
[0200] First, the first time length is used as the sum of the time steps of multiple sub-models in the prediction model to determine the prediction model.
[0201] In this implementation, the first time length can be used as the sum of the time steps of multiple sub-models in the prediction model. The minimum number of sub-models required to obtain the first time step is determined from the database. The prediction model is obtained by combining the determined sub-models and their corresponding first correction models. In this implementation, the multiple sub-models and at least one correction model in the prediction model are arranged sequentially, specifically, they can be arranged alternately in the order of sub-model first, followed by the corresponding first correction model.
[0202] Figure 8A A serially arranged prediction model is shown. In this example, the prediction models are arranged in the following order: sub-model 1, first correction model 1, sub-model 2, second correction model 2, sub-model 3, and first correction sub-model 3.
[0203] For example, a greedy algorithm or a dynamic programming algorithm can be used to determine multiple sub-models from a database, thereby determining the prediction model. These two examples are explained below:
[0204] 1. Use a greedy algorithm to determine multiple sub-models.
[0205] In this example, the condition that the sum of the time steps of multiple sub-models in the prediction model equals the first time length can be used as a condition. A greedy algorithm is then used to determine multiple sub-models that satisfy this condition from the database. At each decision, the greedy algorithm considers the maximum gain or minimum cost obtainable in the current state. Here, the maximum gain or minimum cost is the minimum number of sub-models included in the prediction model, thereby reducing the number of sub-models used in the inference process, shortening the inference prediction time, and improving the efficiency of data prediction. Therefore, when selecting each sub-model using the greedy algorithm, the sub-model with the largest time step that has not yet been selected will be chosen, provided the above condition is met. For example, if the first time length is 8 days, and the database contains time steps... The model consists of three sub-models: sub-model 1 (5-day time step), sub-model 2 (4-day time step), sub-model 3 (2-day time step), and sub-model 4 (1-day time step). When using a greedy algorithm to select the model, the sub-model with the longest allowed time step within the current remaining time step is selected, i.e., sub-model 1. After sub-model 1 is selected, the current remaining time step is 3 days (8 days - 5 days = 3 days). The sub-model with the largest time step (less than or equal to 3 days) is sub-model 3 with a time step of 2 days. After sub-model 3 is selected, the current remaining time step is 1 day (3 days - 2 days = 1 day). Therefore, sub-model 4 with a time step of 1 day is selected, thus determining that the prediction model includes sub-model 1, sub-model 3, and sub-model 4.
[0206] 2. Use dynamic programming algorithm to determine multiple sub-models.
[0207] In this example, the sum of the time steps of multiple sub-models in the prediction model equals the first time length can be used as a condition to determine multiple sub-models that meet the condition from the database using a dynamic programming algorithm. The dynamic programming algorithm can obtain the global optimal solution through state recursion. If the time steps of each sub-model contained in the database are represented as a set T = {t1, t2, ... t...} m Let the first time length be t. target The dynamic programming algorithm can be briefly described as follows:
[0208] 2.1. Define the initial state.
[0209] Define state dp[t k [ ] is the minimum number of submodels required to combine the sum of time steps i, where t k∈T; during initialization, dp[0] = 0, which means that when the sum of time lengths is 0, no sub-models are included, and the states corresponding to the sum of other time lengths can be initialized to infinity (unreachable).
[0210] 2.2. Recursively update the status.
[0211] By iterating through all possible sub-model time steps t j Recursive update status:
[0212] dp[t k ] = min(dp[t k ],dp[t k -t j +1),
[0213] Among them, t j ≤t k , and t j ∈T, the meaning of the above equation is: if there exists a database with a time step of t k If a sub-model with time step t does not exist in the database, then that sub-model is used directly; otherwise, the database does not contain a sub-model with time step t. k If the sub-model is a given sub-model, then iterate through each sub-model in the database and try to find the state dp[t]. k -t j Based on this, a sub-model is added to form the state dp[t]. k At this point, solve dp[t]; k The problem is transformed into solving dp[t] k -t j The state of dp[t] can be solved recursively. During the solution process, the states that have been solved are recorded to avoid redundant calculations. Through this process, dp[t] can be determined. target ].
[0214] For example, if the first time step is 8 days, and the database contains sub-model 1 with a time step of 1 day, sub-model 2 with a time step of 3 days, sub-model 3 with a time step of 4 days, and sub-model 4 with a time step of 7 days, then the various states can be obtained, specifically represented as: dp[0] = 0, dp[1] = 1 (directly using sub-model 1), dp[2] = ∞, dp[3] = 1 (directly using sub-model 2), dp[4] = 1 (directly using sub-model 3), dp[5] = 2 (including sub-model 1 and sub-model 3). ), dp[6]=∞, dp[7]=1 (directly use sub-model 4); the first time step is 8 days, that is, dp[8] needs to be solved; since there is no sub-model with a time step of 8 days in the database, the sub-model can be determined based on the state that the sum of time steps is less than 8 days. Specifically, a sub-model 1 with a time step of 1 day can be added on the basis of dp[7] to construct the various sub-models required for the sum of time steps of 8 days. Therefore, it can be determined that the prediction model includes sub-model 1 and sub-model 4.
[0215] It should be noted that in the serial arrangement, if there is no first correction model corresponding to a certain sub-model in the prediction model, and the sub-model is not the last sub-model in the prediction model, then the next sub-model can be directly connected after the sub-model; if the sub-model is the last sub-model in the prediction model, then the (uncorrected) data output by the sub-model is the final output of the prediction model.
[0216] Figure 8B A sequentially arranged prediction model is shown. In this example, sub-model 3 does not have a corresponding first correction model, and sub-model 3 is the last sub-model in the prediction model. Specifically, the prediction models are arranged in the following order: sub-model 1, first correction model 1, sub-model 2, second correction model 2, and sub-model 3. During data prediction, the (uncorrected) data output by sub-model 3 is the final output of the prediction model.
[0217] Second, identify multiple sub-models with time steps less than or equal to the first time length as multiple sub-models in the prediction model, in order to determine the prediction model.
[0218] In this implementation, multiple sub-models in the database with time steps less than or equal to a first time length can be identified as multiple sub-models in the prediction model. Based on each identified sub-model and its corresponding first correction model, the prediction model can be obtained by combining them. In this implementation, the multiple sub-models in the prediction model are arranged in parallel; wherein, on each branch, they are arranged in the order of sub-model first, followed by the corresponding first correction model.
[0219] Figure 8CA parallel prediction model is shown. In this example, branches 1, 2 and 3 are arranged in parallel. Branch 1 is arranged in the order of sub-model 1 first and first correction model 1 second; branch 2 is arranged in the order of sub-model 2 first and first correction model 2 second; and branch 3 is arranged in the order of sub-model 3 first and first correction model 3 second.
[0220] As an example, each sub-model (denoted as candidate sub-model) with a time step less than or equal to the first time length can be identified in the database. The number of candidate sub-models can be represented as m. Then, n sub-models can be selected from the m candidate sub-models as the sub-models included in the prediction model. Here, n is a positive integer and n≤m. The specific value of n can be set according to actual needs. This application embodiment does not limit this. For example, the database includes sub-model 1 with a time step of 1 day, sub-model 2 with a time step of 3 days, sub-model 3 with a time step of 5 days, sub-model 4 with a time step of 6 days, and sub-model 5 with a time step of 8 days. If the first time step is 5 days, then 3 candidate sub-models can be identified from the database: sub-model 1, sub-model 2, and sub-model 3. Then, n sub-models can be selected from these 3 candidate sub-models as the sub-models included in the prediction model. For example, if n is 3, then each candidate sub-model is included in the prediction model. Alternatively, if n is 2, then 2 sub-models can be selected from the 3 candidate sub-models. Specifically, 2 sub-models can be randomly selected from the 3 candidate sub-models, or 2 sub-models can be selected based on specific conditions, such as selecting the 2 sub-models with the largest time step from the 3 candidate sub-models, or selecting the 2 sub-models with the smallest time step from the 3 candidate sub-models.
[0221] It should be noted that in the parallel arrangement method, if there is no first correction model corresponding to a certain sub-model in the prediction model, then only that sub-model can be arranged on the branch corresponding to that sub-model.
[0222] Figure 8D Another parallel arrangement of prediction models is shown; in this example, branches 1, 2 and 3 are arranged in parallel. Since sub-model 1 does not have a corresponding first correction model, only sub-model 1 is arranged in branch 1; branch 2 is arranged in the order of sub-model 2 first and first correction model 2 last; branch 3 is arranged in the order of sub-model 3 first and first correction model 3 last.
[0223] In this embodiment of the application, after determining the multiple sub-models included in the prediction model, the first data required for data prediction can be determined based on the arrangement of the prediction models and time information.
[0224] When the prediction model is arranged serially, the first data may include data prior to the base time, and the time length between the time of this data and the second time (the time of future data) is the second time length. The second time length corresponds to the time step of the first sub-model in the prediction model. Specifically, the time of the first data can be determined by tracing back the second time length from the second time as the starting point, thus obtaining the first data.
[0225] For example, if the time of the future data to be predicted is March 7th (i.e., the second time), and the prediction model is arranged serially, with the time step corresponding to the first sub-model in the prediction model being 5 days (i.e., the second time step being 5 days), then the first data can include data observed before the base time. Specifically, the time between the time of the first data and March 7th is 5 days. Therefore, we can take March 7th as the starting point, go back 5 days, and determine the time of the first data as March 2nd, that is, the first data is the data observed on March 2nd.
[0226] When the prediction model is arranged in parallel, the first data can include multiple data observed before the reference time, and each data in the first data corresponds to the time step of a sub-model in the prediction model. Specifically, for each sub-model in the prediction model, the time length corresponding to the time step of the sub-model can be traced back from the second time as the starting point to determine the time of the first data corresponding to the sub-model, thereby obtaining the first data.
[0227] For example, if the time for predicting future data is March 9th (i.e., the second time), and the prediction models are arranged in parallel, the prediction models include sub-model 1 with a time step of 3 days, sub-model 2 with a time step of 5 days, and sub-model 3 with a time step of 8 days. For sub-model 1, starting from March 9th and going back 3 days, the time of the first data corresponding to sub-model 1 can be determined to be March 6th, meaning the first data corresponding to sub-model 1 is the data observed on March 6th. For sub-model 2, starting from March 9th and going back 5 days, the time of the first data corresponding to sub-model 2 can be determined to be March 4th, meaning the first data corresponding to sub-model 2 is the data observed on March 4th. For sub-model 3, starting from March 9th and going back 8 days, the time of the first data corresponding to sub-model 3 can be determined to be March 1st, meaning the first data is the data observed on March 1st. Based on this, the first data corresponding to each sub-model can be obtained.
[0228] In this embodiment, the first data can be obtained by a computer device; for example, the computer device is specifically a terminal device, which can obtain the first data from its local memory, or the terminal device can obtain the first data from a cloud system (such as a server, online website, etc.); this embodiment does not limit the source of the first data.
[0229] In one specific implementation of this application, used prediction models can be recorded to improve the efficiency of data prediction. This record can be in the form of a table, array, matrix, etc., and is not limited thereto. In subsequent data prediction processes, if a prediction model corresponding to a first time length exists in the record, that model can be used directly without needing to re-determine it, thus improving prediction efficiency. For example, used prediction models and their corresponding first time lengths can be recorded in a table, as shown in Table 1 below:
[0230] Table 1
[0231] First time length Predictive Model 3 days Prediction Model 1 5 days Prediction Model 2 8 days Prediction Model 3 ... ...
[0232] In subsequent use, if it is necessary to predict the data for the 8th day after the base time, that is, the first time length is 8 days, and there is a corresponding prediction model (prediction model 3) in Table 1, then prediction model 3 can be used directly without having to re-determine the prediction model.
[0233] S702. Input the first data into the prediction model; wherein the prediction model includes multiple sub-models and at least one first correction model, the multiple sub-models correspond to at least one time step, the time step is used to indicate the time length of the data predicted by the sub-model, each of the multiple sub-models is used to predict the second data corresponding to the time step, the second data output by each sub-model is related to the first data, and at least one first correction model is used to correct the second data output by each sub-model.
[0234] S703. Output the prediction result, which is obtained based on at least one of the multiple second data from the outputs of multiple sub-models. The prediction result is used to indicate future data.
[0235] In this embodiment, first data can be input into a prediction model, and multiple sub-models within the prediction model can be used for data prediction. A first correction model will then correct the second data output by the sub-models, such as... Figure 9 As shown, the corrected second data is obtained, which leads to a more accurate prediction result.
[0236] In the embodiments of this application, the data processing process of the prediction model is related to its arrangement. The data processing process of the two prediction models with serial and parallel arrangements will be described below.
[0237] I. Data processing procedure for a serially arranged prediction model:
[0238] When the prediction model is arranged sequentially, the first data can be used as the input to the first sub-model in the prediction model, and the second data output by the last sub-model in the prediction model can be used as the prediction result. Specifically, the input of each first correction model in the prediction model is the output of the previous sub-model, and the output of each first correction model is the input of the next sub-model; accordingly, the first correction model can correct the second data output by the corresponding sub-model to improve the prediction accuracy at the output level.
[0239] Figure 10A A sequentially arranged prediction model is illustrated. In this example, the sub-models and the first correction model are arranged in the following order: Sub-model 1, First Correction Model 1, Sub-model 2, First Correction Model 2, Sub-model 3, First Correction Model 3. During data prediction, the first data can be used as the input to Sub-model 1. The second data 1 output by Sub-model 1 can be used as the input to First Correction Model 1. The corrected second data 1 output by First Correction Model 1 can be used as the input to Sub-model 2. The second data 2 output by Sub-model 2 can be used as the input to First Correction Model 2. The corrected second data 2 output by First Correction Model 2 can be used as the input to Sub-model 3. The second data 3 output by Sub-model 3 can be used as the input to First Correction Model 3. The corrected second data 3 output by Third Correction Model 3 is the prediction result.
[0240] II. Data processing procedure for parallel-arranged prediction models:
[0241] When the prediction model is arranged in parallel, the first data can be used as the input of each sub-model in the prediction model, and the prediction result can be determined based on the second data output by each second sub-model.
[0242] Figure 10BA parallel prediction model is illustrated. In this example, the prediction model specifically includes: sub-model 1 and first correction model 1 (branch 1), sub-model 2 and first correction model 2 (branch 2), and sub-model 3 and first correction model 3 (branch 3). The first data includes multiple data points, each corresponding to one of the sub-models in the prediction model. During data prediction, the first data point 1 corresponding to sub-model 1 can be used as the input of sub-model 1, and the second data point 1 output by sub-model 1 can be used as the input of first correction model 1, which can then output the corrected second data point 1. Similarly, the first data point 2 corresponding to sub-model 2 can be used as the input of sub-model 2, and the second data point 2 output by sub-model 2 can then be used as the input of first correction model 2, which can then output the corrected second data point 2. Likewise, the first data point 3 corresponding to sub-model 3 can be used as the input of sub-model 3, and the second data point 3 output by sub-model 3 can then be used as the input of first correction model 3, which can then output the corrected second data point 3. Based on the corrected second data point 1, second data point 2, and second data point 3, the prediction result can be determined.
[0243] It should be understood that the second data output by the sub-model is related to the first data, the difference being that the second data and the first data are at different times. The time of the second data is after the reference time, and the time of the first data is before the reference time. For example, if the first data is a meteorological parameter, then the second data is also a meteorological parameter; or if the first data is an energy-related parameter, then the second data is also an energy-related parameter; or if the first data is a transportation-related parameter, then the second data is also a transportation-related parameter; or if the first data is an agriculture-related parameter, then the second data is also an agriculture-related parameter.
[0244] In the embodiments of this application, when the prediction model is arranged in parallel, the prediction result can be obtained from multiple second data output by multiple sub-models, and the prediction result can be used to indicate future data.
[0245] As an example, when the prediction model is arranged in parallel, the prediction result may include multiple third data corresponding to multiple second data. The third data are the second data that have been corrected by the first correction model corresponding to each sub-model, and each second data can correspond to one third data.
[0246] For example, if the prediction model is arranged in parallel and includes the following sub-models: sub-model 1, sub-model 2 and sub-model 3, then the prediction result may include the third data 1 corresponding to the second data 1 output by sub-model 1, the third data 2 corresponding to the second data 2 output by sub-model 2, and the third data 3 corresponding to the second data 3 output by sub-model 3.
[0247] As another example, when the prediction model is arranged in parallel, the prediction result can include multiple third data corresponding to multiple second data. The third data is the second data that has been corrected by the first correction model corresponding to each sub-model. Multiple second data of the same size can correspond to one third data, and multiple second data of different sizes can each correspond to one third data.
[0248] For example, the prediction model is arranged in parallel, including sub-model 1, sub-model 2, sub-model 3, sub-model 4, sub-model 5, and sub-model 6. The second data output by each sub-model are: second data 1, second data 2, second data 3, second data 4, second data 5, and second data 6, respectively. Second data 1 and second data 2 have the same value, so the prediction result can include third data 1 corresponding to second data 1 / second data 2. Second data 3 is different from all the other second data, so the prediction result can include third data 2 corresponding to second data 3. Second data 4, second data 5, and second data 6 have the same value, so the prediction result can include third data 3 corresponding to second data 4 / second data 5 / second data 6. In this example, the prediction result includes third data 1, third data 2, and third data 3. This reduces redundancy in the prediction result, providing a more concise result.
[0249] As another example, when the prediction model is arranged in parallel, the prediction results can include multiple third data points corresponding to multiple second data points, as well as the probabilities of different types of future data indicated by the multiple third data points. Specifically, the probability of the occurrence of the future data indicated by the third data point corresponding to each second data point can be determined based on the frequency of occurrence of each second data point. For example, a prediction model includes 10 sub-models. During the inference process, 10 second data points are obtained. Eight of these second data points have the same value, meaning their frequency is 8. The prediction result may include one third data point (denoted as third data point 1) corresponding to these eight second data points, and the probability of the future data indicated by third data point 1 occurring is determined to be 8 / 10 * 100% = 80%. The other two second data points have the same value, so the prediction result may include one third data point (denoted as third data point 2) corresponding to these two second data points, and the probability of the future data indicated by third data point 2 occurring is determined to be 2 / 10 * 100% = 20%. Therefore, the prediction result includes: third data point 1 and its corresponding probability of occurrence is 80%, and third data point 2 and its corresponding probability of occurrence is 20%. Furthermore, the type of future data indicated by the third data point can be determined based on preset type classification conditions. Based on the probability of occurrence of the third data point, the probability of occurrence of the type of future data indicated by the third data point can be determined. The type of future data is related to the type of the first data point.
[0250] For example, if the first data is a meteorological parameter, then the future data will also be meteorological parameters, and the type of the future data can be the same as the type of meteorological parameters. For instance, if the first data is precipitation, then the future data can also be precipitation, and the type of the future data can be the same as the type of precipitation. Here, the type of the future data can be one of no rain, light rain, moderate rain, heavy rain, and rainstorm.
[0251] For example, if the first data is an energy-related parameter, then the future data will also be energy-related parameters. The type of the future data can be the same as that of energy-related parameters. For instance, if the first data is electricity consumption, then the future data can also be electricity consumption. The type of the future data can be one of the following: low load, normal load, high load, and overload.
[0252] For example, if the first data is an agricultural-related parameter, then the future data will also be agricultural-related parameters, and the type of the future data can be the same as the type of agricultural-related parameters. For instance, if the first data is crop yield, then the future data can also be crop yield, and the type of the future data can be the same as the type of crop yield. Here, the type of the future data can be either a bumper harvest or a poor harvest.
[0253] For example, if the first data is a traffic-related parameter, then the future data will also be traffic-related parameters, and the type of the future data can be the same as the type of traffic-related parameters. For instance, if the first data is traffic flow, then the future data can also be traffic flow, and the type of the future data can be the same as the type of traffic flow. Here, the type of the future data can be one of smooth traffic, slow traffic, or severe congestion.
[0254] Since the prediction results are derived by combining the second data from the outputs of various sub-models, including multiple third data (i.e., the outputs of multiple predictions), the bias caused by a single deterministic prediction can be avoided, which helps to improve the reliability of the prediction.
[0255] It's important to understand that the model training and data prediction processes can be performed by the same computer device or by different computer devices. For example, the model training and data prediction processes can be performed by a server; or, for instance, the model training process can be performed by a server, which provides an interface for terminal devices (such as mobile phones) to call the trained model for data prediction.
[0256] exist Figure 4 Based on the corresponding embodiments, in order to better implement the above-described solutions of this application, related equipment for implementing the above solutions is also provided below. See details. Figure 11 , Figure 11 This is a schematic diagram of a model training device 1100 provided in an embodiment of this application. The model training device 1100 includes:
[0257] The acquisition module 1101 is used to acquire the first output data of the first sub-model and the second output data of the second sub-model, wherein the first output data and the second output data correspond to the same time, and the time step of the second sub-model is smaller than the time step of the first sub-model.
[0258] Input module 1102 is used to input the first output data into the second correction model to obtain the third output data;
[0259] The update module 1103 is used to update the second correction model based on the second output data and the third output data to obtain the first correction model.
[0260] In one specific implementation of this application embodiment, the input module 1102 is specifically used for:
[0261] The training loss is determined based on the distance between the second output data and the third output data;
[0262] The second correction model is updated based on the training loss to obtain the first correction model.
[0263] It should be noted that the information execution process of the modules of the above-mentioned model training device 1100 can be specifically described in the method embodiments shown above in this application, and will not be repeated here.
[0264] exist Figure 7 Based on the corresponding embodiments, in order to better implement the above-described solutions of this application, related equipment for implementing the above solutions is also provided below. See details. Figure 12A , Figure 12A This is a schematic diagram of a data prediction device 1200 provided in an embodiment of this application. The data prediction device 1200 includes:
[0265] The acquisition module 1201 is used to acquire first data and time information; wherein, the time information is used to indicate the time for predicting future data related to the first data;
[0266] Input module 1202 is used to input the first data into a prediction model; wherein, the prediction model includes multiple sub-models and at least one first correction model, the multiple sub-models correspond to at least one time step, the time step is used to indicate the time length of the data predicted by the sub-model, each of the multiple sub-models is used to predict second data at the corresponding time step, the second data output by each sub-model is related to the first data, and the at least one first correction model is used to correct the second data output by each sub-model;
[0267] The output module 1203 is used to output a prediction result, which is obtained based on at least one of the second data from the plurality of second data output by the plurality of sub-models, and the prediction result is used to indicate the future data.
[0268] For details, please refer to [link / reference]. Figure 12B In one specific implementation of this application embodiment, the data prediction device 1200 further includes:
[0269] Selection module 1204 is used to select the plurality of sub-models from the database according to the time information, and the at least one first correction model corresponding to the plurality of sub-models;
[0270] The combination module 1205 is used to combine the plurality of sub-models and the at least one first correction model to obtain the prediction model.
[0271] In one specific implementation of this application embodiment, the first time length indicated by the time information is the sum of the time steps of each of the plurality of sub-models;
[0272] Correspondingly, the multiple sub-models in the prediction model and the at least one first correction model are arranged alternately in the order of sub-model first and first correction model second, wherein the input of each first correction model is the output of the previous sub-model, and the output of each first correction model is the input of the next sub-model.
[0273] In one specific implementation of this application, the input of the first sub-model in the prediction model is the first data, and the prediction result is the second data output by the last sub-model in the prediction model.
[0274] In one specific implementation of this application embodiment, the first time length indicated by the time information is less than or equal to the time step of each of the plurality of sub-models;
[0275] Correspondingly, the prediction model has multiple sub-models arranged in parallel, and the output of each sub-model is the input of the first correction model.
[0276] In one specific implementation of this application, the input of each sub-model in the prediction model is the first data, and the prediction result includes multiple third data corresponding to the multiple second data. The third data is the second data corrected by the first correction model corresponding to each sub-model.
[0277] In one specific implementation of this application, the prediction result further includes the probabilities of different types of future data indicated by the plurality of third data.
[0278] In one specific implementation of this application, the first data is a meteorological parameter.
[0279] It should be noted that the information execution process of the module of the aforementioned data prediction device 1200 can be found in the description of the method embodiment shown above in this application, and will not be repeated here.
[0280] The information interaction and execution process between the modules of the above-mentioned device are based on the same concept as the method embodiment of this application, and the resulting technical effects are the same as those of the method embodiment of this application. For details, please refer to the description in the method embodiment shown above in the embodiment of this application, and it will not be repeated here.
[0281] Figure 13 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 13As shown, in one embodiment of the computer device 130 in this application, one embodiment may include one or more processors 1310, communication lines 1320, input / output devices 1330, communication interfaces 1340, and memory 1350.
[0282] The processor 1310 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (server IC), or one or more integrated circuits used to control the execution of programs according to the present application.
[0283] Communication line 1320 may include a path for transmitting information between the aforementioned components.
[0284] Input / output device 1330 may include one or more of a keyboard, mouse, or monitor.
[0285] The communication interface 1340 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.
[0286] The memory 1350 can be temporary or persistent storage for storing programs and scene recognition files. Furthermore, the processor 1310 can be configured to communicate with the memory 1350 and execute a series of instructions stored in the memory 1350 on the device.
[0287] In this embodiment, the processor 1310 can execute the aforementioned... Figure 4 or Figure 7 The method steps in the illustrated embodiments will not be described in detail here.
[0288] In this embodiment, the specific functional module division in the processor 1310 can be the same as described above. Figure 11 , Figure 12A or Figure 12B The module division method described in the previous section is similar, and will not be repeated here.
[0289] This application also relates to a computer storage medium, including computer-readable instructions, which, when executed, implement as follows: Figure 4 or Figure 7 The method described.
[0290] This application also relates to a computer program product containing instructions that, when run on a computer, cause the computer to perform actions such as... Figure 4or Figure 7 The method described.
[0291] This application also relates to a chip system, which includes a processor for calling computer programs or computer instructions stored in memory, so that the processor performs actions such as... Figure 4 or Figure 7 The method.
[0292] In one possible implementation, the processor is coupled to the memory via an interface.
[0293] In one possible implementation, the chip system also includes a memory that stores computer programs or computer instructions.
[0294] This application also relates to a processor for calling computer programs or computer instructions stored in memory, so that the processor performs, for example... Figure 4 or Figure 7 The method described.
[0295] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0296] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0297] 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 units can be selected to achieve the purpose of this embodiment according to actual needs.
[0298] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0299] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. 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 this application. 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.
[0300] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application 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. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A data prediction method, characterized in that, include: Acquire first data and time information; wherein the time information is used to indicate the time for predicting future data related to the first data; The first data is input into the prediction model; wherein the prediction model includes multiple sub-models and at least one first correction model, the multiple sub-models correspond to at least one time step, the time step is used to indicate the time length of the data predicted by the sub-model, each of the multiple sub-models is used to predict the second data corresponding to the time step, the second data output by each sub-model is related to the first data, and the at least one first correction model is used to correct the second data output by each sub-model. The prediction result is output based on at least one of the second data points output by the plurality of sub-models, and the prediction result is used to indicate the future data.
2. The method according to claim 1, characterized in that, The method further includes: Based on the time information, select the plurality of sub-models from the database, and the at least one first correction model corresponding to the plurality of sub-models; The prediction model is obtained by combining the multiple sub-models and the at least one first correction model.
3. The method according to claim 2, characterized in that, The first time length indicated by the time information is the sum of the time steps of each of the multiple sub-models; Correspondingly, the multiple sub-models in the prediction model and the at least one first correction model are arranged alternately in the order of sub-model first and first correction model second, wherein the input of each first correction model is the output of the previous sub-model, and the output of each first correction model is the input of the next sub-model.
4. The method according to claim 3, characterized in that, The first data is the input to the first sub-model in the prediction model, and the prediction result is the second data output by the last sub-model in the prediction model.
5. The method according to claim 2, characterized in that, The time information indicates a first time length that is less than or equal to the time step of each of the plurality of sub-models; Correspondingly, the prediction model has multiple sub-models arranged in parallel, and the output of each sub-model is the input of the first correction model.
6. The method according to claim 5, characterized in that, The input to each sub-model in the prediction model is the first data, and the prediction result includes multiple third data corresponding to the multiple second data. The third data is the second data that has been corrected by the first correction model corresponding to each sub-model.
7. The method according to claim 6, characterized in that, The prediction results also include the probabilities of different types of future data indicated by the plurality of third data.
8. The method according to any one of claims 1-7, characterized in that, The first data consists of meteorological parameters.
9. A model training method, characterized in that, include: Obtain the first output data of the first sub-model and the second output data of the second sub-model. The first output data and the second output data correspond to the same time. The time step of the second sub-model is smaller than the time step of the first sub-model. The first output data is input into the second correction model to obtain the third output data; The second correction model is updated based on the second output data and the third output data to obtain the first correction model.
10. The method according to claim 9, characterized in that, The step of updating the second correction model based on the second output data and the third output data to obtain the first correction model includes: The training loss is determined based on the distance between the second output data and the third output data; The second correction model is updated based on the training loss to obtain the first correction model.
11. A data prediction device, characterized in that, include: An acquisition module is used to acquire first data and time information; wherein the time information is used to indicate the time for predicting future data related to the first data; An input module is used to input the first data into a prediction model; wherein the prediction model includes multiple sub-models and at least one first correction model, the multiple sub-models correspond to at least one time step, the time step is used to indicate the time length of the data predicted by the sub-model, each of the multiple sub-models is used to predict second data at the corresponding time step, the second data output by each sub-model is related to the first data, and the at least one first correction model is used to correct the second data output by each sub-model; An output module is used to output a prediction result, which is obtained based on at least one of the second data from the plurality of second data output by the plurality of sub-models, and the prediction result is used to indicate the future data.
12. A model training device, characterized in that, include: The acquisition module is used to acquire the first output data of the first sub-model and the second output data of the second sub-model. The first output data and the second output data correspond to the same time, and the time step of the second sub-model is smaller than the time step of the first sub-model. The input module is used to input the first output data into the second correction model to obtain the third output data; An update module is used to update the second correction model based on the second output data and the third output data to obtain the first correction model.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 10.
14. A computer program product, characterized in that, The computer program product includes code that, when executed, performs the steps of the method according to any one of claims 1 to 10.
15. A computer device, characterized in that, The device includes a processor coupled to at least one memory, the processor being configured to read a computer program stored in the at least one memory, causing the computer device to perform the method as described in any one of claims 1 to 10.
