Behavior quantity prediction method and device and electronic equipment
By constructing the target behavior sequence and combining it with future time periods, the problem of inaccurate prediction of predetermined behavior volumes is solved, and high-precision prediction effect is achieved.
Patent Information
- Application Number
- CN202411792314.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-04-15
AI Technical Summary
When predicting a predetermined behavior quantity, the prior art has the problem of inaccurate prediction and no effective solution has been found.
By receiving the behavior quantity prediction request, the initial behavior sequence is obtained and the corresponding behavior characteristics and interference characteristics are determined. Then, a prefix behavior sequence is constructed, connected to the initial behavior sequence front end, forming a target behavior sequence. The predicted behavior sequence is determined based on the target behavior sequence and future time period.
By integrating historical data and possible future interference, this method can maintain high prediction accuracy when processing complex periodic and trendy long-sequence data, prevent over-reliance on historical data, reduce the risk of over-fitting, and improve the accuracy of prediction.
Smart Images

Figure CN119829937A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a behavior quantity prediction method, device and electronic equipment. Background Art
[0002] In the related technology, when predicting the amount of predetermined behavior, such as the business volume in a shopping scenario, an autoregressive integral moving average model, a recurrent neural network model, a time convolutional network, etc. are used for prediction. However, when predicting the amount of predetermined behavior, there is a technical problem of inaccurate prediction.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present invention provide a behavior quantity prediction method, device and electronic device to at least solve the technical problem of inaccurate prediction when predicting a predetermined behavior quantity.
[0005] According to one aspect of an embodiment of the present invention, a behavior quantity prediction method is provided, comprising: receiving a behavior quantity prediction request, wherein the behavior quantity prediction request is used to predict the behavior quantity of a target object performing a predetermined behavior within a future time period, and the behavior quantity prediction request carries the future time period; in response to the behavior quantity prediction request, obtaining an initial behavior sequence, wherein the initial behavior sequence includes a plurality of predetermined behavior quantities arranged in chronological order, and the predetermined behavior quantity is the behavior quantity generated by the target object performing the predetermined behavior within a historical time period; determining behavior features corresponding to the initial behavior sequence, and interference features that interfere with the predetermined behavior; determining a prefix behavior sequence based on the behavior features and the interference features; connecting the prefix behavior sequence to the front end of the initial behavior sequence to obtain a target behavior sequence; determining a predicted behavior sequence based on the target behavior sequence and the future time period, wherein the predicted behavior sequence includes a plurality of predicted behavior quantities arranged in chronological order, and the predicted behavior quantity is the predicted behavior quantity generated by the target object performing the predetermined behavior within the future time period.
[0006] Optionally, determining the predicted behavior sequence based on the target behavior sequence and the future time period includes: obtaining a first subsequence and a second subsequence based on the target behavior sequence, wherein the first subsequence represents a sequence that exhibits a stability index trend corresponding to the predetermined behavior quantity within the historical time period, and the second subsequence represents a sequence that exhibits a volatility index trend of the predetermined behavior quantity within the historical time period; determining the predicted behavior sequence based on the first subsequence, the second subsequence and the future time period.
[0007] Optionally, before obtaining the first subsequence and the second subsequence based on the target behavior sequence, it also includes: when the target behavior sequence includes a first number of predetermined behavior quantities, setting a sliding window parameter of a sliding window, wherein the sliding window parameter includes a sliding window length and a sliding step, wherein the length of the sliding window length is the length covering a second number of behavior quantities, and the sliding step represents the number of behavior quantities moved by the sliding window, and the second number is less than the first number; determining, based on the target behavior sequence and the sliding window set with the sliding window parameter, a plurality of corresponding covering behavior sequences in the target behavior sequence; determining average values corresponding to the plurality of covering behavior sequences respectively; and determining the first subsequence based on the average values corresponding to the plurality of covering behavior sequences respectively.
[0008] Optionally, based on the target behavior sequence and the sliding window set with the sliding window parameters, determining multiple corresponding covering behavior sequences in the target behavior sequence includes: aligning the first position of the sliding window with the first behavior quantity position in the target behavior sequence to obtain a first covering behavior sequence, wherein the first covering behavior sequence includes multiple covering behavior quantities, and the multiple covering behavior quantities are the behavior quantities covered by the sliding window length corresponding to the sliding window; moving the sliding window according to the sliding step size to obtain a second covering behavior sequence, until the tail position of the sliding window is aligned with the tail behavior quantity position in the target behavior sequence to obtain the multiple covering behavior sequences.
[0009] Optionally, the sliding window is moved according to the sliding step to obtain a second covering behavior sequence until the tail position of the sliding window is aligned with the tail behavior quantity position in the target behavior sequence to obtain the multiple covering behavior sequences, including: determining whether the tail behavior quantity position is the position result of the last-last behavior quantity position in the target behavior sequence; determining the filling behavior quantity when the position result is not the last-last behavior quantity; filling the target behavior sequence according to the filling behavior quantity to obtain an updated behavior sequence; moving the sliding window according to the sliding step to align the tail position of the sliding window with the last-last behavior quantity position in the update behavior sequence to obtain the multiple covering behavior sequences.
[0010] Optionally, when the position result is not the last behavior amount, determining the filling behavior amount includes: when the position result is not the last behavior amount, determining the last rank; when the last rank is greater than a predetermined threshold, determining the filling behavior amount.
[0011] Optionally, the determining the predicted behavior sequence based on the first subsequence, the second subsequence and the future time period includes: determining a first feature corresponding to the first subsequence based on the first subsequence, wherein the first feature is a feature representing the stability of the predetermined behavior amount; determining a second feature corresponding to the second subsequence based on the second subsequence, wherein the second feature is a feature representing the volatility of the predetermined behavior amount; determining the first predicted subsequence based on the first feature and the future time period;
[0012] A second prediction subsequence is determined based on the second feature and the future time period; and the predicted behavior sequence is determined based on the first prediction subsequence and the second prediction subsequence.
[0013] According to one aspect of an embodiment of the present invention, a behavior quantity prediction device is provided, comprising: an acquisition module for receiving a behavior quantity prediction request, wherein the behavior quantity prediction request is used to predict the behavior quantity of a target object performing a predetermined behavior in a future time period, and the behavior quantity prediction request carries the future time period; a first determination module for acquiring an initial behavior sequence in response to the behavior quantity prediction request, wherein the initial behavior sequence includes a plurality of predetermined behavior quantities arranged in chronological order, and the predetermined behavior quantity is the behavior quantity generated by the target object performing the predetermined behavior in the historical time period; a second determination module for determining a behavior feature corresponding to the initial behavior sequence, and an interference feature that interferes with the predetermined behavior; a third determination module for determining a prefix behavior sequence based on the behavior feature and the interference feature; a fourth determination module for connecting the prefix behavior sequence to the front end of the initial behavior sequence to obtain a target behavior sequence; a fifth determination module for determining a predicted behavior sequence based on the target behavior sequence and the future time period, wherein the predicted behavior sequence includes a plurality of predicted behavior quantities arranged in chronological order, and the predicted behavior quantity is the predicted behavior quantity generated by the target object performing the predetermined behavior in the future time period.
[0014] According to one aspect of an embodiment of the present invention, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement any of the above-mentioned behavior quantity prediction methods.
[0015] According to one aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any of the above-mentioned behavior quantity prediction methods.
[0016] In an embodiment of the present invention, a behavior quantity prediction request is received, wherein the behavior quantity prediction request is used to predict the behavior quantity of a target object performing a predetermined behavior in a future time period, and the behavior quantity prediction request carries the future time period; in response to the behavior quantity prediction request, an initial behavior sequence is obtained, wherein the initial behavior sequence includes a plurality of predetermined behavior quantities arranged in chronological order, and the predetermined behavior quantity is the behavior quantity generated by the target object performing the predetermined behavior in the historical time period; behavior features corresponding to the initial behavior sequence and interference features that interfere with the predetermined behavior are determined; a prefix behavior sequence is determined based on the behavior features and the interference features; the prefix behavior sequence is connected to the front end of the initial behavior sequence to obtain a target behavior sequence; a predicted behavior sequence is determined based on the target behavior sequence and the future time period, wherein the predicted behavior sequence includes a plurality of predicted behavior quantities arranged in chronological order, and the predicted behavior quantity is the predicted behavior quantity generated by the target object performing the predetermined behavior in the future time period. In this embodiment, a prefix behavior sequence is constructed by combining the behavior features corresponding to the initial behavior sequence with the interference features, and the prefix behavior sequence is connected to the front end of the initial behavior sequence to form a new input sequence, namely the target behavior sequence, which integrates historical data and possible future interference. This enables the system to better cope with changes in data distribution and maintain a high level of prediction accuracy when processing long sequence data with complex periodicity and trends, even in the face of uncertainty or external interference, and still be able to operate stably and make reasonable predictions, thereby achieving the technical effect of preventing over-reliance on historical data, reducing the risk of overfitting, and thereby improving the accuracy of predictions, thereby solving the technical problem of inaccurate predictions when making predictions of predetermined behavior quantities. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0018] Figure 1 is a flow chart of a behavior amount prediction method according to an embodiment of the present invention;
[0019] Figure 2 is a flow chart of a long sequence prediction method in an optional embodiment of the present invention;
[0020] Figure 3 is an architectural diagram of long sequence prediction prefix reprogramming in an optional embodiment of the present invention;
[0021] Figure 4 4 is a structural block diagram of a behavior quantity prediction device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:
[0025] Reprogramming: Reprogramming is a process that does not require understanding the internal structure and working principle of the deep model, but only observes and manipulates the input and output responses of the model, and introduces various types of noise to influence and optimize the behavior of the model, especially enhancing the performance of the pre-trained language model in the fine-tuning stage. Reprogramming can be handled by treating the deep model as an opaque "black box", operating only based on the input and output responses of the model, and influencing and optimizing the model by adding various types of noise to these responses, so that continuous fine-tuning can be performed to enhance the pre-trained language model.
[0026] FFT: Fast Fourier Transform (FFT) is an algorithm for calculating Discrete Fourier Transform (DFT) and its inverse transform. The basic idea of FFT is to use the symmetry and periodicity of DFT to decompose the original signal into smaller sub-signals, and then recursively calculate the DFT of these sub-signals. Finally, by combining the DFT results of these sub-signals, the complete frequency domain representation of the original signal is obtained. Due to its high efficiency and versatility, FFT has become one of the indispensable tools in the field of modern digital signal processing.
[0027] Encoder and decoder: Encoders and decoders are devices or algorithms used to process digital signals. They are usually used in pairs to convert signals from one representation to another. Among them, the encoder converts the original data (such as audio, video, image, etc.) into a compressed encoding format to reduce the amount of data and improve transmission efficiency; while the decoder performs the opposite operation, which parses the encoded data into the original data form for playback or further processing. The encoding format between the encoder and decoder must match to ensure the correct transmission and recovery of the data.
[0028] Adam optimizer: Adam optimizer is an optimization algorithm for deep learning models. It combines the advantages of momentum method and adaptive learning rate. It adjusts the learning rate of each parameter by calculating the first-order moment estimate and second-order moment estimate of the gradient, thereby achieving more efficient, stable and adaptive network training. Adam optimizer can achieve good results on a variety of different data sets and model structures, and is one of the most popular optimization algorithms in the field of deep learning.
[0029] Example 1
[0030] According to an embodiment of the present invention, an embodiment of a behavior quantity prediction method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0031] Figure 1 is a flow chart of a behavior amount prediction method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0032] S102, receiving a behavior amount prediction request, wherein the behavior amount prediction request is used to predict the behavior amount of a target object performing a predetermined behavior in a future time period, and the behavior amount prediction request carries the future time period;
[0033] In step S102 provided in the present application, a behavior amount prediction request is received.
[0034] Among them, a behavior volume prediction request is involved, which is a request for indicating the amount of behavior of a target object performing a predetermined behavior in a certain time period in the future. The behavior volume prediction request may include a specified future time period, a target object, and a predetermined behavior of the target object. For example, you want to predict the business volume in a shopping scenario in the next month.
[0035] Among them, a target object is involved, which is a predetermined object specified in the behavior prediction request and will perform a predetermined behavior.
[0036] Among them, it involves a predetermined behavior, which is a predetermined behavior performed by the target object, such as any quantifiable behavior such as clicking and browsing in a shopping scenario.
[0037] Among them, the future time period is involved, which is the specific time range that needs to be predicted. For example, the next few days, the next month, the next year, etc., define the time boundary of the prediction.
[0038] By receiving a behavior volume prediction request, which carries a clearly specified future time period and the type of predetermined behavior to be performed by the target object to be predicted, an accurate prediction direction is provided for the subsequent process, so that subsequent predictions can be made based on these specific information, thereby enhancing the accuracy and specificity of the prediction, and further facilitating the subsequent prediction of the behavior volume of the predetermined behavior performed by the target object within the future time period specified in the behavior volume prediction request.
[0039] It should be noted that there is no specific limitation on the method of receiving behavior prediction requests, and the method can be customized according to the actual application and scenario.
[0040] S104, in response to the behavior amount prediction request, obtaining an initial behavior sequence, wherein the initial behavior sequence includes a plurality of predetermined behavior amounts arranged in chronological order, and the predetermined behavior amount is a behavior amount generated by the target object performing the predetermined behavior within a historical time period;
[0041] In step S104 provided in the present application, a behavior quantity prediction request is responded to, and an initial behavior sequence is obtained.
[0042] Among them, it involves obtaining an initial behavior sequence, which is a time series for representing a series of behavior quantities of a target object performing a predetermined behavior within a historical time period extracted from historical data. In the initial behavior sequence, the predetermined behavior quantities performed by the target object are arranged in chronological order.
[0043] The predetermined behavior volume is used to represent the behavior volume generated by the target object performing the predetermined behavior, for example, the business volume generated by the business behavior in the shopping scene.
[0044] Among them, the historical time period is involved, which is a pre-selected specific time range for analyzing and predicting the amount of predetermined behavior in the future time period. For example, the past few days, the past month, the past year, etc., define the selected historical time boundary.
[0045] After responding to the behavior volume prediction request, the initial behavior sequence is obtained, wherein the initial behavior sequence includes multiple predetermined behavior volumes arranged in chronological order, providing an important data basis and analysis basis for subsequent behavior volume prediction. By analyzing the initial behavior sequence, the trend, fluctuation, and periodic changes of the behavior volume of the target object performing the predetermined behavior in the historical time period can be identified, which helps to accurately predict the behavior volume of the target object performing the predetermined behavior in the future time period.
[0046] It should be noted that the method for obtaining the initial behavior sequence in response to the behavior quantity prediction request is not specifically limited here, and can be customized according to the actual application and scenario.
[0047] S106, determining a behavior feature corresponding to the initial behavior sequence and an interference feature that interferes with the predetermined behavior;
[0048] In step S106 provided in the present application, behavior features corresponding to the initial behavior sequence and interference features that interfere with the predetermined behavior are determined.
[0049] Among them, behavioral features are involved, which are features extracted from the initial behavior sequence and can reflect the state or behavior pattern of the target object when performing the predetermined behavior. The behavioral features can be statistical attributes in the initial behavior sequence, such as mean, variance, autocorrelation, etc., or more advanced representations that reflect the behavior, such as patterns, trends, and periodicity. For example, the peak of business volume in a shopping scene in a specific time period.
[0050] Among them, interference features are involved, which are specific types of interference or noise added to enhance the generalization ability of predictions to simulate unpredictable events or uncertainties in reality. Interference features can be randomly generated noise, outliers, or pattern changes, in order to be more robust when processing real data and better able to cope with unseen situations.
[0051] By determining the behavioral features corresponding to the initial behavior sequence and the interference features that interfere with the predetermined behavior, we can more comprehensively understand the predetermined behavioral features in the initial behavior sequence and deal with disturbances. Especially when dealing with long sequences and time series prediction tasks with complex periodicity, the introduction of interference features can not only ensure stable operation and make reasonable predictions in the face of noise and outliers during the prediction process, but also prevent over-reliance on historical data, thereby reducing the risk of overfitting and improving the accuracy of the prediction.
[0052] It should be noted that there is no specific limitation on the method of determining the behavior features corresponding to the initial behavior sequence and the interference features for interfering with the predetermined behavior, and the settings can be customized according to the actual application and scenario.
[0053] S108, determining a prefix behavior sequence according to the behavior characteristics and the interference characteristics;
[0054] In step S108 provided in the present application, a prefix behavior sequence is determined.
[0055] Among them, a prefix behavior sequence is involved, and the prefix behavior sequence is a sequence determined according to the behavior characteristics and the interference characteristics, and is added to the front end of the initial behavior sequence.
[0056] By encoding the behavior features into the prefix behavior sequence, prior information about the initial behavior sequence can be provided, so that the sequence data can be understood more quickly and accurately. Interference features are used to generate prefix sequences to simulate noise and abnormal events in the real world, especially when processing long sequence data, to increase the predictive ability when facing unseen or perturbed data.
[0057] S110, connecting the prefix behavior sequence to the front end of the initial behavior sequence to obtain the target behavior sequence;
[0058] In step S110 provided in the present application, a target behavior sequence is obtained.
[0059] Among them, a target behavior sequence is involved, and the target behavior sequence is a sequence obtained by merging the prefix behavior sequence and the initial behavior sequence.
[0060] By fusing the prefix behavior sequence with the initial behavior sequence, the target behavior sequence is constructed, which integrates historical data and possible future interference, helping to improve the accuracy of predictions, especially when dealing with long sequence data with complex periodicity and trends. By including interference features in the target sequence, it is possible to learn how to adapt to and deal with these uncertainties, thereby improving the accuracy of predictions.
[0061] S112, determining a predicted behavior sequence based on the target behavior sequence and the future time period, wherein the predicted behavior sequence includes a plurality of predicted behavior quantities arranged in chronological order, and the predicted behavior quantity is the behavior quantity predicted to be generated by the target object performing a predetermined behavior in the future time period.
[0062] In step S112 provided in the present application, a predicted behavior sequence is determined.
[0063] Among them, a predicted behavior sequence is involved, which is determined based on the target behavior sequence and the future time period, and reflects the sequence of predicted values of the behavior amount of the target behavior executing the predetermined behavior in the future time period.
[0064] Among them, the predicted behavior quantity is involved. The predicted behavior quantity is a single data point in the predicted behavior sequence, which is used to represent the predicted value of the behavior quantity of the target behavior executing the predetermined behavior at a certain time point in the future time period.
[0065] Using the target behavior sequence as input, we can take advantage of the trends and periodic patterns in historical data, as well as the interference features provided in the prefix behavior sequence, to more accurately capture the potential laws of long-sequence data, and improve the robustness of the prediction results in the face of uncertainty. By generating a prediction behavior sequence based on the target behavior sequence and combining it with the setting of future time periods, we can achieve the goal of being able to operate stably and make reasonable predictions in the face of noise and outliers during the prediction process, and achieve the technical effect of preventing over-reliance on historical data, reducing the risk of overfitting, and thus improving the accuracy of the prediction.
[0066] Through the above steps S102-S112, a behavior quantity prediction request is received, wherein the behavior quantity prediction request is used to predict the behavior quantity of the target object performing the predetermined behavior in a future time period, and the behavior quantity prediction request carries the future time period; in response to the behavior quantity prediction request, an initial behavior sequence is obtained, wherein the initial behavior sequence includes a plurality of predetermined behavior quantities arranged in chronological order, and the predetermined behavior quantity is the behavior quantity generated by the target object performing the predetermined behavior in the historical time period; the behavior features corresponding to the initial behavior sequence and the interference features that interfere with the predetermined behavior are determined; based on the behavior features and the interference features, a prefix behavior sequence is determined; the prefix behavior sequence is connected to the front end of the initial behavior sequence to obtain a target behavior sequence; based on the target behavior sequence and the future time period, a predicted behavior sequence is determined, wherein the predicted behavior sequence includes a plurality of predicted behavior quantities arranged in chronological order, and the predicted behavior quantity is the predicted behavior quantity generated by the target object performing the predetermined behavior in the future time period. In this embodiment, a prefix behavior sequence is constructed by combining the behavior features corresponding to the initial behavior sequence with the interference features, and the prefix behavior sequence is connected to the front end of the initial behavior sequence to form a new input sequence, namely the target behavior sequence, which integrates historical data and possible future interference. This enables the system to better cope with changes in data distribution and maintain a high level of prediction accuracy when processing long sequence data with complex periodicity and trends, even in the face of uncertainty or external interference, and still be able to operate stably and make reasonable predictions, thereby achieving the technical effect of preventing over-reliance on historical data, reducing the risk of overfitting, and thereby improving the accuracy of predictions, thereby solving the technical problem of inaccurate predictions when making predictions of predetermined behavior quantities.
[0067] As an optional embodiment, a predicted behavior sequence is determined based on a target behavior sequence and a future time period, including: obtaining a first subsequence and a second subsequence based on the target behavior sequence, wherein the first subsequence represents a sequence of stability index trends corresponding to a predetermined behavior quantity within a historical time period, and the second subsequence represents a sequence of volatility index trends corresponding to a predetermined behavior quantity within a historical time period; determining the predicted behavior sequence based on the first subsequence, the second subsequence and the future time period.
[0068] In this embodiment, specific steps of determining a predicted behavior sequence based on a target behavior sequence and a future time period are described.
[0069] Among them, the first subsequence is involved, which is a sequence obtained by splitting the target behavior sequence and is used to reflect the stability index trend of the predetermined behavior amount in the historical time period. For example, the first subsequence can reflect the long-term growth or decline trend of the predetermined behavior amount in the historical time period.
[0070] Among them, the second subsequence is involved, which is obtained by splitting the target behavior sequence and is used to reflect the volatility index trend of the predetermined behavior amount in the historical time period. For example, the trend of periodic fluctuations of the predetermined behavior amount in the historical time period can be reflected by the second subsequence.
[0071] Among them, the stability index trend is involved, and the stability index trend is used to reflect the long-term trend of the predetermined behavior amount in the target behavior sequence in the historical time period, such as an increasing trend, a decreasing trend, a stable trend, etc.
[0072] Among them, the volatility index trend is involved, which is used to reflect the periodic changes of the predetermined behavior quantity in the target behavior sequence within the historical time period, such as the change amplitude, change frequency, periodic fluctuation intensity, etc.
[0073] In the steps involved in this embodiment, the target behavior sequence is analyzed and split into two subsequences: a first subsequence and a second subsequence. The first subsequence mainly reflects the stability index trend of the predetermined behavior amount in the historical time period, which is long-term and stable, such as continuous growth or decline. The second subsequence reflects the volatility index trend of the predetermined behavior amount in the historical time period, which is short-term and fluctuating, such as periodic ups and downs. By combining the information in the first subsequence and the second subsequence, as well as the future time period, the performance of the predetermined behavior amount in the future time period is predicted, thereby obtaining a predicted behavior sequence.
[0074] By splitting the target behavior sequence into two subsequences containing stability trends and volatility trends, the prediction process is refined, and the historical characteristics of the predetermined behavior volume can be more comprehensively understood, solving the limitations of a single prediction method in dealing with complex sequences. In addition, by decomposing the target behavior sequence, the stability trend and volatility trend of the sequence can be analyzed in a targeted manner, so that when predicting the behavior volume in the future time period, it can better adapt to the complex structure that may exist in the historical data, help to deal with the uncertainty and cyclical changes in the future, improve the reliability of the prediction results, and thus achieve a more comprehensive and accurate prediction.
[0075] As an optional embodiment, before obtaining the first subsequence and the second subsequence based on the target behavior sequence, it also includes: when the target behavior sequence includes a first number of predetermined behavior quantities, setting a sliding window parameter of the sliding window, wherein the sliding window parameter includes a sliding window length and a sliding step, wherein the length of the sliding window length is the length covering the second number of behavior quantities, and the sliding step represents the number of behavior quantities moved by the sliding window, and the second number is less than the first number; determining a plurality of corresponding covering behavior sequences in the target behavior sequence based on the target behavior sequence and the sliding window set with the sliding window parameter; determining the average values corresponding to the plurality of covering behavior sequences respectively; and determining the first subsequence based on the average values corresponding to the plurality of covering behavior sequences respectively.
[0076] In this embodiment, the specific steps before obtaining the first subsequence and the second subsequence according to the target behavior sequence are described.
[0077] Therein, a first number is involved, and the first number is used to represent the number of data points in a historical time period corresponding to a predetermined behavior amount included in the target behavior sequence.
[0078] This involves a sliding window, which is a set time window for analyzing and processing a target behavior sequence.
[0079] Among them, the sliding window parameters are involved, which are parameters used to reflect how the sliding window slides and the covering effect of the sliding window, including the sliding window length and the sliding step size.
[0080] Among them, the sliding window length is involved, which is used to indicate the number of data points in the historical time period corresponding to the predetermined amount of behavior in the target behavior sequence that the sliding window can cover. For example, the sliding window parameter can be set to 7 days, which means that the sliding window can cover the predetermined amount of behavior in the target behavior sequence for 7 days.
[0081] Among them, the sliding step size is involved, which is used to indicate the distance that the sliding window moves each time it slides, that is, the number of data points in the historical time period corresponding to the predetermined behavior amount in the target behavior sequence. For example, when the sliding step size is 1 day, it means that the sliding window moves 1 day each time.
[0082] Among them, a second number is involved, which is the number of data points in the historical time period corresponding to the predetermined behavior amount in the target behavior sequence that can be covered by the sliding window length, and the second number is smaller than the first number.
[0083] Among them, a covering behavior sequence is involved, and the covering behavior sequence is a sequence composed of the amount of behavior covered by each sliding when a sliding window with set sliding window parameters slides in the target behavior sequence.
[0084] In the steps involved in this embodiment, a sliding window is set, and sliding window parameters are specified for it, including a sliding window length and a sliding step length, and the sliding window length, that is, the second number is less than the first number. The sliding window with the set sliding window parameters is used to slide on the target behavior sequence. Each time the window slides, it covers a continuous amount of behavior to form a covered behavior sequence. By continuously sliding the window, multiple covered behavior sequences are obtained. And based on the multiple covered behavior sequences, the average value of each covered behavior sequence is determined, and then the first subsequence is determined based on the average value.
[0085] By using a sliding window with set sliding window parameters to slide on the target behavior sequence, multiple such covering behavior sequences are obtained, which effectively avoids the time-consuming and inefficient problem of directly processing these data when the target behavior sequence contains a large amount of data, reduces the complexity of single processing, and effectively improves the accuracy and efficiency of the analysis. The length and step size of the sliding window can be adjusted according to specific application scenarios and requirements, thereby providing great flexibility, which helps to adapt to different data processing and analysis requirements. By determining the average value of each covering behavior sequence, it is easier to identify the key features or trends in the target behavior sequence, and determine the first subsequence based on these average values, achieving efficient and accurate data analysis and feature extraction.
[0086] As an optional embodiment, based on the target behavior sequence and a sliding window set with sliding window parameters, multiple corresponding covering behavior sequences in the target behavior sequence are determined, including: aligning the first position of the sliding window with the first behavior quantity position in the target behavior sequence to obtain a first covering behavior sequence, wherein the first covering behavior sequence includes multiple covering behavior quantities, and the multiple covering behavior quantities are the behavior quantities covered by the sliding window length corresponding to the sliding window; moving the sliding window according to the sliding step size to obtain a second covering behavior sequence, until the tail position of the sliding window is aligned with the tail behavior quantity position in the target behavior sequence to obtain multiple covering behavior sequences.
[0087] In this embodiment, specific steps of determining a plurality of corresponding covering behavior sequences in the target behavior sequence according to the target behavior sequence and a sliding window with sliding window parameters are described.
[0088] Among them, the first position is involved, and the first position is where the first predetermined behavior amount in the target behavior sequence is located, and is used as the starting point position for the sliding window to slide on the target behavior sequence.
[0089] Among them, a first covering behavior sequence is involved, which is a sequence composed of predetermined behavior quantities in the target behavior sequence covered by the sliding window after the first position of the sliding window is aligned with the first behavior quantity position in the target behavior sequence.
[0090] Among them, a second covering behavior sequence is involved, and the second covering behavior sequence is a sequence composed of new predetermined behavior quantities covered after the sliding window is moved once according to the sliding step after the first covering behavior sequence is obtained.
[0091] Among them, the tail position is involved, and the tail position is the position of the predetermined behavior amount at the tail end covered by the sliding window, which can be the last position.
[0092] Among them, the tail behavior quantity is involved. The tail behavior quantity is located in the target behavior sequence. After the sliding window has slid for multiple times, the number of data points of the remaining predetermined behavior quantity in the target behavior sequence is less than the length of the sliding window, causing the sliding window to be unable to continue sliding. The last behavior quantity covered at the tail position of the sliding window.
[0093] In the steps involved in this embodiment, the first position of the sliding window is aligned with the position of the first behavior amount in the target behavior sequence, and the sliding window covers a continuous behavior amount at the beginning of the target behavior sequence, forming the first covered behavior sequence. Next, the sliding window is moved according to the preset sliding step size. After moving once, the sliding window will again cover a continuous behavior amount of the target behavior sequence, forming a second covered behavior sequence. Repeat the above steps, and each time the sliding window moves, it will cover a new continuous behavior amount to form a new covered behavior sequence, until the tail position of the sliding window is aligned with the tail behavior amount in the target behavior sequence, and the sliding window is no longer moved. In this process, multiple covered behavior sequences are obtained.
[0094] By applying a sliding window on the target behavior sequence and moving the sliding window according to a preset sliding step length to generate multiple covering behavior sequences, a step-by-step analysis of the target behavior sequence is achieved. And by setting a sliding window with sliding window parameters, a smaller subsequence can be focused on each time, which reduces the complexity of data processing, improves the accuracy and efficiency of analysis, and helps to more accurately extract useful information and features from the target behavior sequence, thereby helping to accurately split the first subsequence from the target behavior sequence to reflect the stability index trend of the predetermined behavior quantity in the historical time period.
[0095] As an optional embodiment, the sliding window is moved according to the sliding step to obtain a second covering behavior sequence until the tail position of the sliding window is aligned with the tail behavior quantity position in the target behavior sequence to obtain multiple covering behavior sequences, including: determining whether the tail behavior quantity position is the position result of the last behavior quantity position in the target behavior sequence; when the position result is not the last behavior quantity, determining the filling behavior quantity; filling the target behavior sequence according to the filling behavior quantity to obtain an updated behavior sequence; moving the sliding window according to the sliding step to align the tail position of the sliding window with the last behavior quantity position in the update behavior sequence to obtain multiple covering behavior sequences.
[0096] In this embodiment, specific steps for obtaining multiple coverage behavior sequences are described.
[0097] Among them, the tail behavior quantity position is involved, and the tail behavior quantity position is the position of the tail behavior quantity in the target behavior sequence.
[0098] Among them, the last behavior quantity is involved, and the last behavior quantity is the last behavior quantity in the target behavior sequence.
[0099] Among them, the position result is involved, and the position result is used to indicate whether the position of the last behavior quantity is the result of the last behavior quantity position in the target behavior sequence.
[0100] Among them, the filling behavior amount is involved. The filling behavior amount is the behavior amount that needs to be additionally filled into the target behavior sequence when the position result is not the last behavior amount. The filling behavior amount is added to the end of the target behavior sequence to ensure that the tail behavior amount position is the last behavior amount position in the target behavior sequence.
[0101] Among them, an updated behavior sequence is involved, and the updated behavior sequence is a new behavior sequence formed by filling in the filling behavior quantity after the first behavior quantity position of the target behavior sequence.
[0102] In the steps involved in this embodiment, a sliding window is applied to the target behavior sequence, and the sliding window is moved according to a preset sliding step length. After each movement, it is determined whether the tail behavior amount position of the current sliding window is exactly aligned with the last behavior amount in the target behavior sequence. If the tail behavior amount position of the sliding window is not the last behavior amount position in the target behavior sequence, a padding behavior amount is determined, and the target behavior sequence is padded with the determined padding behavior amount to extend the length of the target behavior sequence to obtain an updated behavior sequence. Then, the sliding window is moved according to a preset sliding step length until the tail behavior amount position of the sliding window is aligned with the last behavior amount position in the target behavior sequence, thereby generating multiple covered behavior sequences.
[0103] After each sliding window movement, it is determined whether the position of the tail behavior quantity of the current sliding window is exactly aligned with the position result of the last behavior quantity in the target behavior sequence, so that when the target behavior sequence is analyzed and processed in time, whether the tail behavior quantity is located at the last one of the sliding window to end the moving sliding window. When the position result is not the last one of the behavior quantity, the filling behavior quantity is determined, and the target behavior sequence is filled with the determined filling behavior quantity to extend the length of the target behavior sequence to obtain the updated behavior sequence, thereby ensuring that the sliding window can completely cover the end of the updated behavior sequence, achieving effective alignment of data, ensuring the integrity of the target behavior sequence for analysis, and avoiding processing errors caused by missing data, thereby helping to improve the accuracy of subsequent predictions and effectively solving the technical problem of inaccurate predictions when predicting predetermined behavior quantities, especially predictions involving long time periods.
[0104] As an optional embodiment, when the position result is not the last behavior quantity, the filling behavior quantity is determined, including: when the position result is not the last behavior quantity, determining the last rank; when the last rank is greater than a predetermined threshold, determining the filling behavior quantity.
[0105] In this embodiment, specific steps for determining the filling behavior amount when the position result is not the last-last behavior amount are described.
[0106] Among them, the reciprocal position is involved, which is the position of the last behavior quantity position to the last behavior quantity position in the target behavior sequence after the last position of the sliding window is aligned with the last behavior quantity position in the target behavior sequence. For example, if the last behavior quantity corresponds to the second to last behavior quantity in the target behavior sequence, then the reciprocal position of the last behavior quantity is 2.
[0107] Among them, a predetermined threshold is involved, which is pre-set to reflect the degree of influence of the amount of behavior after the last position on the target behavior sequence analysis. For example, at the last position, if the amount of behavior of the subsequent target behavior sequence has little influence on the analysis (less than the predetermined threshold), the amount of behavior of the subsequent position can be ignored, and there is no need to add additional filler behavior.
[0108] In the steps involved in this embodiment, when the position result is not the last behavior amount, that is, when the position of the last behavior amount in the target behavior sequence is not the last, then the last position in the target behavior sequence corresponding to the current last behavior amount position is determined, and it is judged whether the last position exceeds a predetermined threshold. If it exceeds the predetermined threshold, then the filling behavior amount that needs to be added to the end of the target behavior sequence is further determined.
[0109] When the position result is not the last behavior quantity, by determining the last position, the gap between the last behavior quantity position and the last behavior quantity position in the target behavior sequence can be analyzed, so as to quantitatively evaluate the degree of integrity of the analyzed target behavior sequence. And judging whether the behavior quantity needs to be filled based on the predetermined threshold value can ensure the integrity of the analyzed target behavior sequence, avoid the analysis deviation caused by missing data, and by reasonably setting the predetermined threshold value, it can more accurately judge which positions of the behavior quantity have an important impact on the analysis, so as to avoid unnecessary filling and reduce the interference of noise data on the analysis results, that is, when the influence of the behavior quantity in the target behavior sequence corresponding to the last position on the entire analysis is very small, no subsequent filling steps are required, so as to reduce unnecessary calculation and analysis costs while ensuring the accuracy of the analysis.
[0110] As an optional embodiment, a predicted behavior sequence is determined based on a first subsequence, a second subsequence and a future time period, including: determining a first feature corresponding to the first subsequence based on the first subsequence, wherein the first feature is a feature representing the stability of a predetermined behavior amount; determining a second feature corresponding to the second subsequence based on the second subsequence, wherein the second feature is a feature representing the volatility of a predetermined behavior amount; determining a first predicted subsequence based on the first feature and a future time period; determining a second predicted subsequence based on the second feature and a future time period; and determining a predicted behavior sequence based on the first predicted subsequence and the second predicted subsequence.
[0111] In this embodiment, specific steps of determining a predicted behavior sequence based on the first subsequence, the second subsequence and the future time period are described.
[0112] Among them, the first feature is involved, which is extracted from the first subsequence and is used to reflect the stability of the target behavior sequence, such as stable growth, stable decline, etc.
[0113] Among them, the second feature is involved, which is extracted from the second subsequence and is used to reflect the characteristics of volatility in the target behavior sequence, such as periodic changes, periodic fluctuation amplitude, etc.
[0114] Among them, a first prediction subsequence is involved, which is a prediction sequence obtained based on the first feature and is used to reflect the stability of the target behavior sequence in a future time period.
[0115] Among them, a second prediction subsequence is involved, which is a prediction sequence obtained based on the second feature and is used to reflect the volatility of the target behavior sequence in a future time period.
[0116] In the steps involved in this embodiment, after extracting the first feature that can reflect the stability of the target behavior sequence from the first subsequence and extracting the second feature that can reflect the volatility of the target behavior sequence from the second subsequence, a first prediction subsequence that reflects the stability of the target behavior sequence in the future time period is generated based on the first feature and the future time period, and a second prediction subsequence that reflects the volatility of the target behavior sequence in the future time period is generated based on the second feature and the future time period, and the predicted behavior sequence of the future time period is determined by combining the first prediction subsequence and the second prediction subsequence.
[0117] By extracting the corresponding first feature and second feature from the first subsequence and the second subsequence respectively, the stability and volatility information in the target behavior sequence can be captured, wherein the first feature can reflect the stability features in the target behavior sequence, such as stable growth, stable decline, etc., which is an important basis for predicting the change trend of the target behavior sequence in the future time period, and the second feature reflects the volatility features in the target behavior sequence, such as periodic changes, periodic fluctuation amplitude, etc., which is the key to capturing short-term fluctuations and periodic changes in the target behavior sequence. The first prediction subsequence and the second prediction subsequence are generated according to the first feature and the second feature, respectively, providing long-term predictions of future behavior trends and short-term and periodic predictions of future behavior trends, and improving the credibility of subsequent prediction results. By combining the first prediction subsequence and the second prediction subsequence, a more comprehensive prediction behavior sequence is obtained, which realizes the comprehensive consideration of the stability characteristics and volatility characteristics of the target behavior sequence, thereby being able to more comprehensively reflect the changes in the target behavior sequence, avoiding the deviation that may be caused by prediction based on only a single feature, and improving the comprehensiveness of the prediction, so that the prediction result is closer to the changing trend of the behavior volume in the future time period, and effectively solves the technical problem of inaccurate prediction when predicting the predetermined behavior volume, especially involving predictions over a long period of time.
[0118] Based on the above embodiments and optional embodiments, an optional implementation is provided, which is described in detail below.
[0119] In related technologies, when predicting predetermined behavior volume, such as business volume in a shopping scenario, autoregressive integral moving average models, recurrent neural network models, time convolutional networks, etc. are used for prediction. However, when predicting predetermined behavior volume, there is a technical problem of inaccurate prediction.
[0120] To address the above-mentioned problems, no effective solution has been proposed yet.
[0121] In view of this, an optional implementation of the present invention provides a behavior quantity prediction method, which can also be called a long sequence prediction method, which can effectively solve the technical problem of inaccurate prediction when predicting a predetermined behavior quantity.
[0122] Figure 2 is a flowchart of a long sequence prediction method in an optional embodiment of the present invention, Figure 3 is an architectural diagram of long sequence prediction prefix reprogramming in an optional embodiment of the present invention, such as Figure 2 ,as well as Figure 3 As shown, the optional implementation methods of the present application are described in detail below.
[0123] S1. Receive a behavior amount prediction request, wherein the behavior amount prediction request is used to predict the behavior amount of a target object performing a predetermined behavior in a future time period, and the behavior amount prediction request carries the future time period;
[0124] S2. In response to the behavior amount prediction request, an initial behavior sequence is obtained, wherein the initial behavior sequence includes a plurality of predetermined behavior amounts arranged in chronological order, and the predetermined behavior amount is a behavior amount generated by the target object performing the predetermined behavior within a historical time period;
[0125] For example, a time series (same as the initial behavior sequence) X = {x1, x2, ..., x t} as t observations x t (same as the above-mentioned predetermined behavior quantity) sequence, the t-th observation x t =R D , where R D represents the characteristics of group D, that is Do univariate and multivariate forecasting based on D, the goal is to do time series forecasting. Given a time series X, the goal is to minimize the mean squared error and the mean absolute error between the predicted results and the true results.
[0126] S3, determining the behavior features corresponding to the initial behavior sequence, and the interference features that interfere with the predetermined behavior;
[0127] S4, determining a prefix behavior sequence based on the behavior characteristics and the interference characteristics;
[0128] S5, connecting the prefix behavior sequence to the front end of the initial behavior sequence to obtain the target behavior sequence;
[0129] For example, prefix (same as the prefix behavior sequence above) reprogramming is performed. First, the embedding of the generated prefix reprogramming is passed through a certain amount of Gaussian noise (same as the interference feature above), and then the embedding is connected to the top of the sequence (same as the front end of the initial behavior sequence above) and the resulting input sequence (same as the target behavior sequence above) is provided to the model. Using Fourier transform can provide a domain perspective on frequency time series prediction, which may lead to overfitting of historical data and poor prediction signals for the future. Therefore, prefix reprogramming is used to avoid overfitting to obtain better performance.
[0130] P e =(n1,n2,...n m )
[0131] n i ~N(0,σ 2 )
[0132] X prefix =Concat(P e ,X)
[0133] Among them, P e Indicates a sequence of prefix behaviors, n i represents the i-th specific value in the prefix behavior sequence. m is the length of the prefix behavior sequence, σ 2 is the Gaussian noise variance, X prefix is the target behavior sequence, and X is the initial behavior sequence.
[0134] S6. Determine a predicted behavior sequence based on the target behavior sequence and the future time period, wherein the predicted behavior sequence includes a plurality of predicted behavior quantities arranged in chronological order, and the predicted behavior quantity is the behavior quantity predicted to be generated by the target object performing a predetermined behavior in the future time period.
[0135] Specifically, S6 also includes:
[0136] S61, when the target behavior sequence includes a first number of predetermined behavior quantities, setting a sliding window parameter of the sliding window, wherein the sliding window parameter includes a sliding window length and a sliding step length, wherein the length of the sliding window length is a length covering a second number of behavior quantities, and the sliding step length indicates the number of behavior quantities that the sliding window moves, and the second number is less than the first number;
[0137] S62, determining a plurality of corresponding covering behavior sequences in the target behavior sequence according to the target behavior sequence and a sliding window set with sliding window parameters;
[0138] Specifically, S62 also includes:
[0139] S621, aligning the first position of the sliding window with the first position of the behavior amount in the target behavior sequence to obtain a first covering behavior sequence, wherein the first covering behavior sequence includes a plurality of covering behavior amounts, and the plurality of covering behavior amounts are behavior amounts covered by the sliding window length corresponding to the sliding window;
[0140] S622. Move the sliding window according to the sliding step length to obtain a second covering behavior sequence, until the tail position of the sliding window is aligned with the tail behavior position in the target behavior sequence, to obtain multiple covering behavior sequences.
[0141] Specifically, S622 also includes:
[0142] S6221, determining whether the last behavior quantity position is the position result of the last behavior quantity position in the target behavior sequence;
[0143] S6222: if the position result is not the last behavior amount, determine the filling behavior amount;
[0144] S6223, filling the target behavior sequence according to the filling behavior amount to obtain an updated behavior sequence;
[0145] S6224. Move the sliding window according to the sliding step length so that the tail position of the sliding window is aligned with the position of the last behavior quantity in the update behavior sequence, thereby obtaining multiple coverage behavior sequences.
[0146] Specifically, S6224 also includes: when the position result is not the last behavior quantity, determining the last position; when the last position is greater than a predetermined threshold, determining the filling behavior quantity.
[0147] S63, determining average values corresponding to a plurality of covering behavior sequences respectively;
[0148] S64: Determine a first subsequence according to average values corresponding to a plurality of covering behavior sequences.
[0149] S65. According to the target behavior sequence, a first subsequence and a second subsequence are obtained, wherein the first subsequence represents a sequence showing a stability index trend corresponding to a predetermined behavior amount in a historical time period, and the second subsequence represents a sequence showing a volatility index trend corresponding to a predetermined behavior amount in a historical time period;
[0150] For example, the time series (same as the target behavior sequence) is decomposed into a trend cycle part (same as the first subsequence) and a seasonal part (same as the second subsequence). Among them, several different sliding average windows (same as the sliding window) are used to obtain the trend cycle part and the residual is used to represent the seasonal part. The formula is as follows:
[0151] X t =Mean(AvgPools(Padding(X prefix )))
[0152] X s =X prefix -X t
[0153] Among them, X t represents the first subsequence, X s Represents the second subsequence, AvgPools() represents the average pooling operation, and Padding() represents the padding operation.
[0154] S66. Determine a predicted behavior sequence based on the first subsequence, the second subsequence, and the future time period.
[0155] Specifically, S66 also includes:
[0156] S661, determining a first feature corresponding to the first subsequence according to the first subsequence, wherein the first feature is a feature representing stability of a predetermined behavior amount;
[0157] S662: Determine, based on the second subsequence, a second feature corresponding to the second subsequence, wherein the second feature is a feature representing volatility of a predetermined behavior amount;
[0158] S663, determining a first prediction subsequence according to the first feature and the future time period;
[0159] S664, determining a second prediction subsequence based on the second feature and the future time period;
[0160] S665. Determine a predicted behavior sequence according to the first predicted subsequence and the second predicted subsequence.
[0161] For example, the frequency domain information of the sequence itself is calculated through the FFT-attention mechanism to discover period-based dependencies and convert the sequence from the time domain to the frequency domain.
[0162]
[0163] Among them, A k is the value in the frequency domain information obtained after FFT-attention mechanism processing, ∈ represents the threshold, which is used to remove low-frequency values.
[0164] Q = FFT(W Q )
[0165] K = FFT(W K )
[0166] Where FFT stands for improved fast Fourier transform, Q represents the query vector or matrix, and W Q represents the weight matrix of the query vector or matrix. K represents the key vector or matrix, W K A weight matrix representing a key vector or matrix.
[0167] Score(Q,K)=Softmax(IFFT(Q)×Conj(K))
[0168] Among them, Score(Q,K) represents the attention score between the query (Q) and the key (K), Softmax() represents the normalization processing through the Softmax function, IFFT(Q) represents the inverse fast Fourier transform of the query (Q), and Conj(K) represents the conjugate of the key (K).
[0169] W topk ,I topk=Topk(mean(Score(Q,K),dim))
[0170] Attention=Sum(W topk ×Roll(V,I topk ),dim)
[0171] Among them, W topk It represents the weight corresponding to the average value of the first k (i.e., topk), I topk represents the position index of the top k weights, Topk() represents selecting the top k highest scores and their corresponding indexes from the sorted scores, dim represents the dimension of the operation, Attention represents the output of the attention mechanism, Roll(V,I topk ) represents the sliding window V, according to I topk Index for scrolling operations.
[0172] The encoder is represented as a multi-layer structure:
[0173]
[0174] in, It represents the target behavior sequence of the lth layer in the encoder, and N represents that the encoder (or decoder) has N layers.
[0175] The details are as follows:
[0176]
[0177]
[0178] in, They represent the seasonal components after the i-th decomposition block in the l-th layer.
[0179] The decoder also uses a multi-layer structure:
[0180]
[0181] Represents the output of the lth decoder layer. The details are as follows:
[0182]
[0183]
[0184]
[0185] in, represents the seasonal component after the i-th decomposition block in the l-th layer, represents the seasonal part after the decomposition block in the lth, represents the components of the trend part after the i-th decomposition block in the l-th layer, W l,i represents the i-th The weight of . Represents the trend part obtained by splitting the target behavior sequence.
[0186] For example, we need to predict the business volume for the next month based on the business volume of each day in the shopping scenario in the past two years. The steps are as follows:
[0187] S1. Dataset source preparation: collect the business volume (same as the above-mentioned predetermined behavior volume) for each day from January 1, 2022 to December 31, 2023 (for example, voice records, conversation records, etc.), and divide them into training set, validation set and test set in a 6:2:2 ratio in chronological order;
[0188] S2. Data cleaning, eliminating abnormal data and ensuring data accuracy;
[0189] S3, generate the prefix reprogrammed embedding through a certain amount of Gaussian noise (same as the prefix behavior sequence above), then concatenate the embedding on top of the input data (same as the target behavior sequence above) and feed it to the model;
[0190] S4. Prepare the model encoder and decoder, use the FFT attention mechanism to aggregate information, and introduce the prefix reprogramming mechanism to improve performance and result accuracy;
[0191] S5. Build model & train. The model training uses Adam optimizer, the batch size is 256, the learning rate is set to 1e-4, the length ratio is set to 10%, the variance is 0.03, and the ∈ threshold is 0.1.
[0192] S6. Output the prediction results.
[0193] Through the above optional implementation, at least the following beneficial effects can be achieved:
[0194] (1) Compared with the related art, the present invention provides a basis for training and prediction of the model by obtaining the initial behavior sequence. By combining the behavior features corresponding to the initial behavior sequence with the interference features, a prefix behavior sequence is constructed, and the prefix behavior sequence is connected to the front end of the initial behavior sequence to form a new input sequence, namely the target behavior sequence, which integrates historical data and possible future interference, and provides a more comprehensive input for the model, especially when processing long sequence data with complex periodicity and trends, so that the model can better cope with changes in data distribution and maintain a high prediction accuracy even in the face of uncertainty or external interference. Then, according to the target behavior sequence and the future time period, the predicted behavior sequence is determined, and the purpose of being able to operate stably and make reasonable predictions in the face of noise and outliers in the prediction process is achieved, and the technical effect of preventing excessive reliance on historical data, reducing the risk of overfitting, and thus improving the accuracy of the prediction is achieved, thereby effectively solving the technical problem of inaccurate prediction when predicting a predetermined amount of behavior, especially when predicting a long time period.
[0195] (2) Compared with the related art, the target behavior sequence constructed by the present invention is constructed by fusing the prefix behavior sequence with the initial behavior sequence, which integrates historical data and possible future interference, provides a more comprehensive input for the model, and helps to improve the accuracy of prediction, especially when processing long sequence data with complex periodicity and trends. By including interference features in the target sequence, the model can learn how to adapt to and deal with these uncertainties during the training process, so that it has better generalization ability when facing unknown or abnormal situations.
[0196] (3) Compared with the related art, the present invention uses a sliding window with set sliding window parameters to slide on the target behavior sequence to obtain multiple such covering behavior sequences, which effectively avoids the problem of time-consuming and inefficient direct processing of the data when the target behavior sequence contains a large amount of data, reduces the complexity of single processing, and effectively improves the accuracy and efficiency of the analysis. The length and step size of the sliding window can be adjusted according to the specific application scenario and requirements, thereby providing great flexibility, which helps to adapt to different data processing and analysis requirements. By determining the average value of each covering behavior sequence, it is easier to identify the key features or trends in the target behavior sequence, and determine the first subsequence based on these average values, thereby achieving efficient and accurate data analysis and feature extraction.
[0197] (4) Compared with the related art, when the position result is not the last behavior quantity, the present invention can analyze the gap between the last behavior quantity position and the last behavior quantity position in the target behavior sequence by determining the last position, so as to quantitatively evaluate the degree of integrity of the analyzed target behavior sequence. And judging whether the behavior quantity needs to be filled based on the predetermined threshold value can ensure the integrity of the analyzed target behavior sequence and avoid the analysis deviation caused by missing data. At the same time, by reasonably setting the predetermined threshold value, it can more accurately judge which positions of the behavior quantity have an important influence on the analysis, thereby avoiding unnecessary filling and reducing the interference of noise data on the analysis results. That is, when the influence of the behavior quantity in the target behavior sequence corresponding to the last position on the entire analysis is very small, there is no need for subsequent filling steps, thereby ensuring the accuracy of the analysis while reducing unnecessary calculation and analysis costs.
[0198] (5) By extracting the corresponding first feature and second feature from the first subsequence and the second subsequence, the stability and volatility information in the target behavior sequence can be captured. The first prediction subsequence and the second prediction subsequence are generated according to the first feature and the second feature, respectively, providing long-term prediction of future behavior trends and short-term and periodic prediction of future behavior trends, thereby improving the credibility of subsequent prediction results. By combining the first prediction subsequence and the second prediction subsequence, a more comprehensive prediction behavior sequence is obtained, which realizes the comprehensive consideration of the stability characteristics and volatility characteristics of the target behavior sequence, thereby being able to more comprehensively reflect the changes in the target behavior sequence, avoiding the deviation that may be caused by prediction based on a single feature, improving the comprehensiveness of the prediction, and thus making the prediction result closer to the trend of changes in the behavior volume in the future time period, effectively solving the technical problem of inaccurate prediction when predicting the predetermined behavior volume, especially when predicting a long time period.
[0199] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0200] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of various embodiments of the present invention.
[0201] Example 2
[0202] According to an embodiment of the present invention, a device for implementing the above behavior quantity prediction method is also provided. Figure 4 is a structural block diagram of a behavior prediction device according to an embodiment of the present invention. Figure 4 As shown, the device includes: an acquisition module 402, a first determination module 404, a second determination module 406, a third determination module 408, a fourth determination module 410 and a fifth determination module 412. The device is described in detail below.
[0203] The acquisition module 402 is used to receive a behavior quantity prediction request, wherein the behavior quantity prediction request is used to predict the behavior quantity of the target object performing a predetermined behavior in a future time period, and the behavior quantity prediction request carries the future time period; the first determination module 404 is connected to the above acquisition module 402, and is used to respond to the behavior quantity prediction request and obtain an initial behavior sequence, wherein the initial behavior sequence includes a plurality of predetermined behavior quantities arranged in chronological order, and the predetermined behavior quantity is the behavior quantity generated by the target object performing the predetermined behavior in the historical time period; the second determination module 406 is connected to the above first determination module 404, and is used to determine the behavior features corresponding to the initial behavior sequence, and the predetermined behavior sequence. Interference features for interference; a third determination module 408, connected to the above-mentioned second determination module 406, for determining a prefix behavior sequence based on the behavior features and the interference features; a fourth determination module 410, connected to the above-mentioned third determination module 408, for connecting the prefix behavior sequence to the front end of the initial behavior sequence to obtain a target behavior sequence; a fifth determination module 412, connected to the above-mentioned fourth determination module 410, for determining a predicted behavior sequence based on the target behavior sequence and a future time period, wherein the predicted behavior sequence includes a plurality of predicted behavior quantities arranged in chronological order, and the predicted behavior quantity is a behavior quantity predicted to be generated by the target object performing a predetermined behavior in a future time period.
[0204] It should be noted here that the above-mentioned acquisition module 402, first determination module 404, second determination module 406, third determination module 408, fourth determination module 410 and fifth determination module 412 correspond to steps S102 to S112 in implementing the behavior quantity prediction method, and the instances and application scenarios implemented by the multiple modules are the same as the corresponding steps, but are not limited to the contents disclosed in the above-mentioned embodiment 1.
[0205] Example 3
[0206] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor, wherein the processor is configured to execute instructions to implement any of the above-mentioned behavior quantity prediction methods.
[0207] Example 4
[0208] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute any of the above-mentioned behavior quantity prediction methods.
[0209] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0210] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0211] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0212] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0213] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0214] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0215] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A behavior quantity prediction method, characterized in that: include: receiving a behavior amount prediction request, wherein the behavior amount prediction request is used to predict the behavior amount of a target object performing a predetermined behavior in a future time period, and the behavior amount prediction request carries the future time period; In response to the behavior amount prediction request, an initial behavior sequence is obtained, wherein the initial behavior sequence includes a plurality of predetermined behavior amounts arranged in chronological order, and the predetermined behavior amount is the behavior amount generated by the target object performing the predetermined behavior within a historical time period; Determining behavior features corresponding to the initial behavior sequence and interference features that interfere with the predetermined behavior; Determining a prefix behavior sequence according to the behavior characteristics and the interference characteristics; Connecting the prefix behavior sequence to the front end of the initial behavior sequence to obtain a target behavior sequence; A predicted behavior sequence is determined based on the target behavior sequence and the future time period, wherein the predicted behavior sequence includes a plurality of predicted behavior quantities arranged in chronological order, and the predicted behavior quantity is the behavior quantity predicted to be generated when the target object performs the predetermined behavior within the future time period.
2. The method according to claim 1, characterized in that The step of determining the predicted behavior sequence based on the target behavior sequence and the future time period includes: According to the target behavior sequence, a first subsequence and a second subsequence are obtained, wherein the first subsequence represents a sequence showing a stability index trend corresponding to the predetermined behavior amount within the historical time period, and the second subsequence represents a sequence showing a volatility index trend of the predetermined behavior amount within the historical time period; The predicted behavior sequence is determined according to the first subsequence, the second subsequence and the future time period.
3. The method according to claim 2, characterized in that Before obtaining the first subsequence and the second subsequence according to the target behavior sequence, the method further includes: In the case where the target behavior sequence includes a first number of predetermined behavior quantities, setting a sliding window parameter of the sliding window, wherein the sliding window parameter includes a sliding window length and a sliding step length, wherein the length of the sliding window length is a length covering a second number of behavior quantities, and the sliding step length represents the number of behavior quantities that the sliding window moves, and the second number is less than the first number; Determining a plurality of corresponding covering behavior sequences in the target behavior sequence according to the target behavior sequence and a sliding window provided with the sliding window parameters; Determine average values respectively corresponding to the plurality of covering behavior sequences; The first subsequence is determined according to average values respectively corresponding to the multiple covering behavior sequences.
4. The method according to claim 3, characterized in that The determining, based on the target behavior sequence and the sliding window having the sliding window parameter, a plurality of corresponding covering behavior sequences in the target behavior sequence comprises: Align the first position of the sliding window with the first position of the behavior amount in the target behavior sequence to obtain a first covering behavior sequence, wherein the first covering behavior sequence includes a plurality of covering behavior amounts, and the plurality of covering behavior amounts are behavior amounts covered by the sliding window length corresponding to the sliding window; The sliding window is moved according to the sliding step length to obtain a second covering behavior sequence, until the tail position of the sliding window is aligned with the tail behavior amount position in the target behavior sequence, thereby obtaining the multiple covering behavior sequences.
5. The method according to claim 4, characterized in that The step of moving the sliding window according to the sliding step length to obtain a second covering behavior sequence until the tail position of the sliding window is aligned with the tail behavior amount position in the target behavior sequence to obtain the multiple covering behavior sequences includes: Determine whether the last behavior quantity position is the position result of the last behavior quantity position in the target behavior sequence; In the case where the position result is not the last behavior amount, determining the filling behavior amount; Filling the target behavior sequence according to the filling behavior amount to obtain an updated behavior sequence; The sliding window is moved according to the sliding step length so that the tail position of the sliding window is aligned with the last behavior quantity position in the update behavior sequence to obtain the multiple coverage behavior sequences.
6. The method according to claim 5, characterized in that When the position result is not the last behavior amount, determining the filling behavior amount includes: In the case where the position result is not the last first behavior quantity, determining the last position; When the reciprocal rank is greater than a predetermined threshold, the filling behavior amount is determined.
7. The method according to any one of claims 2 to 6, characterized in that The determining the predicted behavior sequence according to the first subsequence, the second subsequence and the future time period includes: Determining a first feature corresponding to the first subsequence according to the first subsequence, wherein the first feature is a feature representing stability of the predetermined behavior amount; Determining, based on the second subsequence, a second feature corresponding to the second subsequence, wherein the second feature is a feature representing volatility of the predetermined behavior amount; Determining a first prediction subsequence according to the first feature and the future time period; determining a second prediction subsequence according to the second feature and the future time period; The predicted behavior sequence is determined according to the first predicted subsequence and the second predicted subsequence.
8. A behavior prediction device, characterized in that: include: An acquisition module, configured to receive a behavior amount prediction request, wherein the behavior amount prediction request is used to predict the behavior amount of a target object performing a predetermined behavior in a future time period, and the behavior amount prediction request carries the future time period; A first determination module is configured to obtain an initial behavior sequence in response to the behavior amount prediction request, wherein the initial behavior sequence includes a plurality of predetermined behavior amounts arranged in chronological order, and the predetermined behavior amount is a behavior amount generated by a target object performing the predetermined behavior within a historical time period; A second determination module, configured to determine a behavior feature corresponding to the initial behavior sequence and an interference feature that interferes with the predetermined behavior; A third determination module, configured to determine a prefix behavior sequence according to the behavior feature and the interference feature; A fourth determination module, configured to connect the prefix behavior sequence to the front end of the initial behavior sequence to obtain a target behavior sequence; The fifth determination module is used to determine the predicted behavior sequence based on the target behavior sequence and the future time period, wherein the predicted behavior sequence includes a plurality of predicted behavior quantities arranged in chronological order, and the predicted behavior quantity is the behavior quantity predicted to be generated when the target object performs the predetermined behavior within the future time period.
9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the behavior quantity prediction method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the behavior quantity prediction method as claimed in any one of claims 1 to 7.