Network operation index prediction method and system based on Transformer time series prediction model
By decomposing the time series data of network operation indicators into trend terms and periodic terms, and combining with the multi-head sparse self-attention mechanism, the Transformer model is improved, which solves the shortcomings of the existing model in long non-stationary sequence prediction and improves the prediction accuracy. and robustness.
Patent Information
- Application Number
- CN202410584760.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-13
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-05-13
AI Technical Summary
The existing Transformer time series prediction model degrades significantly in long non-stationary sequence prediction, and cannot fully extract local features and periodic features, resulting in the inability to meet the needs of complex non-stationary time series prediction.
Using the improved Transformer time series prediction model, preprocessing and multiple time series decomposition of the original time series data of network operating indicators into trend items and periodic items, combined with the multi-head sparse self-attention mechanism and decoder, improve the model's performance Computational efficiency and prediction accuracy.
It improves the accuracy and robustness of the model in forecasting and analysis tasks, and can better utilize the multi-dimensional information of time series to meet the needs of complex non-stationary time series forecasting.
Smart Images

Figure CN118158116B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of network operation indicator prediction, and in particular to a network operation indicator prediction method and system based on a Transformer time series prediction model. Background Art
[0002] With the rapid popularization of the Internet and the rise of a digital society, network operation indicator prediction has become a key link in ensuring user experience and normal business operation. Users' demand for high-performance, low-latency, reliable and secure network services continues to increase, which poses more severe challenges to network service providers and enterprises. The comprehensive evaluation of network service performance and availability aims to ensure that users can obtain a stable, efficient and reliable service experience. The evaluation covers multiple aspects, including key indicators such as bandwidth, latency, packet loss rate, response time, etc. By monitoring and analyzing these indicators, we can fully understand the network operation status and promptly discover and solve potential problems, thereby improving user satisfaction. Modern network operation status evaluation often relies on advanced monitoring tools and technologies to ensure that services can perform well under different conditions. This evaluation is crucial in areas such as cloud computing, online applications and remote work, helping to ensure user experience and improve business efficiency.
[0003] Most of the algorithms used in the early network operation index prediction methods were supervised algorithms, which required labeling and classification of the huge amount of network data, and then calculation using algorithms such as clustering. However, the huge amount of data is obviously not suitable for practical applications. In addition to supervised algorithms, there are also static threshold assessment algorithms. This method defines the threshold range of various network operation parameters. If the delay exceeds a certain range, such as more than 1s, it is considered that there is a problem with the network. The disadvantage of this method is that it cannot dynamically evaluate the network operation indicators and can only monitor passively. In addition, the setting of thresholds also requires experienced network engineers. Time series prediction can solve the above problems very well. First of all, time series prediction is unsupervised learning and does not require label classification of data. Secondly, the algorithm based on time series prediction can also predict and evaluate the network operation at the current time and future time based on the existing historical data, which has good dynamics.
[0004] Time series prediction is divided into traditional prediction methods and prediction methods based on machine learning. Traditional algorithms include traditional time series prediction, which is mainly based on statistical methods. Traditional prediction methods mainly include autoregressive model (AR), moving average model (MA), auto-regressive moving average model (ARMA), autoregressive conditional heteroskedasticity model (ARCH), etc. Prediction methods based on machine learning include time series prediction based on machine learning, which mainly includes support vector machine (SVM), Bayesian Network (BN), LSTM and Transformer models. These methods have solved the problem of being unable to cope with nonlinearity to a certain extent, but the algorithm requires the time series to be stationary (that is, the time series features are single or not obvious), so it is not suitable for long series prediction of non-stationary time series.
[0005] However, traditional time series prediction methods have many problems, great limitations, lack of versatility, and harsh use conditions, simple models and single parameters. They are only suitable for fitting simple linear curves and cannot meet complex time series prediction needs. In addition, traditional time series prediction methods only consider time modeling, which is a regression calculation analysis of historical data, ignoring other additional features, which also leads to unsatisfactory prediction accuracy. The time series prediction method based on machine learning has better versatility and can fit multiple nonlinear curves through feature extraction. However, time series prediction based on machine learning still has many problems. Although the Transformer with excellent prediction effect has strong global modeling ability, the Transformer degrades significantly when processing non-stationary data, and cannot extract local features and various periodic features in the time series well. Therefore, the existing Transformer time series prediction model degrades significantly in the prediction of long non-stationary series, and the extraction of local features and periodic features is insufficient, which makes it impossible to meet the needs of complex non-stationary time series prediction. Summary of the invention
[0006] Based on this, the present application proposes a network operation indicator prediction method and system based on the Transformer time series prediction model, aiming to solve the problem that the existing Transformer time series prediction model has obvious degradation in the prediction of long non-stationary sequences, insufficient extraction of local features and periodic features, and cannot meet the complex non-stationary time series prediction needs.
[0007] The first aspect of the present application provides a network operation indicator prediction method, based on an improved Transformer timing prediction model, the improved Transformer timing prediction model includes an embedding layer, an encoder and a decoder, the method includes:
[0008] Acquire original time series data of network operation indicators, perform preprocessing and multi-item time series decomposition on the original time series data, wherein the multi-item time series decomposition includes trend item time series decomposition and cycle item time series decomposition, so as to obtain multi-item time series data of network operation;
[0009] Inputting the multiple time series data into the embedding layer for conversion to obtain an embeddable feature sequence;
[0010] Inputting the embeddable feature sequence into an encoder, wherein a multi-head sparse self-attention is introduced into the encoder to capture the global information and local features of the embeddable feature sequence;
[0011] The encoder output features and the supplementary mask sequence are input into the decoder to obtain the prediction results of the network operation indicators.
[0012] Compared with the prior art, the network operation index prediction method provided by the present application is based on the improved Transformer time series prediction model. The original time series data of the network operation index is first preprocessed and multi-time series decomposition is performed. The purpose of this step is to decompose the original one-dimensional time series items into multiple items, including trend items and periodic item sequences. The trend item can reflect the overall stable change trend of the time series and can understand the overall change trend and long-term trend of the data. On the basis of the trend item, the periodic item focuses more on local non-stationary changes and can capture the periodic change pattern in the time series data. Such a decomposition can divide the original time series data into different time series information more finely, thereby In the subsequent processing, hidden information can be better mined; the decomposed multiple time series are sent to the embedding layer of the model. The role of the embedding layer is to convert multiple time series into an input format acceptable to the model, and the feature representation in the data can be learned; then, the data output by the embedding layer is input into the encoder module based on sparse attention. This module contains a stack of multiple multi-head self-attention and maximum pooling layers. The introduction of the sparse attention mechanism effectively reduces the complexity of attention calculation and improves the computational efficiency and performance of the model; the decoder is then used to complete the task of predicting the sequence. The decoder can generate the corresponding output sequence according to the input encoding representation, so that the prediction of the future trend of the time series or other goals can be achieved. Through such a processing flow, the model proposed in this application can better utilize the multi-dimensional information of the time series, thereby improving the accuracy and robustness of the model in prediction and analysis tasks, and can solve the problem that the existing Transformer time series prediction model has obvious degradation in the prediction of long non-stationary sequences, insufficient extraction of local features and periodic features, and cannot meet the needs of complex non-stationary time series prediction.
[0013] As an optional implementation manner of the first aspect, the preprocessing includes:
[0014] Through windowing In principle, abnormal data is detected from the original time series data and set as null values, and then the null values are interpolated based on the KNN interpolation algorithm of dynamic time warping distance.
[0015] As an optional implementation manner of the first aspect, the multiple time series decomposition steps include:
[0016] Define the variable values of the original time series data , where s t is the periodic term, is the trend item, is the remainder;
[0017] The preprocessed raw time series data Perform T-order difference, the T-order difference formula is:
[0018] ,
[0019] in, Represents the original time series data after preprocessing The T-order difference of represents the time series data at another time Tt, represents the T-order difference of the trend term, represents the T-order difference of the periodic term, represents the T-order difference of the remainder.
[0020] As an optional implementation manner of the first aspect, the step of temporal decomposition of the trend item includes:
[0021] The trend term is minimized by weighting Enhance to construct the objective function, rewrite the objective function into an equivalent matrix, perform paradigm substitution on the equivalent matrix to obtain the transformed objective function, minimize the transformed objective function, and use the output of minimizing the transformed objective function as the trend term after decomposition enhancement .
[0022] As an optional implementation manner of the first aspect, the step of decomposing the periodic item timing includes:
[0023] The decomposition-enhanced trend term From the preprocessed raw time series data After removing it, update it to , the As the processing object of the time series decomposition of periodic items;
[0024] Using non-local seasonal filtering from the Extract the decomposed periodic terms and extract the decomposed periodic terms The formula is:
[0025] ,
[0026] in, represents the weight of the bilateral filter, For the The jth time series of a subsequence, The value range is , , K represents the number of subsequences, h ranges from 1 to H, and H represents the filter window size.
[0027] As an optional implementation manner of the first aspect, the step of inputting the multiple time series data into the embedding layer for conversion to obtain an embeddable feature sequence includes:
[0028] The local timestamp is embedded using the classic embedding method in Transformer, the global timestamp is embedded in a learnable way, and then a one-dimensional convolution filter is used for dimension alignment, so that the multiple time series data are mapped to obtain the embeddable feature sequence.
[0029] As an optional implementation manner of the first aspect, the step of introducing multi-head sparse self-attention includes:
[0030] The calculation formula of the introduced multi-head sparse self-attention is:
[0031] ,
[0032] Among them, Attention(Q,K,V) represents the multi-head sparse self-attention defined on the query vector Q, key vector K and value vector V. is the activation function, represents the vector with the highest probability in each query vector, Represents the transposed matrix of the key vector, where d represents the dimension.
[0033] As an optional implementation of the first aspect, the step of inputting the encoder output features and the supplementary mask sequence into the decoder to obtain a prediction result of the network operation indicator includes:
[0034] The encoder output feature is input as the first part to the decoder, the output of the embedding layer is masked and filled to obtain a supplementary mask sequence, and the supplementary mask sequence is input as the second part to the decoder. The input expression of the decoder is:
[0035] ,
[0036] in, represents the input of the decoder, Indicates that the connection operation is performed according to the timestamp. represents the sequence length corresponding to the encoder output, Indicates the length of the supplementary mask sequence;
[0037] Then, through the processing of multi-head sparse self-attention and fully connected layers, the final prediction results of the network operation indicators are obtained.
[0038] As an optional implementation manner of the first aspect, after the step of obtaining the prediction result of the network operation indicator, the step further includes:
[0039] The prediction results of the network operation indicators are evaluated by using the windowed cumulative error value and percentage weighted error. Based on the evaluation results, the objective weights and subjective weights under different network operation states are adjusted. The algorithm formula of the evaluation is:
[0040] ,
[0041] in, Indicates the result of the evaluation. It represents the mean square error loss function value of the predicted data and the actual data when the window length is n. and are subjective weight and objective weight respectively, is the actual value of the ith indicator, is the predicted value of the ith indicator.
[0042] The second aspect of the present application provides a network operation indicator prediction system, based on an improved Transformer timing prediction model, the improved Transformer timing prediction model includes an embedding layer, an encoder and a decoder, and the system includes:
[0043] A data acquisition module, used to acquire original time series data of network operation indicators, preprocess and perform multiple time series decomposition on the original time series data, wherein the multiple time series decomposition includes trend item time series decomposition and cycle item time series decomposition, so as to obtain multiple time series data of network operation;
[0044] A data embedding module, used for inputting the multiple time series data into the embedding layer for conversion to obtain an embeddable feature sequence;
[0045] A feature encoding module, used for inputting the embeddable feature sequence into an encoder, wherein a multi-head sparse self-attention is introduced into the encoder to capture the global information and local features of the embeddable feature sequence;
[0046] The feature decoding module is used to input the encoder output features and the supplementary mask sequence into the decoder to obtain the prediction results of the network operation indicators.
[0047] Additional aspects and advantages of the present application will be given in part in the following description, and in part will become apparent from the following description, or will be understood through the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A flowchart of a network operation indicator prediction method proposed in the first embodiment of the present application;
[0049] Figure 2A structural diagram of a time series prediction model based on an improved Transformer proposed in the first embodiment of the present application;
[0050] Figure 3 This is a flowchart of the preprocessing in the first embodiment of the present application;
[0051] Figure 4 It is a flowchart of multiple timing decompositions in the first embodiment of the present application;
[0052] Figure 5 This is a flowchart of sparse self-attention calculation in the first embodiment of the present application;
[0053] Figure 6 A schematic diagram of the structure of a network operation indicator prediction system proposed in the second embodiment of the present application.
[0054] The following specific implementation methods will further illustrate the present application in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0055] In order to facilitate understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. Several embodiments of the present application are provided in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0057] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.
[0058] See also Figure 1 , which is a flowchart of a network operation indicator prediction method proposed in an embodiment of the present application, is described in detail as follows:
[0059] Step S01: Acquire original time series data of network operation indicators, preprocess and perform multiple time series decomposition on the original time series data, wherein the multiple time series decomposition includes trend item time series decomposition and cycle item time series decomposition to obtain multiple time series data of network operation.
[0060] like Figure 2 As shown, this is a structural diagram of a time series prediction model based on an improved Transformer proposed in this embodiment.
[0061] Specifically, the preprocessing includes step S011 and step S012. Figure 3 The figure shows the flow chart of preprocessing.
[0062] Step S011: Windowing In principle, abnormal data is detected from the original time series data and set to null values;
[0063] For any original time series data d i , in the original time series data d i In the subsequence with a window size of N as the center, the calculation window size does not contain d i The mean and standard deviation of the subsequences are then calculated using The principle is to calculate the upper and lower bounds of the threshold of abnormal data, and set the abnormal data exceeding the upper and lower bounds to null values;
[0064] Step S012: interpolating the null value using a KNN interpolation algorithm based on dynamic time warping distance;
[0065] Calculate the distance between neighbor data points and null value , the distance calculation formula is:
[0066] ,
[0067] in, Represents a null value, represents the i-th neighbor data point, and n represents the number of neighbor data points;
[0068] Find the K complete data points closest to the time point where the null value is located as neighbor data points;
[0069] Use weighted average to interpolate. The expression is:
[0070] .
[0071] Furthermore, the multiple time series decomposition includes steps S021 to S024, such as Figure 4 As shown, it is a flowchart of multiple timing decompositions.
[0072] It should be noted that, in order to facilitate the description of the decomposition algorithm, the symbols used are shown in Table 1:
[0073] Table 1 Commonly used symbols
[0074]
[0075] Step S021: defining the preprocessed original time series data to include a period term, a trend term and a remainder term, and performing a difference on the preprocessed original time series data;
[0076] It should be noted that decomposing time series can decompose the one-dimensional time series information into multi-dimensional time series information. These time series information will reveal more hidden information in different trends and cycles, which helps to understand and mine the hidden information in the data more deeply. Among them, the trend item, cycle item and residual item sequence obtained by decomposition represent different aspects of data characteristics, which are of great significance for time series analysis and prediction.
[0077] Define the variable values of the preprocessed raw time series data ,in, is the periodic term, is the trend item, is the remainder;
[0078] The variable values of the preprocessed original time series data Perform T-order difference, the T-order difference formula is:
[0079] ,
[0080] in, Represents the variable value of the original time series data after preprocessing The T-order difference of represents the time series data at another time Tt, represents the T-order difference of the trend term, represents the T-order difference of the periodic term, represents the T-order difference of the remainder.
[0081] Step S022: Decomposing trend items from the pre-processed original time series data, and updating the time series data;
[0082] It should be noted that the trend item reflects the overall stable change trend of the time series, is the embodiment of the basic changes of the time series data, and constitutes the basic changes of the time series. Through the decomposition and analysis of the trend item, we can understand the overall change trend and long-term trend of the data, and provide an important reference for future forecasting and planning. Since the characteristic changes of the trend item are relatively stable, it is necessary to perform seasonal difference on the data first to reduce the impact of the periodic characteristics on the trend item.
[0083] Assumptions and If there are seasonal differences, The value of will become smaller, and the trend term needs to be enhanced by minimizing the weight to construct the objective function f:
[0084] ,
[0085] in, and are the weight parameters of the first-order difference and the second-order difference, It means replacing the square loss function with the minimum absolute deviation. The first-order difference representing the trend term Accumulate over time series, The second-order difference representing the trend term Accumulation in time series;
[0086] Since the trend characteristics change slowly, based on the above analysis, the objective function can be rewritten as an equivalent matrix ,
[0087] in, Represents the normal form of vectors x, g and is the corresponding vector, M represents the Toeplitz matrix corresponding to the first-order difference, and D represents the Toeplitz matrix corresponding to the second-order difference;
[0088] In order to minimize the objective function, , and Use paradigm To replace,
[0089] in, , , P is a matrix, q is a vector, and I is a Toeplitz matrix;
[0090] After minimizing the objective function, output represents the output of minimizing the objective function, ,
[0091] in, represents the minimization operation. Indicates satisfaction Under the constraint condition of , 𝑣 is an auxiliary vector variable;
[0092] The output of the minimized objective function is the decomposed enhanced trend term , the decomposition enhanced trend term The expression is:
[0093] .
[0094] The decomposition-enhanced trend term From the preprocessed raw time series data After removing it, update it to , the As the processing object of periodic term time series decomposition.
[0095] Step S023: extracting decomposition periodic items from the updated time series data using non-local seasonal filtering;
[0096] It should be noted that it is more difficult to extract the periodic term of the original time series after removing the trend feature. The traditional time series decomposition method can only consider a certain number of subsequences to extract periodic features. When the size of the period changes, the extraction of periodicity may fail. In order to accurately evaluate the periodicity and extract the periodic features, this paper will update the series. Perform global seasonal filtering decomposition. In this non-traditional filtering method, not only the K sub-segment sequences are considered , and also added The K neighborhood of a point is the center.
[0097] use The linear combination of , is the variable value of the time series in the above K neighborhood. and The weight is determined by the distance and approximation in time. If the nearest time in the K neighborhood contains variables with similar cycles, a larger weight is assigned to it, so that the most approximate cycle time point can be obtained.
[0098] Then the overall seasonal filtering extracts the decomposition periodic term The formula is:
[0099] ,
[0100] in, represents the weight of the bilateral filter, For the The jth time series of a subsequence, The value range is , , K represents the number of subsequences, h ranges from 1 to H, and H is the filter window size.
[0101] in, The weight calculation method of the bilateral filter weight is expressed as:
[0102] , and is a fixed parameter and θ is a normalization factor.
[0103] Based on the trend term, the periodic term focuses more on local non-stationary changes, and it captures the periodic change pattern in the time series data. Since different time series data may have periodic changes of various lengths, the decomposition of the periodic term can be performed for different period lengths, thereby providing more detailed periodic feature information.
[0104] Step S024: After decomposing the trend term and the period term from the preprocessed original time series data, a remainder term is obtained.
[0105] It should be noted that, based on the trend term and the period term, the residual term sequence usually shows poor stability but contains rich hidden feature information. It contains the part of the time series data that is not explained by the trend term and the period term, which may include noise, outliers or other implicit features. The processing of the residual term sequence requires certain data preprocessing to eliminate interference information and retain important features. The specific preprocessing method can be adopted according to the actual situation, such as removing outliers, smoothing or other statistical methods.
[0106] Step S02: inputting the multiple time series data into the embedding layer for conversion to obtain an embeddable feature sequence.
[0107] Specifically, the local timestamp is embedded using the classic embedding method in Transformer, and the embedding expression is:
[0108] ,
[0109] The value range of i is , pos is the position in the sequence, PE is the position code, i is the vector dimension index, is the vector dimension.
[0110] Furthermore, the global timestamp is represented by an embedding with a finite length that can be learned, which ensures that the similarity calculation of self-attention can be performed while accessing the temporal global feature information.
[0111] The alignment dimension uses a one-dimensional convolution filter to map the input vector to the input vector Mapping Dimensional vector .
[0112] After the above transformations, we finally get an embeddable feature sequence It is expressed as:
[0113] ,
[0114] The value range of i is , is the mapping of the one-dimensional convolution filter, is the vector length, is a balance factor used to balance between local and global timestamps and alignment dimensions. is a learnable token embedding of the global timestamp, The position of the local timestamp is embedded.
[0115] Step S03: inputting the embeddable feature sequence into an encoder, and introducing multi-head sparse self-attention into the encoder to capture the global information and local features of the embeddable feature sequence.
[0116] It should be noted that the encoder is an important part of the Transformer neural network, which is responsible for converting the input data into hidden representations and extracting key features from the data. In modern Transformer models, the encoder consists of multiple stacked multi-head self-attention and maximum pooling layers. This design can effectively capture the global information and local features of the input sequence. Specifically, the complexity of the native Transformer self-attention mechanism is , where n represents the length of the input sequence. The reason for this quadratic increase in complexity is that each position needs to calculate the attention weights of all positions. This may become a bottleneck for computing and memory when processing long sequences or large-scale data, limiting the application scope and efficiency of the model.
[0117] In order to solve the complexity problem of the original Transformer self-attention mechanism, sparse self-attention optimization is introduced. Sparse self-attention reduces the computational complexity by limiting each position to only a small number of positions near it. This optimization can effectively improve the computational efficiency and memory utilization of the model in practical applications.
[0118] Next, this step starts with the calculation process of the self-attention mechanism, analyzes the calculation method of the attention weight of each position and other positions, and explains the root cause of the complexity increase. Subsequently, this step will introduce the complexity derivation process after sparse self-attention optimization, and explain how sparse self-attention reduces the computational complexity by designing the attention calculation method, and maintains the effectiveness and accuracy of the model when processing input sequences.
[0119] Specifically, the sparse self-attention calculation process includes steps S031 to S033, such as Figure 5 As shown, it is a flowchart of sparse self-attention calculation.
[0120] Step S031: randomly sample some keys K of the query vector Q, and calculate the similarity using KL divergence;
[0121] The input data defines Q's attention to K in the form of probability according to the calculation formula of self-attention: , and then use KL divergence to distinguish the similarity between input data. KL divergence is expressed as:
[0122] ,
[0123] in represents KL divergence, ln and exp are logarithmic calculation and exponential calculation respectively, represents the length of the key vector, is the query vector, represents the key vector transposed matrix, d represents the vector dimension;
[0124] Step S032: Calculate the sparsity of the query vector Q;
[0125] The i-th query vector The sparsity of is defined as:
[0126] ,
[0127] in represents the key vector, represents the sparsity of the i-th query vector to the matrix K, The larger the value of The greater the importance, the more attention mechanism can be transformed into a probability problem. We only need to take the vector with the largest probability. The calculation formula of the multi-head sparse self-attention introduced in this way is:
[0128] ,
[0129] Among them, Attention(Q,K,V) represents the multi-head sparse self-attention defined on the query vector Q, key vector K and value vector V. is the activation function, represents the vector with the highest probability in each query vector, represents the key vector transposed matrix, and d represents the dimension.
[0130] For all and , the upper and lower bounds of the sparsity of each query vector are:
[0131] ,
[0132] Among them, max() means taking the maximum value, which can get the maximum approximate value of sparsity. :
[0133] ;
[0134] Step S033: perform dot product calculation on the n query vectors Q with the largest sparsity to obtain the attention calculation result.
[0135] Add a max pooling layer after the sparse self-attention layer to pool the sparsest layers. dot product results, and fill the rest with 0, making the sparsest vector as the query vector .
[0136] The entire encoder consists of multiple stacks of multi-head sparse self-attention and max pooling layers to effectively capture the global information and local features of the input sequence.
[0137] Step S04: Input the encoder output features and the supplementary mask sequence into the decoder to obtain the prediction results of the network operation indicators.
[0138] Specifically, the encoder output feature is input as the first part into the decoder, the output of the embedding layer is masked and filled to obtain a supplementary mask sequence, and the supplementary mask sequence is input as the second part into the decoder. The input expression of the decoder is:
[0139] ,
[0140] in, represents the input of the decoder, Indicates that the connection operation is performed according to the timestamp. represents the sequence length corresponding to the encoder output, Indicates the length of the supplementary mask sequence;
[0141] Then, through the processing of multi-head sparse self-attention and fully connected layers, the final prediction results of the network operation indicators are obtained.
[0142] Then, a masked multi-head attention mechanism is applied in the probability sparse sub-attention calculation to prevent the model from paying too much attention to the position to be generated during the generation process, thereby preventing the problem of autoregression. In the generative decoding stage, the model generates a vector for each position to be predicted, and finally processes it through the fully connected layer to obtain the final prediction result of the network operation index. .
[0143] Furthermore, after obtaining the prediction result of the network operation index, the prediction result of the network operation index can be evaluated by using the windowed cumulative error value and percentage weighted error. For example, for a given window size n, the current data and the historical data are calculated. The root mean square error of each data is calculated, and then the weighted error percentage of the current data and the predicted data at the current time is calculated. The weighting method adopts the AHP hierarchical analysis method. The AHP hierarchical analysis method is a method that combines subjective weighting method and objective weighting method. It is widely used to determine the weight of indicators. This method first uses expert experience to evaluate the relative importance of indicators, and then performs weighted calculation of the final result. It is particularly suitable for solving problems that are difficult to deal with using quantitative methods.
[0144] Based on the evaluation results, the objective weights and subjective weights under different network operation states can be adjusted according to different network environments. (objective weight) to adjust according to different network service needs or different user groups The value of (subjective weight) can be adjusted. For example, for networks or users with more streaming media, the weights of bandwidth and delay in the network parameter indicators can be increased. For network environments such as Internet cafes and user needs, the weights of jitter and latency can be increased.
[0145] The algorithm formula for the evaluation is:
[0146] ,
[0147] in, Indicates the result of the evaluation. It represents the mean square error loss function value of the predicted data and the actual data when the window length is n. and are subjective weight and objective weight respectively, is the actual value of the ith indicator, is the predicted value of the ith indicator.
[0148] In summary, the present application provides a network operation index prediction method, which is based on the improved Transformer time series prediction model. The original time series data of the network operation index is first preprocessed and multi-time series decomposition is performed. The purpose of this step is to decompose the original one-dimensional time series items into multiple items, including trend items and periodic item sequences. The trend item can reflect the overall stable change trend of the time series and can understand the overall change trend and long-term trend of the data. On the basis of the trend item, the periodic item focuses more on local non-stationary changes and can capture the periodic change pattern in the time series data. Such a decomposition can divide the original time series data into different time series information more finely, so as to facilitate the subsequent processing. The decomposed multiple time series are sent to the embedding layer of the model. The function of the embedding layer is to convert multiple time series into an input format acceptable to the model and learn the feature representation in the data. Then, the data output by the embedding layer is input into the encoder module based on sparse attention. This module contains a stack of multiple multi-head self-attention and maximum pooling layers. The introduction of the sparse attention mechanism effectively reduces the complexity of attention calculation and improves the computational efficiency and performance of the model. The decoder is then used to complete the task of predicting the sequence. The decoder can generate the corresponding output sequence according to the input encoding representation, so that the prediction of the future trend or other goals of the time series can be achieved. Through such a processing flow, the model proposed in this application can better utilize the multi-dimensional information of the time series, thereby improving the accuracy and robustness of the model in prediction and analysis tasks, and can solve the problem that the existing Transformer time series prediction model has obvious degradation in the prediction of long non-stationary sequences, insufficient extraction of local features and periodic features, and cannot meet the needs of complex non-stationary time series prediction.
[0149] See also Figure 6 , shown is a schematic diagram of the structure of a network operation index prediction system in the second embodiment of the present application, based on an improved Transformer timing prediction model, the improved Transformer timing prediction model includes an embedding layer, an encoder and a decoder, and the system includes:
[0150] The data acquisition module 10 is used to acquire the original time series data of the network operation index, and preprocess and decompose the original time series data into multiple time series, wherein the multiple time series decomposition includes trend item time series decomposition and cycle item time series decomposition, so as to obtain multiple time series data of the network operation;
[0151] A data embedding module 20, configured to input the multiple time series data into the embedding layer for conversion to obtain an embeddable feature sequence;
[0152] A feature encoding module 30, used for inputting the embeddable feature sequence into an encoder, wherein a multi-head sparse self-attention is introduced into the encoder to capture the global information and local features of the embeddable feature sequence;
[0153] The feature decoding module 40 is used to input the encoder output features and the supplementary mask sequence into the decoder to obtain the prediction results of the network operation indicators.
[0154] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0155] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A network operation index prediction method, characterized in that: Based on an improved Transformer time series prediction model, the improved Transformer time series prediction model includes an embedding layer, an encoder and a decoder, and the method includes: Acquire original time series data of network operation indicators, perform preprocessing and multi-item time series decomposition on the original time series data, wherein the multi-item time series decomposition includes trend item time series decomposition and cycle item time series decomposition, so as to obtain multi-item time series data of network operation; The steps of decomposing multiple time series include: Define the variable values of the original time series data , where s t is the periodic term, is the trend item, is the remainder; The preprocessed raw time series data Perform T-order difference, the T-order difference formula is: , in, Represents the original time series data after preprocessing The T-order difference of represents the time series data at another time Tt, represents the T-order difference of the trend term, represents the T-order difference of the periodic term, represents the T-order difference of the remainder; The steps of temporal decomposition of the trend items include: The trend term is minimized by weighting Enhance to construct the objective function, rewrite the objective function into an equivalent matrix, perform paradigm substitution on the equivalent matrix to obtain the transformed objective function, minimize the transformed objective function, and use the output of minimizing the transformed objective function as the trend term after decomposition enhancement ; The step of decomposing the periodic item timing comprises: The decomposition-enhanced trend term From the preprocessed raw time series data After removing it, update it to , the As the processing object of the time series decomposition of periodic items; Using non-local seasonal filtering from the Extract the decomposed periodic terms and extract the decomposed periodic terms The formula is: , in, represents the weight of the bilateral filter, For the The jth time series of a subsequence, The value range is , , K represents the number of subsequences, h ranges from 1 to H, and H represents the filter window size; Inputting the multiple time series data into the embedding layer for conversion to obtain an embeddable feature sequence; Inputting the embeddable feature sequence into an encoder, wherein a multi-head sparse self-attention is introduced into the encoder to capture the global information and local features of the embeddable feature sequence; The step of introducing multi-head sparse self-attention includes: The calculation formula of the introduced multi-head sparse self-attention is: , Among them, Attention(Q,K,V) represents the multi-head sparse self-attention defined on the query vector Q, key vector K and value vector V. is the activation function, represents the vector with the highest probability in each query vector, represents the transposed matrix of the key vector, d represents the dimension; The encoder output features and the supplementary mask sequence are input into the decoder to obtain the prediction results of the network operation indicators.
2. The network operation index prediction method according to claim 1, characterized in that: The pre-processing comprises: Through windowing In principle, abnormal data is detected from the original time series data and set as null values, and then the null values are interpolated based on the KNN interpolation algorithm of dynamic time warping distance.
3. The network operation index prediction method according to claim 1, characterized in that: The step of inputting the multiple time series data into the embedding layer for conversion to obtain an embeddable feature sequence comprises: The local timestamp is embedded using the classic embedding method in Transformer, the global timestamp is embedded in a learnable way, and then a one-dimensional convolution filter is used for dimension alignment, so that the multiple time series data are mapped to obtain the embeddable feature sequence.
4. The network operation index prediction method according to claim 1, characterized in that: The step of inputting the encoder output features and the supplementary mask sequence into the decoder to obtain a prediction result of the network operation index comprises: The encoder output feature is input as the first part to the decoder, the output of the embedding layer is masked and filled to obtain a supplementary mask sequence, and the supplementary mask sequence is input as the second part to the decoder. The input expression of the decoder is: , in, represents the input of the decoder, Indicates that the connection operation is performed according to the timestamp. represents the sequence length corresponding to the encoder output, Indicates the length of the supplementary mask sequence; Then, through the processing of multi-head sparse self-attention and fully connected layers, the final prediction results of the network operation indicators are obtained.
5. The network operation index prediction method according to claim 1, characterized in that: After the step of obtaining the prediction result of the network operation index, the method further includes: The prediction results of the network operation indicators are evaluated by using the windowed cumulative error value and percentage weighted error. Based on the evaluation results, the objective weights and subjective weights under different network operation states are adjusted. The algorithm formula of the evaluation is: , in, Indicates the result of the evaluation. It represents the mean square error loss function value of the predicted data and the actual data when the window length is n. and are subjective weight and objective weight respectively, is the actual value of the ith indicator, is the predicted value of the ith indicator.
6. A network operation index prediction system, characterized in that: Based on an improved Transformer time series prediction model, the improved Transformer time series prediction model includes an embedding layer, an encoder and a decoder, and the system includes: A data acquisition module, used to acquire original time series data of network operation indicators, preprocess and perform multiple time series decomposition on the original time series data, wherein the multiple time series decomposition includes trend item time series decomposition and cycle item time series decomposition, so as to obtain multiple time series data of network operation; The steps of decomposing multiple time series include: Define the variable values of the original time series data , where s t is the periodic term, is the trend item, is the remainder; The preprocessed raw time series data Perform T-order difference, the T-order difference formula is: , in, Represents the original time series data after preprocessing The T-order difference of represents the time series data at another time Tt, represents the T-order difference of the trend term, represents the T-order difference of the periodic term, represents the T-order difference of the remainder; The steps of temporal decomposition of the trend items include: The trend term is minimized by weighting Enhance to construct the objective function, rewrite the objective function into an equivalent matrix, perform paradigm substitution on the equivalent matrix to obtain the transformed objective function, minimize the transformed objective function, and use the output of minimizing the transformed objective function as the trend term after decomposition enhancement ; The step of decomposing the periodic item timing comprises: The decomposition-enhanced trend term From the preprocessed raw time series data After removing it, update it to , the As the processing object of the time series decomposition of periodic items; Using non-local seasonal filtering from the Extract the decomposed periodic terms and extract the decomposed periodic terms The formula is: , in, represents the weight of the bilateral filter, For the The jth time series of a subsequence, The value range is , , K represents the number of subsequences, h ranges from 1 to H, and H represents the filter window size; A data embedding module, used for inputting the multiple time series data into the embedding layer for conversion to obtain an embeddable feature sequence; A feature encoding module, used for inputting the embeddable feature sequence into an encoder, wherein a multi-head sparse self-attention is introduced into the encoder to capture the global information and local features of the embeddable feature sequence; The step of introducing multi-head sparse self-attention includes: The calculation formula of the introduced multi-head sparse self-attention is: , Among them, Attention(Q,K,V) represents the multi-head sparse self-attention defined on the query vector Q, key vector K and value vector V. is the activation function, represents the vector with the highest probability in each query vector, represents the transposed matrix of the key vector, d represents the dimension; The feature decoding module is used to input the encoder output features and the supplementary mask sequence into the decoder to obtain the prediction results of the network operation indicators.
