Data prediction method, device and storage medium

By combining layered time series data with preset models and loss functions and gradient solving to optimize model parameters, the problem of low single-level prediction accuracy in existing technologies is solved, achieving higher prediction accuracy.

CN113656691BActive Publication Date: 2025-09-19BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110943383.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-17
Publication Date
2025-09-19
Estimated Expiration
2041-08-17

AI Technical Summary

Technical Problem

Existing time series forecasting methods usually rely on data from a single level, resulting in low forecast accuracy, and are prone to introducing errors when selecting levels and aggregating or decomposing results, and lack cross-level information utilization.

Method used

Using hierarchical time series data, the preset data prediction model is combined with the loss function and gradient solution. The model parameters are optimized through iterative training, and the errors between each layer and the prediction error are considered to form a more accurate prediction model.

Benefits of technology

The accuracy of time series prediction is improved. By considering the errors between each level and the prediction error, the trained model performs more accurately in hierarchical time series prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113656691B_ABST
    Figure CN113656691B_ABST
Patent Text Reader

Abstract

The present invention provides a data prediction method, device and storage medium, which obtains hierarchical time series data; the hierarchical time series data is multiple groups of data corresponding to the time series of each level, wherein the sum of the data of the sub-levels of each level in each level is equal to the data of the corresponding parent level; the hierarchical time series data is predicted using a preset data prediction model to determine the prediction results within a preset time period after multiple historical time periods; wherein the preset data prediction model is trained based on the prediction errors of multiple groups of training data within the historical preset time period in the hierarchical time series data, as well as the errors between the various levels. Since the preset data prediction model not only takes into account the accuracy of the prediction error during training, but also takes into account the errors between the various levels, the trained preset data prediction model is more accurate in predicting data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of prediction model technology, and in particular to a data prediction method, device, and storage medium. Background Art

[0002] Time series forecasting has a wide range of applications, including demand forecasting in the retail industry, financial market forecasting, and logistics volume forecasting. Time series forecasting plays a crucial role in automating and intelligentizing many business processes. For example, online shopping websites need to predict sales of each product category over a period of time, which is a crucial factor in making business decisions. Factors such as inventory preparation and promotions must be considered, so forecasting technology ultimately has a significant impact on sales revenue, inventory costs, and other factors. Furthermore, large online shopping websites can sell up to millions of products simultaneously, creating new challenges for modern time series forecasting technologies.

[0003] In existing technologies, time series forecasting uses data from a single level for prediction, then decomposing or aggregating it to derive prediction results for other levels. While this approach is simple and convenient, it also often results in relatively low prediction accuracy. Key drawbacks include: First, existing forecasting methods essentially rely solely on the prediction results from a single level, failing to leverage the information contained in the prediction data from other levels, resulting in a loss of accuracy; second, aggregating or decomposing the prediction results upwards or downwards introduces additional prediction errors. Furthermore, because different single levels yield different results, the choice of level relies heavily on manual experience, which also results in a loss of accuracy. Summary of the Invention

[0004] The embodiments of the present invention provide a data prediction method, device, and storage medium, which can improve the accuracy of data prediction.

[0005] The technical solution of the present invention is achieved as follows:

[0006] An embodiment of the present invention provides a data prediction method, comprising:

[0007] Obtain hierarchical time series data; hierarchical time series data is multiple sets of data corresponding to time series at each level, where the sum of the data of each sub-level in each level is equal to the data of the corresponding parent level;

[0008] Using the preset data prediction model, the layered time series data is predicted to determine the prediction results within the preset time period after multiple historical time periods;

[0009] The preset data prediction model is trained based on the prediction errors of multiple sets of training data within a historical preset time period in the layered time series data, as well as the errors between each layer.

[0010] In the above solution, after obtaining the layered time series data, the method further includes: using a preset data prediction model to predict the layered time series data, and determining the prediction results within the preset time period after multiple historical time periods.

[0011] Standardize multiple sets of hierarchical time series data, and divide the standardized data into training sets and test sets according to preset historical time periods; the training set includes: multiple sets of training data; the test set includes: multiple sets of test data;

[0012] The prediction error of the training set and the error between each layer are calculated using the loss function of the initial prediction model, and the model parameters of the initial prediction model are iteratively adjusted based on the prediction error and the error between each layer until the training conditions are met, thereby obtaining a first prediction data set corresponding to the test set; the first prediction data set includes: multiple prediction data from the iterative process of each layer for each historical time period corresponding to the test set;

[0013] The plurality of test data sets are compared with the first prediction data set to determine a preset data prediction model.

[0014] In the above scheme, the prediction error of the training set and the error between each layer are calculated using the loss function of the initial prediction model. The model parameters of the initial prediction model are iteratively adjusted according to the prediction error and the error between each layer until the training conditions are met. The first prediction data set corresponding to the test set is obtained, including:

[0015] Inputting multiple sets of training data into the initial prediction model to obtain a second prediction data set; the second prediction data set includes: prediction data of various levels in multiple historical time periods;

[0016] Based on the second prediction data set and multiple sets of training data, the prediction error and the error between each layer are calculated in combination with the loss function;

[0017] Solve the gradient of the loss function to obtain the model parameters in the iterative process, thereby obtaining an updated prediction model;

[0018] Using the updated prediction model, continue training multiple sets of training data until the training conditions are met, and obtain the final prediction model, thereby obtaining multiple prediction models in the iterative process;

[0019] When using multiple prediction models to obtain each corresponding second prediction data set, the prediction data of each level of each historical time period of the corresponding test set is extracted to obtain the first prediction data set in the iterative process.

[0020] In the above solution, based on the second prediction data set and multiple sets of training data, the prediction error and the error between each layer are calculated in combination with the loss function, including:

[0021] Calculating a prediction error based on first prediction data in a second prediction data set and multiple sets of training data; the first prediction data is prediction data of each level in multiple first time periods in the second prediction data set; the multiple first time periods are time periods before a preset historical time period in the multiple historical time periods;

[0022] Based on the second prediction data in the second prediction data set, the errors between each level are calculated; the second prediction data is the prediction data of each level in multiple second time periods in the second prediction data set; the multiple second time periods are time periods after the preset historical time period in multiple historical time periods.

[0023] In the above solution, the prediction error is calculated based on the first prediction data in the second prediction data set and multiple sets of training data, including:

[0024] Calculate the sum of the squares of the differences between the first prediction data in the same first time period and the training data of the corresponding level, and then obtain the first sums of each level in the same first time period. Add up the multiple first sums corresponding to multiple first time periods to obtain the prediction error.

[0025] In the above solution, based on the second prediction data in the second prediction data set, the errors between the various levels are calculated, including:

[0026] Calculating the sum of squares of differences between the prediction data of each parent level of each layer in the second prediction data in the same second time period and the sum of the prediction data of each corresponding child level, and adding multiple square sums of multiple second time periods to obtain a second sum;

[0027] Multiply the multiple second sums by the harmonic error penalty hyperparameter to obtain the error between each layer.

[0028] In the above solution, multiple sets of test data are compared with the first prediction data set to determine the preset data prediction model, including:

[0029] Comparing the multiple test data sets with the multiple prediction data sets in the first prediction data set, and determining multiple comparison errors corresponding to the multiple prediction data sets;

[0030] Determining a target comparison error within a preset error range among multiple comparison errors;

[0031] Determine the target number of iterations corresponding to the target number of prediction data corresponding to the target comparison error;

[0032] A prediction data prediction model corresponding to a target iteration is determined among multiple prediction models.

[0033] In the above solution, the multiple sets of training data include: multiple sets of first processed data; the multiple sets of test data include: multiple sets of second processed data;

[0034] Standardize multiple sets of stratified time series data and divide the standardized data into training sets and test sets according to preset historical time periods, including:

[0035] Delete outliers at each level in multiple sets of data and fill them with the average data of the level corresponding to the outliers;

[0036] The average data corresponding to the level with blank data is used to fill the blank data corresponding to each level in multiple sets of data, thereby obtaining multiple sets of processed data corresponding to the time series of each level;

[0037] A preset historical time period is determined from multiple historical time periods, multiple groups of first processed data corresponding to multiple first time periods before the preset historical time period are combined into a training set, and multiple groups of second processed data corresponding to multiple second time periods after the preset historical time period are combined into a test set.

[0038] In the above solution, the method further includes:

[0039] Obtain multiple sets of logistics cargo volume data corresponding to multiple historical time periods;

[0040] The preset data prediction model is used to process multiple groups of logistics cargo volume data to obtain the predicted logistics cargo volume data for the preset time period after multiple historical time periods.

[0041] An embodiment of the present invention further provides a data prediction device, comprising:

[0042] A data acquisition unit is used to acquire hierarchical time series data; hierarchical time series data is a plurality of groups of data corresponding to time series of each level, wherein the sum of the data of the sub-levels of each level in each level is equal to the data of the corresponding parent level;

[0043] The prediction unit is used to predict the hierarchical time series data using a preset data prediction model to determine the prediction results within a preset time period after multiple historical time periods; wherein,

[0044] The preset data prediction model is trained based on the prediction errors of multiple sets of training data within a historical preset time period in the hierarchical time series data, as well as the errors between each level.

[0045] An embodiment of the present invention further provides a data prediction device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor implements the steps in the above method when executing the program.

[0046] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above method when executed by a processor.

[0047] In an embodiment of the present invention, hierarchical time series data is obtained; the hierarchical time series data is a plurality of groups of data corresponding to the time series of each level, wherein the sum of the data of the sub-levels of each level in each level is equal to the data of the corresponding parent level; a preset data prediction model is used to predict the hierarchical time series data, and a prediction result within a preset time period after multiple historical time periods is determined; wherein the preset data prediction model is trained based on the prediction errors of multiple groups of training data within the historical preset time period in the hierarchical time series data, as well as the errors between the various levels. Since the preset data prediction model is trained based on the prediction errors of multiple groups of training data within the historical time period and the errors between the various levels, not only the accuracy of the prediction errors is taken into account during training, but also the errors between the various levels, so the trained preset data prediction model is more accurate in predicting the data. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 An optional flowchart of a data prediction method provided by an embodiment of the present invention;

[0049] Figure 2 An optional effect diagram of the data prediction method provided by an embodiment of the present invention;

[0050] Figure 3 An optional effect diagram of the data prediction method provided by an embodiment of the present invention;

[0051] Figure 4 An optional flowchart of a data prediction method provided by an embodiment of the present invention;

[0052] Figure 5 An optional flowchart of a data prediction method provided by an embodiment of the present invention;

[0053] Figure 6 An optional flowchart of a data prediction method provided by an embodiment of the present invention;

[0054] Figure 7 An optional flowchart of a data prediction method provided by an embodiment of the present invention;

[0055] Figure 8 An optional flowchart of a data prediction method provided by an embodiment of the present invention;

[0056] Figure 9 An optional flowchart of a data prediction method provided by an embodiment of the present invention;

[0057] Figure 10 A schematic diagram of the structure of a logistics cargo volume prediction device provided by an embodiment of the present invention;

[0058] Figure 11 An optional flowchart of a data prediction method provided by an embodiment of the present invention;

[0059] Figure 12 A schematic diagram of the structure of the data prediction device provided by the embodiment of the present invention Figure 1 ;

[0060] Figure 13 A schematic diagram of the structure of the data prediction device provided by the embodiment of the present invention Figure 2 ;

[0061] Figure 14 A schematic diagram of a hardware entity of a data prediction device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0062] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention are further elaborated in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limiting the present invention. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0063] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0064] If similar descriptions of "first / second" appear in the invention document, the following explanation is added. In the following description, the terms "first\second\third" involved are only used to distinguish similar objects and do not represent a specific order for the objects. It can be understood that "first\second\third" can be interchanged with the specific order or sequence where permitted, so that the embodiments of the invention described herein can be implemented in an order other than that illustrated or described herein.

[0065] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention pertains. The terms used herein are for the purpose of describing embodiments of the present invention only and are not intended to limit the present invention.

[0066] In existing technology, for example, a national fast-moving consumer goods manufacturer needs to simultaneously forecast future sales of a particular product nationwide and by province in order to formulate inventory layout and stocking plans. The forecasting solution involves performing single-time series forecasts for both provincial and national sales time series. However, these forecast results at different levels often do not automatically meet consistency. That is, the sum of the national sales forecast and the provincial sales forecast will not be equal. Such inconsistent forecast results cannot be used in collaborative decision-making processes at all levels.

[0067] The main forecasting methods currently available include "Top-Down," "Bottom-Up," "Middle-Out," and "Optimal Harmonization." As the name implies, "Top-Down" means forecasting the highest-level time series first, then splitting the forecast results to lower levels according to a fixed ratio. "Bottom-Up" means forecasting the finest-grained time series first, then aggregating the forecast results upward. The "Middle-Out" method combines the bottom-up and top-down approaches. First, the "middle level" is selected and forecasts are generated for all series at that level. For series above the middle level, the bottom-up approach is used to generate a consistent forecast by aggregating the "middle level" forecasts upward. For series below the "middle level," the top-down approach is used to generate a consistent forecast by decomposing the "middle level" forecasts downward. The "Optimal Harmonization" method first obtains forecast results for all levels, then processes these forecast results through optimal linear weighted harmonization to obtain the final result.

[0068] The three most commonly used methods are "top-down," "bottom-up," and "intermediate breakthrough." These methods use data from only a single level for prediction, then derive prediction results for other levels through splitting or aggregation. While simple and convenient to use, they also generally result in relatively low prediction accuracy. Their main drawbacks are: First, all three prediction methods essentially only use prediction results from a single level, failing to leverage the information contained in prediction data from other levels, resulting in a loss of accuracy; second, aggregating or decomposing prediction results upwards or downwards also introduces additional prediction errors. Furthermore, because different single levels yield different results, the choice of level relies heavily on manual experience, which also results in a loss of accuracy.

[0069] In order to solve the technical problem of low prediction accuracy of the above-mentioned prediction model, the embodiment of the present invention also provides a data prediction method, please refer to Figure 1 , is an optional flow chart of the data prediction method provided by the embodiment of the present invention, which is combined with Figure 1 The steps shown are explained.

[0070] S101. Obtain hierarchical time series data; hierarchical time series data is a plurality of groups of data corresponding to time series of each level, wherein the sum of the data of the sub-levels of each level in each level is equal to the data of the corresponding parent level.

[0071] In an embodiment of the present invention, a server obtains hierarchical time series data, wherein the hierarchical time series data is a plurality of sets of data corresponding to time series of each level, wherein the sum of the data of the sub-levels of each level in each level is equal to the data of the corresponding parent level.

[0072] In this embodiment of the present invention, the server pre-establishes communication connections with clients corresponding to each layer. Through these communication connections, the server obtains from the clients multiple sets of data at each layer corresponding to multiple historical time periods. In other words, the server obtains multiple sets of data corresponding to each layer's time series from the clients at each layer.

[0073] In the embodiment of the present invention, the server obtains pre-stored hierarchical time series data in its own database.

[0074] Any one of the multiple sets of data may include a combination of data corresponding to each level of any time series. That is, any one of the multiple sets of data may include a combination of data corresponding to each level of any time period in multiple historical time periods. One piece of data in a set of data may include any one of sales volume data, logistics volume data, or user age data at a corresponding level. The logistics volume data may include any one of the total number of logistics items, total logistics weight, and total logistics volume.

[0075] For example, the time series may be three time series corresponding to the three months before the current moment, or three time series corresponding to the three days before the current moment. In the embodiment of the present invention, the time series is not limited.

[0076] In this embodiment of the present invention, a sub-level can be a city level, and the parent level can be the province level corresponding to the sub-level. A province level can correspond to multiple city levels. The parent level can also be a first-level agent, and the sub-level can be multiple second-level agents corresponding to the parent level. A first-level agent can correspond to multiple second-level agents. The sum of the data of multiple sub-levels is the data corresponding to the parent level.

[0077] In the embodiment of the present invention, the server first collects the layered time series data to be predicted. The value of the i-th time series observed by the server at time 1-T is recorded as y i =(y t i ,…,y T i ) T ,i=1,…,n. Among them, y i =(y t i ,…,y T i ) T Represents the data of each level in 1-T time periods, where 1,…,n represents n levels.

[0078] Among them, the hierarchical time series data satisfies the requirement that the sum of the data of each sub-level is equal to the data of the corresponding parent level. Figure 2 , the hierarchical structure satisfies y1=y2+y3, where y1 is the parent-level data corresponding to y2 and y3, and y2 and y3 are the child-level data corresponding to y1.

[0079] Combine Figure 3 The hierarchical structure of hierarchical time series data satisfies y1=y2+y3, y2=y4+y5, y3=y6+y7. Among them, y2 is the parent level data corresponding to y4 and y5, and y3 is the parent level data corresponding to y6 and y7. The task of hierarchical time series prediction is to predict the value of all time series at the future period t+h given the observation data at time 1, ..., t0. Here, y represents the data in the time series. When the time series is daily, it represents the daily cargo volume. For example, from July 1st to 5th, y_Beijing = (10, 20, 30, 40, 50), and y_Hebei = (30, 40, 50, 60, 10). In the research and application of hierarchical time series, the following hierarchical structure diagram is often used to visually express this constraint. This type of constraint is a fundamental characteristic of hierarchical time series and embodies the meaning of "stratification." Such constraints are natural laws that must be satisfied by all variables within the statistical scope, such as Y_Nationwide = sum(Y_Beijing, Y_Hebei, ...), and Y_Beijing = sum(Y_Haidian, ..., Y_Xicheng).

[0080] S102. Use a preset data prediction model to predict the layered time series data and determine the prediction results within a preset time period after multiple historical time periods; wherein the preset data prediction model is based on the layered time series data, the prediction errors of multiple groups of training data within the historical preset time period, and the errors between each layer, and is trained together.

[0081] In an embodiment of the present invention, the server uses a preset data prediction model to predict the layered time series data and determine the prediction results within a preset time period after multiple historical time periods; wherein the preset data prediction model is based on the layered time series data, the prediction errors of multiple groups of training data within the historical preset time period, and the errors between each level are trained together.

[0082] In an embodiment of the present invention, a server divides multiple sets of data into training sets and test sets. The server iteratively trains an initial prediction model using the training data in combination with a loss function. Through iterative training, the server obtains multiple prediction models corresponding to multiple iterations. The server compares the predicted data of each iteration with the corresponding real data to obtain the prediction error of each iteration. The server determines the prediction model corresponding to the iteration with the smallest error as the preset data prediction model.

[0083] In an embodiment of the present invention, by obtaining hierarchical time series data; the hierarchical time series data is a plurality of groups of data corresponding to the time series of each level, wherein the sum of the data of the sub-levels of each level in each level is equal to the data of the corresponding parent level; using a preset data prediction model, the hierarchical time series data is predicted to determine the prediction results within a preset time period after multiple historical time periods; wherein the preset data prediction model is based on the prediction errors of multiple groups of training data within the historical preset time period in the hierarchical time series data, and the errors between the various levels. Since the preset data prediction model is based on the prediction errors of multiple groups of training data within the historical time period and the errors between the various levels, not only the accuracy of the prediction errors is taken into account during training, but also the errors between the various levels, so the trained preset data prediction model is more accurate in predicting the data.

[0084] In some embodiments, see Figure 4 , Figure 4 An optional flow chart of a data prediction method provided by an embodiment of the present invention is provided. Figure 1 S101 shown is followed by S103 to S105, which will be described in conjunction with each step.

[0085] S103 , performing standardization processing on multiple groups of stratified time series data, and dividing the multiple groups of standardized data into training sets and test sets according to preset historical time periods.

[0086] In an embodiment of the present invention, a server performs normalization processing on multiple sets of hierarchical time series data and divides the normalized data into a training set and a test set according to a preset historical time period. The training set includes multiple sets of training data, and the test set includes multiple sets of test data.

[0087] In an embodiment of the present invention, the server can delete redundant data from the multiple sets of data and fill it with the average data of the corresponding level, or the server can fill the blank data of each level in the multiple sets of data with the average data of the corresponding level to obtain the processed multiple sets of data. Because the multiple sets of data correspond to multiple historical time periods, the server determines a preset historical time period from the multiple historical time periods and determines the several sets of training data corresponding to the preset historical time period as the training set. The server determines the several sets of test data corresponding to the preset historical time period as the test set.

[0088] The training set is the data set used to train the initial prediction model, and the test set is the data set used to determine the preset data prediction model.

[0089] In this embodiment of the present invention, the server preprocesses multiple sets of data, removes outliers and fills in missing values, and normalizes the data. The preprocessed data is then divided into a training set (t = 1, ..., t0) and a test set (t = t0+1, ..., T) based on the intended use at a certain time t0.

[0090] S104. Calculate the prediction error of the training set and the error between each layer using the loss function of the initial prediction model, and iteratively adjust the model parameters of the initial prediction model based on the prediction error and the error between each layer until the training conditions are met, thereby obtaining the first prediction data set corresponding to the test set.

[0091] In an embodiment of the present invention, the server uses the loss function of the initial prediction model to calculate the prediction error of the training set and the error between each layer. Based on the prediction error and the error between each layer, the server iteratively adjusts the model parameters of the initial prediction model until the training conditions are met, thereby obtaining a first prediction data set corresponding to the test set. The first prediction data set includes multiple prediction data from the iterative process for each layer in each historical time period corresponding to the test set.

[0092] In an embodiment of the present invention, the server inputs multiple sets of training data in the training set into the initial prediction model. A second prediction data set is obtained. The second prediction data set includes: prediction data of each level in multiple historical time periods. Based on the second prediction data set and multiple sets of training data, the server calculates the prediction errors of the multiple sets of training data and the errors between the levels in combination with the loss function. The server solves the loss function to obtain the model parameters for this training. The server adjusts the initial prediction model according to the model parameters to obtain a new prediction model. The server continues to train the multiple sets of training data using the new prediction model until the training conditions are met, and the final prediction model is obtained. At the same time, the first prediction data set corresponding to the test set in the iterative process is also obtained.

[0093] The training condition may be satisfied by reaching a preset number of training times or by convergence of the loss function value.

[0094] S105: Compare the multiple test data sets with the first prediction data set to determine a preset data prediction model.

[0095] In the embodiment of the present invention, the server compares multiple groups of test data with the first prediction data set to determine a preset data prediction model.

[0096] In this embodiment of the present invention, the first prediction data set includes multiple prediction data corresponding to multiple iterations of the test set. The server compares the data at each level in each time period of the multiple test data sets with the corresponding data in each prediction data set, determines the error at each level, and then sums the errors at each level to obtain the error of each prediction data set. This allows the server to determine multiple errors corresponding to the multiple prediction data sets. The server determines that the prediction model corresponding to the prediction data set with the smallest error, after iterative adjustment, is the preset data prediction model.

[0097] For example, the server subtracts the data of each level in each time period of the multiple test data sets from the corresponding data in a certain prediction data to obtain the error of the data of each level in each time period. The server adds the errors of the data of each level in each time period to obtain the error of the corresponding prediction data.

[0098] In this embodiment of the present invention, the server iteratively adjusts the prediction model using prediction errors and inter-level errors, resulting in multiple prediction models during the iterative process. The server then compares multiple sets of test data with the first set of prediction data to determine a preset data model. Because the preset data prediction model is trained based on the prediction errors of multiple sets of training data within a historical time period and the inter-level errors, the training considers not only the accuracy of the prediction errors but also the inter-level errors. Therefore, the trained preset data prediction model provides more accurate data predictions.

[0099] In some embodiments, see Figure 5 , Figure 5 An optional flow chart of a data prediction method provided by an embodiment of the present invention is provided. Figure 4 The illustrated S104 can also be implemented through S106 to S110 , which will be described in conjunction with each step.

[0100] S106: Input multiple sets of training data into the initial prediction model to obtain a second prediction data set.

[0101] In an embodiment of the present invention, the server inputs multiple sets of training data into the initial prediction model to obtain a second prediction data set for the first iteration of the iterative process, wherein the second prediction data set includes prediction data of various levels in multiple historical time periods.

[0102] In this embodiment of the present invention, the server inputs multiple sets of training data into the initial prediction model to obtain a second set of prediction data for the first training. Based on the first second set of prediction data, the server calculates the prediction error and the errors between each layer using a loss function. The server then obtains model parameters based on the prediction error and the errors between each layer, adjusts the initial prediction model, and obtains the next updated prediction model. The server again inputs multiple sets of training data into the next updated prediction model, executing the above process again to complete the iteration.

[0103] S107 . Based on the second prediction data set and multiple sets of training data, the prediction error and the error between each layer are calculated in combination with the loss function.

[0104] In the embodiment of the present invention, the server calculates the prediction error and the errors between each layer based on the second prediction data set and multiple sets of training data using a loss function, wherein the loss function is a function corresponding to the initial prediction model.

[0105] In an embodiment of the present invention, the server calculates prediction errors corresponding to the multiple sets of training data for multiple first time periods based on the second prediction data set and the multiple sets of training data using a loss function. The multiple first time periods are time periods before a preset historical time period in the multiple historical time periods. The prediction errors represent the error between the prediction data and corresponding data in the multiple sets of training data.

[0106] In an embodiment of the present invention, the server calculates, based on the second prediction data set and in conjunction with a loss function, the inter-level errors within the second prediction data set for multiple second time periods. The multiple second time periods are time periods after a preset historical time period in the multiple historical time periods. The inter-level errors represent the error between the sum of the data of a parent level and the data of the corresponding child level in the second prediction data set.

[0107] S108. Perform gradient calculation on the loss function to obtain the model parameters in the iterative process, thereby obtaining an updated prediction model.

[0108] In the embodiment of the present invention, the server performs a gradient solution on the loss function to obtain model parameters in the iterative process, thereby obtaining an updated prediction model.

[0109] In the embodiment of the present invention, during the iteration process, the server solves the gradient of the loss function after each iteration to obtain the model parameters for each iteration. The server adjusts the current prediction model based on the model parameters each time to obtain an updated prediction model.

[0110] S109: Using the updated prediction model, continue training multiple sets of training data until the training conditions are met, and obtain the final prediction model, thereby obtaining multiple prediction models in the iterative process.

[0111] In the embodiment of the present invention, the server uses the updated prediction model to continue training multiple sets of training data until the training conditions are met, and obtains the final prediction model, thereby obtaining multiple prediction models in the iterative process.

[0112] In this embodiment of the present invention, the prediction model's network structure backpropagates the prediction error and the errors between each layer through the output layer, then to the intermediate and input layers, layer by layer, using a gradient descent method to adjust the weights of each layer. Once the weights of each layer in the prediction model's network structure have been adjusted, a new prediction model is obtained. The new prediction model's network structure continues to train on the training set until the training conditions are met, resulting in multiple prediction models in the iterative process.

[0113] S110 , extracting the prediction data of each level in each historical time period of the corresponding test set from each corresponding second prediction data set obtained by using multiple prediction models, and then obtaining the first prediction data set in the iterative process.

[0114] In an embodiment of the present invention, the server uses multiple prediction models to obtain each corresponding second prediction data set, extracts the prediction data of each level of each historical time period of the corresponding test set, and then obtains the first prediction data set in the iterative process.

[0115] In this embodiment of the present invention, the server extracts the prediction data for each level in each historical time period corresponding to the test set from each second prediction data set, thereby obtaining a prediction data set corresponding to each iteration. The server combines the prediction data sets from each iteration to form the first prediction data set.

[0116] In an embodiment of the present invention, the server inputs multiple sets of training data into the initial prediction model to obtain a second prediction data set. The server then calculates the prediction error and the error between each layer through the second prediction data set. The server iteratively adjusts the prediction model through the prediction error and the error between each layer to obtain multiple prediction models in the iterative process. At the same time, the server can extract the first prediction data set from the multiple second prediction data sets in the iterative process for comparison. Since the preset data prediction model is based on the prediction error of multiple sets of training data in the historical time period and the error between each layer, not only the accuracy of the prediction error is taken into account during training, but also the error between each layer. Therefore, the preset data prediction model obtained by training is more accurate in predicting the data.

[0117] In some embodiments, see Figure 6 , Figure 6 An optional flow chart of a data prediction method provided by an embodiment of the present invention is provided. Figure 5 The illustrated S107 can also be implemented through S111 to S112 , which will be described in conjunction with each step.

[0118] S111 . Calculate a prediction error based on the first prediction data in the second prediction data set and multiple sets of training data.

[0119] In the embodiment of the present invention, the server calculates the prediction error based on the first prediction data in the second prediction data set and the multiple sets of training data.

[0120] The first prediction data is prediction data of each level in a plurality of first time periods in the second prediction data set, and the plurality of first time periods are time periods before a preset historical time period in the plurality of historical time periods.

[0121] S112. Calculate the errors between the various levels based on the second prediction data in the second prediction data set.

[0122] In the embodiment of the present invention, the server calculates the errors between the various levels based on the second prediction data in the second prediction data set.

[0123] The second prediction data is prediction data of each level in a plurality of second time periods in the second prediction data set, and the plurality of second time periods are time periods after a preset historical time period in the plurality of historical time periods.

[0124] In the embodiment of the present invention, the server constructs a hierarchical time series prediction model based on DeepAR. The DeepAR model is a time series prediction model based on a recurrent neural network. It can be used for general time series prediction, but cannot be directly used for hierarchical time prediction. Therefore, for the hierarchical time series prediction task, the improved loss function (1) for hierarchical time series prediction designed by the present invention is:

[0125]

[0126] in, is the prediction error loss, is the loss function of the DeepAR model. Without loss of generality, we assume here that l(x, y) = (xy) 2 , is the inter-level reconciliation error loss, where λ is the reconciliation error penalty hyperparameter. C is the set of constraints derived from the hierarchical structure. is the predicted value of the “parent node” time series in constraint c at time t, is the predicted value of the “leaf node” time series in the constraint condition c at time t, and J(c) is the number of “leaf nodes”. Figure 3 Taking the hierarchical time series data with the structure shown in as an example, the constraints satisfied by the hierarchical structure are C = {y1 = y2 + y3, y2 = y4 + y5, y3 = y6 + y7}.

[0127] in, is the predicted value. for The corresponding training data. n is the number of levels, t0 is the number of first time periods, and T is the number of second time periods.

[0128] In some embodiments, see Figure 7 , Figure 7 An optional flow chart of a data prediction method provided by an embodiment of the present invention is provided. Figure 6 S111 to S112 shown can also be implemented through S113 to S115, which will be explained in conjunction with each step.

[0129] S113. Calculate the sum of squares of the differences between the first prediction data in the same first time period and the training data of the corresponding level, and then obtain the first sums of each level in the same first time period. Add up multiple first sums corresponding to multiple first time periods to obtain a prediction error.

[0130] In this embodiment of the present invention, the server calculates the sum of squares of the differences between the first predicted data in the same first time period and the training data at the corresponding level, thereby obtaining a first sum for each level in the same first time period. The server then adds together multiple first sums corresponding to multiple first time periods to obtain a prediction error.

[0131] Exemplarily, the multiple first time periods include: two first time periods. Each level includes: a parent level (first-level agent) and two corresponding child levels (two second-level agents). The server calculates the sum of the squares of the differences between the data of the parent level and the corresponding predicted data in the first first time period, and calculates the sum of the squares of the differences between the data of the two child levels and the corresponding predicted data. The server then adds the sum of the squares of the corresponding differences of the parent level to the sum of the squares of the corresponding differences of the two child levels to obtain the first sum corresponding to the first first time period. Similarly, the server uses the same method to calculate the first sum corresponding to the second time period. The server adds the two first sums to obtain the prediction error.

[0132] S114. Calculate the sum of squares of differences between the prediction data of each parent level of each layer in the second prediction data in the same second time period and the sum of the prediction data of each corresponding child level, and add up multiple square sums of multiple second time periods to obtain a second total.

[0133] In an embodiment of the present invention, the server calculates the square sum of the differences between the prediction data of each parent level of each layer in the second prediction data in the same second time period and the sum of the prediction data of each corresponding child level, and adds up multiple square sums of multiple second time periods to obtain a second total.

[0134] Exemplarily, the multiple second time periods include two second time periods. Each level includes a parent level (a first-level agent) and two corresponding child levels (two second-level agents). The server calculates the sum of squares of the difference between the parent level data and the sum of the predicted data for each corresponding child level in the first second time period. Similarly, the server calculates the sum of squares corresponding to the second time period using the same method. The server adds the two sums of squares to obtain a second sum.

[0135] S115. Multiply the multiple second sums by the harmonic error penalty hyperparameter to obtain the errors between each level.

[0136] In the embodiment of the present invention, the server combines the multiple second sums with the harmonic error penalty term hyperparameter to obtain the errors between the various levels.

[0137] Among them, the harmonic error penalty hyperparameter can be any positive number.

[0138] Compared with ordinary time series prediction, hierarchical time series prediction essentially adds consistency constraints between levels to the final prediction results, namely:

[0139]

[0140]

[0141] It is very difficult to directly solve such a large-scale optimization problem. By adding the constraints as penalty terms to the loss function, we can solve Formula (1) through methods such as stochastic gradient descent. For any given difference penalty hyperparameter λ, the inconsistency of the prediction results between layers will decrease as the loss function value decreases during training.

[0142] For hierarchical time series prediction, the future time series of each level must meet the consistency between the levels. By adding the penalty term of harmonic error loss, from the perspective of parameter iteration, this is equivalent to requiring DeepAR's network parameters to take into account both prediction bias and hierarchical structure bias during the optimization process. From the results, this is equivalent to optimizing the lower bound of the test set error. Figure 2 Taking the hierarchical time series in as an example, according to the Cauchy inequality:

[0143]

[0144] Therefore, it can be seen that the hierarchical structure deviation term in the loss function is essentially a lower bound of the prediction error. Intuitively, although the prediction results that meet the consistency between levels are not necessarily guaranteed to have the highest prediction accuracy, since the real data in the future must meet the consistency, then if the error between the levels of the prediction results is large, then the prediction accuracy will definitely not be very high. Therefore, adding this term to the loss function can help improve the prediction performance of hierarchical time series prediction.

[0145] In this embodiment of the present invention, the server calculates the prediction error and the errors between each layer using the first and second prediction data in the second prediction data set. Because the server considers the errors between each layer when calculating the error using a loss function, the prediction model, adjusted using the model parameters of the loss function, provides more accurate data prediction.

[0146] In some embodiments, see Figure 8 , Figure 8 An optional flow chart of a data prediction method provided by an embodiment of the present invention is provided. Figure 3 The illustrated S103 can be implemented through S116 to S118 , which will be described in conjunction with each step.

[0147] S116. Delete the outliers at each level in the multiple data sets, and fill in the data with the average data of the level corresponding to the outliers.

[0148] In the embodiment of the present invention, the server deletes abnormal values ​​at each level in the multiple sets of data and fills them with average data of the level corresponding to the abnormal values.

[0149] The average data is the average value of multiple data of the level corresponding to the abnormal value in multiple historical time periods.

[0150] S117 , using the average data corresponding to the level with blank data to fill the blank data corresponding to each level in the multiple sets of data, thereby obtaining multiple sets of processed data corresponding to the time series of each level.

[0151] In the embodiment of the present invention, the server fills the blank data corresponding to each level in the multiple sets of data with the average data corresponding to the level with blank data, thereby obtaining multiple sets of processed data corresponding to the time series of each level.

[0152] S118. Determine a preset historical time period from multiple historical time periods, combine multiple groups of first processed data corresponding to multiple first time periods before the preset historical time period into a training set, and combine multiple groups of second processed data corresponding to multiple second time periods after the preset historical time period into a test set.

[0153] In an embodiment of the present invention, the server determines a preset historical time period from multiple historical time periods, combines multiple groups of first processed data corresponding to multiple first time periods before the preset historical time period into a training set, and combines multiple groups of second processed data corresponding to multiple second time periods after the preset historical time period into a test set.

[0154] For example, the multiple historical time periods may include 12 time periods corresponding to January through December. The server may determine September as the preset historical time period. If the server determines September as the preset historical time period, the multiple first time periods may include 8 time periods corresponding to January through August, and the multiple second time periods may further include 3 time periods corresponding to October through December.

[0155] In an embodiment of the present invention, the server performs standardization processing on multiple groups of data, deletes outliers and fills blank data, thereby making the data structure of the multiple groups of data more complete, which is conducive to model training.

[0156] In some embodiments, see Figure 8 , Figure 8 An optional flow chart of a data prediction method provided by an embodiment of the present invention is provided. Figure 3 The illustrated S105 can be implemented through S119 to S122 , which will be described in conjunction with each step.

[0157] S119: Compare the multiple groups of test data with the multiple prediction data in the first prediction data set respectively, and determine multiple comparison errors corresponding to the multiple prediction data.

[0158] In the embodiment of the present invention, the server compares the multiple groups of test data with the multiple prediction data in the first prediction data set, and determines multiple comparison errors corresponding to the multiple prediction data.

[0159] In an embodiment of the present invention, the server compares the test data at each level for each time period in multiple sets of test data with the corresponding prediction data in a certain prediction data set of the first prediction data set. The server determines the error corresponding to the test data at each level for each time period. The server sums the errors corresponding to the test data at each level for each time period to obtain the error corresponding to each time period, that is, the error for each set of test data. The server then sums the errors corresponding to each set of test data to obtain the error corresponding to the prediction data for that time. This allows for the determination of multiple comparison errors for multiple prediction data.

[0160] S120 , determining a target comparison error within a preset error range from the multiple comparison errors.

[0161] In the embodiment of the present invention, the server determines a target comparison error within a preset error range from a plurality of comparison errors.

[0162] S121. Determine a target number of iterations corresponding to a target number of prediction data corresponding to a target comparison error.

[0163] In the embodiment of the present invention, the server determines a target number of iterations corresponding to a target number of prediction data corresponding to a target comparison error.

[0164] S122. Determine a prediction data prediction model corresponding to a target iteration number among multiple prediction models.

[0165] In the embodiment of the present invention, since multiple prediction models are formed during the iteration process, the server determines the preset data prediction model formed corresponding to the target iteration number from the multiple prediction models.

[0166] In an embodiment of the present invention, since multiple prediction models are formed during the iterative process, the server determines the preset data prediction model corresponding to the target iteration number with the smallest error for multiple sets of test data. Since the preset data prediction model has a high prediction accuracy for the test set, the layered time series data is processed through the preset data prediction model to obtain a prediction result with a high prediction accuracy.

[0167] In some embodiments, see Figure 9 , Figure 9An optional flow chart of a data prediction method provided in an embodiment of the present invention will be described in conjunction with each step.

[0168] S123. Obtain multiple groups of logistics cargo volume data corresponding to multiple historical time periods.

[0169] In an embodiment of the present invention, the server obtains multiple groups of logistics cargo volume data corresponding to multiple historical time periods.

[0170] Among them, multiple sets of logistics cargo volume data include: national, regional, and provincial shipment volume data and hierarchical relationships.

[0171] S124. Process multiple sets of logistics cargo volume data using a preset data prediction model to obtain predicted logistics cargo volume data for a preset time period after multiple historical time periods.

[0172] In an embodiment of the present invention, the server processes multiple sets of logistics cargo volume data using a preset data prediction model to obtain predicted logistics cargo volume data for a preset time period after multiple historical time periods.

[0173] In this embodiment of the present invention, the server processes multiple sets of logistics volume data using a preset data prediction model. Because the preset data prediction model is trained based on the prediction errors of multiple sets of training data within a preset historical time period, as well as the errors between various levels, the preset data prediction model can be used to predict multiple sets of logistics volume data, resulting in highly accurate prediction results.

[0174] The embodiment of the present invention also provides a logistics cargo volume prediction device 600 for executing Figure 9 For data prediction methods provided in , see, Figure 10 A schematic diagram of the structure of a logistics cargo volume prediction device provided by an embodiment of the present invention.

[0175] An embodiment of the present invention provides a logistics cargo volume prediction device 600, comprising: a data acquisition module 601, a data preprocessing module 602, a target prediction model training module 603 and a data prediction model 604.

[0176] The data acquisition module 601 is used to obtain the historical time series data of logistics cargo volume and the hierarchical relationship between the time series, such as the national, regional, and provincial shipment volume data and the hierarchical relationship. The data acquisition module 601 is used to execute S123.

[0177] The data preprocessing module 602 is used to preprocess the data, remove outliers and fill in missing values, and standardize the data. The preprocessed data is then divided into a training set and a test set.

[0178] The target prediction model training module 603 is used to train the initial network model using historical time series data to obtain a target prediction model for the time series data.

[0179] The data prediction module 604 is used to use the target prediction model to predict the data of the time series data in the future time period to obtain a prediction result, and store and display the prediction result.

[0180] In some embodiments, see Figure 11 , Figure 11 An optional flow chart of a data prediction method provided in an embodiment of the present invention will be described in conjunction with each step.

[0181] S201: Collect hierarchical time series data to be predicted.

[0182] For example, combined Figure 12 The data acquisition module 701 in the data prediction device 700 is used to obtain the hierarchical relationship between historical time series data and time series.

[0183] S202: Data preprocessing, removing outliers and filling missing values; data segmentation, dividing the training set into the test set.

[0184] Exemplarily, the data preprocessing module 702 in the data prediction device 700 is used to preprocess the historical time series data, remove outliers and fill in missing values, and standardize the data. The preprocessed data is then divided into a training set and a test set.

[0185] S203. Build a DeepAR time series prediction model.

[0186] S204: Input the training set.

[0187] S205. Set the layer-wise loss hyperparameters.

[0188] S206. Update the DeepAR model parameters using the Adam optimization algorithm with adaptive learning rate.

[0189] S207: Whether the training reaches the preset number of training times.

[0190] Exemplarily, the target prediction model training module 703 in the data prediction device 700 is used to train the initial network model using historical time series data to obtain a target prediction model for the time series data, that is, a final model.

[0191] S208: Take the final model and output the future prediction results.

[0192] Illustratively, the data prediction module 704 in the data prediction device 700 is used to use the target prediction model (final model) to predict the data of the time series data in the future time period to obtain a prediction result, and store and display the prediction result.

[0193] Since the DeepAR time series prediction model is constructed based on the prediction errors of multiple sets of training data in the stratified time series data within the historical time period, as well as the errors between each layer, the DeepAR time series prediction model training not only takes into account the accuracy of the prediction errors, but also the errors between each layer. Therefore, the final model obtained by training is more accurate in predicting the data.

[0194] Exemplarily, the embodiment of the present invention further provides a data prediction device 700 for executing Figure 11 For data prediction methods provided in , see, Figure 12 A schematic diagram of the structure of the data prediction device provided by the embodiment of the present invention Figure 1 .

[0195] The embodiment of the present invention provides a data prediction device 700 , comprising: a data acquisition module 701 , a data preprocessing module 702 , a target prediction model training module 703 and a data prediction model 704 .

[0196] The data acquisition module 701 is used to obtain the hierarchical relationship between historical time series data and time series.

[0197] Data preprocessing module 702 is used to preprocess the historical time series data, remove outliers, fill in missing values, and standardize the data. The preprocessed data is then divided into a training set and a test set. The module details are described in S202 of the forecasting method flow above.

[0198] The target prediction model training module 703 is used to train the initial network model using historical time series data to obtain a target prediction model for the time series data. The specific details of the module are in S203 to S207 in the above prediction method process.

[0199] The data prediction module 704 is used to use the target prediction model to predict the time series data in the future time period to obtain prediction results, and store and display the prediction results. The module details are described in S208 in the above prediction method process.

[0200] Please see, Figure 13 A schematic diagram of the structure of the data prediction device provided by the embodiment of the present invention Figure 2 .

[0201] The embodiment of the present invention further provides a data prediction device 800 , including: a data acquisition unit 803 and a prediction unit 804 .

[0202] The data acquisition unit 803 is used to acquire hierarchical time series data; hierarchical time series data is a plurality of groups of data corresponding to time series of each level, wherein the sum of the data of the sub-levels of each level in each level is equal to the data of the corresponding parent level;

[0203] The prediction unit 804 is used to predict the hierarchical time series data using a preset data prediction model to determine the prediction results within a preset time period after multiple historical time periods; wherein,

[0204] The preset data prediction model is trained based on the prediction errors of multiple sets of training data within a historical preset time period in the hierarchical time series data, as well as the errors between each level.

[0205] In an embodiment of the present invention, the data prediction device 800 is used to perform standardization processing on multiple groups of hierarchical time series data, and divide the multiple groups of data after standardization into training sets and test sets according to preset historical time periods; the training set includes: multiple groups of training data; the test set includes: multiple groups of test data; the prediction error of the training set and the error between each level are calculated using the loss function of the initial prediction model, and the model parameters of the initial prediction model are iteratively adjusted based on the prediction error and the error between each level until the training conditions are met, and the first prediction data set corresponding to the test set is obtained; the first prediction data set includes: multiple prediction data in the iterative process of each level in each historical time period of the corresponding test set; the multiple groups of test data are compared with the first prediction data set to determine the preset data prediction model.

[0206] In an embodiment of the present invention, the data prediction device 800 is used to input multiple groups of training data into an initial prediction model to obtain a second prediction data set; the second prediction data set includes: prediction data of each level in multiple historical time periods; based on the second prediction data set and multiple groups of training data, the prediction error and the error between each level are calculated in combination with the loss function; the loss function is gradient-solved to obtain the model parameters in the iterative process, thereby obtaining an updated prediction model; using the updated prediction model, continue to train the multiple groups of training data until the training conditions are met, and stop to obtain the final prediction model, thereby obtaining multiple prediction models in the iterative process; in each corresponding second prediction data set obtained by using multiple prediction models, the prediction data of each level in each historical time period of the corresponding test set is extracted, and then the first prediction data set in the iterative process is obtained.

[0207] In an embodiment of the present invention, the data prediction device 800 is used to calculate the prediction error based on the first prediction data in the second prediction data set and multiple sets of training data; the first prediction data is the prediction data of each level in multiple first time periods in the second prediction data set; the multiple first time periods are time periods before the preset historical time period in multiple historical time periods; based on the second prediction data in the second prediction data set, the error between each level is calculated; the second prediction data is the prediction data of each level in multiple second time periods in the second prediction data set; the multiple second time periods are time periods after the preset historical time period in multiple historical time periods.

[0208] In an embodiment of the present invention, the data prediction device 800 is used to calculate the sum of the squares of the differences between the first predicted data in the same first time period and the training data of the corresponding level, and then obtain the first sum of each level in the same first time period, and add up the multiple first sums corresponding to multiple first time periods to obtain the prediction error.

[0209] In an embodiment of the present invention, the data prediction device 800 is used to calculate the square sum of the differences between the prediction data of each parent level of each layer in the second prediction data in the same second time period and the sum of the prediction data of each corresponding child level, and add up multiple square sums of multiple second time periods to obtain a second total; multiply the multiple second totals by the harmonic error penalty term hyperparameter to obtain the error between each level.

[0210] In an embodiment of the present invention, the data prediction device 800 is used to compare multiple groups of test data with multiple prediction data in the first prediction data set, determine multiple comparison errors corresponding to the multiple prediction data; determine a target comparison error within a preset error range among the multiple comparison errors; determine a target iteration number corresponding to the target prediction data corresponding to the target comparison error; and determine a prediction data prediction model corresponding to the target iteration number among multiple prediction models.

[0211] In an embodiment of the present invention, multiple groups of training data include: multiple groups of first processed data; multiple groups of test data include: multiple groups of second processed data; the data prediction device 800 is used to delete the outliers of each level in the multiple groups of data, and fill them with the average data of the level corresponding to the outliers; use the average data corresponding to the level where blank data exists to fill the blank data corresponding to each level in the multiple groups of data, and then obtain multiple groups of processed data corresponding to the time series of each level; determine a preset historical time period from multiple historical time periods, combine the multiple groups of first processed data corresponding to the multiple first time periods before the preset historical time period into a training set, and combine the multiple groups of second processed data corresponding to the multiple second time periods after the preset historical time period into a test set.

[0212] In an embodiment of the present invention, the data acquisition unit 803 in the data prediction device 800 is used to obtain multiple groups of logistics cargo volume data corresponding to multiple historical time periods; the prediction unit 804 in the data prediction device 800 is used to process the multiple groups of logistics cargo volume data using a preset data prediction model to obtain predicted logistics cargo volume data for a preset time period after the multiple historical time periods.

[0213] In an embodiment of the present invention, the hierarchical time series data is acquired by the data acquisition unit 803; the hierarchical time series data is a plurality of groups of data corresponding to the time series of each level, wherein the sum of the data of the sub-levels of each level in each level is equal to the data of the corresponding parent level; the hierarchical time series data is then predicted by the prediction unit 804 using the preset data prediction model to determine the prediction results within the preset time period after multiple historical time periods; wherein the preset data prediction model is based on the prediction errors of the multiple groups of training data within the historical preset time period in the hierarchical time series data, and the errors between the various levels. Since the preset data prediction model is based on the prediction errors of the multiple groups of training data within the historical time period and the errors between the various levels, not only the accuracy of the prediction errors is taken into account during training, but also the errors between the various levels, so the trained preset data prediction model is more accurate in predicting the data.

[0214] It should be noted that, in the embodiment of the present invention, if the above-mentioned data prediction method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a data prediction device (which can be a personal computer, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk. In this way, the embodiment of the present invention is not limited to any specific combination of hardware and software.

[0215] Correspondingly, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above method when executed by a processor.

[0216] Correspondingly, an embodiment of the present invention provides a data prediction device, including a memory 802 and a processor 801, wherein the memory 802 stores a computer program that can be run on the processor 801, and the processor 801 implements the steps in the above method when executing the program.

[0217] It should be noted that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of the present invention, please refer to the description of the method embodiments of the present invention for understanding.

[0218] It should be noted that Figure 14 A schematic diagram of a hardware entity of a data prediction device provided by an embodiment of the present invention is shown as follows: Figure 14 As shown, the hardware entity of the data prediction device 800 includes: a processor 801 and a memory 802, wherein;

[0219] The processor 801 generally controls the overall operation of the data prediction apparatus 800 .

[0220] The memory 802 is configured to store instructions and applications executable by the processor 801, and can also cache data to be processed or processed by the processor 801 and each module in the data prediction device 800 (for example, image data, audio data, voice communication data and video communication data), which can be implemented through flash memory (FLASH) or random access memory (Random Access Memory, RAM).

[0221] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present invention. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention. The serial numbers of the above-mentioned embodiments of the present invention are for description only and do not represent the advantages and disadvantages of the embodiments.

[0222] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0223] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0224] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0225] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0226] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiments; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, and other media that can store program codes.

[0227] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0228] The above description is merely an embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A data prediction method, characterized in that: include: Get hierarchical time series data; The layered time series data is a plurality of sets of data corresponding to the time series of each layer, wherein the sum of the data of the sub-layers of each layer in each layer is equal to the data of the corresponding parent layer; the layers include: regional layer and agency layer; the layered time series data includes logistics cargo volume data of the corresponding layer; Using a preset data prediction model, the layered time series data is predicted to determine the prediction results within a preset time period after multiple historical time periods; wherein, The preset data prediction model is obtained by training based on the prediction errors of multiple groups of training data within a historical preset time period in the layered time series data, as well as the errors between various levels.

2. The data prediction method according to claim 1, characterized in that Before predicting the hierarchical time series data using a preset data prediction model and determining prediction results within a preset time period after a plurality of historical time periods, after obtaining the hierarchical time series data, the method further includes: Standardizing the multiple sets of data of the layered time series data, and dividing the standardized multiple sets of data into a training set and a test set according to a historical preset time period; the training set includes: multiple sets of training data; the test set includes: multiple sets of test data; Calculating the prediction error of the training set and the error between each layer using the loss function of the initial prediction model, and iteratively adjusting the model parameters of the initial prediction model based on the prediction error and the error between each layer until the training condition is met, thereby obtaining a first prediction data set corresponding to the test set; the first prediction data set includes: multiple prediction data from the iterative process for each layer in each historical time period corresponding to the test set; The plurality of test data sets are compared with the first prediction data set to determine the preset data prediction model.

3. The data prediction method according to claim 2, characterized in that: The loss function of the initial prediction model is used to calculate the prediction error of the training set and the error between each layer, and the model parameters of the initial prediction model are iteratively adjusted according to the prediction error and the error between each layer until the training condition is met, thereby obtaining a first prediction data set corresponding to the test set, including: Inputting the multiple sets of training data into the initial prediction model to obtain a second prediction data set; the second prediction data set includes: prediction data of each level of the multiple historical time periods; Calculating the prediction error and the errors between the various levels based on the second prediction data set and the multiple sets of training data in combination with the loss function; Performing gradient solving on the loss function to obtain model parameters in the iterative process, thereby obtaining an updated prediction model; Using the updated prediction model, continue training the multiple sets of training data until the training conditions are met, and obtain a final prediction model, thereby obtaining multiple prediction models in the iterative process; When using the multiple prediction models to obtain each corresponding second prediction data set, the prediction data of each level corresponding to each historical time period of the test set is extracted to obtain the first prediction data set in the iterative process.

4. The data prediction method according to claim 3, characterized in that: The calculating the prediction error and the errors between the various levels based on the second prediction data set and the multiple sets of training data in combination with the loss function includes: Calculating the prediction error based on first prediction data in the second prediction data set and the multiple sets of training data; the first prediction data is prediction data of each level in multiple first time periods in the second prediction data set; the multiple first time periods are time periods before the historical preset time period in the multiple historical time periods; Based on the second prediction data in the second prediction data set, the errors between the various levels are calculated; the second prediction data are the prediction data of each level in multiple second time periods in the second prediction data set; the multiple second time periods are the time periods after the historical preset time periods in the multiple historical time periods.

5. The data prediction method according to claim 4, characterized in that: The calculating the prediction error based on the first prediction data in the second prediction data set and the multiple sets of training data includes: Calculate the sum of the squares of the differences between the first prediction data in the same first time period and the training data of the corresponding level, and then obtain the first sum of each level in the same first time period, and add the multiple first sums corresponding to the multiple first time periods to obtain the prediction error.

6. The data prediction method according to claim 4, characterized in that: The calculating the errors between the respective levels based on the second prediction data in the second prediction data set includes: Calculating the sum of squares of differences between the predicted data of each parent level of each layer in the second predicted data in the same second time period and the sum of the predicted data of each corresponding child level, and adding multiple square sums of the multiple second time periods to obtain a second sum; The multiple second sums are multiplied by the harmonic error penalty term hyperparameter to obtain the errors between the various levels.

7. The data prediction method according to any one of claims 3 to 6, characterized in that: The comparing the plurality of test data sets with the first prediction data set to determine the preset data prediction model includes: Comparing the multiple test data sets with multiple prediction data in the first prediction data set, respectively, to determine multiple comparison errors corresponding to the multiple prediction data; Determining a target comparison error within a preset error range from the multiple comparison errors; Determine a target number of iterations corresponding to a target number of prediction data corresponding to the target comparison error; The preset data prediction model corresponding to the target iteration number is determined among the multiple prediction models.

8. The data prediction method according to any one of claims 3 to 6, characterized in that: The multiple sets of training data include: multiple sets of first processed data; the multiple sets of test data include: multiple sets of second processed data; The step of normalizing the multiple sets of data of the layered time series data and dividing the normalized multiple sets of data into a training set and a test set according to a preset historical time period includes: Deleting outliers at each level in the multiple sets of data and filling in the data with the average data of the level corresponding to the outliers; Filling the blank data corresponding to each level in the plurality of sets of data with the average data corresponding to the level with blank data, thereby obtaining a plurality of sets of processed data corresponding to the time series of each level; A historical preset time period is determined from the multiple historical time periods, and the multiple groups of first processed data combinations corresponding to the multiple first time periods before the historical preset time period are used as training sets, and the multiple groups of second processed data combinations corresponding to the multiple second time periods after the historical preset time period are used as test sets.

9. The data prediction method according to any one of claims 3 to 6, characterized in that: The method further comprises: Obtaining multiple sets of logistics cargo volume data corresponding to the multiple historical time periods; The plurality of groups of logistics cargo volume data are processed using the preset data prediction model to obtain predicted logistics cargo volume data for a preset time period after the plurality of historical time periods.

10. A data prediction device, characterized in that: include: A data acquisition unit, used for acquiring hierarchical time series data; The layered time series data is a plurality of sets of data corresponding to the time series of each layer, wherein the sum of the data of the sub-layers of each layer in each layer is equal to the data of the corresponding parent layer; the layers include: regional layer and agency layer; the layered time series data includes logistics cargo volume data of the corresponding layer; The prediction unit is used to predict the hierarchical time series data using a preset data prediction model to determine the prediction results within a preset time period after multiple historical time periods; wherein, The preset data prediction model is obtained by training based on the prediction errors of multiple groups of training data within a historical preset time period in the layered time series data, as well as the errors between various levels.

11. A data prediction device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the steps in the method according to any one of claims 1 to 9 are implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Wind power prediction method and prediction system based on time hierarchical combination

    CN111915083A