Data prediction method and device, electronic equipment, storage medium and computer program product

By adaptively iteratively updating the sequence length and using a pre-trained data prediction model for multi-step prediction, the problem of prediction error caused by manually setting the sequence length is solved, thus improving the accuracy and consistency of data prediction.

CN122087299APending Publication Date: 2026-05-26BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
Filing Date
2025-12-16
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing data prediction methods, setting the sequence length based on human experience is prone to prediction errors, and these errors tend to accumulate during stepwise prediction, resulting in low data prediction accuracy.

Method used

By adaptively iteratively updating the lengths of multiple initial sequences, the target sequence length is obtained. Then, a pre-trained data prediction model is used for multi-step prediction processing to ensure that the historical sequence data matches the target sequence length and reduce prediction error.

Benefits of technology

It achieves intelligent optimization of sequence length, reduces prediction error, improves data prediction accuracy, avoids error accumulation, and enhances the certainty of data prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122087299A_ABST
    Figure CN122087299A_ABST
Patent Text Reader

Abstract

The invention relates to a data prediction method and device, electronic equipment, a storage medium and a computer program product. The method comprises the following steps: acquiring historical sequence data of a to-be-predicted object; the sequence length of the historical sequence data is matched with the target sequence length; the target sequence length is obtained by performing adaptive iterative updating on a plurality of initial sequence lengths; inputting the historical sequence data into a pre-trained data prediction model for multi-step prediction processing to obtain prediction data of the to-be-predicted object in a plurality of continuous time steps in the future; the pre-trained data prediction model is obtained by training sample sequence data of the to-be-predicted object; the sequence length of the sample sequence data is matched with the target sequence length; and obtaining a data prediction result of the to-be-predicted object based on the prediction data of the to-be-predicted object in the plurality of continuous time steps in the future. By adopting the method, the data prediction accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a data prediction method, apparatus, electronic device, storage medium, and computer program product. Background Technology

[0002] With the development of artificial intelligence technology, it is possible to predict the data of an object (such as sales data) in the future based on the historical sequence data of the object (such as a product).

[0003] In related technologies, current data prediction methods generally involve setting the sequence length of historical data based on human experience and making step-by-step predictions to obtain data for the object in the future time period. However, setting the sequence length based on human experience is prone to prediction errors, and when making step-by-step predictions, errors accumulate, resulting in low data prediction accuracy. Summary of the Invention

[0004] This disclosure provides a data prediction method, apparatus, electronic device, storage medium, and computer program product to at least solve the problem of low data prediction accuracy in related technologies. The technical solution of this disclosure is as follows:

[0005] According to a first aspect of the present disclosure, a data prediction method is provided, comprising:

[0006] Acquire historical sequence data of the object to be predicted; the sequence length of the historical sequence data is matched with the target sequence length; the target sequence length is obtained by adaptively iteratively updating multiple initial sequence lengths.

[0007] The historical sequence data is input into a pre-trained data prediction model for multi-step prediction processing to obtain the predicted data of the object to be predicted in multiple consecutive time steps in the future; the pre-trained data prediction model is trained using sample sequence data of the object to be predicted; the sequence length of the sample sequence data matches the length of the target sequence.

[0008] Based on the predicted data of the object to be predicted at multiple consecutive time steps in the future, the data prediction result of the object to be predicted is obtained.

[0009] In an exemplary embodiment, the step of inputting the historical sequence data into a pre-trained data prediction model for multi-step prediction processing to obtain prediction data for the object to be predicted at multiple consecutive time steps in the future includes:

[0010] The historical sequence data is input into a pre-trained data prediction model to obtain the encoding vector of the historical sequence data;

[0011] Attention processing is performed on the encoding vector of the historical sequence data to obtain the attention output sequence corresponding to the encoding vector;

[0012] Based on the attention output sequence, sequence length compression processing is performed to obtain the target attention output sequence corresponding to the encoding vector;

[0013] Multi-step prediction processing is performed based on the target attention output sequence to obtain prediction data for the object to be predicted in multiple consecutive time steps in the future.

[0014] In an exemplary embodiment, the step of inputting the historical sequence data into a pre-trained data prediction model to obtain the encoded vector of the historical sequence data includes:

[0015] The historical sequence data is input into a pre-trained data prediction model for position encoding processing to obtain the position vector of the historical sequence data.

[0016] The feature vector of the historical sequence data is obtained, and the position vector and feature vector of the historical sequence data are fused to obtain the encoding vector of the historical sequence data.

[0017] In an exemplary embodiment, obtaining the data prediction result of the object to be predicted based on the prediction data of the object to be predicted at multiple consecutive time steps in the future includes:

[0018] Obtain known data features of the object to be predicted at multiple consecutive time steps in the future;

[0019] The known data features and predicted data of the object to be predicted in multiple consecutive time steps in the future are fused together to obtain the fused features of the object to be predicted in multiple consecutive time steps in the future.

[0020] The fused features of the object to be predicted at multiple consecutive time steps in the future are input into the target data prediction model to obtain the target prediction data of the object to be predicted at multiple consecutive time steps in the future.

[0021] Based on the target prediction data of the object to be predicted at multiple consecutive time steps in the future, the data prediction result of the object to be predicted is obtained.

[0022] In an exemplary embodiment, the pre-trained data prediction model is trained in the following manner:

[0023] The target sequence length is obtained by adaptively iteratively updating the lengths of the multiple initial sequences.

[0024] Obtain the sample sequence data of the object to be predicted;

[0025] The sample sequence data is input into the data prediction model to be trained for multi-step prediction processing to obtain the sample data prediction result of the object to be predicted.

[0026] The model loss of the data prediction model to be trained is obtained based on the difference between the predicted result of the sample data of the object to be predicted and the actual data result of the object to be predicted.

[0027] The model parameters of the data prediction model to be trained are adjusted based on the model loss until the preset convergence condition is met, thus obtaining the pre-trained data prediction model.

[0028] In an exemplary embodiment, the step of inputting the sample sequence data into a data prediction model to be trained for multi-step prediction processing to obtain the sample data prediction result of the object to be predicted includes:

[0029] The sample sequence data is input into the data prediction model to be trained to obtain the sample encoding vector of the sample sequence data;

[0030] Attention processing is performed on the sample encoding vector to obtain the sample attention output sequence corresponding to the sample encoding vector;

[0031] Based on the sample attention output sequence, the sequence length is compressed to obtain the target attention output sequence corresponding to the sample encoding vector;

[0032] Multi-step prediction processing is performed based on the target attention output sequence corresponding to the sample encoding vector to obtain the sample prediction data of the object to be predicted in multiple consecutive sample time steps in the future.

[0033] The known sample data features and sample prediction data of the object to be predicted in multiple consecutive sample time steps in the future are fused to obtain the sample fusion features of the object to be predicted in multiple consecutive sample time steps in the future.

[0034] The sample fusion features of the object to be predicted at multiple consecutive sample time steps in the future are input into the target data prediction model to obtain the target sample prediction data of the object to be predicted at multiple consecutive sample time steps in the future.

[0035] Based on the target sample prediction data of the object to be predicted in multiple consecutive sample time steps in the future, the sample data prediction result of the object to be predicted is obtained.

[0036] In an exemplary embodiment, the step of adaptively iteratively updating the lengths of the plurality of initial sequences to obtain the target sequence length includes:

[0037] Obtain the original historical data of the object to be predicted;

[0038] The original historical data of the object to be predicted is preprocessed to obtain the processed historical data of the object to be predicted.

[0039] The lengths of the multiple initial sequences are updated using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths; sample sequence data matching each updated sequence length are extracted from the processed historical data.

[0040] Based on the sample sequence data that matches the length of each updated sequence, the prediction error corresponding to each updated sequence length is determined.

[0041] If the prediction error corresponding to each updated sequence length meets the preset condition, the multiple updated sequence lengths are used as multiple initial sequence lengths, and the process jumps to the step of updating the multiple initial sequence lengths using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths, until the preset number of iterations is met.

[0042] From the last obtained updated sequence lengths, the updated sequence length with the smallest corresponding prediction error is selected as the target sequence length.

[0043] In one exemplary embodiment, the method further includes:

[0044] Obtain monitoring indicators for the iterative update process of sequence length; the monitoring indicators include at least the population diversity of the updated sequence length and the convergence rate of the prediction error corresponding to the updated sequence length;

[0045] Using the monitoring indicators, the inertia weights and the asymmetric learning factors are adaptively updated to obtain the adaptively updated inertia weights and the adaptively updated asymmetric learning factors.

[0046] The method of updating the lengths of the multiple initial sequences using inertia weights and asymmetric learning factors to obtain multiple updated sequence lengths includes:

[0047] The lengths of the multiple initial sequences are updated using the adaptively updated inertial weights and the adaptively updated asymmetric learning factors to obtain multiple updated sequence lengths.

[0048] In an exemplary embodiment, after obtaining the data prediction result of the object to be predicted based on the prediction data of the object to be predicted at multiple consecutive time steps in the future, the method further includes:

[0049] Obtain feedback data on the data prediction results for the object to be predicted;

[0050] Based on the feedback data, the target sequence length is iteratively updated to obtain the updated target sequence length;

[0051] The pre-trained data prediction model is iteratively updated using the target sample sequence data of the object to be predicted to obtain an updated data prediction model; the sequence length of the target sample sequence data matches the length of the updated target sequence.

[0052] According to a second aspect of the present disclosure, a data prediction apparatus is provided, comprising:

[0053] The data acquisition unit is configured to acquire historical sequence data of the object to be predicted; the sequence length of the historical sequence data matches the target sequence length; the target sequence length is obtained by adaptively iteratively updating multiple initial sequence lengths.

[0054] The prediction processing unit is configured to perform multi-step prediction processing by inputting the historical sequence data into a pre-trained data prediction model to obtain prediction data for the object to be predicted in multiple consecutive time steps in the future; the pre-trained data prediction model is trained using sample sequence data of the object to be predicted; the sequence length of the sample sequence data matches the length of the target sequence.

[0055] The result determination unit is configured to execute prediction data based on the object to be predicted over multiple consecutive time steps in the future to obtain the data prediction result of the object to be predicted.

[0056] In an exemplary embodiment, the prediction processing unit is further configured to perform the following operations: inputting the historical sequence data into a pre-trained data prediction model to obtain an encoding vector of the historical sequence data; performing attention processing based on the encoding vector of the historical sequence data to obtain an attention output sequence corresponding to the encoding vector; performing sequence length compression processing based on the attention output sequence to obtain a target attention output sequence corresponding to the encoding vector; and performing multi-step prediction processing based on the target attention output sequence to obtain prediction data of the object to be predicted for multiple consecutive time steps in the future.

[0057] In an exemplary embodiment, the prediction processing unit is further configured to perform position encoding processing by inputting the historical sequence data into a pre-trained data prediction model to obtain the position vector of the historical sequence data; obtain the feature vector of the historical sequence data; and fuse the position vector and feature vector of the historical sequence data to obtain the encoded vector of the historical sequence data.

[0058] In an exemplary embodiment, the result determination unit is further configured to perform the following operations: acquiring known data features of the object to be predicted over multiple consecutive time steps; fusing the known data features and predicted data of the object to be predicted over multiple consecutive time steps to obtain fused features of the object to be predicted over multiple consecutive time steps; inputting the fused features of the object to be predicted over multiple consecutive time steps into a target data prediction model to obtain target predicted data of the object to be predicted over multiple consecutive time steps; and obtaining a data prediction result of the object to be predicted based on the target predicted data of the object to be predicted over multiple consecutive time steps.

[0059] In one exemplary embodiment, the apparatus further includes a model training unit configured to perform adaptive iterative updates of the lengths of the plurality of initial sequences to obtain the target sequence length; acquire the sample sequence data of the object to be predicted; input the sample sequence data into a data prediction model to be trained for multi-step prediction processing to obtain a sample data prediction result of the object to be predicted; obtain the model loss of the data prediction model to be trained based on the difference between the sample data prediction result of the object to be predicted and the actual data result of the object to be predicted; and adjust the model parameters of the data prediction model to be trained based on the model loss until a preset convergence condition is met to obtain the pre-trained data prediction model.

[0060] In an exemplary embodiment, the model training unit is further configured to: input the sample sequence data into a data prediction model to be trained to obtain a sample encoding vector of the sample sequence data; perform attention processing based on the sample encoding vector to obtain a sample attention output sequence corresponding to the sample encoding vector; perform sequence length compression processing based on the sample attention output sequence to obtain a target attention output sequence corresponding to the sample encoding vector; perform multi-step prediction processing based on the target attention output sequence corresponding to the sample encoding vector to obtain sample prediction data of the object to be predicted for multiple consecutive sample time steps; fuse the known sample data features and sample prediction data of the object to be predicted for multiple consecutive sample time steps to obtain sample fusion features of the object to be predicted for multiple consecutive sample time steps; input the sample fusion features of the object to be predicted for multiple consecutive sample time steps into a target data prediction model to obtain target sample prediction data of the object to be predicted for multiple consecutive sample time steps; and obtain the sample data prediction result of the object to be predicted based on the target sample prediction data of the object to be predicted for multiple consecutive sample time steps.

[0061] In an exemplary embodiment, the model training unit is further configured to: acquire the original historical data of the object to be predicted; preprocess the original historical data of the object to be predicted to obtain processed historical data of the object to be predicted; update the multiple initial sequence lengths using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths; extract sample sequence data matching each updated sequence length from the processed historical data; determine the prediction error corresponding to each updated sequence length based on the sample sequence data matching each updated sequence length; if the prediction error corresponding to each updated sequence length meets a preset condition, use the multiple updated sequence lengths as multiple initial sequence lengths, and jump to the step of updating the multiple initial sequence lengths using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths, until a preset number of iterations is met; and select the updated sequence length with the smallest corresponding prediction error from the last obtained updated sequence lengths as the target sequence length.

[0062] In an exemplary embodiment, the apparatus further includes a data update unit configured to perform a monitoring index for the iterative update process of the sequence length; the monitoring index includes at least the population diversity of the updated sequence length and the convergence rate of the prediction error corresponding to the updated sequence length; using the monitoring index, the inertial weight and the asymmetric learning factor are adaptively updated to obtain the adaptively updated inertial weight and the adaptively updated asymmetric learning factor.

[0063] The model training unit is further configured to update the lengths of the plurality of initial sequences using the adaptively updated inertial weights and the adaptively updated asymmetric learning factors, thereby obtaining a plurality of updated sequence lengths.

[0064] In one exemplary embodiment, the apparatus further includes a model update unit configured to perform actions such as: acquiring feedback data of data prediction results for the object to be predicted; iteratively updating the target sequence length based on the feedback data to obtain an updated target sequence length; iteratively updating the pre-trained data prediction model using the target sample sequence data of the object to be predicted to obtain an updated data prediction model; and matching the sequence length of the target sample sequence data with the updated target sequence length.

[0065] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0066] processor;

[0067] Memory used to store the processor's executable instructions;

[0068] The processor is configured to execute the instructions to implement the data prediction method as described in any embodiment of the first aspect.

[0069] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform a data prediction method as described in any embodiment of the first aspect.

[0070] According to a fifth aspect of the present disclosure, a computer program product is provided, the computer program product including instructions that, when executed by a processor of an electronic device, enable the electronic device to perform the data prediction method as described in any embodiment of the first aspect.

[0071] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:

[0072] The process involves acquiring historical sequence data of the object to be predicted; matching the sequence length of the historical sequence data with the target sequence length; obtaining the target sequence length through adaptive iterative updates of multiple initial sequence lengths; then, inputting the historical sequence data into a pre-trained data prediction model for multi-step prediction processing to obtain predicted data for the object to be predicted at multiple consecutive time steps; the pre-trained data prediction model is trained using sample sequence data of the object to be predicted; matching the sequence length of the sample sequence data with the target sequence length; finally, based on the predicted data of the object to be predicted at multiple consecutive time steps, obtaining the data prediction result for the object to be predicted. This method, by adaptively iteratively updating multiple initial sequence lengths to obtain the target sequence length, achieves the goal of intelligently optimizing the sequence length. This facilitates obtaining a target sequence length that fits the object to be predicted, thereby reducing prediction errors and avoiding the shortcomings of manually setting sequence lengths, which is prone to prediction errors. This makes the subsequent data prediction results determined based on historical sequence data matching the target sequence length more accurate, thus improving the data prediction accuracy. Furthermore, by utilizing a pre-trained data prediction model based on historical sequence data that matches the length of the target sequence, multi-step prediction processing is performed, and the predicted data of the object to be predicted for multiple consecutive time steps in the future are output at once. This avoids the defect of error accumulation that is easy to occur when making step-by-step predictions, which helps to reduce prediction errors and thus improves the certainty accuracy of data prediction results, thereby further improving the accuracy of data prediction.

[0073] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0074] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0075] Figure 1 This is a flowchart illustrating a data prediction method according to an exemplary embodiment.

[0076] Figure 2 This is a flowchart illustrating, according to an exemplary embodiment, the steps of obtaining prediction data for an object to be predicted at multiple consecutive time steps in the future.

[0077] Figure 3 This is a flowchart illustrating the steps of obtaining a data prediction result for an object to be predicted, according to an exemplary embodiment.

[0078] Figure 4 This is a flowchart illustrating the training steps of a data prediction model according to an exemplary embodiment.

[0079] Figure 5 This is a flowchart illustrating the steps of obtaining the target sequence length according to an exemplary embodiment.

[0080] Figure 6 This is a flowchart illustrating another data prediction method according to an exemplary embodiment.

[0081] Figure 7 This is a flowchart illustrating a multi-step prediction method for long-term time series data in the Informer algorithm based on adaptive PSO optimization, according to an exemplary embodiment.

[0082] Figure 8 This is a comparison chart of training and validation loss curves based on a common seq2seq+attention algorithm for multi-step prediction, according to an exemplary embodiment.

[0083] Figure 9 This is a comparison chart of the last time sequence prediction based on the ordinary seq2seq+attention algorithm for multi-step prediction, according to an exemplary embodiment.

[0084] Figure 10 This is a histogram of the prediction error distribution based on a conventional seq2seq+attention algorithm for multi-step prediction, as illustrated in an exemplary embodiment.

[0085] Figure 11 This is a scatter plot of predicted values ​​versus true values ​​based on a common seq2seq+attention algorithm for multi-step prediction, as illustrated in an exemplary embodiment.

[0086] Figure 12 This is a comparison chart of training and validation loss curves for multi-step time-series prediction based on the Informer algorithm with adaptive PSO optimization, according to an exemplary embodiment.

[0087] Figure 13 This is a comparison chart of the last time series predictions in multi-step time series prediction based on the Informer algorithm with adaptive PSO optimization, as illustrated in an exemplary embodiment.

[0088] Figure 14 This is a histogram of the prediction error distribution for multi-step time series prediction based on the Informer algorithm with adaptive PSO optimization, as illustrated in an exemplary embodiment.

[0089] Figure 15 This is a scatter plot of predicted values ​​vs. actual values ​​for multi-step time series prediction based on the Informer algorithm with adaptive PSO optimization, as illustrated in an exemplary embodiment.

[0090] Figure 16 This is a block diagram illustrating a data prediction apparatus according to an exemplary embodiment.

[0091] Figure 17 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation

[0092] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0093] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0094] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0095] Figure 1 This is a flowchart illustrating a data prediction method according to an exemplary embodiment, such as... Figure 1As shown, this data processing method is used in a server; it is understood that the method can also be applied to a terminal, and to a system including a terminal and a server, and is implemented through interaction between the terminal and the server. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, and tablets; the server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. In this exemplary embodiment, the method includes the following steps:

[0096] In step S110, historical sequence data of the object to be predicted is obtained; the sequence length of the historical sequence data is matched with the target sequence length; the target sequence length is obtained by adaptively iteratively updating multiple initial sequence lengths.

[0097] The objects to be predicted refer to the objects whose forecast data need to be predicted for multiple consecutive time steps in the future. Specifically, these include commodities (sales forecast), industrial parks (power load forecast), cities (meteorological data forecast), etc., such as summer short-sleeved T-shirts, laundry detergent, mobile phones, air conditioners, and televisions.

[0098] The target sequence length refers to the sequence length that fits the object to be predicted, such as 30 days, 60 days, or 90 days. It's important to note that if the manually set sequence length is too short (e.g., the actual data period is 30 days, but only 10 days of historical data are used), the model cannot learn the complete cyclical pattern, leading to large prediction errors due to "insufficient information" (e.g., missing the impact of monthly promotions on sales). Conversely, if the manually set sequence length is too long (e.g., the actual data period is 7 days, but 100 days of historical data are used), it introduces a large amount of redundant information (e.g., expired seasonal fluctuation data), increasing the model's computational cost (longer training time, increased computing power) and potentially causing overfitting (learning noise instead of valid patterns), thus resulting in large prediction errors.

[0099] Historical sequence data includes historical data of the object to be predicted that matches the target sequence length. Specifically, it includes historical data (e.g., historical sales data) for each time step (e.g., day) within the target time period (i.e., the target sequence length). For example, historical sales data for a product over the past 30 days, 60 days, and 90 days. Matching the target sequence length with the historical sequence data means that the sequence lengths are the same, such as both being 30 days. The initial sequence length refers to the preset sequence length at the beginning, such as 40 days, 50 days, 60 days, 70 days, 80 days, or 90 days.

[0100] The adaptive iterative update of multiple initial sequence lengths refers to using the adaptive PSO (Particle Swarm Optimization) algorithm to perform a series of adaptive iterative update processes on multiple initial sequence lengths to obtain the target sequence length. The improvement of the adaptive PSO algorithm lies in the adoption of an intelligent parameter adjustment strategy, that is, an intelligent adjustment strategy based on population diversity and convergence speed, which can dynamically correct and optimize the "fixed change pattern". Although the basic framework is that the inertia weight decreases from high to low and the learning factor changes from individual cognition-dominated to social learning-dominated in the early stage, for example: in the early stage: large inertia weight (0.9) + strong individual learning (2.5) → extensive exploration; in the later stage: small inertia weight (0.4) + strong social learning → fine convergence, that is, the inertia weight is large in the early stage and small in the later stage, such as linearly decreasing from 0.9 to 0.4; the individual cognition factor is large in the early stage and small in the later stage, such as decreasing from 2.5 to 1.0; the social learning factor is small in the early stage and large in the later stage, such as increasing from 1.0 to 2.5. However, in actual iteration, the exploration state (i.e., population diversity) and convergence speed of particles (i.e., sequence length) may deviate from expectations (i.e., the aforementioned basic framework). It is necessary to monitor these two indicators (i.e., population diversity and convergence speed) in real time and flexibly adjust parameters such as inertia weight, individual cognitive factor, and social learning factor to adjust the particle's speed and position (i.e., update the sequence length) to avoid "premature convergence" or "insufficient exploration," thereby achieving the goal of finding the optimal sequence length more efficiently. In other words, this disclosure adopts an intelligent parameter adjustment strategy based on population diversity and convergence speed, adaptively adjusting the inertia weight and learning factor to adaptively adjust the sequence length, thereby finding the optimal sequence length (i.e., the target sequence length). For example, when population diversity is low or the convergence speed is slow, the inertia weight and individual cognitive factor are increased, and the social learning factor is decreased; when population diversity is high or the convergence speed is fast, the inertia weight and individual cognitive factor are decreased, and the social learning factor is increased. It should be noted that by adjusting parameters such as inertia weight, individual cognitive factor, and social learning factor, the velocity of the particle (i.e., the sequence length) can be adjusted, and then the position of the particle can be adjusted by the adjusted velocity of the particle, thereby obtaining the updated sequence length.

[0101] It should be noted that the inertia weight (w) controls the degree to which a particle retains its own historical velocity, while the learning factors (i.e., individual cognitive factor c1 and social learning factor c2) control the intensity of the particle's learning towards its individual optimal position / global optimal position. For example, the inertia weight (w) controls the degree to which a particle "retains its previous search direction." In the early stages, when w is larger (0.9), the particle tends to explore new ranges; in the later stages, when w is smaller (0.4), the particle tends to converge to the optimal solution. The learning factors are divided into "individual cognitive factor" (the particle refers to the optimal solution it found previously) and "social learning factor" (the particle refers to the global optimal solution found by all particles); in the early stages, c1 > c2 (individual cognition is dominant), and in the later stages, c2 > c1 (social learning is dominant).

[0102] For example, the server obtains multiple initial sequence lengths of the object to be predicted (e.g., a laundry detergent brand), and uses an adaptive PSO algorithm to adaptively iteratively update these initial sequence lengths to obtain the optimal sequence length, which is then used as the target sequence length. During the adaptive iterative update process, the server monitors the population diversity of the updated sequence lengths or the convergence speed of the prediction error corresponding to the updated sequence length, and adaptively adjusts the inertia weights and learning factors (i.e., individual cognitive factors and social learning factors) accordingly. For example, from the last obtained updated sequence lengths, the updated sequence length with the smallest corresponding prediction error is selected as the target sequence length. Next, the server obtains sample sequence data of the object to be predicted that matches the target sequence length (e.g., daily sales data of a laundry detergent brand over the past 60 days), and iteratively trains the data prediction model to be trained based on the sample sequence data of the object to be predicted that matches the target sequence length, until a preset convergence condition is met (e.g., reaching a preset number of training iterations or the model loss is less than a preset loss), thereby obtaining the trained data prediction model, which serves as the pre-trained data prediction model. Finally, after obtaining the target sequence length and the pre-trained data prediction model, the server retrieves historical sequence data of the object to be predicted that matches the target sequence length from the local database, such as in response to a data prediction request sent by the terminal for the object to be predicted.

[0103] In step S120, historical sequence data is input into a pre-trained data prediction model for multi-step prediction processing to obtain prediction data for the object to be predicted in multiple consecutive time steps in the future; the pre-trained data prediction model is trained using sample sequence data of the object to be predicted; the sequence length of the sample sequence data is matched with the target sequence length.

[0104] In this context, a pre-trained data prediction model refers to a model used to predict the data of an object to be predicted over multiple consecutive time steps in the future. Specifically, it is obtained by iteratively training the data prediction model using sample sequence data of the object to be predicted that matches the length of the target sequence. For example, the Informer model can be used for multi-step prediction of medium- to long-term time series data. Matching the sequence length of the sample sequence data with the target sequence length means that the sequence lengths of the sample sequence data and the target sequence are the same, for example, both are 40 days.

[0105] Multi-step forecasting refers to outputting the forecast data of the object to be predicted for multiple consecutive time steps in the future at once. Specifically, it means outputting the forecast data of the object to be predicted for each time step in multiple consecutive time steps in the future. For example, outputting the predicted sales data of a certain laundry detergent for each day in the next 30 days, outputting the predicted power load data of a certain industrial park for each day in the next 30 days, outputting the predicted weather data of a certain city for each day in the next 30 days, etc.

[0106] The predicted data of the object to be predicted in multiple consecutive time steps in the future refers to the predicted data of the object to be predicted in each of the multiple consecutive time steps in the future, such as the predicted sales data of a certain shampoo for each day in the next 30 days.

[0107] Here, a time step refers to a unit of time, such as a minute, hour, day, or week; these time steps are continuous. Forecast data can refer to predicted sales data, electricity load data, meteorological data, etc., and this disclosure does not specify any particular data.

[0108] Here, sample sequence data can refer to sample sequence data of the object to be predicted that matches the length of the target sequence. Sample sequence data of the object to be predicted that matches the length of the target sequence refers to the training data of the data prediction model to be trained, used to train the pre-trained data prediction model.

[0109] For example, the server inputs historical sequence data into a pre-trained data prediction model, and performs multi-step prediction processing based on the historical sequence data through the pre-trained data prediction model to obtain the predicted data of the object to be predicted in multiple consecutive time steps in the future; for example, the pre-trained data prediction model performs position encoding processing, probabilistic sparse attention processing, self-attention distillation processing and multi-step prediction processing based on historical sequence data to obtain the predicted data of the object to be predicted in multiple consecutive time steps in the future.

[0110] For example, the server obtains the historical sales data of a certain laundry detergent for each day of the past 60 days, resulting in a historical sales data sequence for that laundry detergent over the past 60 days. Then, the historical sales data sequence for that laundry detergent over the past 60 days is input into a pre-trained Informer model for multi-step prediction processing. The pre-trained Informer model then outputs the predicted sales data for each day of the laundry detergent for the next 30 days in one go.

[0111] In step S130, based on the prediction data of the object to be predicted over multiple consecutive time steps in the future, the data prediction result of the object to be predicted is obtained.

[0112] The data prediction result of the object to be predicted can refer to the predicted data of the object to be predicted in multiple consecutive time steps in the future.

[0113] For example, the server uses the predicted data of the object to be predicted over multiple consecutive time steps as the data prediction result of the object to be predicted, or it uses a multi-head attention-enhanced DNN (Deep Neural Network) to perform multi-head attention enhancement processing on the predicted data of the object to be predicted over multiple consecutive time steps to optimize the predicted data of the object to be predicted over multiple consecutive time steps, thereby obtaining the target predicted data of the object to be predicted over multiple consecutive time steps, and using it as the data prediction result of the object to be predicted.

[0114] In the above data prediction method, historical sequence data of the object to be predicted is obtained; the sequence length of the historical sequence data is matched with the target sequence length; the target sequence length is obtained by adaptively iteratively updating multiple initial sequence lengths; then, the historical sequence data is input into a pre-trained data prediction model for multi-step prediction processing to obtain the predicted data of the object to be predicted for multiple consecutive time steps in the future; the pre-trained data prediction model is trained using sample sequence data of the object to be predicted; the sequence length of the sample sequence data is matched with the target sequence length; finally, based on the predicted data of the object to be predicted for multiple consecutive time steps in the future, the data prediction result of the object to be predicted is obtained. In this way, by adaptively iteratively updating multiple initial sequence lengths to obtain the target sequence length, the purpose of intelligently optimizing the sequence length is achieved. This is beneficial for obtaining a target sequence length that fits the object to be predicted, thereby reducing prediction errors and avoiding the defects of setting the sequence length by human experience, which is prone to prediction errors. This makes the subsequent data prediction results determined based on the historical sequence data of the object to be predicted that matches the target sequence length more accurate, thereby improving the data prediction accuracy. Furthermore, by utilizing a pre-trained data prediction model based on historical sequence data that matches the length of the target sequence, multi-step prediction processing is performed, and the predicted data of the object to be predicted is output at once for multiple consecutive time steps in the future. This avoids the defect of error accumulation that is easy to occur when making step-by-step predictions, which helps to reduce prediction errors and thus improves the certainty accuracy of data prediction results, further improving the accuracy of data prediction (such as improving the accuracy of sales data prediction).

[0115] In one exemplary embodiment, such as Figure 2 As shown, in step 120, historical sequence data is input into a pre-trained data prediction model for multi-step prediction processing to obtain prediction data for the object to be predicted in multiple consecutive time steps in the future. This can be achieved through the following steps:

[0116] In step S210, historical sequence data is input into a pre-trained data prediction model to obtain the encoding vector of the historical sequence data.

[0117] In step S220, attention processing is performed on the encoding vectors of historical sequence data to obtain the attention output sequence corresponding to the encoding vectors.

[0118] In step S230, the sequence length is compressed based on the attention output sequence to obtain the target attention output sequence corresponding to the encoding vector.

[0119] In step S240, multi-step prediction processing is performed based on the target attention output sequence to obtain prediction data of the object to be predicted in multiple consecutive time steps in the future.

[0120] The encoding vector for the historical sequence data includes the encoding vector for each time step; for example, if the target sequence length is 90 days, then the encoding vector for the historical sequence data includes the encoding vector for each day within those 90 days. The encoding vector for each time step = the position vector for that time step + the feature vector. The attention processing can refer to probabilistic sparse attention processing, used to obtain the attention output sequence corresponding to the encoding vector. The attention output sequence includes the attention output for each time step, such as the attention output for each day within those 90 days.

[0121] Sequence length compression can refer to self-attention distillation, used to compress the length of the attention output sequence, such as compressing a 90-day attention output sequence into a 10-day attention output sequence. The target attention output sequence refers to the attention output sequence after sequence length compression, such as a 10-day attention output sequence.

[0122] Multi-step prediction processing can be achieved through a generative decoder in a pre-trained data prediction model.

[0123] For example, the server inputs historical sequence data into a pre-trained data prediction model, which encodes the historical sequence data to obtain encoded vectors. Then, a probabilistic sparse attention mechanism is used to apply attention to these encoded vectors, resulting in an attention output sequence. For instance, the encoded vectors of the historical sequence data include encoded vectors for each day of the 90-day period. Based on the encoded vectors of each time step (e.g., day 1) and other time steps (e.g., days 2-90), the similarity between the encoded vectors of each time step and the encoded vectors of other time steps is calculated. These similarities are sorted from high to low, and the top N time-step encoding vectors (e.g., the top 5 time-step encoding vectors) with the highest similarity are selected from the encoding vectors of other time steps. Then, the similarity of the encoding vectors of the N time steps is normalized to obtain the attention weights corresponding to the encoding vectors of the N time steps. Then, the attention weights corresponding to the encoding vectors of the N time steps are used to sum the encoding vectors of the N time steps to obtain the attention output of each time step (e.g., day 1). The attention outputs of each time step are combined to obtain the attention output sequence corresponding to the encoding vectors of the historical sequence data.

[0124] Next, the server compresses the attention output sequence using self-attention distillation to obtain the compressed attention output sequence, which serves as the target attention output sequence corresponding to the encoding vector. For example, convolution and average pooling are performed on the 90-day attention output sequence to obtain the 30-day attention output sequence, and convolution and average pooling are performed again on the 30-day attention output sequence to obtain the 10-day attention output sequence, which serves as the target attention output sequence. Finally, the generative decoder in the pre-trained data prediction model performs multi-step prediction processing based on the target attention output sequence to obtain the predicted data of the object to be predicted for multiple consecutive time steps in the future. For example, the target attention output sequence (length 10 days) and the placeholder sequence (length 30 days, initial value 0, representing the position in the next 30 days) are input into the generative decoder. The generative decoder calculates the attention between each time step (the next 30 days) and the target attention output sequence (length 10 days) to learn the mapping relationship between historical core patterns and future sales. Based on the attention between each time step and the target attention output sequence, the predicted sales data for each time step is calculated, that is, the sales sequence [y1, y2, ..., y30] for the next 30 days is obtained at once.

[0125] The technical solution provided in this disclosure inputs historical sequence data into a pre-trained data prediction model for multi-step prediction processing to obtain prediction data of the object to be predicted for multiple consecutive time steps in the future. In this way, through encoding processing, attention processing, sequence length compression processing, and multi-step prediction processing, the prediction data of the object to be predicted for multiple consecutive time steps in the future is output at once, avoiding the defect of prediction error accumulation that is easy to occur when making step-by-step prediction, which helps to reduce prediction error and thus improve the accuracy of data prediction.

[0126] In an exemplary embodiment, in step S210, the historical sequence data is input into a pre-trained data prediction model to obtain the encoding vector of the historical sequence data. Specifically, this includes: inputting the historical sequence data into the pre-trained data prediction model for position encoding processing to obtain the position vector of the historical sequence data; obtaining the feature vector of the historical sequence data; and fusing the position vector and feature vector of the historical sequence data to obtain the encoding vector of the historical sequence data.

[0127] The location vector of the historical sequence data includes the location vector for each time step, such as the location vector for each day. The feature vector of the historical sequence data includes the feature vector for each time step, such as the feature vector for each day (e.g., daily sales volume, price, promotional activities, weather, holidays, etc.).

[0128] The encoding vector for historical sequence data includes the location vector and feature vector of the historical sequence data.

[0129] For example, the server inputs historical sequence data into a pre-trained data prediction model. The pre-trained data prediction model performs position encoding on each time step in the historical sequence data to obtain a position vector for each time step. Based on the position vector of each time step, the position vector of the historical sequence data is obtained. Next, the features corresponding to each time step in the historical sequence data (such as sales volume, price, promotional activities, weather, holidays, etc.) are processed by feature encoding to obtain a feature vector corresponding to each time step. Based on the feature vector corresponding to each time step, the feature vector of the historical sequence data is obtained. Finally, the position vector and feature vector of the historical sequence data are concatenated to obtain the encoded vector of the historical sequence data. For example, the feature vector of day 1 is [x1, x2, ..., x512], and the position vector is [p1, p2, ..., p512]. After encoding, the encoded vector of day 1 is [x1+p1, x2+p2, ..., x512+p512].

[0130] The technical solution provided in this disclosure takes into account both the position vector and the feature vector of the historical sequence data when determining the encoding vector, which helps to improve the accuracy of encoding vector determination, making the subsequent data prediction results based on the encoding vector more accurate, and further improving the data prediction accuracy.

[0131] In one exemplary embodiment, such as Figure 3 As shown, in step 130, based on the prediction data of the object to be predicted over multiple consecutive time steps in the future, the data prediction result of the object to be predicted is obtained. This can be achieved through the following steps:

[0132] In step S310, known data features of the object to be predicted are obtained for multiple consecutive time steps in the future.

[0133] In step S320, the known data features and predicted data of the object to be predicted in multiple consecutive time steps in the future are fused to obtain the fused features of the object to be predicted in multiple consecutive time steps in the future.

[0134] In step S330, the fused features of the object to be predicted at multiple consecutive time steps in the future are input into the target data prediction model to obtain the target prediction data of the object to be predicted at multiple consecutive time steps in the future.

[0135] In step S340, based on the target prediction data of the object to be predicted in multiple consecutive time steps in the future, the data prediction result of the object to be predicted is obtained.

[0136] Among these, known data characteristics can refer to price, promotional activities, holidays, seasons, etc.

[0137] The fusion features for each time step include known data features (such as price, promotional activities, etc.) and predicted data (such as predicted sales data) for each time step.

[0138] Among them, the target data prediction model refers to a model used to output the target prediction data of the object to be predicted in multiple consecutive time steps in the future. For example, multi-head attention enhanced DNN can be used to fit nonlinear relationships, such as "price → sales volume" or "promotional activity → sales volume". Moreover, multi-head attention enhanced DNN is mainly used to optimize the prediction data of the object to be predicted in multiple consecutive time steps in the future, thereby obtaining the target prediction data of the object to be predicted in multiple consecutive time steps in the future; for example, fitting nonlinear laws such as "price decreases by 5% → sales volume increases by 10%" or "promotional activity → sales volume doubles", supplementing the time series modeling capability of the Informer model.

[0139] Among them, the target prediction data of the object to be predicted in multiple consecutive time steps in the future refers to the target prediction data of the object to be predicted in each of the multiple consecutive time steps in the future, such as the target prediction sales data of a certain shampoo for each day in the next 30 days.

[0140] In this context, the target predicted data for the object to be predicted over multiple consecutive time steps can refer to the optimized predicted data for the object over multiple consecutive time steps. For example, if the predicted sales volume for a certain future day is 100 units, after adding factors such as price and promotional activities, the predicted sales volume for that day is updated to 120 units. The data prediction result for the object to be predicted can refer to the target predicted data for the object over multiple consecutive time steps.

[0141] For example, the server obtains known data features (such as price, promotional activities, etc.) of the object to be predicted in multiple consecutive time steps in the future, and concatenates them with the predicted data of the object to be predicted in multiple consecutive time steps in the future to obtain the fused features of the object to be predicted in multiple consecutive time steps in the future. Then, the fused features of the object to be predicted in multiple consecutive time steps in the future are input into a multi-head attention-enhanced DNN. Based on the fused features of the object to be predicted in multiple consecutive time steps in the future, the multi-head attention-enhanced DNN performs multi-head attention enhancement processing to obtain the target prediction data of the object to be predicted in multiple consecutive time steps in the future, which is used as the data prediction result of the object to be predicted.

[0142] For example, the server concatenates the 30-day predicted output (1 dimension / day) of the Informer model's generative decoder with the original features (prices, promotions, etc., already converted to 32 dimensions / day) to obtain a 30×33 matrix. Then, a four-layer fully connected network is used to process this 30×33 matrix for prediction, yielding the sales forecast for the next 30 days; for example, layer 1: 30×33 → 30×384 (using 384 neurons, ReLU activation function); layer 2: 30×384 → 30×256 (256 neurons, ReLU); layer 3: 30×256 → 30×128 (128 neurons, ReLU); layer 4: 30×128 → 30×64 → 30×1 (final output: the sales forecast for the next 30 days).

[0143] The technical solution provided in this disclosure, after obtaining the prediction data of the object to be predicted for multiple consecutive time steps in the future, introduces the known data features of the object to be predicted for multiple consecutive time steps in the future to optimize the prediction data of the object to be predicted for multiple consecutive time steps in the future, so that the final data prediction result is more accurate and further improves the data prediction accuracy.

[0144] In one exemplary embodiment, such as Figure 4 As shown, the pre-trained data prediction model is obtained through the following steps:

[0145] In step S410, the lengths of multiple initial sequences are adaptively iteratively updated to obtain the target sequence length.

[0146] In step S420, sample sequence data of the object to be predicted is obtained.

[0147] In step S430, the sample sequence data is input into the data prediction model to be trained for multi-step prediction processing to obtain the sample data prediction result of the object to be predicted.

[0148] In step S440, the model loss of the data prediction model to be trained is obtained based on the difference between the predicted result of the sample data of the object to be predicted and the actual data result of the object to be predicted.

[0149] In step S450, the model parameters of the data prediction model to be trained are adjusted based on the model loss until the preset convergence condition is met, thus obtaining the pre-trained data prediction model.

[0150] The adaptive iterative update process can be implemented using the adaptive PSO algorithm. The data prediction model to be trained can be an Informer model.

[0151] The prediction results of the sample data of the object to be predicted include the target sample prediction data of the object to be predicted in multiple consecutive sample time steps in the future, such as predicted sales data.

[0152] The actual data results of the object to be predicted include the actual data of the object to be predicted in multiple consecutive sample time steps in the future, such as actual sales data.

[0153] Among them, model loss is used to measure the difference between the predicted result of the sample data of the object to be predicted and the actual data result of the object to be predicted, such as cross-entropy loss, mean squared error, mean absolute error, etc.

[0154] For example, the server uses an adaptive PSO algorithm to adaptively iteratively update multiple initial sequence lengths to obtain the target sequence length. Next, it acquires sample sequence data of the object to be predicted that matches the target sequence length and inputs this data into a data prediction model to be trained (e.g., an Informer model). The model then performs multi-step prediction processing on the sample sequence data to obtain the target sample prediction data for the object to be predicted in multiple consecutive sample time steps, which serves as the sample data prediction result for the object to be predicted. Finally, it acquires the actual data of the object to be predicted in multiple consecutive sample time steps and performs... The first step is to obtain the actual data results of the object to be predicted. Next, the difference between the predicted sample data results and the actual data results of the object to be predicted is obtained, and the model loss of the data prediction model to be trained is calculated based on this difference. If the model loss is greater than or equal to the preset loss, the model parameters of the data prediction model to be trained are adjusted based on the model loss to obtain the parameter-adjusted data prediction model. Then, the process jumps to step S430 until the obtained model loss is less than the preset loss, or the total number of training iterations reaches the preset number of training iterations. At this point, training stops, and the last parameter-adjusted data prediction model obtained is used as the pre-trained data prediction model. For details, please refer to [link / reference needed]. Figure 7 The adaptive PSO sequence length optimization process and the Informer model training process.

[0155] The technical solution provided in this disclosure first adaptively iteratively updates the lengths of multiple initial sequences to obtain the target sequence length, and then uses sample sequence data of the object to be predicted that matches the target sequence length to iteratively train the data prediction model to be trained. This enables the predicted data output by the trained data prediction model to be more accurate, further improving the data prediction accuracy.

[0156] In an exemplary embodiment, in step S430, the sample sequence data is input into the data prediction model to be trained for multi-step prediction processing to obtain the sample data prediction result of the object to be predicted. Specifically, this includes: inputting the sample sequence data into the data prediction model to be trained to obtain the sample encoding vector of the sample sequence data; performing attention processing based on the sample encoding vector to obtain the sample attention output sequence corresponding to the sample encoding vector; performing sequence length compression processing based on the sample attention output sequence to obtain the target attention output sequence corresponding to the sample encoding vector; performing multi-step prediction processing based on the target attention output sequence corresponding to the sample encoding vector to obtain the sample prediction data of the object to be predicted for multiple consecutive sample time steps; fusing the known sample data features and sample prediction data of the object to be predicted for multiple consecutive sample time steps to obtain the sample fusion features of the object to be predicted for multiple consecutive sample time steps; inputting the sample fusion features of the object to be predicted for multiple consecutive sample time steps into the target data prediction model to obtain the target sample prediction data of the object to be predicted for multiple consecutive sample time steps; and obtaining the sample data prediction result of the object to be predicted based on the target sample prediction data of the object to be predicted for multiple consecutive sample time steps.

[0157] Among these, known sample data characteristics can refer to price, promotional activities, season, holidays, etc.

[0158] For example, the server inputs sample sequence data into the data prediction model to be trained. The model performs position encoding on each sample time step in the sample sequence data to obtain a sample position vector for each sample time step. Based on the sample position vector for each sample time step, the sample position vector of the sample sequence data is obtained. Next, the sample features (such as sales volume, price, promotional activities, weather, holidays, etc.) corresponding to each sample time step in the sample sequence data are processed by feature encoding to obtain a sample feature vector corresponding to each sample time step. Based on the feature vector corresponding to each sample time step, the feature vector of the sample sequence data is obtained. Finally, the sample position vector and the sample feature vector of the sample sequence data are concatenated to obtain the sample encoding vector of the sample sequence data.

[0159] Next, the server performs attention processing on the sample encoding vector of the sample sequence data through a probabilistic sparse attention mechanism to obtain the sample attention output sequence corresponding to the sample encoding vector. Then, through self-attention distillation, the sequence length of the sample attention output sequence is compressed to obtain the compressed sample attention output sequence, which serves as the target attention output sequence corresponding to the sample encoding vector. Finally, the generative decoder in the data prediction model to be trained performs multi-step prediction processing based on the target attention output sequence corresponding to the sample encoding vector to obtain the sample prediction data of the object to be predicted in multiple consecutive sample time steps in the future.

[0160] Next, the server obtains known sample data features (such as price, promotional activities, etc.) of the object to be predicted over multiple consecutive sample time steps, and concatenates them with the sample prediction data of the object to be predicted over multiple consecutive sample time steps to obtain the sample fusion features of the object to be predicted over multiple consecutive sample time steps. Finally, the fusion features of the object to be predicted over multiple consecutive sample time steps are input into a multi-head attention-enhanced DNN. The multi-head attention-enhanced DNN performs multi-head attention enhancement processing based on the sample fusion features of the object to be predicted over multiple consecutive sample time steps to obtain the target sample prediction data of the object to be predicted over multiple consecutive sample time steps, which serves as the sample data prediction result of the object to be predicted. For details, please refer to [link / reference]. Figure 7 The training process of the Informer model in [the context of the text].

[0161] The technical solution provided in this disclosure, based on sample sequence data, performs encoding processing, attention processing, sequence length compression processing, and multi-step prediction processing, which can make the obtained sample prediction data more accurate. At the same time, it introduces the known sample data features of the object to be predicted in multiple consecutive sample time steps in the future, which is conducive to improving the determination accuracy of the target sample prediction data, and further improves the determination accuracy of the sample data prediction results.

[0162] In one exemplary embodiment, such as Figure 5 As shown, in step S410, the lengths of multiple initial sequences are adaptively iteratively updated to obtain the target sequence length. This can be achieved through the following steps:

[0163] In step S510, the original historical data of the object to be predicted is obtained.

[0164] In step S520, the original historical data of the object to be predicted is preprocessed to obtain the processed historical data of the object to be predicted.

[0165] In step S530, multiple initial sequence lengths are updated using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths; sample sequence data matching each updated sequence length are extracted from the processed historical data.

[0166] In step S540, the prediction error corresponding to each updated sequence length is determined based on the sample sequence data that matches each updated sequence length.

[0167] In step S550, if the prediction error corresponding to each updated sequence length meets the preset condition, the multiple updated sequence lengths are used as multiple initial sequence lengths, and the process jumps to the step of updating the multiple initial sequence lengths using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths, until the preset number of iterations is met.

[0168] In step S560, the updated sequence length with the smallest prediction error is selected from the last obtained updated sequence lengths and used as the target sequence length.

[0169] Among them, original historical data can refer to original historical sales volume, original historical price, original historical promotional activities, original historical holidays, etc.

[0170] Preprocessing can refer to data loading and preprocessing, outlier detection and handling, data imputation / deletion, feature engineering and seasonal coding, etc. See [link / reference] for details. Figure 7 .

[0171] The asymmetric learning factors include individual cognitive factor c1 and social learning factor c2. By utilizing inertia weights and asymmetric learning factors, the velocity of particles (i.e., the sequence length) can be updated, and then the position of the particles can be updated through the updated velocity, thereby updating the sequence length.

[0172] Among them, prediction error can refer to MAE (Mean Absolute Error), MSE (Mean Squared Error), RMSE (Root Mean Squared Error), MAPE (Mean Absolute Percentage Error), etc.

[0173] The prediction error corresponding to each updated sequence length refers to the prediction error of the data prediction model (such as the Informer model) trained using sample sequence data that matches each updated sequence length, and the difference between the predicted data output by the data prediction model corresponding to each updated sequence length and the actual data.

[0174] Among them, the prediction error corresponding to each updated sequence length satisfies the preset condition, which means that the prediction error corresponding to each updated sequence length is less than the prediction error obtained in the previous one.

[0175] For example, the server obtains the original historical data of the object to be predicted, and then performs a series of preprocessing steps on the original historical data of the object to be predicted to obtain the processed historical data of the object to be predicted. Next, using inertia weights and asymmetric learning factors, the velocity of each initial sequence length (e.g., 8 particles, each particle corresponding to one initial sequence length) is updated. Then, using the updated velocity of each initial sequence length, the position of each initial sequence length is updated to obtain the updated sequence length corresponding to each initial sequence length. Then, if each updated sequence length is within a preset sequence length range (e.g., 30 days to 400 days), sample sequence data matching each updated sequence length (e.g., 60-day historical sales data, 70-day historical sales data, 8-day historical sales data, etc.) is extracted from the processed historical data. (0-day historical sales data, 90-day historical sales data, etc.); Next, using sample sequence data that matches the length of each updated sequence, a data prediction model (such as the Informer model) corresponding to each updated sequence length is trained. The historical sequence data that matches the length of each updated sequence is then input into the data prediction model corresponding to each updated sequence length to obtain the predicted data output by the data prediction model corresponding to each updated sequence length (such as predicted sales data for the next 10 days). Based on the difference between the predicted data output by the data prediction model corresponding to each updated sequence length and the actual data (such as actual sales data for the next 10 days), the prediction error of the data prediction model corresponding to each updated sequence length is calculated and used as the prediction error corresponding to each updated sequence length. Next, if the prediction error corresponding to each updated sequence length meets the preset condition, multiple updated sequence lengths are used as multiple initial sequence lengths. The process then jumps to updating these initial sequence lengths using inertia weights and asymmetric learning factors to obtain multiple updated sequence lengths, until a preset number of iterations (e.g., 15) is met. Finally, from the last obtained updated sequence lengths, the updated sequence length with the smallest corresponding prediction error (e.g., 90 days) is selected as the target sequence length. For details, please refer to [reference needed]. Figure 7The adaptive PSO sequence length optimization process in [the context of PSO].

[0176] The technical solution provided in this disclosure adaptively updates multiple initial sequence lengths and takes the updated sequence length with the smallest prediction error among the last updated sequence lengths as the target sequence length. This helps to obtain a target sequence length that matches the object to be predicted, thereby reducing the prediction error and avoiding the defects of setting the sequence length by manual experience, which is prone to prediction errors. This makes the subsequent data prediction results determined based on historical sequence data that matches the target sequence length more accurate, further improving the data prediction accuracy.

[0177] In an exemplary embodiment, the data prediction method provided in this disclosure further includes a step of adaptively updating the inertia weights and asymmetric learning factors, specifically including: obtaining monitoring indicators for the iterative update process of the sequence length; the monitoring indicators include at least the population diversity of the updated sequence length and the convergence rate of the prediction error corresponding to the updated sequence length; using the monitoring indicators, adaptively updating the inertia weights and asymmetric learning factors to obtain the adaptively updated inertia weights and adaptively updated asymmetric learning factors.

[0178] In step S530, multiple initial sequence lengths are updated using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths. Specifically, this includes the following: updating multiple initial sequence lengths using adaptively updated inertial weights and adaptively updated asymmetric learning factors to obtain multiple updated sequence lengths.

[0179] The population diversity of the updated sequence length refers to the degree of difference between the updated sequence lengths after each iteration; the greater the difference, the higher the population diversity; the smaller the difference, the lower the population diversity. For example, if the updated sequence lengths of the particles in the updated population are 57, 63, 78, 99, and 105 days, a large difference in these values ​​indicates high population diversity; if they are concentrated in the 95-100 day range, a small difference indicates low population diversity.

[0180] The convergence speed of the prediction error corresponding to the updated sequence length is quantified by the difference between the global minimum error in the prediction error corresponding to the updated sequence length and the global minimum error in the prediction error corresponding to the updated sequence length obtained in the previous round. The greater the difference, the faster the convergence speed; the smaller the difference, the slower the convergence speed. Adaptive updating of the inertia weight and asymmetric learning factor means that when population diversity is low or the convergence speed is slow (e.g., insufficient exploration), the inertia weight and individual cognitive factor are increased, and the social learning factor is decreased to increase exploration; when population diversity is high or the convergence speed is fast (e.g., premature convergence), the inertia weight and individual cognitive factor are decreased, and the social learning factor is increased to prevent premature convergence.

[0181] For example, the server acquires monitoring metrics for the iterative update process of the sequence length, such as the population diversity of the updated sequence length and the convergence speed of the prediction error corresponding to the updated sequence length. Then, using these monitoring metrics, the inertia weight and asymmetric learning factor are adaptively updated to obtain the adaptively updated inertia weight and asymmetric learning factor. For example, when the population diversity is low or the convergence speed is slow, the inertia weight and individual cognitive factor are increased, and the social learning factor is decreased; when the population diversity is high or the convergence speed is fast, the inertia weight and individual cognitive factor are decreased, and the social learning factor is increased. Finally, using the adaptively updated inertia weight and adaptively updated asymmetric learning factor, the speed of updating each initial sequence length (which can refer to each updated sequence length, see step S550 for details) is updated. Then, using the updated speed of each initial sequence length, the position of each initial sequence length is updated to obtain the updated sequence length corresponding to each initial sequence length. The specific process can be found in [reference needed]. Figure 7 The adaptive PSO sequence length optimization process in [the context of PSO].

[0182] For example, the server monitors population diversity in real time to prevent premature convergence or excessive dispersion. The adaptive adjustment strategy based on population diversity is as follows: if the population diversity is <0.1 (i.e., low population diversity, increase exploration), then w=min(w*1.2, self.w_max), which means increasing the inertia weight (i.e., increasing the inertia weight by 1.2 times, not exceeding the preset upper limit, allowing particles to jump out of the current interval to explore more candidate sequence lengths), and c1=min(c1*1.1, self.c1_max). This means increasing the individual cognitive factor (i.e., increasing the weight of particles to approach their own historical best sequence length by 1.1 times, and not exceeding the preset upper limit of the individual cognitive factor, thus strengthening individual exploration); if the population diversity is >0.3 (i.e., the population diversity is high, thus increasing development), then w=max(w*0.9, self.w_min), which means decreasing the inertia weight (i.e., decreasing the inertia weight by 0.9 times, and not lower than the preset lower limit of the inertia weight), and c2=min(c2*1.1, self.c2_max), which means increasing the social learning factor (i.e., increasing the social learning factor by 1.1 times, and not exceeding the preset upper limit of the social learning factor).

[0183] For example, the server monitors the convergence speed in real time and dynamically adjusts parameters based on the convergence speed. The adaptive adjustment strategy based on the convergence speed is as follows: if the convergence speed is <0.01 (i.e., slow convergence, increase exploration), then w = min(w*1.1, self.w_max), that is, increase the inertia weight (i.e., increase the inertia weight by 1.1 times, and do not exceed the preset upper limit of the inertia weight), and c1 = min(c1*1.05, self.c1_max). This means increasing the individual cognitive factor (i.e., increasing the individual cognitive factor by 1.05 times, but not exceeding the preset upper limit of the individual cognitive factor); if the convergence speed is >0.1 (i.e., convergence is too fast, to prevent premature convergence), then w=max(w*0.95, self.w_min), which means decreasing the inertia weight (i.e., decreasing the inertia weight by 0.95 times, but not lower than the preset lower limit of the inertia weight), and c2=min(c2*1.05, self.c2_max), which means increasing the social learning factor (i.e., increasing the social learning factor by 1.05 times, but not exceeding the preset upper limit of the social learning factor).

[0184] The technical solution provided in this disclosure utilizes the population diversity of the updated sequence length and the convergence speed of the prediction error corresponding to the updated sequence length to adaptively update the inertia weight and asymmetric learning factor. This achieves the purpose of adaptively updating multiple initial sequence lengths, avoiding the defects of insufficient exploration or premature convergence, which leads to low accuracy of the determined target sequence length. This is beneficial to improving the accuracy of the target sequence length determination.

[0185] In an exemplary embodiment, in step S130, after obtaining the data prediction result of the object to be predicted based on the prediction data of the object to be predicted over multiple consecutive time steps in the future, the following steps are also included: obtaining feedback data on the data prediction result of the object to be predicted; iteratively updating the target sequence length based on the feedback data to obtain the updated target sequence length; iteratively updating the pre-trained data prediction model using the target sample sequence data of the object to be predicted to obtain the updated data prediction model; and matching the sequence length of the target sample sequence data with the updated target sequence length.

[0186] Feedback data can refer to the actual data of the object to be predicted at multiple consecutive time steps in the future, such as actual sales data, actual power load data, and actual weather data.

[0187] Iterative updates to the target sequence length refer to using feedback data to redetermine the optimal sequence length, which becomes the updated target sequence length. For example, if the original target sequence length was 90 days, the updated target sequence length would be 80 days. Matching the target sample sequence length with the updated target sequence length means that the target sample sequence length and the updated target sequence length are the same, for example, both are 50 days.

[0188] The updated data prediction model can refer to the updated Informer model.

[0189] For example, the server obtains feedback data on the prediction results for the object to be predicted; then, based on the feedback data, it uses an adaptive PSO algorithm to adaptively iteratively update multiple initial sequence lengths to redetermine the optimal sequence length as the updated target sequence length (e.g., 80 days); finally, it obtains sample sequence data of the object to be predicted that matches the updated target sequence length (e.g., sales data sequence of a certain laundry detergent over the past 80 days), and uses this sample sequence data to iteratively update the pre-trained data prediction model until a preset convergence condition is met (e.g., reaching a preset number of training iterations or the model loss is less than a preset loss), thus obtaining the updated data prediction model. For details, please refer to [reference needed]. Figure 7 .

[0190] The technical solution provided in this disclosure, based on feedback data of the data prediction results for the object to be predicted, iteratively updates the target sequence length to obtain the updated target sequence length. Then, using sample sequence data of the object to be predicted that matches the updated target sequence length, iteratively updates the pre-trained data prediction model to obtain the updated data prediction model. This achieves the purpose of iteratively updating the target sequence length and the pre-trained data prediction model based on feedback data, which is beneficial to further improve the accuracy of the determination of the data prediction results, thereby improving the data prediction accuracy.

[0191] Figure 6 This is a flowchart illustrating another data prediction method according to an exemplary embodiment, such as... Figure 6 As shown, this data prediction method is used in a server and can be implemented through the following steps:

[0192] In step S601, the original historical data of the object to be predicted is obtained; the original historical data of the object to be predicted is preprocessed to obtain the processed historical data of the object to be predicted.

[0193] In step S602, multiple initial sequence lengths are updated using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths; sample sequence data matching each updated sequence length are extracted from the processed historical data.

[0194] Specifically, the server can acquire monitoring metrics for the iterative update process of the sequence length; the monitoring metrics include at least the population diversity of the updated sequence length and the convergence rate of the prediction error corresponding to the updated sequence length; using the monitoring metrics, the inertial weights and asymmetric learning factors are adaptively updated to obtain the adaptively updated inertial weights and adaptively updated asymmetric learning factors; using the adaptively updated inertial weights and adaptively updated asymmetric learning factors, multiple initial sequence lengths are updated to obtain multiple updated sequence lengths.

[0195] In step S603, the prediction error corresponding to each updated sequence length is determined based on the sample sequence data that matches each updated sequence length.

[0196] In step S604, if the prediction error corresponding to each updated sequence length meets the preset condition, the multiple updated sequence lengths are used as multiple initial sequence lengths, and the process jumps to the step of updating the multiple initial sequence lengths using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths, until the preset number of iterations is met.

[0197] In step S605, the updated sequence length with the smallest prediction error is selected from the last obtained updated sequence lengths and used as the target sequence length.

[0198] In step S606, sample sequence data of the object to be predicted is obtained; the sequence length of the sample sequence data matches the target sequence length; the sample sequence data is input into the data prediction model to be trained for multi-step prediction processing to obtain the sample data prediction result of the object to be predicted.

[0199] In step S607, the model loss of the data prediction model to be trained is obtained based on the difference between the predicted result of the sample data of the object to be predicted and the actual data result of the object to be predicted; the model parameters of the data prediction model to be trained are adjusted based on the model loss until the preset convergence condition is met, and the pre-trained data prediction model is obtained.

[0200] In step S608, historical sequence data of the object to be predicted is obtained; the sequence length of the historical sequence data matches the target sequence length.

[0201] In step S609, historical sequence data is input into a pre-trained data prediction model for position encoding processing to obtain the position vector of historical sequence data; the feature vector of historical sequence data is obtained, and the position vector and feature vector of historical sequence data are fused to obtain the encoding vector of historical sequence data.

[0202] In step S610, attention processing is performed on the encoding vector of the historical sequence data to obtain the attention output sequence corresponding to the encoding vector; the sequence length is compressed based on the attention output sequence to obtain the target attention output sequence corresponding to the encoding vector.

[0203] In step S611, multi-step prediction processing is performed based on the target attention output sequence to obtain the prediction data of the object to be predicted in multiple consecutive time steps in the future; and the known data features of the object to be predicted in multiple consecutive time steps in the future are obtained.

[0204] In step S612, the known data features and predicted data of the object to be predicted in multiple consecutive time steps in the future are fused to obtain the fused features of the object to be predicted in multiple consecutive time steps in the future.

[0205] In step S613, the fused features of the object to be predicted at multiple consecutive time steps in the future are input into the target data prediction model to obtain the target prediction data of the object to be predicted at multiple consecutive time steps in the future.

[0206] In step S614, the data prediction result of the object to be predicted is obtained based on the target prediction data of the object to be predicted in multiple consecutive time steps in the future.

[0207] The server can also obtain feedback data on the prediction results of the object to be predicted; based on the feedback data, iteratively update the target sequence length to obtain the updated target sequence length; iteratively update the pre-trained data prediction model using the target sample sequence data of the object to be predicted to obtain the updated data prediction model; and match the sequence length of the target sample sequence data with the updated target sequence length.

[0208] In the aforementioned data prediction method, the target sequence length is obtained by adaptively iteratively updating multiple initial sequence lengths, achieving intelligent optimization of the sequence length. This facilitates obtaining a target sequence length that fits the object to be predicted, thereby reducing prediction errors and avoiding the pitfalls of manually setting sequence lengths, which are prone to errors. This makes subsequent data predictions based on historical sequence data matching the target sequence length more accurate, thus improving the overall data prediction accuracy. Furthermore, by using a pre-trained data prediction model based on historical sequence data matching the target sequence length, multi-step prediction processing is performed, outputting the predicted data for the object at multiple consecutive time steps in a single step. This avoids the error accumulation that can occur with step-by-step predictions, further reducing prediction errors and improving the accuracy of the data prediction results.

[0209] To more clearly illustrate the data prediction method provided in the embodiments of this disclosure, the following specific embodiment will be used to describe the data prediction method in detail. In one embodiment, as... Figure 7 As shown, this disclosure also provides a multi-step prediction method for medium- and long-term time series data based on the dynamic sequence length Informer algorithm with adaptive PSO optimization. Through intelligent parameter adjustment, multi-strategy search and dynamic adaptation mechanism, it effectively solves the key problem of sequence length optimization. The main contributions are: (1) a complete adaptive particle swarm optimization framework is proposed and a parameter dynamic adjustment strategy is designed; (2) based on the improved PSO+Informer combined algorithm, an end-to-end automatic prediction process is realized to support medium- and long-term time series prediction problems; (3) the effectiveness of the method is verified on multiple actual datasets.

[0210] refer to Figure 7The method may include the following steps: Step 1, data loading and preprocessing. Step 2, outlier detection and handling. Step 3, determining if the data is abnormal; if yes, proceed to Step 4; otherwise, proceed to Step 5. Step 4, performing data imputation / deletion. Step 5, feature engineering and seasonal encoding. Step 6, adaptive PSO sequence length optimization. Step 7, PSO optimization engine initialization: PSO parameter initialization, fast model evaluation, fitness calculation, dynamic inertia weight adjustment, asymmetric learning factor adjustment, and population diversity monitoring. Step 8, particle population evaluation: based on the initialization results of the PSO optimization engine, comprehensively evaluate the performance of all "candidate sequence lengths (particles)" (e.g., selecting particles with higher fitness). Step 9, adaptive parameter adjustment: combining the results of "population diversity monitoring," dynamically adjust the PSO parameters; for example, if population diversity is low, increase w / c1; if population diversity is high, decrease w / c2 and increase c2. Step 10, determining if convergence has occurred; if not, proceed to Step 8; if yes, proceed to Step 11. Step 11: Obtain the optimal sequence length. Step 12: Dynamic sequence generation. Step 13: Informer model training: Train the Informer model using the optimal length sequence obtained through dynamic sequence generation. Step 14: Informer model core module initialization: Positional encoding, probabilistic sparse attention, self-attention distillation, and generative decoder. Step 15: Multi-head attention-enhanced DNN: Based on the Informer core module, a multi-head attention mechanism is superimposed to enhance the model's ability to capture multi-dimensional features of time-series data (e.g., simultaneously focusing on data trends and periods). Step 16: Determine if the model meets expectations. If not, proceed to step 17; if yes, proceed to step 19. Step 17: Iterative model optimization. Step 18: Visualize and analyze attention weights, then proceed to step 13. Step 19: Model deployment. Step 20: Real-time prediction. Step 21: Predict the output layer. Step 22: Visualize attention weights. Step 23: Performance monitoring and feedback. Step 24: Determine if the model needs to be updated. If yes, proceed to step 6; otherwise, end the process.

[0211] For example, a comparative experiment was conducted using a standard seq2seq (Sequence-to-Sequence) + attention algorithm for multi-step prediction. The input was (Day 1, Day 2, ..., Day 365), such as historical sales data. After sequential processing by an RNN (Recurrent Neural Network) encoder, a context vector (i.e., a compressed 256-dimensional vector) was obtained. Then, after sequential generation by an RNN decoder, the output was (Day 366, Day 367, ..., Day 395), such as predicted sales data. The algorithm's overall statistical metrics include MAE (4,109,621,817), MSE (22,828,975,645,793,882,112), RMSE (4,777,967,732), and MAPE (25.04%). The trained model (including all network parameters, weights, and layer structure) has been saved as a file (e.g., 'informer_cost18_model.pth'), which can be directly loaded later (without retraining) to predict new data (e.g., predicting values ​​on day 396 and beyond). Comparison charts of the algorithm's training and validation loss curves, prediction comparison charts for the last time series, histograms of prediction error distribution, and scatter plots of predicted vs. actual values ​​are available for reference. Figures 8 to 11 .

[0212] The process of optimizing the input sequence length parameter for the Informer algorithm multi-step time series prediction method based on adaptive PSO optimization is as follows: (1) Device used: CPU (Central Processing Unit); (2) Algorithm: Informer time series prediction based on adaptive PSO optimization with dynamic sequence length; (3) Total number of data days: 1102; (4) Start adaptive PSO optimization, number of particles: 8; maximum number of iterations: 15; (5) Sequence length search range: [30, 400]; (6) Adaptive parameter strategy: dynamic inertia weight: early exploration (0.9) → later convergence (0.4); asymmetric learning factor: early individual cognition → later social learning; intelligent parameter adjustment based on diversity and convergence speed.

[0213] The algorithm's overall statistical metrics include MAE (1,719,933,090), RMSE (2,289,361,752), and MAPE (10.46%). The trained model (including all network parameters, weights, and layer structure) has been saved as a file (e.g., 'best_informer_model.pth'), which can be directly loaded later (without retraining) to make predictions on new data (e.g., predicting sales data for the next 30 days). Comparison charts of the algorithm's training and validation loss curves, prediction comparison charts for the last time series, histograms of prediction error distribution, and scatter plots of predicted vs. actual values ​​can be found in the reference charts. Figures 12 to 15 .

[0214] The comparison shows that the prediction accuracy of the long-term time series multi-step prediction method based on adaptive PSO optimization and dynamic sequence length Informer is better.

[0215] The above embodiments can achieve the following technical effects: (1) An adaptive particle swarm optimization algorithm is proposed, which realizes intelligent optimization of sequence length through dynamic parameter adjustment mechanism, effectively balances the contradiction between exploration and development, and significantly improves optimization efficiency. The PSO algorithm with dynamic adjustment of inertia weight and learning factor is introduced to intelligently optimize sequence length. An adaptive parameter adjustment strategy based on search progress, diversity and convergence speed is used to improve optimization efficiency and prevent premature convergence. (2) A collaborative architecture of dynamic sequence generation and Informer is designed. Combining self-attention distillation and generative decoder, the memory bottleneck and error accumulation problem of long sequence processing are solved, which is suitable for medium and long-term prediction tasks. By dynamically generating input sequences of different lengths, the model can adapt to inputs of various sizes and improve the generalization ability of the model. Informer adopts self-attention distillation operation, which further reduces memory usage and computational complexity by halving the length of input sequence layer by layer. This design enables the model to process extremely long input sequences and solves the memory bottleneck problem of traditional Transformer. The improved combination of PSO and Informer can generate prediction results for multiple time steps at once, avoiding the error accumulation problem in the traditional stepwise prediction method, and is cleverly applied to medium- and long-term multi-step time series prediction. (3) A multi-dimensional evaluation system was constructed, which provides comprehensive support for model performance evaluation and algorithm mechanism understanding by combining quantitative indicators with visualization analysis.

[0216] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0217] It is understood that the same / similar parts between the various embodiments of the methods described above in this specification can be referred to each other. Each embodiment focuses on the differences from other embodiments, and relevant parts can be referred to the description of other method embodiments.

[0218] Based on the same inventive concept, this disclosure also provides a data prediction apparatus for implementing the data prediction method described above.

[0219] Figure 16 This is a block diagram illustrating a data prediction apparatus according to an exemplary embodiment. (Refer to...) Figure 16 The device includes a data acquisition unit 1610, a prediction processing unit 1620, and a result determination unit 1630.

[0220] The data acquisition unit 1610 is configured to acquire historical sequence data of the object to be predicted; the sequence length of the historical sequence data is matched with the target sequence length; the target sequence length is obtained by adaptively iteratively updating multiple initial sequence lengths.

[0221] The prediction processing unit 1620 is configured to perform multi-step prediction processing by inputting historical sequence data into a pre-trained data prediction model to obtain prediction data of the object to be predicted in multiple consecutive time steps in the future; the pre-trained data prediction model is trained by the sample sequence data of the object to be predicted; the sequence length of the sample sequence data is matched with the target sequence length.

[0222] The result determination unit 1630 is configured to execute prediction data based on the object to be predicted over multiple consecutive time steps in the future to obtain the data prediction result of the object to be predicted.

[0223] In one exemplary embodiment, the prediction processing unit 1620 is further configured to perform the following: inputting historical sequence data into a pre-trained data prediction model to obtain an encoding vector of the historical sequence data; performing attention processing based on the encoding vector of the historical sequence data to obtain an attention output sequence corresponding to the encoding vector; performing sequence length compression processing based on the attention output sequence to obtain a target attention output sequence corresponding to the encoding vector; and performing multi-step prediction processing based on the target attention output sequence to obtain prediction data of the object to be predicted for multiple consecutive time steps in the future.

[0224] In an exemplary embodiment, the prediction processing unit 1620 is further configured to perform position encoding processing by inputting historical sequence data into a pre-trained data prediction model to obtain the position vector of the historical sequence data; obtain the feature vector of the historical sequence data; and fuse the position vector and feature vector of the historical sequence data to obtain the encoded vector of the historical sequence data.

[0225] In an exemplary embodiment, the result determination unit 1630 is further configured to perform the following operations: acquire known data features of the object to be predicted over multiple consecutive time steps; fuse the known data features of the object to be predicted over multiple consecutive time steps with the predicted data to obtain fused features of the object to be predicted over multiple consecutive time steps; input the fused features of the object to be predicted over multiple consecutive time steps into the target data prediction model to obtain target prediction data of the object to be predicted over multiple consecutive time steps; and obtain the data prediction result of the object to be predicted based on the target prediction data of the object to be predicted over multiple consecutive time steps.

[0226] In an exemplary embodiment, the data prediction apparatus further includes a model training unit configured to perform adaptive iterative updates of multiple initial sequence lengths to obtain a target sequence length; acquire sample sequence data of the object to be predicted; input the sample sequence data into the data prediction model to be trained for multi-step prediction processing to obtain the sample data prediction result of the object to be predicted; obtain the model loss of the data prediction model to be trained based on the difference between the sample data prediction result of the object to be predicted and the actual data result of the object to be predicted; and adjust the model parameters of the data prediction model to be trained based on the model loss until a preset convergence condition is met to obtain a pre-trained data prediction model.

[0227] In one exemplary embodiment, the model training unit is further configured to: input sample sequence data into the data prediction model to be trained to obtain sample encoding vectors of the sample sequence data; perform attention processing based on the sample encoding vectors to obtain sample attention output sequences corresponding to the sample encoding vectors; perform sequence length compression processing based on the sample attention output sequences to obtain target attention output sequences corresponding to the sample encoding vectors; perform multi-step prediction processing based on the target attention output sequences corresponding to the sample encoding vectors to obtain sample prediction data of the object to be predicted for multiple consecutive sample time steps; fuse the known sample data features and sample prediction data of the object to be predicted for multiple consecutive sample time steps to obtain sample fusion features of the object to be predicted for multiple consecutive sample time steps; input the sample fusion features of the object to be predicted for multiple consecutive sample time steps into the target data prediction model to obtain target sample prediction data of the object to be predicted for multiple consecutive sample time steps; and obtain the sample data prediction result of the object to be predicted based on the target sample prediction data of the object to be predicted for multiple consecutive sample time steps.

[0228] In an exemplary embodiment, the model training unit is further configured to: acquire the original historical data of the object to be predicted; preprocess the original historical data of the object to be predicted to obtain processed historical data of the object to be predicted; update multiple initial sequence lengths using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths; extract sample sequence data matching each updated sequence length from the processed historical data; determine the prediction error corresponding to each updated sequence length based on the sample sequence data matching each updated sequence length; if the prediction error corresponding to each updated sequence length meets a preset condition, use the multiple updated sequence lengths as multiple initial sequence lengths, and jump to the step of updating the multiple initial sequence lengths using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths, until a preset number of iterations is met; and select the updated sequence length with the smallest corresponding prediction error from the last obtained updated sequence lengths as the target sequence length.

[0229] In an exemplary embodiment, the data prediction apparatus further includes a data update unit configured to perform a monitoring index for the iterative update process of the sequence length; the monitoring index includes at least the population diversity of the updated sequence length and the convergence rate of the prediction error corresponding to the updated sequence length; using the monitoring index, the inertial weight and the asymmetric learning factor are adaptively updated to obtain the adaptively updated inertial weight and the adaptively updated asymmetric learning factor.

[0230] The model training unit is also configured to update multiple initial sequence lengths using adaptively updated inertial weights and adaptively updated asymmetric learning factors, resulting in multiple updated sequence lengths.

[0231] In one exemplary embodiment, the data prediction apparatus further includes a model update unit configured to perform the following actions: acquiring feedback data of the data prediction result for the object to be predicted; iteratively updating the target sequence length based on the feedback data to obtain the updated target sequence length; iteratively updating the pre-trained data prediction model using the target sample sequence data of the object to be predicted to obtain the updated data prediction model; and matching the sequence length of the target sample sequence data with the updated target sequence length.

[0232] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0233] Each module in the aforementioned data prediction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0234] Figure 17 This is a block diagram illustrating an electronic device 1700 for implementing a data prediction method according to an exemplary embodiment. For example, the electronic device 1700 may be a server. (Refer to...) Figure 17 The electronic device 1700 includes a processing component 1720, which further includes one or more processors, and memory resources represented by memory 1722 for storing instructions, such as application programs, that can be executed by the processing component 1720. The application programs stored in memory 1722 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1720 is configured to execute instructions to perform the methods described above.

[0235] Electronic device 1700 may further include: a power supply component 1724 configured to perform power management of electronic device 1700, a wired or wireless network interface 1726 configured to connect electronic device 1700 to a network, and an input / output (I / O) interface 1728. Electronic device 1700 may operate on an operating system stored in memory 1722, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, or similar.

[0236] In one exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1722 including instructions, which can be executed by a processor of an electronic device 1700 to perform the above-described method. The storage medium may be a computer-readable storage medium, for example, a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0237] In one exemplary embodiment, a computer program product is also provided, the computer program product including instructions that can be executed by a processor of an electronic device 1700 to perform the above-described method.

[0238] It should be noted that the above-mentioned apparatus, electronic equipment, computer-readable storage medium, computer program product, etc., may also include other implementation methods according to the description of the method embodiments. For specific implementation methods, please refer to the description of the relevant method embodiments, which will not be elaborated here.

[0239] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0240] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A data prediction method, characterized in that, include: Obtain historical sequence data of the object to be predicted; The sequence length of the historical sequence data matches the length of the target sequence. The target sequence length is obtained by adaptively iteratively updating multiple initial sequence lengths; The historical sequence data is input into a pre-trained data prediction model for multi-step prediction processing to obtain the predicted data of the object to be predicted in multiple consecutive time steps in the future; the pre-trained data prediction model is trained using the sample sequence data of the object to be predicted. The length of the sample sequence data matches the length of the target sequence. Based on the predicted data of the object to be predicted at multiple consecutive time steps in the future, the data prediction result of the object to be predicted is obtained.

2. The method according to claim 1, characterized in that, The step of inputting the historical sequence data into a pre-trained data prediction model for multi-step prediction processing to obtain prediction data for the object to be predicted at multiple consecutive time steps in the future includes: The historical sequence data is input into a pre-trained data prediction model to obtain the encoding vector of the historical sequence data; Attention processing is performed on the encoding vector of the historical sequence data to obtain the attention output sequence corresponding to the encoding vector; Based on the attention output sequence, sequence length compression processing is performed to obtain the target attention output sequence corresponding to the encoding vector; Multi-step prediction processing is performed based on the target attention output sequence to obtain prediction data for the object to be predicted in multiple consecutive time steps in the future.

3. The method according to claim 2, characterized in that, The step of inputting the historical sequence data into a pre-trained data prediction model to obtain the encoded vector of the historical sequence data includes: The historical sequence data is input into a pre-trained data prediction model for position encoding processing to obtain the position vector of the historical sequence data. The feature vector of the historical sequence data is obtained, and the position vector and feature vector of the historical sequence data are fused to obtain the encoding vector of the historical sequence data.

4. The method according to claim 1, characterized in that, The process of obtaining the data prediction result of the object to be predicted based on the prediction data of the object to be predicted at multiple consecutive time steps in the future includes: Obtain known data features of the object to be predicted at multiple consecutive time steps in the future; The known data features and predicted data of the object to be predicted in multiple consecutive time steps in the future are fused together to obtain the fused features of the object to be predicted in multiple consecutive time steps in the future. The fused features of the object to be predicted at multiple consecutive time steps in the future are input into the target data prediction model to obtain the target prediction data of the object to be predicted at multiple consecutive time steps in the future. Based on the target prediction data of the object to be predicted at multiple consecutive time steps in the future, the data prediction result of the object to be predicted is obtained.

5. The method according to claim 1, characterized in that, The pre-trained data prediction model is trained in the following manner: The target sequence length is obtained by adaptively iteratively updating the lengths of the multiple initial sequences. Obtain the sample sequence data of the object to be predicted; The sample sequence data is input into the data prediction model to be trained for multi-step prediction processing to obtain the sample data prediction result of the object to be predicted. The model loss of the data prediction model to be trained is obtained based on the difference between the predicted result of the sample data of the object to be predicted and the actual data result of the object to be predicted. The model parameters of the data prediction model to be trained are adjusted based on the model loss until the preset convergence condition is met, thus obtaining the pre-trained data prediction model.

6. The method according to claim 5, characterized in that, The step of inputting the sample sequence data into the data prediction model to be trained for multi-step prediction processing to obtain the sample data prediction result of the object to be predicted includes: The sample sequence data is input into the data prediction model to be trained to obtain the sample encoding vector of the sample sequence data; Attention processing is performed on the sample encoding vector to obtain the sample attention output sequence corresponding to the sample encoding vector; Based on the sample attention output sequence, the sequence length is compressed to obtain the target attention output sequence corresponding to the sample encoding vector; Multi-step prediction processing is performed based on the target attention output sequence corresponding to the sample encoding vector to obtain the sample prediction data of the object to be predicted in multiple consecutive sample time steps in the future. The known sample data features and sample prediction data of the object to be predicted in multiple consecutive sample time steps in the future are fused to obtain the sample fusion features of the object to be predicted in multiple consecutive sample time steps in the future. The sample fusion features of the object to be predicted at multiple consecutive sample time steps in the future are input into the target data prediction model to obtain the target sample prediction data of the object to be predicted at multiple consecutive sample time steps in the future. Based on the target sample prediction data of the object to be predicted in multiple consecutive sample time steps in the future, the sample data prediction result of the object to be predicted is obtained.

7. The method according to claim 5, characterized in that, The adaptive iterative update of the lengths of the plurality of initial sequences to obtain the target sequence length includes: Obtain the original historical data of the object to be predicted; The original historical data of the object to be predicted is preprocessed to obtain the processed historical data of the object to be predicted. The lengths of the multiple initial sequences are updated using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths; sample sequence data matching each updated sequence length are extracted from the processed historical data. Based on the sample sequence data that matches the length of each updated sequence, the prediction error corresponding to each updated sequence length is determined. If the prediction error corresponding to each updated sequence length meets the preset condition, the multiple updated sequence lengths are used as multiple initial sequence lengths, and the process jumps to the step of updating the multiple initial sequence lengths using inertial weights and asymmetric learning factors to obtain multiple updated sequence lengths, until the preset number of iterations is met. From the last obtained updated sequence lengths, the updated sequence length with the smallest corresponding prediction error is selected as the target sequence length.

8. The method according to claim 7, characterized in that, The method further includes: Obtain monitoring indicators for the iterative update process of sequence length; the monitoring indicators include at least the population diversity of the updated sequence length and the convergence rate of the prediction error corresponding to the updated sequence length; Using the monitoring indicators, the inertia weights and the asymmetric learning factors are adaptively updated to obtain the adaptively updated inertia weights and the adaptively updated asymmetric learning factors. The method of updating the lengths of the multiple initial sequences using inertia weights and asymmetric learning factors to obtain multiple updated sequence lengths includes: The lengths of the multiple initial sequences are updated using the adaptively updated inertial weights and the adaptively updated asymmetric learning factors to obtain multiple updated sequence lengths.

9. The method according to any one of claims 1 to 8, characterized in that, After obtaining the data prediction result of the object to be predicted based on the prediction data of the object to be predicted at multiple consecutive time steps in the future, the method further includes: Obtain feedback data on the data prediction results for the object to be predicted; Based on the feedback data, the target sequence length is iteratively updated to obtain the updated target sequence length; The pre-trained data prediction model is iteratively updated using the target sample sequence data of the object to be predicted to obtain an updated data prediction model; the sequence length of the target sample sequence data matches the length of the updated target sequence.

10. A data prediction device, characterized in that, include: The data acquisition unit is configured to acquire historical sequence data of the object to be predicted. The sequence length of the historical sequence data matches the length of the target sequence. The target sequence length is obtained by adaptively iteratively updating multiple initial sequence lengths; The prediction processing unit is configured to perform multi-step prediction processing by inputting the historical sequence data into a pre-trained data prediction model to obtain prediction data for the object to be predicted in multiple consecutive time steps in the future; the pre-trained data prediction model is trained using sample sequence data of the object to be predicted. The length of the sample sequence data matches the length of the target sequence. The result determination unit is configured to execute prediction data based on the object to be predicted over multiple consecutive time steps in the future to obtain the data prediction result of the object to be predicted.

11. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the data prediction method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the data prediction method as described in any one of claims 1 to 9.

13. A computer program product, the computer program product comprising instructions, characterized in that, When the instructions are executed by the processor of the electronic device, the electronic device is able to perform the data prediction method as described in any one of claims 1 to 9.