A time series data frequent pattern mining method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-25
- Publication Date
- 2026-08-11
AI Technical Summary
[0006]本发明的目的是为解决现有频繁模式挖掘方法存在的计算复杂度高以及功耗高的问题,而提出了一种时间序列数据频繁模式挖掘方法
[0025] This invention achieves efficient and accurate detection of repetitive pattern data by optimizing the calculation efficiency of the DTW distance lower bound and improving the similarity matching strategy. By introducing a Boolean mask vector M, elements detrimental to the effectiveness of the lower bound are selectively masked, further improving the tightness and filtering capability of the lower bound. Addressing the limitation of LB_DIAG's reliance on a global mask vector, this invention proposes calculating a locally adaptive mask vector for each diagonal. Dynamically adjusting the mask vector by analyzing the element distribution characteristics of each diagonal subsequence further improves the filtering effect of the lower bound. By first using the computationally efficient LB_DIAG for initial filtering, and then employing a cascaded filtering strategy using a traditional tight lower bound for fine filtering, the number of candidate pairs entering the precise DTW distance calculation can be reduced. Furthermore, the combination of sliding window technology and inner product operations reduces the computational time complexity, significantly improving the calculation speed.
Smart Images

Figure CN121278670B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of CPU utilization data processing technology, specifically relating to a method for mining frequent patterns in time series data. Background Technology
[0002] In the era of big data and the Internet of Things, the large-scale application of time series data (such as sensor data and industrial monitoring signals) has created an urgent need for low-power computing. Dynamic Time Warping (DTW), as a core technology for time series similarity analysis, has extensive applications in processing real-world datasets (Sara Alaee, Kaveh Kamgar, and Eamonn Keogh. 2020. Matrix profile XXII: exact discovery of time series motifs under DTW. In 2020 IEEE International Conference on Data Mining (ICDM). IEEE, 900–905.), and is indispensable in motif discovery (a fundamental task in frequent pattern mining) (B. Chiu, E. Keogh, and S. Lonardi, “Probabilistic discovery of time series motifs,” in Proceedings of the ninth ACM SIGKDD international conference on Knowledge discovery and datamining, 2003, pp. 493–498.). However, its traditional algorithms face significant challenges of high time complexity and high computational power consumption, specifically manifested in the following ways:
[0003] CPU utilization time-series data in computer systems often exhibits periodic or quasi-periodic fluctuations. When CPU utilization fluctuates frequently and shows a certain regularity within a specific time period, this pattern often indicates the presence of repetitive tasks or abnormal behaviors in the system. For example, in some cases, periodic spikes in CPU utilization may indicate that an application is experiencing lag, that background task scheduling is under abnormal pressure, or even that malicious program activity is taking place.
[0004] In this context, frequent pattern mining techniques (such as motif discovery) can effectively identify these semantically meaningful recurring patterns, thus providing strong support for system performance monitoring, anomaly detection, and task optimization. However, traditional DTW-based frequent pattern mining methods are computationally complex and energy-intensive, making them difficult to operate efficiently in resource-constrained scenarios (such as embedded systems and edge computing devices). Especially when processing large-scale CPU utilization monitoring data, the high time complexity and memory consumption of traditional algorithms limit their real-time performance and deployability.
[0005] Therefore, how to reduce computational complexity and improve energy efficiency while ensuring mining accuracy has become a key challenge for the application of current time series frequent pattern mining technology in the field of system monitoring. Summary of the Invention
[0006] The purpose of this invention is to solve the problems of high computational complexity and high power consumption in existing frequent pattern mining methods, and to propose a frequent pattern mining method for time series data.
[0007] The technical solution adopted by the present invention to solve the above-mentioned technical problems is as follows:
[0008] According to one aspect of the present invention, a method for mining frequent patterns in time series data, the method specifically includes the following steps:
[0009] Step 1: Use a sliding window of length L to slide over a CPU utilization data sequence of total length n, with a sliding step size of 1. When the window slides to each position, the data within the window forms a subsequence.
[0010] Normalize each subsequence to obtain normalized subsequences; calculate the upper and lower envelopes of each normalized subsequence, and determine the initial value of the bsf array based on the obtained subsequences.
[0011] Step 2: Initialize the mask vector. The mask vector is a vector of length L with all elements being 1. Use the initialized mask vector to filter the subsequence pairs to obtain the remaining subsequence pairs after the first filtering.
[0012] Step 3: Generate a mask vector according to the LB_local method, and perform a second filtering on the remaining subsequence pairs in Step 2 based on the generated mask vector to obtain the remaining subsequence pairs after the second filtering;
[0013] Step 4: Generate a mask vector using the LB_global method. Then, perform a third filter on the remaining subsequence pairs after the second filter based on the generated mask vector to obtain the remaining subsequence pairs after the third filter.
[0014] Step 5: Use LB_KEOGH and LB_Petitjean to filter the remaining subsequence pairs after the third filtering to obtain the final remaining subsequence pairs;
[0015] Step 6: Calculate the DTW distance for each remaining subsequence pair, and obtain the subsequence pair corresponding to the minimum DTW distance. The data of the obtained subsequence pairs is the mined repeating pattern data.
[0016] According to another aspect of the present invention, a method for mining frequent patterns in time series data, the method specifically includes the following steps:
[0017] Step 1: Use a sliding window of length L to slide over a CPU utilization data sequence of total length n, with a sliding step size of 1. When the window slides to each position, the data within the window forms a subsequence.
[0018] Normalize each subsequence to obtain normalized subsequences; calculate the upper and lower envelopes of each normalized subsequence, and determine the initial value of the bsf array based on the obtained subsequences.
[0019] Step 2: Construct an (n-L+1)×(n-L+1) matrix, where the elements in the i-th and j-th rows represent the subsequence S. i With S j In the matrix, the elements corresponding to the subsequence pairs that satisfy ji=L+1 are taken as the starting diagonal, and the region from the starting diagonal to the upper right corner of the matrix is taken as the region to be divided.
[0020] Set the size of the parallelogram region, and divide the region to be divided into parallelograms along the horizontal direction of the matrix starting from the starting diagonal. This division results in several parallelogram regions, and each row of parallelogram regions needs to cover the right boundary of the matrix corresponding to the current row.
[0021] Step 3: For any parallelogram region, sequentially use the initial mask vector, the mask vector generated by the LB_local method, the mask vector generated by the LB_global method, and the LB_KEOGH method to filter each sub-sequence pair within the parallelogram region. Multi-threading is used to perform the filtering operation. The filtering operation obtains sub-sequence pairs within the parallelogram region whose DTW distance lower bound is less than the value of the bsf array. The DTW distance of these sub-sequence pairs is calculated, and the value of the bsf array is updated based on the minimum DTW distance corresponding to the parallelogram region.
[0022] The parallelogram regions are traversed sequentially, that is, the parallelograms in odd-numbered rows are traversed from left to right, and the parallelograms in even-numbered rows are traversed from right to left.
[0023] After all parallelogram regions have been traversed, the subsequence pairs corresponding to the final values stored in the bsf array are the recurring pattern data obtained from mining.
[0024] The beneficial effects of this invention are:
[0025] This invention achieves efficient and accurate detection of repetitive pattern data by optimizing the calculation efficiency of the DTW distance lower bound and improving the similarity matching strategy. By introducing a Boolean mask vector M, elements detrimental to the effectiveness of the lower bound are selectively masked, further improving the tightness and filtering capability of the lower bound. Addressing the limitation of LB_DIAG's reliance on a global mask vector, this invention proposes calculating a locally adaptive mask vector for each diagonal. Dynamically adjusting the mask vector by analyzing the element distribution characteristics of each diagonal subsequence further improves the filtering effect of the lower bound. By first using the computationally efficient LB_DIAG for initial filtering, and then employing a cascaded filtering strategy using a traditional tight lower bound for fine filtering, the number of candidate pairs entering the precise DTW distance calculation can be reduced. Furthermore, the combination of sliding window technology and inner product operations reduces the computational time complexity, significantly improving the calculation speed.
[0026] Meanwhile, this invention proposes a GPU acceleration solution that utilizes the parallel computing capabilities of GPUs to distribute the lower bound calculation tasks on the diagonal to different threads, while optimizing memory access patterns, reducing the frequency of global memory access, significantly improving the processing speed of large-scale data, and reducing the power consumption during the calculation process. Attached Figure Description
[0027] Figure 1 This is a flowchart of a method for mining frequent patterns in time series data according to the present invention;
[0028] Figure 2 This is a diagram illustrating the calculation along the diagonal;
[0029] Figure 3 This is a diagram showing the comparison of mask vector effects;
[0030] Figure 4 This is a diagram illustrating GPU computing deployment. Detailed Implementation
[0031] Specific implementation method one: Combining Figure 1 This embodiment describes a method for mining frequent patterns in time series data, which specifically includes the following steps:
[0032] Step 1: Use a sliding window of length L to slide over a CPU utilization data sequence of total length n, with a sliding step size of 1. When the window slides to each position, the data within the window forms a subsequence.
[0033] Normalize each subsequence to obtain normalized subsequences; use monotonic queues to calculate the upper and lower envelopes of each normalized subsequence, and determine the initial value of the bsf (best-so-far) array based on the obtained subsequences.
[0034] Step 2: Initialize the mask vector. The mask vector is a vector of length L with all elements being 1. Use the initialized mask vector to filter the subsequence pairs to obtain the remaining subsequence pairs after the first filtering.
[0035] Step two of this invention is the preliminary filtering performed using the LB_DIAG algorithm;
[0036] Step 3: Generate a mask vector according to the LB_local method, and perform a second filtering on the remaining subsequence pairs in Step 2 based on the generated mask vector to obtain the remaining subsequence pairs after the second filtering;
[0037] Step 4: Generate a mask vector using the LB_global method. Then, perform a third filter on the remaining subsequence pairs after the second filter based on the generated mask vector to obtain the remaining subsequence pairs after the third filter.
[0038] Step 5: Use LB_KEOGH and LB_Petitjean to filter the remaining subsequence pairs after the third filtering to obtain the final remaining subsequence pairs;
[0039] Step 6: Calculate the DTW distance for each remaining subsequence pair (the traditional method can be used for DTW distance calculation), and obtain the subsequence pair corresponding to the minimum DTW distance. The data of the obtained subsequence pairs is the mined repeating pattern data.
[0040] Specific Implementation Method Two: This implementation method differs from Specific Implementation Method One in that the initial value of the BSF array is determined based on the obtained sub-sequences, specifically as follows:
[0041] Calculate the Euclidean distance between any two subsequences obtained in step one (it should be noted that any two subsequences here should be two subsequences that satisfy |ij|=ID≥L), and then select the N pairs of subsequences corresponding to the smallest Euclidean distance;
[0042] For any selected subsequence pair, calculate the DTW value of the two subsequences in the subsequence pair. After traversing to N subsequence pairs, select the minimum DTW distance from the DTW values of the N subsequence pairs and use the minimum DTW distance as the initial value of the bsf array.
[0043] The other steps and parameters are the same as in Specific Implementation Method 1.
[0044] For example, when the window length is 100, the first subsequence includes the first to the 100th elements of the data sequence, the second subsequence includes the second to the 101st elements of the data sequence, and so on.
[0045] Specific Implementation Method Three: This implementation method differs from Specific Implementation Method One or Two in that the normalization of each subsequence is performed as follows:
[0046] For the i-th subsequence S i :
[0047]
[0048] Among them, S i [l] represents the value of the l-th element in the i-th subsequence. S represents i The normalized value of [l], μ i Let σ represent the mean of all elements in the i-th subsequence. i Let represent the standard deviation of all elements in the i-th subsequence.
[0049] Other steps and parameters are the same as in specific implementation method one or two.
[0050] Specific Implementation Method Four: This implementation method differs from Specific Implementation Methods One to Three in that, in step two, the initialized mask vector M is used. j The subsequence pairs are filtered to obtain the remaining subsequence pairs after the first filtering; the specific process is as follows:
[0051] Step 2: Initialize ID = L;
[0052] Step 2: For any subsequence pair that satisfies |ij| = ID, this subsequence pair is formed by the i-th subsequence S. i and the j-th subsequence S j Composition, calculation of S i With S j LB between KimFL distance:
[0053]
[0054] where, r1 = min{(S i [2] - S j [1]) 2 , (S i [2] - S j [2]) 2 , (S i [1] - S j [2]) 2};
[0055] r2 = min{(S i [L - 1] - S j [L] 2 , (S i [L - 1] - S j [L - 1]) 2 , (S i [L] - S j [L - 1]) 2};
[0056] r3 = min{(S i [1] - S j [3]) 2 , (S i [2] - S j [3]) 2 , (S i [3] - S j [3]) 2 , (S i [3] - S j [2]) 2 , (S i [3] -
[0057] S j [1]) 2};
[0058] r4 = min{(S i [L] - S j [L - 2]) 2 , (S i [L - 1] - S j [L - 2])<0匡000052>, (S i [L - 2] - S j [L - 2]) 2 , (S i [L - 2]
[0059] - 1) 2 , (S i [L - 2] - S j [L]) 2}
[0060] Among them, S i [1] represents the value of the first element in the i-th subsequence, S i [2] represents the value of the second element in the i-th subsequence, S i [3] represents the value of the 3rd element in the i-th subsequence, S j [1] represents the value of the first element in the j-th subsequence, S j [2] represents the value of the second element in the j-th subsequence, S j [3] represents the value of the 3rd element in the j-th subsequence, S i [L-1] represents the value of the (L-1)th element in the i-th subsequence, S i [L-2] represents the value of the (L-2)th element in the i-th subsequence, S i [L] represents the value of the Lth element in the i-th subsequence, S j [L-1] represents the value of the (L-1)th element in the j-th subsequence, S j [L-2] represents the value of the (L-2)th element in the j-th subsequence, S j [L] represents the value of the Lth element in the j-th subsequence;
[0061] Steps two and three: Calculate S i With S j Between distance;
[0062] The specific process of steps two and three is as follows:
[0063] Step 231: When i > j, execute step 232; when i < j, execute step 233.
[0064] Step 2.2. For the j-th subsequence S j The upper and lower envelopes are normalized respectively:
[0065]
[0066] Among them, U j [1] represents the j-th subsequence S j The value of the first element in the matrix corresponds to the value on the upper envelope, V. j [1] represents the j-th subsequence S j The value of the first element in the value is the value corresponding to the lower envelope, U. j [2] represents the j-th subsequence S j The value of the second element in the matrix corresponds to the value on the upper envelope, V. j [2] represents the j-th subsequence S j The value of the second element in the value is the value corresponding to the lower envelope, U. j[L] represents the j-th subsequence S j The value of the Lth element in the matrix corresponds to the value on the upper envelope, V. j [L] represents the j-th subsequence S j The value of the Lth element in the lower envelope is the value of the Lth element. S represents the j-th subsequence. j The mean of the values corresponding to all elements in the upper envelope. S represents the j-th subsequence. j The standard deviation of the corresponding values of all elements in the upper envelope. S represents the j-th subsequence. j The mean of the values corresponding to all elements in the lower envelope. S represents the j-th subsequence. j The standard deviation of the corresponding values of all elements in the lower envelope, U′ j V′ represents the normalized upper envelope. j This represents the lower envelope after normalization.
[0067] Let the initialized mask vector be denoted as M. j =(M j [1],M j [2],...,M j [L]), M j [1] = M j [2] = ... = M j [L] = 1, then The distance is:
[0068]
[0069] in, This indicates that the non-zero elements in the mask vector are in U. j ′ and V j The Euclidean distance calculated from the corresponding value in ′; This indicates that the non-zero elements in the mask vector are used to determine the values of the mask vector. and V j The Euclidean distance calculated from the corresponding value in ′; This indicates that the non-zero elements in the mask vector are used to determine the values of the mask vector. and U j The Euclidean distance calculated from the corresponding value in ′;
[0070] Then S i With S j The lower bound of the DTW distance between them is
[0071] Step 2.3.3: For the i-th subsequence S i The upper and lower envelopes are normalized respectively:
[0072]
[0073]
[0074] Among them, U i [1] represents the i-th subsequence S i The value of the first element in the matrix corresponds to the value on the upper envelope, V. i [1] represents the i-th subsequence S i The value of the first element in the matrix is the value corresponding to the lower envelope, U′. i V′ represents the normalized upper envelope. i U represents the lower envelope after normalization. i [2] represents the i-th subsequence S i The value of the first element in the matrix corresponds to the value on the upper envelope, V. i [2] represents the i-th subsequence S i The value of the first element in the value is the value corresponding to the lower envelope, U. i [L] represents the i-th subsequence S i The value of the Lth element in the matrix corresponds to the value on the upper envelope, V. i [L] represents the i-th subsequence S i The value of the Lth element in the lower envelope is the value of the Lth element. S represents the i-th subsequence. i The mean of the values corresponding to all elements in the upper envelope. S represents the i-th subsequence. i The standard deviation of the corresponding values of all elements in the upper envelope. S represents the i-th subsequence. i The mean of the values corresponding to all elements in the lower envelope. S represents the i-th subsequence. i The standard deviation of the corresponding values of all elements in the lower envelope;
[0075] Let the initialized mask vector be denoted as M. i =(M i [1],M i [2],...,M i [L]), M i [1] = M i [2] = ... = M i [L] = 1, then The distance is:
[0076]
[0077] in, This indicates that the non-zero elements in the mask vector are in U. i ′ and V i The Euclidean distance calculated from the corresponding value in ′; This indicates that the non-zero elements in the mask vector are used to determine the values of the mask vector. and V i The Euclidean distance calculated from the corresponding value in ′; This indicates that the non-zero elements in the mask vector are used to determine the values of the mask vector. and U i The Euclidean distance calculated from the corresponding value in ′;
[0078] Then S j With S i The lower bound of the DTW distance between them is
[0079] Step 24: For each subsequence pair that satisfies |ij|=ID, execute Step 22 and Step 23 respectively, and filter out the subsequence pairs (S) whose DTW distance is less than the value in the bsf array. i With S j The lower bound of the DTW distance between and S j With S i The lower bound of the DTW distance between them must be less than the value in the bsf array, that is, to obtain the remaining subsequence pairs that satisfy |ij|=ID after the first filtering;
[0080] Step 25: Determine if ID = n - L + 1 is satisfied:
[0081] If ID = n - L + 1 is satisfied, then the remaining subsequence pairs after the first filtering are obtained;
[0082] If ID = n - L + 1 is not satisfied, then set ID = ID + 1 and return to step two.
[0083] Its steps and parameters are the same as those in one of the specific implementation methods one to three.
[0084] First, calculate all during the data preparation phase. The value is then determined according to the lower bound function LB. M The calculation formula only requires further calculation. Partial values.
[0085] Use the following formula to process:
[0086]
[0087] in:
[0088]
[0089] Among them, t1, t2, t3, t4, and t5 can be converted into a series of inner products, which are: <M j ,S i ⊙S i >、 <M j ,(U′ j ⊙U′ j )⊕(V′ j ⊙V′ j )>、 <M j ,U′ j ⊕V′ j >、 <M j ,S i >、 i ,(U′ j ⊙M j )⊕(V′ j ⊙M j )> and <M j M j >;
[0090] and <M j ,(U′ j ⊙U′ j )⊕(V′ j ⊙V′ j )>、 <M j ,U′ j ⊕V′ j >、 <M j M j This can be calculated using a sliding window during the data preparation phase. Therefore, only the following three values need to be calculated for each subsequence pair:
[0091] cov = i ,(U′ j ⊙M j )⊕(V′ j ⊙M j )>
[0092] cov2 = <M j ,S i >
[0093] cov3 = <M j ,S i ⊙S i >
[0094] According to such Figure 2 The order shown is calculated along the diagonal: Since two diagonally adjacent subsequences have L–1 (let the subsequence length be L) common elements, when calculating the next dot product, we only need to subtract the first value from the previous calculation and add the last value from the next calculation, that is:
[0095] cov+=(V[q]+U[q])*S[p]-(V[j-1]+U[j-1])*S[i-1])
[0096] cov2+=M[q]*S[p]-M[j-1]*S[i-1]
[0097] cov3+=M[q]*S[p] 2 -M[j-1]*S[i-1] 2
[0098] For a subsequence length L, the dot product of the diagonal elements can be maintained in constant time. Therefore, the lower bound LB of each subsequence pair can be computed in amortized O(1) time. M .
[0099] It can be proven that for any mask vector MASK, the following condition is met:
[0100]
[0101] Specific Implementation Method Five: This implementation method differs from Specific Implementation Methods One to Four in that the specific process of step three is as follows:
[0102] Step 3: 1. Generate a mask vector for each subsequence pair according to the LB_local method;
[0103] Step 3.2. Calculate the lower bound of the DTW distance for each subsequence pair according to the mask vector and the method in Step 2. Filter out subsequence pairs whose lower bound of the DTW distance is greater than or equal to the value in the bsf array, and obtain the remaining subsequence pairs after the second filtering.
[0104] The other steps and parameters are the same as those in one of the specific implementation methods one to four.
[0105] like Figure 3 As shown, where:
[0106]
[0107] It can be seen that when t = 2, 3, 4, 6, 8, f1(t) ≈ 0, while the value of f2(t) is relatively large. Therefore, the contribution to the overall LB value is negative. That is, the calculation of these elements reduces the tightness of the lower bound. Therefore, this invention proposes a mask vector generation method to selectively mask out elements that do not contribute to the lower bound or have a negative contribution.
[0108] Specific Implementation Method Six: This implementation method differs from Specific Implementation Methods One to Five in that the specific process of step three is as follows:
[0109] Step B1: For the remaining subsequence pairs after the first filtering, each subsequence pair is formed by the i-th subsequence S.i and the j-th subsequence S j composition;
[0110] When i < j, then calculate the i-th subsequence S. i With the j-th subsequence S j When the DTW distance is below the lower bound, step B2 is used to generate the mask vector;
[0111] When i > j, then calculate the j-th subsequence S. j With the i-th subsequence S i When the DTW distance is below the bound, step B3 is used to generate the mask vector;
[0112] Step B2: Generate a mask vector based on the ID values of the subsequence pairs, specifically as follows:
[0113] Step B21: For the i-th subsequence S i and the j-th subsequence S j The subsequence pairs that satisfy ID = a·L, where a is an integer (the maximum value of a is determined by the length n of the data sequence);
[0114] Step B22: Initialize a = 1;
[0115] Step B23: Obtain the subsequence S i The L subsequences containing the t-th element are then used to obtain the subsequence S. i The value of the t-th element in the normalized L subsequences is obtained as the subsequence S. i The t-th element in the array corresponds to L normalized values;
[0116] Divide the entire interval corresponding to the L normalized values to obtain a histogram with B equal-width intervals (bins);
[0117] Step B24: Obtain the j-th normalized subsequence The t-th value in the upper envelope U′ j The corresponding value U′ j [t], to obtain the j-th normalized subsequence The t-th value in the lower envelope V′ j The corresponding value V′ j [t];
[0118] Then determine U′ j [t] and V′ j The histogram interval containing [t] will be U′ j Let p1 be the histogram interval containing [t], and let V′ j The histogram interval containing [t] is denoted as p2;
[0119] Count the number h of the L normalized values from step 2 that fall between the p1-th and p2-th histogram intervals, and then calculate the ratio d of h to B. t ;
[0120] Determine if it satisfies α is a hyperparameter;
[0121] If satisfied If the value is 1, then the value of the t-th element in the mask vector is 1; otherwise, the value of the t-th element in the mask vector is 0.
[0122] The hyperparameter α is calculated as follows:
[0123] After dividing the interval [-0.7, 0.7] into equal intervals (each subinterval has a length of 0.1), the division points are obtained. Each division point and interval point is then traversed, treating each as a hyperparameter α value to obtain the mask vector corresponding to each hyperparameter α. Finally, the subsequence S under each mask vector is calculated using the method in step two. i With S j The lower bound of the DTW distance between them;
[0124] The methods in steps B23 to B24 are used to process each subsequence pair remaining after the first filtering that satisfies ID = a·L, to determine the optimal hyperparameter α that maximizes the filtering efficiency of the subsequence pairs remaining after the first filtering that satisfy ID = a·L (i.e., if S i With S j If the lower bound of the DTW distance between them is greater than or equal to the value in the bsf array, then S i With S j The subsequence pairs are filtered out, and the hyperparameter that makes the most subsequence pairs filtered out is selected. The mask vector of each subsequence pair that satisfies ID = a·L is generated according to the optimal hyperparameter α.
[0125] Step B25: Let a = a + 1 until the value of a reaches the maximum value (i.e. (a + 1)·L is greater than the maximum number of IDs);
[0126] Step B26: Take each ID value of ID = a·L as the endpoint of the large interval, divide each large interval into equal intervals, and take each dividing point as the endpoint of the small interval.
[0127] Step B27: Initialize b = 1;
[0128] Step B28: Initialize a = 1;
[0129] Step B29: For the subsequence pairs remaining after the first filtering that satisfy ID = a·L + b:
[0130] If a·L+b is not a small interval endpoint, then the subsequence S is calculated based on the optimal hyperparameter α corresponding to the interval endpoint with the smallest distance from the ID value of the subsequence pair at both its left and right ends (this could be a large interval endpoint or a small interval endpoint; it should be noted that if a·L+b is not a small interval endpoint, and a·L+b only has a large interval endpoint at its left end, then the subsequence pair with ID = a·L+b is processed in the same way as the small interval endpoint). i′ With S j′ The optimal hyperparameter α between the left and right endpoints is obtained by inversely weighting the optimal hyperparameter α at the left and right endpoints. For example, if the optimal hyperparameter at the left endpoint is α1 and the optimal hyperparameter at the right endpoint is α2, and the distance between the left endpoint and the ID value of the subsequence pair is l1, and the distance between the right endpoint and the ID value of the subsequence pair is l2, then the inverse weighted distance result is... ), subsequence S i′ With S j′ The subsequences remaining after the first filtering that satisfy ID = a·L + b, where i′ is less than j′, are used to generate and calculate the subsequence S based on the optimal hyperparameters. i′ With S j′ The mask vector of the lower bound of the DTW distance between them;
[0131] If a·L+b is a small interval endpoint, then obtain the optimal hyperparameter α1 corresponding to the large interval endpoint closest to a·L+b, and generate the computational subsequence S based on the hyperparameters α1+0.1, α1-0.1, and α1 respectively. i′ With S j′ The mask vectors for the DTW distance between the three subsequence pairs are generated. Based on the three generated mask vectors, and using the method in step two, the lower bound of the DTW distance for each subsequence pair remaining after the first filtering and satisfying ID = a·L + b is calculated. The hyperparameter corresponding to the maximum filtering efficiency is selected from α1 + 0.1, α1 - 0.1, and α1 as the optimal hyperparameter. The subsequence S is generated based on the optimal hyperparameter. i′ With S j′ The mask vector for the DTW distance between them;
[0132] Let a = a + 1, return to step B29, until the value of a reaches its maximum, then execute step B30;
[0133] Step B30: Let b = b + 1, then return to step B28 until the value of b reaches its maximum.
[0134] Step B3: Obtain the subsequence S j The L subsequences containing the t-th element are then used to obtain the subsequence S. j The value of the t-th element in the normalized L subsequences is obtained as the subsequence S. j The t-th element in the array corresponds to L normalized values;
[0135] Divide the entire interval corresponding to the L normalized values to obtain a histogram with B equal-width intervals (bins);
[0136] Obtain the i-th normalized subsequence The t-th value in the upper envelope U′ i The corresponding value U′ i [t], to obtain the i-th normalized subsequence The t-th value in the lower envelope V′ i The corresponding value V′ i [t];
[0137] Then determine U′ i [t] and V′ i The histogram interval containing [t] will be U′ i Let p1 be the histogram interval containing [t], and let V′ i The histogram interval containing [t] is denoted as p2;
[0138] Count the number h of the L normalized values from step 2 that fall between the p1-th and p2-th histogram intervals, and then calculate the ratio d of h to B. t ;
[0139] Determine if it satisfies
[0140] If satisfied If the value is 1, then the value of the t-th element in the mask vector is 1; otherwise, the value of the t-th element in the mask vector is 0.
[0141] The other steps and parameters are the same as those in one of the specific implementation methods one to five.
[0142] For each subsequence pair remaining after filtering in step two, the mask vector of the subsequence pair in the positive direction and the mask vector of the subsequence pair in the negative direction can be calculated. When the distance of the DTW in the positive direction from the lower bound or the distance of the DTW in the negative direction from the lower bound is greater than or equal to the value of the bsf array, the subsequence pair will be filtered out.
[0143] Specific Implementation Method Seven: This implementation method differs from Specific Implementation Methods One to Six in that the specific process of step four is as follows:
[0144] For the remaining components after the second filtering, S i and S j The subsequence pairs formed, where i < j:
[0145] Step 4.1 Obtain the subsequence S i The L subsequences containing the t-th element are then used to obtain the subsequence S.i The value of the t-th element in the normalized L subsequences is obtained as the subsequence S. i The L normalized values corresponding to the t-th element in the array;
[0146] Step 42: Divide the entire interval corresponding to the L normalized values to obtain a histogram with B equal-width intervals (bins);
[0147] Step 4.3: Obtain the j-th normalized subsequence The t-th value in the upper envelope U′ j The corresponding value U′ j [t], to obtain the j-th normalized subsequence The t-th value in the lower envelope V′ j The corresponding value V′ j [t];
[0148] Then determine U′ j [t] and V′ j The histogram interval containing [t] will be U′ j Let p1 be the histogram interval containing [t], and let V′ j The histogram interval containing [t] is denoted as p2;
[0149] Step 4: Count the number h of the L normalized values from Step 4.1 that fall within the interval from the p1th histogram to the p2th histogram, and then calculate the ratio d of h to B. t Then calculate the normalized subsequences separately. The ratio corresponding to each value in the table;
[0150] Let the mean of all ratios be denoted as Cmaen, and the standard deviation of all ratios be denoted as Cstd. If d t If ≤Cmaen+thr×Cstd, where thr is a hyperparameter, then the value of the t-th element in the mask vector is 1; otherwise, the value of the t-th element in the mask vector is 0.
[0151] Steps four and five: Based on the generated mask vector and the method in step two, calculate the result of S. i and S j The lower bound of the DTW distance of the formed subsequence pairs (i.e., calculating the subsequence S based on the generated mask vector). i With S j The lower bound of the DTW distance between and the subsequence S j With S iThe lower bound of the DTW distance between the two directions (the distances in the positive and negative directions can be calculated based on the same mask vector). If the lower bound of the DTW distance is greater than or equal to the value in the bsf array (i.e., if the lower bound of the DTW distance in the positive direction is greater than or equal to the value in the bsf array, or if the lower bound of the DTW distance in the negative direction is greater than or equal to the value in the bsf array), then it will be determined by S. i and S j Filter out the resulting subsequence pairs; otherwise, keep them.
[0152] The other steps and parameters are the same as those in one of the specific implementation methods one to six.
[0153] Specific Implementation Method Eight: This implementation method differs from Specific Implementation Methods One to Seven in that the specific process of step five is as follows:
[0154] Step 51: For the remaining values after the third filter, S... i and S j The subsequence pairs formed are used to calculate S. i With S j distance S j With S i distance
[0155] The specific process of step 51 is as follows:
[0156] Step 511: Calculate S i The t-th element and S j Distance to the t-th element:
[0157] like Then S i The t-th element and S j The distance to the t-th element is
[0158] like Then S i The t-th element and S j The distance to the t-th element is
[0159] Otherwise, S i The t-th element and S j The distance to the t-th element is 0;
[0160] Then S i With S j distance For: S i With S j The sum of the distances corresponding to each element;
[0161] Step 512: Calculate S jThe t-th element and S i Distance to the t-th element:
[0162] like Then S j The t-th element and S i The distance to the t-th element is
[0163] like Then S j The t-th element and S i The distance to the t-th element is
[0164] Otherwise, S i The t-th element and S j The distance to the t-th element is 0;
[0165] Then S j With S i distance For: S j With S i The sum of the distances corresponding to each element;
[0166] Step 52, if or If the value is greater than or equal to the value of the bsf array, then S will be... i and S j The resulting subsequence pairs are filtered out; otherwise, S i and S j The resulting subsequence pairs are not filtered out; if S i and S j If the resulting subsequence pairs are not filtered out, then S is calculated. i and S j The LB_Kim (lower bound of the King's Law) value of the subsequence pairs formed;
[0167] Traverse to all remaining subsequence pairs after the third filtering, and execute step five three on the remaining subsequence pairs after filtering;
[0168] Step 53: For the remaining S from Step 52 i and S j The subsequence pairs are composed of subsequences, and the subsequence S is calculated. j The t-th value S j The projection p of [t] j [t]:
[0169] If S j [t]>U i [t], then p j [t]=U i [t];
[0170] If S j [t]<V i [t], then p j [t] = V i [t];
[0171] Otherwise, p j [t] = S j [t];
[0172] Then according to p j [t] Calculate the upper envelope of the projected values. and lower envelope
[0173] Step 54, according to S i Upper envelope and lower envelope Calculate the subsequence S i and S j LB_Petitjean distance;
[0174] The specific process of step five-four is as follows:
[0175] Step 541: Calculate the subsequence S i The t-th element and S j LB_Petitjean distance of the t-th element:
[0176] like Then the subsequence S i The t-th element and S j The LB_Petitjean distance of the t-th element is
[0177] like Then the subsequence S i The t-th element and S j The LB_Petitjean distance of the t-th element is
[0178] like And not satisfied Then the subsequence S i The t-th element and S j The LB_Petitjean distance of the t-th element is
[0179] like And not satisfied Then the subsequence S i The t-th element and S j The LB_Petitjean distance of the t-th element is
[0180] Otherwise, subsequence S i The t-th element and S j The LB_Petitjean distance of the t-th element is 0;
[0181] Then the subsequence S i With S j The LB_Petitjean distance is the sum of the LB_Petitjean distances of each element;
[0182] Step 55: For the subsequence S i With S j Calculate the sum of LB_Petitjean distance, LB_KEOGH distance, and LB_Kim value, and use the sum as the subsequence S. i With S j The final distance lower bound;
[0183] If the subsequence S i With S j If the final distance lower bound is greater than or equal to the value in the array bsf, then the subsequence S will be... i With S j The resulting subsequence pairs are filtered out.
[0184] Otherwise, retain the subsequence S. i With S j The subsequence pairs formed.
[0185] The other steps and parameters are the same as those in any of the specific implementation methods one to seven.
[0186] Specific Implementation Method Nine: Combining Figure 4 This embodiment describes a method for mining frequent patterns in time series data. The specific process of the method is as follows:
[0187] Step 1: Use a sliding window of length L to slide over a CPU utilization data sequence of total length n, with a sliding step size of 1. When the window slides to each position, the data within the window forms a subsequence.
[0188] Normalize each subsequence to obtain normalized subsequences; use monotonic queues to calculate the upper and lower envelopes of each normalized subsequence, and determine the initial value of the bsf array based on the obtained subsequences.
[0189] The specific process of step one is the same as that of specific implementation method one;
[0190] Step 2: Construct an (n-L+1)×(n-L+1) matrix, where the elements in the i-th and j-th rows represent the subsequence S. i With S j In the matrix, the elements corresponding to the subsequence pairs that satisfy ji=L+1 are taken as the starting diagonal, and the region from the starting diagonal to the upper right corner of the matrix is taken as the region to be divided.
[0191] The size of the parallelogram region is set according to the GPU's computing power. Starting from the initial diagonal, the region to be divided into parallelograms along the horizontal direction of the matrix, resulting in several parallelogram regions (e.g., ...). Figure 4 As shown, the region is first divided along the first row. After the first row is divided, the second row is divided. It should be noted that the row here refers to the number of rows of parallelograms. Each row of parallelograms occupies several rows of the matrix, and the last parallelogram in each row does not have to be a complete parallelogram. Each row of parallelogram regions needs to cover the right boundary of the matrix corresponding to the current row.
[0192] Step 3: For any parallelogram region, sequentially use the initial mask vector, the mask vector generated by the LB_local method, the mask vector generated by the LB_global method, and the LB_KEOGH method to filter each sub-sequence pair within the parallelogram region (the mask vector generation method is the same as in Implementation Method 1). Then, call multi-threading to perform the filtering operation. The filtering operation obtains sub-sequence pairs within the parallelogram region whose DTW distance lower bound is less than the value of the bsf array. Calculate the DTW distance of these sub-sequence pairs, and update the value of the bsf array based on the minimum DTW distance corresponding to the parallelogram region.
[0193] It should be noted that if the parallelogram region includes subsequence S i With S j If the resulting subsequence pairs are used, then S needs to be calculated simultaneously during filtering. i With S j The lower bound of the DTW distance between them, and S j With S i The lower bound of the DTW distance between the subsequences S and BSF is determined if any one of them has a lower bound greater than or equal to the value of the BSF array. i With S j The resulting subsequence pairs are filtered out.
[0194] The parallelogram regions are traversed sequentially, that is, the parallelograms in odd-numbered rows are traversed from left to right, and the parallelograms in even-numbered rows are traversed from right to left.
[0195] After all parallelogram regions have been traversed, the subsequence pairs corresponding to the final values stored in the bsf array are the recurring pattern data obtained from mining.
[0196] Specific Implementation Method Ten: This implementation method differs from Specific Implementation Method Nine in that, in step three, the specific process of calculating the DTW distance using the LB_KEOGH method is as follows:
[0197] For the subsequence S i With S j The DTW distance of the resulting subsequence pairs is calculated in parallel using several threads (in this invention, the number of threads is set to 32):
[0198] Step 1: Construct an L×L dynamic programming table K, with the bottom left vertex as the starting point of the table (the row containing the starting point is the first row, and the column containing the starting point is the first column). The starting point corresponds to the subsequence S. i The first element and subsequence S j The first element takes the top-right vertex as the endpoint of the dynamic programming table, and the endpoint corresponds to the subsequence S. i The Lth element and subsequence S j The Lth element (taking the row where the endpoint is located as the Lth row and the column where the endpoint is located as the Lth column);
[0199] Step 2: For the l-th thread, calculate the starting point (p′, q′) of the l-th thread, p′ = l - 16, q′ = 16 - l, and the calculation tasks assigned to the l-th thread are (p′, q′), (p′, q′ + 1), (p′ + 1, q′ + 1), (p′ + 1, q′ + 2), (p′ + 2, q′ + 2), that is, the calculation tasks are alternately increased by 1 along the column and row directions of the matrix until the boundary of the dynamic programming table K is reached;
[0200] When p′ is less than or equal to 0 and q′ is not equal to 0, the DTW distance D(p′,q′) is set to infinity;
[0201] When q′ is less than or equal to 0 and p′ is not equal to 0, set the DTW distance D(p′,q′) to infinity;
[0202] When p′ equals 0 and q′ equals 0, set the DTW distance D(p′,q′) to 0;
[0203] When p′ is greater than 0 and q′ is greater than 0, the subsequence S i The p′-th element and the subsequence S j The DTW distance D(q′,p′) of the q′-th element is:
[0204] D(p′,q′)=DIST(p′,q′)+min(D(p′-1,q′),D(p′-1,q′-1),D(p′,q′-1))
[0205] Where D(p′-1,q′) represents the subsequence S i The p′-1th element and the subsequence S j The DTW distance of the q′-th element in the sequence S, where D(p′-1,q′-1) represents the subsequence S. i The p′-1th element and the subsequence S j The DTW distance of the (q′-1)th element in the sequence S, where D(p′,q′-1) represents the subsequence S. i The p′-th element and the subsequence S j The DTW distance of the (q′-1)th element in the sequence S, where DIST(p′,q′) represents the subsequence S. i The p′-th element and the subsequence S j The Euclidean distance of the q′-th element in the dataset;
[0206] Step 3: After the task allocation for each thread is completed, multiple threads synchronously execute the computation tasks through parallel computing until the subsequence S is calculated. i The Lth element and subsequence S j The DTW distance of the Lth element is used to subsequence S. i The Lth element and subsequence S j The DTW distance of the Lth element is used as the subsequence S i With S j The DTW distance of the subsequence pairs formed.
[0207] The other steps and parameters are the same as in Specific Implementation Method Nine.
[0208] For Dynamic Time Warping (DTW) computation, the algorithm of this invention leverages the massive multithreading capabilities of GPUs to efficiently populate the dynamic programming table. Low-overhead communication within thread bundles is particularly advantageous for data-dependent computations in DTW. Furthermore, the algorithm implements an early termination strategy to reduce computation time: computation of candidate sequences can be stopped when the minimum cumulative value of a row exceeds a threshold. The GPU implementation of this invention extends the benchmark method in the literature (Bertil Schmidt and Christian Hundt. 2020. cuDTW++: ultra-fast dynamic time warping on CUDA-enabled GPUs. In European Conference on Parallel Processing. Springer, 597–612.) by introducing bandwidth constraints and refactoring them into block-level kernel functions to compute a large number of candidate sequences in a single grid (rather than launching a grid for each candidate sequence). This not only improves the utilization of streaming multiprocessors (SMs) but also optimizes global memory access patterns and reduces scheduling time costs. Candidate indices are collected and randomly distributed across p CUDA streams (where p corresponds to the number of streaming multiprocessors) to maximize concurrent execution.
[0209] The above examples of the present invention are merely illustrative of the computational model and process of the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is impossible to exhaustively list all possible implementations here. Any obvious variations or modifications derived from the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. A method for mining frequent patterns in time series data, characterized in that, The method specifically includes the following steps: Step 1: Use a sliding window of length L to slide over a CPU utilization data sequence of total length n, with a sliding step size of 1. When the window slides to each position, the data within the window forms a subsequence. Normalize each subsequence to obtain normalized subsequences; calculate the upper and lower envelopes of each normalized subsequence, and determine the initial value of the bsf array based on the obtained subsequences. Step 2: Initialize the mask vector. The mask vector is a vector of length L with all elements being 1. Use the initialized mask vector to filter the subsequence pairs to obtain the remaining subsequence pairs after the first filtering. Step 3: Generate a mask vector according to the LB_local method, and perform a second filtering on the remaining subsequence pairs in Step 2 based on the generated mask vector to obtain the remaining subsequence pairs after the second filtering; Step 4: Generate a mask vector using the LB_global method. Then, perform a third filter on the remaining subsequence pairs after the second filter based on the generated mask vector to obtain the remaining subsequence pairs after the third filter. Step 5: Use LB_KEOGH and LB_Petitjean to filter the remaining subsequence pairs after the third filtering to obtain the final remaining subsequence pairs; Step 6: Calculate the DTW distance for each remaining subsequence pair, and obtain the subsequence pair corresponding to the minimum DTW distance. The data of the obtained subsequence pairs is the mined repeating pattern data.
2. The method for mining frequent patterns in time series data according to claim 1, characterized in that, The initial value of the BSF array is determined based on the obtained subsequences, specifically as follows: Calculate the Euclidean distance between any two subsequences obtained in step one, and then select the N subsequence pairs corresponding to the smallest Euclidean distances; For any selected subsequence pair, calculate the DTW value of the two subsequences in the subsequence pair. After traversing to N subsequence pairs, select the minimum DTW distance from the DTW values of the N subsequence pairs and use the minimum DTW distance as the initial value of the bsf array.
3. The method for mining frequent patterns in time series data according to claim 2, characterized in that, The normalization of each subsequence is performed as follows: For the i-th subsequence S i : Among them, S i [l] represents the value of the l-th element in the i-th subsequence. S represents i The normalized value of [l], μ i Let σ represent the mean of all elements in the i-th subsequence. i Let represent the standard deviation of all elements in the i-th subsequence.
4. The method for mining frequent patterns in time series data according to claim 3, characterized in that, In step two, the initialized mask vector M is used. j The subsequence pairs are filtered to obtain the remaining subsequence pairs after the first filtering; the specific process is as follows: Step 2: Initialize ID = L; Step 2: For any subsequence pair that satisfies |ij| = ID, this subsequence pair is formed by the i-th subsequence S. i and the j-th subsequence S j Composition, calculation of S i With S j LB between KimFL distance: Where, r1=min{(S i [2]-S j [1]) 2 ,(S i [2]-S j [2]) 2 ,(S i [1]-S j [2]) 2 }; r2=min{(S i [L-1]-S j [L] 2 ,(S i [L-1]-S j [L-1]) 2 ,(S i [L]-S j [L-1]) 2 }; r3=min{(S i [1]-S j [3]) 2 ,(S i [2]-S j [3]) 2 ,(S i [3]-S j [3]) 2 ,(S i [3]-S j [2]) 2 ,(S i [3]-S j [1]) 2 }; r4=min{(S i [L]-S j [L-2]) 2 ,(S i [L-1]-S j [L-2]) 2 ,(S i [L-2]-S j [L-2]) 2 ,(S i [L-2]-1) 2 ,(S i [L-2]-S j [L]) 2 } Among them, S i [1] represents the value of the first element in the i-th subsequence, S i [2] represents the value of the second element in the i-th subsequence, S i [3] represents the value of the 3rd element in the i-th subsequence, S j [1] represents the value of the first element in the j-th subsequence, S j [2] represents the value of the second element in the j-th subsequence, S j [3] represents the value of the 3rd element in the j-th subsequence, S i [L-1] represents the value of the (L-1)th element in the i-th subsequence, S i [L-2] represents the value of the (L-2)th element in the i-th subsequence, S i [L] represents the value of the Lth element in the i-th subsequence, S j [L-1] represents the value of the (L-1)th element in the j-th subsequence, S j [L-2] represents the value of the (L-2)th element in the j-th subsequence, S j [L] represents the value of the Lth element in the j-th subsequence; Steps two and three: Calculate S i With S j Between distance; The specific process of steps two and three is as follows: Step 231: When i > j, execute step 232; when i < j, execute step 233. Step 2.
2. For the j-th subsequence S j The upper and lower envelopes are normalized respectively: Among them, U j [1] represents the j-th subsequence S j The value of the first element in the matrix corresponds to the value on the upper envelope, V. j [1] represents the j-th subsequence S j The value of the first element in the value is the value corresponding to the lower envelope, U. j [2] represents the j-th subsequence S j The value of the second element in the matrix corresponds to the value on the upper envelope, V. j [2] represents the j-th subsequence S j The value of the second element in the value is the value corresponding to the lower envelope, U. j [L] represents the j-th subsequence S j The value of the Lth element in the matrix corresponds to the value on the upper envelope, V. j [L] represents the j-th subsequence S j The value of the Lth element in the lower envelope is the value of the Lth element. S represents the j-th subsequence. j The mean of the values corresponding to all elements in the upper envelope. S represents the j-th subsequence. j The standard deviation of the corresponding values of all elements in the upper envelope. S represents the j-th subsequence. j The mean of the values corresponding to all elements in the lower envelope. S represents the j-th subsequence. j The standard deviation of the corresponding values of all elements in the lower envelope, U' j V' represents the normalized upper envelope. j This represents the lower envelope after normalization. Let the initialized mask vector be denoted as M. j =(M j [1],M j [2],...,M j [L]), M j [1] = M j [2] = ... = M j [L] = 1, then The distance is: in, This indicates that the non-zero elements in the mask vector are in U' j and V' j The Euclidean distance is calculated from the corresponding value in the equation. This indicates that the non-zero elements in the mask vector are used to determine the values of the mask vector. and V' j The Euclidean distance is calculated from the corresponding value in the equation. This indicates that the non-zero elements in the mask vector are used to determine the values of the mask vector. and U' j The Euclidean distance is calculated from the corresponding value in the equation. Then S i With S j The lower bound of the DTW distance between them is Step 2.3.3: For the i-th subsequence S i The upper and lower envelopes are normalized respectively: Among them, U i [1] represents the i-th subsequence S i The value of the first element in the matrix corresponds to the value on the upper envelope, V. i [1] represents the i-th subsequence S i The value of the first element in the value is the value corresponding to the lower envelope, U' i V' represents the normalized upper envelope. i U represents the lower envelope after normalization. i [2] represents the i-th subsequence S i The value of the first element in the matrix corresponds to the value on the upper envelope, V. i [2] represents the i-th subsequence S i The value of the first element in the value is the value corresponding to the lower envelope, U. i [L] represents the i-th subsequence S i The value of the Lth element in the matrix corresponds to the value on the upper envelope, V. i [L] represents the i-th subsequence S i The value of the Lth element in the lower envelope is the value of the Lth element. S represents the i-th subsequence. i The mean of the values corresponding to all elements in the upper envelope. S represents the i-th subsequence. i The standard deviation of the corresponding values of all elements in the upper envelope. S represents the i-th subsequence. i The mean of the values corresponding to all elements in the lower envelope. S represents the i-th subsequence. i The standard deviation of the corresponding values of all elements in the lower envelope; Let the initialized mask vector be denoted as M. i =(M i [1],M i [2],...,M i [L]), M i [1] = M i [2] = ... = M i [L] = 1, then The distance is: in, This indicates that the non-zero elements in the mask vector are in U' i and V' i The Euclidean distance is calculated from the corresponding value in the equation. This indicates that the non-zero elements in the mask vector are used to determine the values of the mask vector. and V' i The Euclidean distance is calculated from the corresponding value in the equation. This indicates that the non-zero elements in the mask vector are used to determine the values of the mask vector. and U' i The Euclidean distance is calculated from the corresponding value in the equation. Then S j With S i The lower bound of the DTW distance between them is Step 24: For each subsequence pair that satisfies |ij|=ID, execute Step 22 and Step 23 respectively to filter out the subsequence pairs whose distance from DTW to the lower bound is less than the value in the bsf array, that is, obtain the remaining subsequence pairs that satisfy |ij|=ID after the first filtering; Step 25: Determine if ID = n - L + 1 is satisfied: If ID = n - L + 1 is satisfied, then the remaining subsequence pairs after the first filtering are obtained; If ID = n - L + 1 is not satisfied, then set ID = ID + 1 and return to step two.
5. The method for mining frequent patterns in time series data according to claim 4, characterized in that, The specific process of step three is as follows: Step 3:
1. Generate a mask vector for each subsequence pair according to the LB_local method; Step 3.
2. Calculate the lower bound of the DTW distance for each subsequence pair according to the mask vector and the method in Step 2. Filter out subsequence pairs whose lower bound of the DTW distance is greater than or equal to the value in the bsf array, and obtain the remaining subsequence pairs after the second filtering.
6. The method for mining frequent patterns in time series data according to claim 5, characterized in that, The specific process of step 31 is as follows: Step B1: For the remaining subsequence pairs after the first filtering, each subsequence pair is formed by the i-th subsequence S. i and the j-th subsequence S j composition; When i < j, then calculate the i-th subsequence S. i With the j-th subsequence S j When the DTW distance is below the lower bound, step B2 is used to generate the mask vector; When i > j, then calculate the j-th subsequence S. j With the i-th subsequence S i When the DTW distance is below the bound, step B3 is used to generate the mask vector; Step B2: Generate a mask vector based on the ID values of the subsequence pairs, specifically as follows: Step B21: For the i-th subsequence S i and the j-th subsequence S j The subsequence pairs that satisfy ID = a·L, where a is an integer; Step B22: Initialize a = 1; Step B23: Obtain the subsequence S i The L subsequences containing the t-th element are then used to obtain the subsequence S. i The value of the t-th element in the normalized L subsequences is obtained as the subsequence S. i The t-th element in the array corresponds to L normalized values; Divide the entire interval corresponding to the L normalized values to obtain a histogram with B equal-width intervals; Step B24: Obtain the j-th normalized subsequence The t-th value in the upper envelope U' j The corresponding value U' j [t], to obtain the j-th normalized subsequence The t-th value in the lower envelope V' j The corresponding value V' j [t]; Determine U' again j [t] and V' j The histogram interval containing [t] will be U' j Let p1 be the histogram interval containing [t], and let V j The histogram interval containing '[t]' is denoted as p2; Count the number h of the L normalized values from step 2 that fall between the p1-th and p2-th histogram intervals, and then calculate the ratio d of h to B. t ; Determine if it satisfies α is a hyperparameter; If satisfied If the value is 1, then the value of the t-th element in the mask vector is 1; otherwise, the value of the t-th element in the mask vector is 0. The hyperparameter α is calculated as follows: After dividing the interval [-0.7, 0.7] into equal intervals, we obtain the segmentation points. We then iterate through each segmentation point and interval point, treating each segmentation point and interval point as a hyperparameter α value, to obtain the mask vector corresponding to each hyperparameter α. Finally, we use the method in step two to calculate the subsequence S under each mask vector. i With S j The lower bound of the DTW distance between them; The methods in steps B23 to B24 are used to process each sub-sequence pair that remains after the first filtering and satisfies ID = a·L, and the optimal hyperparameter α that maximizes the filtering efficiency of the sub-sequence pairs that remain after the first filtering and satisfy ID = a·L is determined. The mask vector of each sub-sequence pair that satisfies ID = a·L is generated based on the optimal hyperparameter α. Step B25: Let a = a + 1, until the value of a reaches its maximum value; Step B26: Take each ID value of ID = a·L as the endpoint of the large interval, divide each large interval into equal intervals, and take each dividing point as the endpoint of the small interval. Step B27: Initialize b = 1; Step B28: Initialize a = 1; Step B29: For the subsequence pairs remaining after the first filtering that satisfy ID = a·L + b: If a·L+b is not an endpoint of a subsequence, then the subsequence S is calculated based on the optimal hyperparameter α corresponding to the endpoint of the subsequence pair whose left and right ends are closest to the ID value of the subsequence pair. i' With S j' The optimal hyperparameter α and subsequence S between them i' With S j' The subsequence S is the remaining subsequence pair after the first filtering that satisfies ID = a·L + b, where i' is less than j'. The subsequence S is calculated based on the optimal hyperparameters. i' With S j' The mask vector of the lower bound of the DTW distance between them; If a·L+b is a small interval endpoint, then obtain the optimal hyperparameter α1 corresponding to the large interval endpoint closest to a·L+b, and generate the computational subsequence S based on the hyperparameters α1+0.1, α1-0.1, and α1 respectively. i' With S j' The mask vectors for the DTW distance between the three subsequence pairs are generated. Based on the three generated mask vectors, and using the method in step two, the lower bound of the DTW distance for each subsequence pair remaining after the first filtering and satisfying ID = a·L + b is calculated. The hyperparameter corresponding to the maximum filtering efficiency is selected from α1 + 0.1, α1 - 0.1, and α1 as the optimal hyperparameter. The subsequence S is generated based on the optimal hyperparameter. i' With S j' The mask vector for the DTW distance between them; Let a = a + 1, return to step B29, until the value of a reaches its maximum, then execute step B30; Step B30: Let b = b + 1, then return to step B28 until the value of b reaches its maximum. Step B3: Obtain the subsequence S j The L subsequences containing the t-th element are then used to obtain the subsequence S. j The value of the t-th element in the normalized L subsequences is obtained as the subsequence S. j The t-th element in the array corresponds to L normalized values; Divide the entire interval corresponding to the L normalized values to obtain a histogram with B equal-width intervals; Obtain the i-th normalized subsequence The t-th value in the upper envelope U' i The corresponding value U' i [t], to obtain the i-th normalized subsequence The t-th value in the lower envelope V' i The corresponding value V' i [t]; Determine U' again i [t] and V' i The histogram interval containing [t] will be U' i Let p1 be the histogram interval containing [t], and let V' i The histogram interval containing [t] is denoted as p2; Count the number h of the L normalized values from step 2 that fall between the p1-th and p2-th histogram intervals, and then calculate the ratio d of h to B. t ; Determine if it satisfies If satisfied If the value is 1, then the value of the t-th element in the mask vector is 1; otherwise, the value of the t-th element in the mask vector is 0.
7. The method for mining frequent patterns in time series data according to claim 6, characterized in that, The specific process of step four is as follows: For the remaining components after the second filtering, S i and S j The subsequence pairs formed, where i < j: Step 4.1 Obtain the subsequence S i The L subsequences containing the t-th element are then used to obtain the subsequence S. i The value of the t-th element in the normalized L subsequences is obtained as the subsequence S. i The L normalized values corresponding to the t-th element in the array; Step 42: Divide the entire interval corresponding to the L normalized values to obtain a histogram with B equal-width intervals; Step 4.3: Obtain the j-th normalized subsequence The t-th value in the upper envelope U' j The corresponding value U' j [t], to obtain the j-th normalized subsequence The t-th value in the lower envelope V' j The corresponding value V' j [t]; Determine U' again j [t] and V' j The histogram interval containing [t] will be U' j Let p1 be the histogram interval containing [t], and let V' j The histogram interval containing [t] is denoted as p2; Step 4: Count the number h of the L normalized values from Step 4.1 that fall within the interval from the p1th histogram to the p2th histogram, and then calculate the ratio d of h to B. t Then calculate the normalized subsequences separately. The ratio corresponding to each value in the table; Let the mean of all ratios be denoted as Cmaen, and the standard deviation of all ratios be denoted as Cstd. If d t If ≤Cmaen+thr×Cstd, where thr is a hyperparameter, then the value of the t-th element in the mask vector is 1; otherwise, the value of the t-th element in the mask vector is 0. Steps four and five: Based on the generated mask vector and the method in step two, calculate the result of S. i and S j The lower bound of the DTW distance of the formed subsequence pairs. If the lower bound of the DTW distance is greater than or equal to the value in the bsf array, then it will be determined by S. i and S j Filter out the resulting subsequence pairs; otherwise, keep them.
8. The method for mining frequent patterns in time series data according to claim 7, characterized in that, The specific process of step five is as follows: Step 51: For the remaining values after the third filter, S... i and S j The subsequence pairs formed are used to calculate S. i With S j distance S j With S i distance The specific process of step 51 is as follows: Step 511: Calculate S i The t-th element and S j Distance to the t-th element: like Then S i The t-th element and S j The distance to the t-th element is like Then S i The t-th element and S j The distance to the t-th element is Otherwise, S i The t-th element and S j The distance to the t-th element is 0; Then S i With S j distance For: S i With S j The sum of the distances corresponding to each element; Step 512: Calculate S j The t-th element and S i Distance to the t-th element: like Then S j The t-th element and S i The distance to the t-th element is like Then S j The t-th element and S i The distance to the t-th element is Otherwise, S i The t-th element and S j The distance to the t-th element is 0; Then S j With S i distance For: S j With S i The sum of the distances corresponding to each element; Step 52, if or If the value is greater than or equal to the value of the bsf array, then S will be... i and S j The resulting subsequence pairs are filtered out; otherwise, S i and S j The resulting subsequence pairs are not filtered out; if S i and S j If the resulting subsequence pairs are not filtered out, then S is calculated. i and S j The LB_Kim value of the resulting subsequence pairs; Traverse to all remaining subsequence pairs after the third filtering, and execute step five three on the remaining subsequence pairs after filtering; Step 53: For the remaining S from Step 52 i and S j The subsequence pairs are composed of subsequences, and the subsequence S is calculated. j The t-th value S j The projection p of [t] j [t]: If S j [t]>U i [t], then p j [t]=U i [t]; If S j [t]<V i [t], then p j [t] = V i [t]; Otherwise, p j [t] = S j [t]; Then according to p j [t] Calculate the upper envelope of the projected values. and lower envelope Step 54, according to S i Upper envelope and lower envelope Calculate the subsequence S i and S j LB_Petitjean distance; The specific process of step five-four is as follows: Step 541: Calculate the subsequence S i The t-th element and S j LB_Petitjean distance of the t-th element: like Then the subsequence S i The t-th element and S j The LB_Petitjean distance of the t-th element is like Then the subsequence S i The t-th element and S j The LB_Petitjean distance of the t-th element is like And not satisfied Then the subsequence S i The t-th element and S j The LB_Petitjean distance of the t-th element is like And not satisfied Then the subsequence S i The t-th element and S j The LB_Petitjean distance of the t-th element is Otherwise, subsequence S i The t-th element and S j The LB_Petitjean distance of the t-th element is 0; Then the subsequence S i With S j The LB_Petitjean distance is the sum of the LB_Petitjean distances of each element; Step 55: For the subsequence S i With S j Calculate the sum of LB_Petitjean distance, LB_KEOGH distance, and LB_Kim value, and use the sum as the subsequence S. i With S j The final distance lower bound; If the subsequence S i With S j If the final distance lower bound is greater than or equal to the value in the array bsf, then the subsequence S will be... i With S j The resulting subsequence pairs are filtered out. Otherwise, retain the subsequence S. i With S j The subsequence pairs formed.
9. A method for mining frequent patterns in time series data, characterized in that, The method specifically includes the following steps: Step 1: Use a sliding window of length L to slide over a CPU utilization data sequence of total length n, with a sliding step size of 1. When the window slides to each position, the data within the window forms a subsequence. Normalize each subsequence to obtain normalized subsequences; calculate the upper and lower envelopes of each normalized subsequence, and determine the initial value of the bsf array based on the obtained subsequences. Step 2: Construct an (n-L+1)×(n-L+1) matrix, where the elements in the i-th and j-th rows represent the subsequence S. i With S j In the matrix, the elements corresponding to the subsequence pairs that satisfy ji=L+1 are taken as the starting diagonal, and the region from the starting diagonal to the upper right corner of the matrix is taken as the region to be divided. Set the size of the parallelogram region, and divide the region to be divided into parallelograms along the horizontal direction of the matrix starting from the starting diagonal. This division results in several parallelogram regions, and each row of parallelogram regions needs to cover the right boundary of the matrix corresponding to the current row. Step 3: For any parallelogram region, sequentially use the initial mask vector, the mask vector generated by the LB_local method, the mask vector generated by the LB_global method, and the LB_KEOGH method to filter each sub-sequence pair within the parallelogram region. Multi-threading is used to perform the filtering operation. The filtering operation obtains sub-sequence pairs within the parallelogram region whose DTW distance lower bound is less than the value of the bsf array. The DTW distance of these sub-sequence pairs is calculated, and the value of the bsf array is updated based on the minimum DTW distance corresponding to the parallelogram region. The parallelogram regions are traversed sequentially, that is, the parallelograms in odd-numbered rows are traversed from left to right, and the parallelograms in even-numbered rows are traversed from right to left. After all parallelogram regions have been traversed, the subsequence pairs corresponding to the final values stored in the bsf array are the recurring pattern data obtained from mining.
10. A method for mining frequent patterns in time series data according to claim 9, characterized in that, In step three, the specific process of calculating the DTW distance using the LB_KEOGH method is as follows: For the subsequence S i With S j The DTW distance between the resulting subsequence pairs is calculated in parallel using several threads. Step 1: Construct an L×L dynamic programming table K, taking the bottom left vertex as the starting point of the dynamic programming table, and the starting point corresponds to the subsequence S. i The first element and subsequence S j The first element takes the top-right vertex as the endpoint of the dynamic programming table, and the endpoint corresponds to the subsequence S. i The Lth element and subsequence S j The Lth element; Step 2: For the l-th thread, calculate the starting point (p', q') of the l-th thread, p' = l - 16, q' = 16 - l, and the calculation tasks assigned to the l-th thread are (p', q'), (p', q' + 1), (p' + 1, q' + 1), (p' + 1, q' + 2), (p' + 2, q' + 2), that is, the calculation tasks are incremented by 1 alternately along the column and row directions of the matrix until the boundary of the dynamic programming table K is reached; When p' is less than or equal to 0 and q' is not equal to 0, set the DTW distance D(p',q') to infinity; When q' is less than or equal to 0 and p' is not equal to 0, set the DTW distance D(p',q') to infinity; When p' equals 0 and q' equals 0, set the DTW distance D(p',q') to 0; When p' is greater than 0 and q' is greater than 0, the subsequence S i The p'-th element and the subsequence S j The DTW distance D(p',q') of the q'-th element is: D(p',q')=DIST(p',q')+min(D(p'-1,q'),D(p'-1,q'-1),D(p',q'-1)) Where D(p'-1,q') represents the subsequence S i The p'-1th element and the subsequence S j The DTW distance of the q'th element in the set; D(p'-1,q'-1) represents the subsequence S i The p'-1th element and the subsequence S j The DTW distance of the (q'-1)th element in the middle; D(p',q'-1) represents the subsequence S i The p'-th element and the subsequence S j The DTW distance of the (q'-1)th element in the middle; DIST(p',q') represents the subsequence S i The p'-th element and the subsequence S j The Euclidean distance of the q'-th element in the set; Step 3: After the task allocation for each thread is completed, multiple threads synchronously execute the computation tasks through parallel computing until the subsequence S is calculated. i The Lth element and subsequence S j The DTW distance of the Lth element is used to subsequence S. i The Lth element and subsequence S j The DTW distance of the Lth element is used as the subsequence S i With S j The DTW distance of the subsequence pairs formed.
Citation Information
Patent Citations
Real-time online detection method based on asynchronous multivariate time series data
CN116578436A
Time series data full-length frequent pattern mining method based on DTW distance
CN117009419A