Database index data prediction method based on double attention and static fusion GCN
By introducing dual attention and static fusion GCN method in database index data prediction, multi-scale spatiotemporal features are extracted and static and dynamic features are learned, the problem of low prediction accuracy in the existing technology is solved, and a more efficient database is achieved Operation and maintenance forecast.
Patent Information
- Application Number
- CN202411385288.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2024-12-31
AI Technical Summary
The existing database metric data prediction technology is insufficient, and it is difficult to effectively capture the multi-scale and periodic characteristics of time series data, and the impact of server static characteristics on operation and maintenance is not considered, resulting in low prediction accuracy.
Using a database index data prediction method based on dual attention and static fusion GCN, multi-scale spatiotemporal features are extracted and space-time features are learned by downsampling multi-scale modules, time-expanding dual attention modules, static feature fusion dynamic GCN modules and inter-fragment attention layer. The association between static and dynamic features generates adjacency matrix of different time segments to reflect the continuous changing timing features.
It improves the accuracy of database indicator data prediction, can analyze data more comprehensively, overcomes the disadvantages of sharing adjacency matrix, and enhances the prediction ability of the model.
Smart Images

Figure CN119226775A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database management technology, and in particular to a database indicator data prediction method based on dual attention and static fusion GCN. Background Art
[0002] Database management systems are the main tools used by all walks of life to store and analyze data and achieve stable development. Therefore, if we can perceive the abnormal changes in the indicator data of the database in the operation process in advance, we can reduce resource losses. Database indicator data also refers to one-dimensional time series data. The prediction of time series data is generally obtained by collecting a large amount of historical information of long-term changes, learning the mathematical logic contained therein, obtaining predicted data, and timely predicting maintenance personnel. Traditional time series prediction algorithms have high requirements for data sets and require expert experience. They are too time-consuming and laborious. For example, when the number of samples of VAR is small, the estimated parameter accuracy is low and it is difficult to give the dynamic dependency between variables. The time series prediction algorithms in the field of deep learning have stronger processing capabilities for large-scale, complex and non-stationary data. LSTM and GRU models focus on the dynamic update of information, but it is difficult to obtain the multi-scale and periodic characteristics of time series and cannot capture the dynamic variability between data; the Transformer model uses the attention mechanism to extract the relationship between variables, which improves the training speed, but the time and space complexity of the model is high. In addition, currently in the database, there is no model that considers whether the static characteristics of the server have an impact on database operation and maintenance. The GNN-based prediction algorithm obtains data features through the two dimensions of time and space, uses graph structure to describe the interaction between time series data, and has strong tolerance in the study of unevenly distributed and irregular data. Summary of the invention
[0003] The purpose of the present invention is to solve the problem of insufficient database indicator data prediction technology at present, comprehensively consider global and local context information, extract multi-scale spatiotemporal features, and propose a database indicator data prediction method based on dual attention and static fusion GCN. The dynamic graph construction layer fused with static information can learn the relationship between static and dynamic features and analyze data more comprehensively. The adjacency matrix generated in different time segments can also reflect the continuously changing time series characteristics, overcoming the drawbacks of sharing the adjacency matrix and improving the prediction accuracy of the model.
[0004] The technical solution adopted by the present invention is:
[0005] The database indicator data prediction method based on dual attention and static fusion GCN includes the following steps:
[0006] Step 1: Select different types of one-dimensional indicator data sequences within the target time period to form a multivariate time series data set, and divide the indicator data into training set, test set and validation set according to the set ratio after data preprocessing and cleaning. The set ratios for different prediction tasks are different. At the same time, collect the static configuration information of the corresponding server of the database operation, and generate the embedding vector through the word embedding technology Word2Vec;
[0007] Specifically, the collection database indicator data sequence X = [s t [i]]∈R N×T ,t∈[1,2,…,T],i∈[1,2,…,N],X represents the historical observations of T timestamps,N represents the number of variable features,s t [i]∈R N×1 represents the value of the i-th variable at timestamp t;
[0008] 25 indicator data within the target time period are selected as the multivariate time series data set, and the data collection speed is once per minute. At the same time, 7 static configuration information of the corresponding server of database operation are collected; data preprocessing is performed to linearly interpolate missing values and remove outliers (the values outside the threshold are replaced by the mean of the first 5 numbers); static configuration information is embedded by Word2Vec technology to generate embedding vectors; the processed 25 indicator data are divided into training set, test set and validation set according to proportion, and the proportions of different prediction tasks are different;
[0009] Step 2, construct a database indicator data prediction model, which is divided into the following modules connected in sequence: downsampling multi-scale module, time expansion dual attention module, static feature fusion dynamic GCN module, inter-fragment attention and prediction module; the downsampling multi-scale module contains multiple layers of convolution and pooling units, which are used to generate time series of different lengths. The long sequence reflects the overall fluctuation of the data, and the short sequence reflects the local characteristics of the data; the result data of the downsampling multi-scale module is input into the time expansion dual attention module, which contains two parallel time convolution layers, time attention and deep channel attention gates, which are used to capture the temporal correlation of features; the static feature fusion dynamic GCN layer comprehensively considers the influence of the static configuration information of the database, fuses the static data graph structure with the dynamic data graph structure, and captures the spatial correlation of features; the global correlation of the overall sequence is extracted through inter-fragment attention; finally, the information of each scale is aggregated to output the prediction result;
[0010] The database indicator data prediction model performs the following steps:
[0011] Step 2-1, use the preset downsampling to divide the multi-scale layer to capture the temporal correlation of the time series at different scales, and can also flexibly deal with long sequence data;
[0012] Step 2-2, use the time-expanded dual attention module to capture temporal dependencies and extract high-level temporal features; the time-expanded dual attention module consists of parallel temporal convolutional layers and dual attention gates;
[0013] Step 2-3, time series data changes in real time and cannot rely on a single shared adjacency matrix. The results of the time expansion dual attention module are input into the static feature fusion dynamic GCN module to capture spatial features, and the dynamic construction layer of the graph based on GRU is used to capture the dynamic change features to generate a series of adjacency matrices, which are sent to the graph convolutional network (GCN) to obtain vector associations; at the same time, the static feature graph learning layer of the server static information is used to generate the adjacency matrix, which is also sent to the graph convolutional network; the two results are fused and added, and then the residual operation is performed with the output of the downsampling multi-scale module to prevent overfitting and obtain spatiotemporal feature information;
[0014] Step 2-4: Using the inter-segment attention layer, the interacting temporal segments represent global correlations;
[0015] Step 2-5: Aggregate spatiotemporal information across scales, i.e. add each layer of information in sequence;
[0016] Step 2-6: Input the prediction module consisting of two layers of activation functions and one-dimensional convolution, dynamically adjust the dimensions of the required output data to perform two prediction tasks: single-step prediction output of the predicted value Y at a single time step Q T+Q ; The forecast sequence for a period of time output by multi-step forecasting is [Y T+1 , Y T+2 ,...,Y T+Q ];
[0017] Step 3: For the two prediction tasks, the corresponding evaluation indicators are used for evaluation respectively, and then the optimization algorithm is used to perform back propagation of time series prediction, update the model parameters, and reduce the model training loss value; the loss function is used to measure the error between the predicted value and the true value in the single-step prediction, and the loss function includes relative square error (RSE) and correlation coefficient (CORR); the mean absolute error (MAE), root mean square error (RMSE), and CORR are used in multi-step prediction;
[0018] Step 4: Use the early stopping strategy to speed up model training. When the training loss reaches the set number of iterations without decreasing continuously, stop the current round of training and save the weight corresponding to the previous lowest loss value as the optimal model.
[0019] Step 5: Use the test set data to test the model performance and output the model test loss value, and obtain the predicted time series value of the prediction output of the prediction module as the prediction result;
[0020] Step 6: Use the prediction results to predict the one-dimensional indicator data of the database to be predicted, and monitor the operation status of the database system in real time.
[0021] Furthermore, the specific description of the division of the training set, validation set, and test set mentioned in step 1 is as follows:
[0022] Step 1-1: In single-step prediction, the training set, validation set, and test set are divided in a ratio of 6:2:2. In multi-step prediction, in order to enhance the model's ability to capture the interactivity between nodes, the time step offsets of the input and output sequences are defined, time features are added (such as the position of each time step in a day and the position of each time step in a week), and the sliding window method is used to increase the sample size, generating the input and output data required for training, validation, and testing in a ratio of 7:1:2.
[0023] Furthermore, the downsampling division of the multi-scale layer in step 2-1 specifically performs the following steps:
[0024] Step 2-1-1, obtaining a preset convolution kernel size array corresponding to the number of scale layers; the convolution kernel size values in the preset convolution kernel size array decrease in sequence as the scale layer increases;
[0025] Step 2-1-2, the input data is convolved with 1×1 convolution and convolution kernel size corresponding to the first scale layer to obtain the first scale layer 1;
[0026] Step 2-1-3, based on the first scale layer, the current scale layer is used as input and divided into two paths for downsampling. The downsampling process is as follows: the first path passes through the 1×1 convolution of the residual; the second path passes through the convolution of the convolution kernel size corresponding to the next scale layer and the pooling of the pooling kernel size of 1×3, and then the two results are added to obtain the next scale layer;
[0027] Step 2-1-4, and so on, after each downsampling, the convolution kernel size of the second convolution is reduced in sequence according to the preset number of layers in the downsampling process until the downsampling of the preset minimum convolution kernel size is completed, and multiple scale layers are obtained.
[0028] Specifically, taking the 3-layer as an example, the convolution kernel size is set to [7, 6, 3] according to the preset size value;
[0029] First, after 1×1 convolution and 1×7 convolution, the first scale layer 1 is obtained. The downsampling process in the next step includes: one 1×1 convolution for residual; another 1×6 convolution and 1×3 pooling, and finally the two results are added to obtain scale layer 2. Then, based on scale layer 2, downsampling is also performed to obtain scale layer 3, but the convolution kernel size of the second convolution is the preset size [7,6,3] corresponding to scale layer 3, so it is 1×3, and the pooling kernel size remains unchanged. The subsequent time expansion dual attention module and static feature fusion dynamic GCN module are included in each scale layer.
[0030] Furthermore, the time dilation dual attention module (TDDA) in step 2-2 is specifically:
[0031] Step 2-2-1: The output of the downsampling multi-scale module is the data input of this module and is sent to two parallel processing paths, and the two input paths are consistent.
[0032] Step 2-2-2: One of them is a parallel temporal convolution layer and a temporal attention layer. The parallel temporal convolution layer divides the input data into four paths and sends them to four "filters", that is, expansion layers with convolution kernels of "1×1, 1×2, 1×3, 1×6", with an initial expansion rate of 1 and a subsequent expansion rate of 2. l-1 Increase, l is the number of layers. Then each path passes through the gating unit (only one path has a Sigmoid function). Add the information of each path one by one, and finally concatenate the four paths of information to get Z1 (the information of each path is first truncated according to the length after the maximum "1×6" convolution). After data Z1 reaches the temporal attention layer, we get:
[0033] Z T =Sigmoid(Conv 1×1 (ReLU(BN(Conv 1×3 (Z1))))) (1)
[0034] Among them, Conv 1×1 、Conv 1×3 represents the convolution operation, Z T is the weight coefficient generated by the temporal attention layer, which gives different degrees of attention to information at different time steps and captures temporal dependencies.
[0035] Step 2-2-3: The other path is a parallel temporal convolution layer and a deep channel attention layer. The latter is composed of a deep separable convolution and a channel attention layer. The deep separable convolution uses a convolution kernel for each channel of the input sequence, and then uses point-by-point convolution to achieve information interaction between space and channels, reduce parameter calculations, and deepen the network depth. Therefore, a deep separable convolution is used to obtain different attention for each channel; the deep channel attention is further adaptively averaged pooled F.AAP , combined with one-dimensional convolution, the model can focus on learning the features of different channels and focus on the features that are beneficial to the prediction task. After the deep channel attention layer, we get:
[0036] Z C =Sigmoid(Conv 1×1 (F AAP (Conv dw (Z1)))) (2)
[0037] Above, Conv dw Represents depthwise separable convolution.
[0038] Step 2-2-4: The features extracted by two different attention mechanisms pass through the Tanh and Sigmoid gating units respectively.
[0039] Furthermore, the static feature fusion dynamic GCN module in step 2-3 is specifically:
[0040] Step 2-3-1: The dynamic GCN module is mainly used to generate a dynamically evolving graph structure, using a series of GRUs to generate the adjacency matrix for each time period. Therefore, one input of the GRU is a number of time segments [Sec1,Sec 2,...,Secn] divided into a given length, and the mean aggregator is used to aggregate the features to obtain [ρ 1 ,ρ 2 ,...,ρ n ].
[0041] In addition, another initial input of GRU is trend information X tr With Season InformationX s :X tr =F(padding(X)),X s =XX tr F() represents the use of a moving average kernel, and the difference between the original sequence and the trend term is the seasonal term. Then use the fully connected layer FC modeling and superimpose these two types of information as the initial input of the GRU:
[0042] Z initial =FC(X tr )+FC(X s ) (3)
[0043] Step 2-3-2: The above two eigenvectors: [ρ 1 ,ρ 2 ,...,ρ n ]、Z initial It is fed into the GRU, and the hidden state of the GRU is dynamically passed backward to generate an embedding vector with randomly initialized node embedding vectors Construct the adjacency matrix to generate the first dynamic adjacency matrix For example:
[0044]
[0045] In the above formula, β is the hyperparameter that controls the saturation rate of the Tanh activation function, W1 and W2 are model parameters, is a learnable node embedding vector. is the transformed feature representation of the embedding vector; idx is the index of the first k features selected. is the embedding vector generated by GRU. In order to reduce the subsequent training parameters, argtopk represents selecting the first k nodes with the greatest correlation with node i for operation, and at the same time, formula (8) sets the weight of its unconnected nodes to 0.
[0046] Step 2-3-3: Input the adjacency matrix and the information of each time segment in step 2-3-1 into GCN to aggregate node neighbor information and capture spatial correlation. The structure of the graph convolutional network consists of two hybrid jump propagation layers. The information propagation of one hybrid jump propagation layer is:
[0047]
[0048] In the above formula, H (j-1) is the hidden state output of the previous layer, H (j) is the current hidden state output, γ is used to determine the proportion of source information retained, is a diagonal matrix, A is an adjacency matrix, and I is an identity matrix. is the information update value, j is the propagation depth, W (j) is a model parameter used to dynamically adjust the original feature information. Then, the GCN values corresponding to each fragment adjacency matrix are concatenated.
[0049] Step 2-3-4: Embed the 7 static information vectors with randomly initialized node vector Constructing a static adjacency matrix Similarly, the undivided time information is fed into the graph convolutional network to update the node feature information.
[0050] Step 2-3-5: Sum the value of the dynamic GCN and the value of the static GCN.
[0051] Specifically, the inter-fragment attention layer in step 2-4 is as follows: Since the static feature fusion dynamic GCN module has concatenated the GCN values of each fragment, the input sequence needs to be split into n blocks according to the same preset size as step 2-3-1, combined with the feature embedding dimension d mWith the dimension S of the segment length, we get d = S·d m , then enter X in Perform linear mapping to obtain Q in , K in 、V in , and then use the self-attention mechanism to represent the global correlation: Finally, the results of each segment are spliced together.
[0052] Furthermore, the evaluation indicators mentioned in step 3 are specifically:
[0053] Step 3-1: The time input window length is 168, the prediction output length in single-step prediction is 1, and the prediction output length in multi-step prediction is 12. The indicators used are:
[0054]
[0055] Among them, Y r , are the true value and the predicted value respectively, is the number of samples, and N is the number of features. The lower the RSE, MAE, and RMSE values, the better, and the higher the CORR value, the better.
[0056] Furthermore, in step 4, an early stopping strategy is used to speed up model training. When the training loss does not decrease for 15 consecutive epochs, the current round of training is stopped, and the weight corresponding to the previous lowest loss value is saved as the optimal model.
[0057] The present invention adopts the above technical scheme, and the designed time capture layer can capture the time dependency of each feature and the correlation between features of different categories, and can flexibly apply data information of different periods to extract local and global dependencies; and the graph convolutional network (GCN) can propagate and aggregate node features to solve the problem of processing non-grid data; on this basis, the dynamic graph construction layer fused with static information can learn the relationship between static and dynamic features and analyze the data more comprehensively, and the adjacency matrix generated by different time segments can also reflect the continuously changing time series characteristics, overcoming the drawbacks of sharing the adjacency matrix and improving the prediction accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments;
[0059] Figure 1 It is a schematic diagram of the overall framework of the database indicator data prediction method based on dual attention and static fusion GCN of the present invention;
[0060] Figure 2 is a schematic diagram of the time-expanded dual attention layer of the present invention;
[0061] Figure 3 This is a schematic diagram of the static feature fusion dynamic GCN module of the present invention;
[0062] Figure 4 This is a flowchart of the steps of the database indicator data prediction method based on dual attention and static fusion GCN of the present invention. Implementation
[0063] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0064] like Figures 1 to 4 As shown in one, the present invention discloses a database indicator data prediction method based on dual attention and static fusion GCN, comprising the following steps:
[0065] Step 1: Collect one-dimensional index data sequence X=[s t [i]]∈R N×T ,t∈[1,2,…,T],i∈[1,2,…,N],X represents the historical observations of T timestamps,N represents the number of variable features,s t [i]∈R N×1 Indicates the value of the i-th variable at timestamp t. As shown in Table 1, 25 indicator data within the target time period are selected as the multivariate time series data set. At the same time, 7 static configuration information of the corresponding servers of the database operation are collected, as shown in Table 2. Data preprocessing is performed, missing values are linearly interpolated, outliers are removed (values outside the threshold are replaced by the mean of the first 5 numbers); static information needs to be generated by Word2Vec word embedding vectors. The 25 processed data are divided into training set, test set and validation set in proportion.
[0066] Table 1: 25 database indicators
[0067]
[0068] Table 2: 7 static configuration information
[0069] Serial number index Serial number index 1 Server Model 2 Database installation date 3 Installation location 4 CPU model 5 Running memory 6 Disk Capacity 7 User version
[0070] Step 2: The database indicator data prediction method includes sequentially connecting a downsampling multi-scale module, a time expansion dual attention module, a static feature fusion dynamic GCN module, and an inter-fragment attention and prediction module to construct a database indicator data prediction model. The database indicator data prediction model specifically performs the following steps:
[0071] Step 2-1: Use the preset downsampling to divide the multi-scale layers to capture the temporal correlation of the time series at different scales, and can also flexibly deal with long sequence data.
[0072] Furthermore, the downsampling division of the multi-scale layer in step 2-1 specifically performs the following steps:
[0073] Step 2-1-1, obtaining a preset convolution kernel size array corresponding to the number of scale layers; the convolution kernel size values in the preset convolution kernel size array decrease in sequence as the scale layer increases;
[0074] Step 2-1-2, the input data is convolved with 1×1 convolution and convolution kernel size corresponding to the first scale layer to obtain the first scale layer 1;
[0075] Step 2-1-3, based on the first scale layer, the current scale layer is used as input and divided into two paths for downsampling. The downsampling process is as follows: the first path passes through the 1×1 convolution of the residual; the second path passes through the convolution of the convolution kernel size corresponding to the next scale layer and the pooling of the pooling kernel size of 1×3, and then the two results are added to obtain the next scale layer;
[0076] Step 2-1-4, and so on, after each downsampling, the convolution kernel size of the second convolution is reduced in sequence according to the preset number of layers in the downsampling process until the downsampling of the preset minimum convolution kernel size is completed, and multiple scale layers are obtained.
[0077] Specifically, taking the 3-layer as an example, the convolution kernel size is set to [7, 6, 3] according to the preset size value;
[0078] First, after 1×1 convolution and 1×7 convolution, the first scale layer 1 is obtained. The downsampling process in the next step includes: one 1×1 convolution for residual; another 1×6 convolution and 1×3 pooling, and finally the two results are added to obtain scale layer 2. Then, based on scale layer 2, downsampling is also performed to obtain scale layer 3, but the convolution kernel size of the second convolution is the preset size [7,6,3] corresponding to scale layer 3, so it is 1×3, and the pooling kernel size remains unchanged. The subsequent time expansion dual attention module and static feature fusion dynamic GCN module are included in each scale layer.
[0079] Step 2-2: Use the time-expanded dual attention module to capture temporal dependencies and extract high-level temporal features. This module consists of a parallel time convolution layer and a dual attention gate. The parallel convolution layer consists of four dilated convolution gate units, and the dilation rate increases exponentially by 2 according to the number of layers. The four-way information is gradually superimposed and spliced. Next, one path is connected to the time attention layer, which contains convolution units, BN layers, ReLU functions, and Sigmoid functions to generate time weight coefficients and extract time dependencies; the other path is connected to the deep channel attention layer, which contains deep separable convolution and channel attention. The former obtains different attention for the channel, deepens the network depth, and enables the model to focus on channel feature information that is beneficial to the prediction task. Finally, connect Tanh and Sigmoid gates to control the amount of information flow.
[0080] Step 2-3: Time series data changes in real time and cannot rely on a single shared adjacency matrix. The results of the time expansion dual attention module are input into the static feature fusion dynamic GCN module to capture spatial features. The dynamic construction layer of the graph can capture dynamic features to generate a series of adjacency matrices, which are then sent to GCN to obtain vector associations. At the same time, the static feature graph learning layer that contains the static information of the server will also generate an adjacency matrix, which is also sent to GCN. The two results are fused and added, and then combined with the output residual of the downsampling multi-scale module to prevent overfitting and obtain spatiotemporal feature information.
[0081] Step 2-4: Using the inter-segment attention layer, the interacting temporal segments represent the global correlation.
[0082] Step 2-5: Aggregate spatiotemporal information across scales, i.e. add each layer of information in sequence.
[0083] Step 2-6: Next, input the prediction module consisting of two layers of activation functions and one-dimensional convolution, which can dynamically adjust the dimension of the required output data. Perform two prediction tasks, single-step prediction output: predicted value Y at single time step Q T+Q ; Multi-step prediction output: a period of time prediction sequence [Y T+1 , Y T+2 ,...,Y T+Q ].
[0084] Step 3: Two sets of evaluation indicators are used for the two tasks. In single-step prediction, the loss functions are used: relative square error (RSE) and correlation coefficient (CORR) to measure the error between the predicted value and the true value; in multi-step prediction, the mean absolute error (MAE), root mean square error (RMSE), and CORR are used. Based on this, the optimization algorithm is used to perform back propagation of time series prediction, update model parameters, and reduce the model training loss value.
[0085] Step 4: Use the early stopping strategy to speed up model training. When the training loss does not decrease for 15 consecutive epochs, stop the current round of training and save the weight corresponding to the previous lowest loss value as the optimal model.
[0086] Step 5: Use the test set data to test the model performance, output the model test loss value, and output the predicted time series value mentioned in steps 2-6.
[0087] Step 6: Use the above prediction results to predict the one-dimensional indicator data of the database and monitor the operation status of the database system in real time.
[0088] Furthermore, the specific description of the division of the training set, validation set, and test set mentioned in step 1 is as follows:
[0089] Step 1-1: In single-step prediction, the training set, validation set, and test set are divided in a ratio of 6:2:2. In multi-step prediction, in order to enhance the model's ability to capture the interactivity between nodes, the time step offsets of the input and output sequences are defined, time features are added (such as the position of each time step in a day and the position of each time step in a week), and the sliding window method is used to increase the sample size, generating the input and output data required for training, validation, and testing in a ratio of 7:1:2.
[0090] Furthermore, the time expansion dual attention module in step 2-2 is specifically:
[0091] Step 2-2-1: The output of the downsampling multi-scale module is the data input of this module and is sent to two parallel processing paths, and the two input paths are consistent.
[0092] Step 2-2-2: One of them is a parallel temporal convolution layer and a temporal attention layer. The parallel temporal convolution layer divides the input data into four paths and sends them to four "filters", that is, expansion layers with convolution kernels of "1×1, 1×2, 1×3, 1×6", with an initial expansion rate of 1 and a subsequent expansion rate of 2. l-1 Increase, l is the number of layers. Then each path passes through the gating unit (only one path has a Sigmoid function). Add the information of each path one by one, and finally concatenate the four paths to get Z1 (the information of each path is first truncated according to the length after the maximum "1×6" convolution). After data Z1 reaches the temporal attention layer, we get
[0093] Z T =Sigmoid(Conv 1×1 (ReLU(BN(Conv 1×3 (Z1))))) (1)
[0094] Among them, Conv 1×1 、Conv 1×3 represents the convolution operation, ZT is the weight coefficient generated by the temporal attention layer, which gives different degrees of attention to information at different time steps and captures temporal dependencies.
[0095] Step 2-2-3: The other path is a parallel temporal convolution layer and a deep channel attention layer. The latter is composed of a deep separable convolution and a channel attention layer. The deep separable convolution uses a convolution kernel for each channel of the input sequence, and then uses point-by-point convolution to achieve information interaction between space and channels, reduce parameter calculations, and deepen the network depth. Therefore, a deep separable convolution is used to obtain different attention for each channel; the deep channel attention is further adaptively averaged pooled F. AAP , combined with one-dimensional convolution, the model can focus on learning the features of different channels and focus on the features that are beneficial to the prediction task. After the deep channel attention layer, we get:
[0096] Z C =Sigmoid(Conv 1×1 (F AAP (Conv dw (Z1)))) (2)
[0097] Above, Conv dw Depthwise Separable Convolution
[0098] Step 2-2-4: The features extracted by two different attention mechanisms pass through the Tanh and Sigmoid gating units respectively.
[0099] Furthermore, the static feature fusion dynamic GCN module in step 2-3 is specifically:
[0100] Step 2-3-1: The dynamic GCN module is mainly used to generate a dynamically evolving graph structure, using a series of GRUs to generate the adjacency matrix for each time period. Therefore, one input of the GRU is a number of time segments [Sec1,Sec 2,...,Secn] divided into a given length, and the mean aggregator is used to aggregate the features to obtain [ρ 1 ,ρ 2 ,...,ρ n ].
[0101] In addition, another initial input of GRU is trend information X tr With Season InformationX s :X tr =F(padding(X)),X s =XX tr F() represents the use of a moving average kernel, and the difference between the original sequence and the trend term is the seasonal term. Then use the fully connected layer FC modeling and superimpose these two types of information as the initial input of the GRU:
[0102] Z initial =FC(X tr )+FC(X s ) (3)
[0103] Step 2-3-2: The above two eigenvectors: [ρ 1 ,ρ 2 ,...,ρ n ]、Z initial It is fed into the GRU, and the hidden state of the GRU is dynamically passed backward to generate an embedding vector with randomly initialized node embedding vectors Construct the adjacency matrix to generate the first dynamic adjacency matrix For example:
[0104]
[0105] In the above formula is the transformed feature representation of the embedding vector; idx is the index of the first k features selected. is the embedding vector generated by GRU. β is the hyperparameter that controls the saturation rate of the Tanh activation function, W1 and W2 are model parameters, is a learnable node embedding vector. To reduce subsequent training parameters, argtopk represents selecting the first k nodes with the greatest correlation with node i for operation, and at the same time, formula (8) sets the weight of its unconnected nodes to 0.
[0106] Step 2-3-3: Input the adjacency matrix and the information of each time segment in step 2-3-1 into GCN to aggregate node neighbor information and capture spatial correlation. The structure of the graph convolutional network consists of two hybrid jump propagation layers. The information propagation of one hybrid jump propagation layer is:
[0107]
[0108] In the above formula, H (j-1) is the hidden state output of the previous layer, H (j) is the current hidden state output, γ is used to determine the proportion of source information retained, is a diagonal matrix, A is an adjacency matrix, and I is an identity matrix. is the information update value, j is the propagation depth, W (j) is a model parameter used to dynamically adjust the original feature information. Then, the GCN values corresponding to each fragment adjacency matrix are concatenated.
[0109] Step 2-3-4: Embed the 7 static information vectors with randomly initialized node vector Constructing a static adjacency matrix Similarly, the undivided time information is fed into the graph convolutional network to update the node feature information.
[0110] Step 2-3-5: Sum the value of the dynamic GCN and the value of the static GCN.
[0111] Specifically, the inter-fragment attention layer in steps 2-4 is:
[0112] Step 2-4-1: Since the static feature fusion dynamic GCN module has concatenated the GCN values of each fragment, the input sequence needs to be split into n blocks according to the same preset size as step 2-3-1, combined with the feature embedding dimension d m With the dimension S of the segment length, we get d = S·d m , then enter X in Perform linear mapping to obtain Q in , K in 、v in , and then use the self-attention mechanism to represent the global correlation: Finally, the results of each segment are spliced together.
[0113] Furthermore, the evaluation indicators mentioned in step 3 are specifically:
[0114] Step 3-1: The time input window length is 168, the prediction output length in single-step prediction is 1, and the prediction output length in multi-step prediction is 12. The indicators used are:
[0115]
[0116]
[0117] Among them, Y r , are the true value and the predicted value respectively, is the number of samples, and N is the number of features. The lower the RSE, MAE, and RMSE values, the better, and the higher the CORR value, the better.
[0118] The principle of the present invention is described in detail below:
[0119] like Figure 1As shown, the overall framework diagram of the model of the present invention. It mainly contains: a downsampling multi-scale module, a time expansion dual attention layer, a static feature fusion dynamic GCN layer and an inter-fragment attention layer. The downsampling multi-scale module contains multiple layers of convolution and pooling units, which are used to generate time series of different lengths. Long sequences can reflect the overall fluctuation of the data, and short sequences can reflect the local characteristics of the data. Then the data is input into the time expansion dual attention module, which contains two parallel time convolution layers, time attention and deep channel attention gates, which are used to capture the temporal correlation of features. The next step is to input it into the static feature fusion dynamic GCN layer, comprehensively consider the influence of the static configuration information of the database, and fuse the static data graph structure with the dynamic data graph structure to capture the spatial correlation of the features. Then the global correlation of the overall sequence is extracted through inter-fragment attention. Finally, the information of each scale is aggregated and the prediction result is output.
[0120] like Figure 2 As shown, the schematic diagram of the time-expanded dual attention layer of the present invention. Data is input into two parallel temporal convolutional layers (PTCL). The parallel convolutional layer is composed of four dilated convolutional gate units. The dilation rate increases exponentially by 2 according to the number of layers. The four-way information is gradually superimposed and spliced. In the next step, one channel is connected to the time attention layer, which includes convolution units, BN layers, ReLU functions, and Sigmoid functions, which are used to generate time weight coefficients and extract time dependencies; the other channel is connected to the deep channel attention layer, which includes deep separable convolution and channel attention. The former obtains different attention for the channel, deepens the network depth, and enables the model to focus on channel feature information that is beneficial to the prediction task. Finally, the Tanh and Sigmoid gates are connected to control the amount of information flow.
[0121] like Figure 3 As shown, the schematic diagram of the static feature fusion dynamic GCN module of the present invention. The input sequence is segmented according to the preset size, and input into the connected GRU together with the trend information and the seasonal information, to generate a series of embedding vectors containing time series features, and then generate a dynamic adjacency matrix that conforms to the time series changes with the randomly initialized node vector, and each matrix and the segmented information are sent to the GCN, and the results are spliced. The static embedding vector also constructs a static adjacency matrix with the randomly initialized node vector, and is sent to the GCN with the unsegmented information, and the output value is added to the above-mentioned spliced result.
[0122] like Figure 4As shown in the flowchart of the main steps of the present invention, firstly, the collected 25 kinds of database indicator data are linearly interpolated, outliers are eliminated according to the preset data range, and 7 kinds of static indicators are converted into embedded vectors using Word2Vec. The data set is divided into training set, validation set and test set in proportion, and the training set and validation set data are put into training. In the downsampling multi-scale module, scale layers with different lengths are obtained through continuous downsampling operations, and each scale layer contains a time expansion dual attention layer and a static feature fusion dynamic GCN layer. The time expansion dual attention layer is used to extract delicate and different receptive fields of time dimension information and enhance the ability to extract local information; the static feature fusion dynamic GCN layer is used to capture spatial dimension information, and the global dependency of data can be obtained by adding the inter-fragment attention layer. In the next step, the multi-scale feature information is fused, the information of each time segment is aggregated, and the predicted value is calculated. Then the loss rate is calculated, and the Adam optimization algorithm is used for back propagation to continuously update the model parameters. If the loss rate does not converge, it returns to retraining until the training loss rate converges, and the weight is saved as the optimal model. The test set data is put into the saved optimal model, and the predicted value and prediction accuracy are output.
[0123] Compared with the prior art, the present invention has the following beneficial effects:
[0124] 1. The Temporal Dilated Dual-Attention Module (TDDA) designed for temporal semantics in this invention includes a parallel temporal convolutional layer (PTCL) and temporal and deep channel attention gates. The former uses parallel dilated convolutions and gated linear units with different convolution kernel sizes to process time series information of different period lengths, and adopts a layer-by-layer accumulation method to enhance the representation of feature information. The latter combines temporal attention and deep channel attention with the data features of the time series, and can learn the importance of different historical data to the current task, and learn the weight information of different features, thereby enhancing the model's ability to extract local contextual information.
[0125] 2. The static feature fusion dynamic GCN module designed by the present invention uses a data decomposition enhancement method to extract the trend and seasonal information of the sample as the initial input of the gated recurrent unit (GRU), and generates a series of adjacency matrices to characterize the dynamic association between multidimensional variables. In addition, the static information of the fusion server is used to construct a static graph structure, which can comprehensively consider the factors affecting the operation of the database. Due to the different configuration levels of different databases, such as: a high load rate does not necessarily mean that the database is abnormal, it may be that the memory is small. This method can monitor the database performance in all directions and improve predictability. Both graph structures are fused after GCN to enhance the capture of spatial semantic information. Coupled with the processing of the attention mechanism between fragments, it is possible to grasp the interaction ability between each time fragment, obtain the global correlation of the database time series, and enhance the prediction effect.
[0126] 3. The database indicator data prediction method designed by the present invention can capture the temporal and spatial feature information, local and global information dependencies, and has made certain progress in the experimental process. Compared with other models, it also has better performance, which shows that this time series prediction algorithm design has great application prospects in the field of database security operation and maintenance.
[0127] The present invention adopts the above technical scheme, and the designed time capture layer can capture the time dependency of each feature and the correlation between features of different categories, and can flexibly apply data information of different periods to extract local and global dependencies; and the graph convolutional network (GCN) can propagate and aggregate node features to solve the problem of processing non-grid data; on this basis, the dynamic graph construction layer fused with static information can learn the relationship between static and dynamic features and analyze the data more comprehensively, and the adjacency matrix generated by different time segments can also reflect the continuously changing time series characteristics, overcoming the drawbacks of sharing the adjacency matrix and improving the prediction accuracy of the model.
[0128] Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of the present application is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians of the art without making creative work are within the scope of protection of the present application.
Claims
1. Database indicator data prediction method based on dual attention and static fusion GCN, characterized by: It includes the following steps: Step 1: Select different types of one-dimensional indicator data sequences within the target time period to form a multivariate time series data set, and divide the indicator data into training set, test set and validation set according to the set ratio after data preprocessing and cleaning. The set ratios for different prediction tasks are different. At the same time, collect the static configuration information of the corresponding server of the database operation, and generate the embedding vector through the word embedding technology Word2Vec; Step 2: Build a database index data prediction model, which is divided into the following modules connected in sequence: downsampling multi-scale module, time expansion dual attention module, static feature fusion dynamic GCN module, inter-fragment attention and prediction module; the downsampling multi-scale module contains multiple layers of convolution and pooling units, which are used to generate time series of different lengths. Long sequences reflect the overall fluctuation of the data, and short sequences reflect the local characteristics of the data; the result data of the downsampling multi-scale module is input into the time expansion dual attention module, which contains two parallel time convolution layers, time attention and depth channel attention gates, which are used to capture the temporal correlation of features; The static feature fusion dynamic GCN layer comprehensively considers the influence of the static configuration information of the database, fuses the static data graph structure with the dynamic data graph structure, captures the spatial correlation of the features; extracts the global correlation of the entire sequence through inter-fragment attention; and finally aggregates the information at each scale to output the prediction result; The database indicator data prediction model performs the following steps: Step 2-1, use the preset downsampling to divide the multi-scale layer, generate time series of different lengths, and capture the temporal correlation of time series at different scales; Long sequences reflect the overall fluctuation of the data, while short sequences reflect the local characteristics of the data. Step 2-2, use the time dilation dual attention module to capture temporal dependencies and extract high-level temporal features; The temporal dilation dual attention module consists of parallel temporal convolutional layers and dual attention gates; Step 2-3: The result of the time expansion dual attention module is input into the static feature fusion dynamic GCN module to capture spatial features. The dynamic graph construction layer based on GRU is used to capture dynamic change features to generate a series of adjacency matrices, which are sent to the graph convolutional network to obtain vector associations. At the same time, the static feature graph learning layer of the server static information is used to generate an adjacency matrix, which is also sent to the graph convolutional network. The two results are fused and added, and then the residual operation is performed with the output of the downsampling multi-scale module to prevent overfitting and obtain spatiotemporal feature information. Step 2-4: Using the inter-segment attention layer, the interacting temporal segments represent global correlations; Step 2-5: Aggregate spatiotemporal information across scales, i.e. add each layer of information in sequence; Step 2-6: Input the prediction module consisting of two layers of activation functions and one-dimensional convolution, dynamically adjust the dimensions of the required output data to perform two prediction tasks to obtain prediction results; among them, the predicted value Y at a single time step Q output by the single-step prediction T+Q ; The forecast sequence for a period of time output by multi-step forecasting is [Y T+1 , Y T+2 , ..., Y T+Q ]; Step 3: For the two prediction tasks, the corresponding evaluation indicators are used for evaluation respectively, and then the optimization algorithm is used to perform back propagation of time series prediction, update the model parameters, and reduce the model training loss value; the loss function is used in single-step prediction to measure the error between the predicted value and the true value, and the loss function includes relative square error RSE and correlation coefficient CORR; the mean absolute error MAE, root mean square error RMSE, and correlation coefficient CORR are used in multi-step prediction to measure the error between the predicted value and the true value; Step 4: Use the early stopping strategy to speed up model training. When the training loss reaches the set number of iterations without decreasing continuously, stop the current round of training and save the weight corresponding to the previous lowest loss value as the optimal model. Step 5: Use the test set data to test the model performance and output the model test loss value, and obtain the time series value of the prediction output of the prediction module as the prediction result; Step 6: Use the prediction results to predict the one-dimensional indicator data of the database to be predicted, and monitor the operation status of the database system in real time.
2. The database indicator data prediction method based on dual attention and static fusion GCN according to claim 1 is characterized by: In step 1, the one-dimensional index data sequence X of the database is t [i]]∈R N×T , t∈[1, 2, ..., T], i∈[1, 2, ..., N], X represents the historical observations of T timestamps, N represents the number of variable features, s t [i]∈R N×1 represents the value of the i-th variable at timestamp t; in step 1, 25 indicator data within the target time period are selected as the multivariate time series data set, and the data collection speed is once per minute; 7 static configuration information of the corresponding server of database operation is collected; Data preprocessing includes linear interpolation of missing values and removal of outliers.
3. The database indicator data prediction method based on dual attention and static fusion GCN according to claim 1 is characterized by: The specific description of the division of training set, validation set and test set mentioned in step 1 is as follows: in single-step prediction, the training set, validation set and test set are divided according to the ratio of 6:2:2; in multi-step prediction, the sliding window method is used to increase the sample size, and the input data required for training, validation and testing are generated according to the ratio of 7:1:
2.
4. The database indicator data prediction method based on dual attention and static fusion GCN according to claim 1 is characterized in that: The downsampling division multi-scale layer in step 2-1 specifically performs the following steps: Step 2-1-1, obtaining a preset convolution kernel size array corresponding to the number of scale layers; the convolution kernel size values in the preset convolution kernel size array decrease in sequence as the scale layer increases; Step 2-1-2, the input data is convolved with 1×1 convolution and convolution kernel size corresponding to the first scale layer to obtain the first scale layer 1; Step 2-1-3, based on the first scale layer, the currently obtained scale layer is used as input and divided into two paths for downsampling. The downsampling process is as follows: the first path passes through the 1×1 convolution of the residual; The second path is convolution with the convolution kernel size corresponding to the next scale layer and pooling with a pooling kernel size of 1×3, and then the two results are added to obtain the next scale layer; Step 2-1-4, and so on, after each downsampling, the convolution kernel size of the second convolution is reduced in sequence according to the preset number of layers in the downsampling process until the downsampling of the preset minimum convolution kernel size is completed, and multiple scale layers are obtained.
5. The database indicator data prediction method based on dual attention and static fusion GCN according to claim 1 is characterized in that: The time-expanded dual attention module in step 2-2 specifically performs the following steps: Step 2-2-1: Send the output of the downsampling multi-scale module as data input to two parallel processing paths respectively, and the two input paths are consistent; Step 2-2-2: One of them is a parallel temporal convolution layer and a temporal attention layer. The parallel temporal convolution layer divides the input data into four paths and sends them to four "filters", that is, the expansion layers with convolution kernels of "1×1, 1×2, 1×3, 1×6" respectively. The initial expansion rate is 1, and then the expansion rate is 2. l-1 Increase, l is the number of layers; then each path passes through the gating unit, and only one path has a Sigmoid function; add the information of each path one by one, and finally concatenate the four paths of information to obtain data Z1, and the information of each path is first truncated according to the length after the maximum "1×6" convolution; after data Z1 reaches the temporal attention layer, the weight coefficient Z of the temporal attention layer is obtained T , giving different degrees of attention to information at different time steps, capturing time dependence; weight coefficient Z T The specific expression is as follows: Z T =Sigmoid(Conv 1×1 (ReLU(BN(Conv 1×3 (Z1))))) (1) Among them, Conv 1×1 、Conv 1×3 represents the convolution operation, Z T is the weight coefficient generated by the temporal attention layer; Step 2-2-3: The other path is a parallel temporal convolution layer and a deep channel attention layer; the deep channel attention layer is composed of a deep separable convolution and a channel attention layer; the deep separable convolution uses a convolution kernel for each channel of the input sequence, and then uses point-by-point convolution to achieve information interaction between space and channels, and obtain different attention for each channel; the deep channel attention layer further uses adaptive average pooling F AAP , combined with one-dimensional convolution, the model can focus on learning the features of different channels and focus on the features that are beneficial to the prediction task; after the deep channel attention layer, the weight coefficient Z of the deep channel attention layer is obtained C The specific expression is as follows: Z C =Sigmoid(Conv 1×1 (F AAP (Conv dw (Z1)))) (2) Among them, Conv dw represents depthwise separable convolution; Step 2-2-4: Pass the features extracted by the two different attention mechanisms through the Tanh and Sigmoid gating units to obtain the corresponding features.
6. The database indicator data prediction method based on dual attention and static fusion GCN according to claim 1 is characterized by: The static feature fusion dynamic GCN module in step 2-3 is specifically: Step 2-3-1: The dynamic GCN module is used to generate a dynamically evolving graph structure. A series of GRUs are used to generate the adjacency matrix for each time period. Two feature vectors of the input GRU are calculated separately: One input of GRU is multiple time segment information [Sec 1, Sec 2, ..., Sec n] divided into a given length, and each segment feature is aggregated using the mean aggregator to obtain the aggregate feature [ρ 1 , ρ 2 , ..., ρ n ]; Another initial input of GRU is trend information X tr =F(padding(X)) and season information X s =XX tr , F( ) represents the use of a moving average kernel, and the difference between the original sequence and the trend term is the seasonal term; and the fully connected layer FC is used to model and superimpose the two types of information as the initial input of the GRU; Z initial =FC(X tr )+FC(X s ) (3); Step 2-3-2: Set [ρ 1 , ρ 2 , ..., ρ n ] and Z initial The two feature vectors are fed into the GRU and dynamically passed backward by the hidden state of the GRU, while generating the embedding vector Then with the randomly initialized node embedding vector Construct an adjacency matrix; Step 2-3-3: Input the adjacency matrix and each time segment information into the graph convolutional network to aggregate the node neighbor information, obtain the GCN value of each segment adjacency matrix, capture the spatial correlation, and then splice the GCN values corresponding to each segment adjacency matrix to obtain the dynamic GCN value; The structure of the graph convolutional network consists of two hybrid jump propagation layers, and the information propagation of one hybrid jump propagation layer is: Among them, H (j-1) is the hidden state output of the previous layer, H (j) is the current hidden state output, γ is used to determine the proportion of source information retained, is a diagonal matrix, A is an adjacency matrix, and I is an identity matrix; is the information update value, j is the propagation depth, W (j) is a model parameter used to dynamically adjust the original feature information; Step 2-3-4: Embed the static configuration information into a vector with randomly initialized node vector Constructing a static adjacency matrix Similarly, the static adjacency matrix The undivided time information is fed into the graph convolutional network to update the node feature information and obtain the value of the static GCN; Step 2-3-5: Sum the value of the dynamic GCN and the value of the static GCN.
7. The database indicator data prediction method based on dual attention and static fusion GCN according to claim 6 is characterized by: The first dynamic adjacency matrix generated in step 2-3-2 The specific expression is as follows: in, is the transformed feature representation of the embedded vector; idx is the index of the first k features selected; is the embedding vector generated by GRU; β is the hyperparameter that controls the saturation rate of the Tanh activation function; W1 and W2 are model parameters, is a learnable node embedding vector; argtopk means selecting the first k nodes with the greatest correlation with node i for operation; Indicates setting the weight of no connections to 0.
8. The database indicator data prediction method based on dual attention and static fusion GCN according to claim 1 is characterized by: The inter-fragment attention layer in steps 2-4 is as follows: the output of the static feature fusion dynamic GCN module is used as the input sequence X in Split into n blocks according to the preset size, combined with the feature embedding dimension d m With the dimension S of the segment length, we get d = S·d m ; Then input sequence X in Perform a linear mapping to obtain Q in , K in 、V in , and use the self-attention mechanism to get the global correlation: Finally, the results of each segment are spliced together.
9. The database indicator data prediction method based on dual attention and static fusion GCN according to claim 1 is characterized by: The evaluation indicators mentioned in step 3 are as follows: the time input window length is 168, the prediction output length in single-step prediction is 1; the prediction output length in multi-step prediction is 12; the indicators used are: Among them, Y r , are the true value and the predicted value respectively, is the number of samples, and N is the number of features.
10. The database indicator data prediction method based on dual attention and static fusion GCN according to claim 1 is characterized by: In step 4, the early stopping strategy is used to speed up the model training. When the training loss does not decrease for 15 consecutive epochs, the current round of training is stopped, and the weight corresponding to the previous lowest loss value is saved as the optimal model.
Citation Information
Cited By
Yangtze river water level prediction method of hybrid model
CN119990411A
Marine hydrometeorological data fusion processing method based on deep learning fusion
CN120067973A
Industrial time sequence prediction method and system
CN120873572A
Lithium battery capacity prediction method and system based on GTSFormer model
CN121167661A
Cross-resolution AI downscaling method based on VAR
CN121456836A
