Arbitrary long-time sequence data similarity query method and system
Through segmented feature representation and singular value decomposition, the arrangement of entropy spectral features are constructed and the compact lower bound distance index is established, which solves the problems of high overhead and low efficiency in data similarity query of any long time series, and realizes efficient query processing and Data normalization.
Patent Information
- Application Number
- CN202411312357.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-27
AI Technical Summary
In the prior art, when processing data similarity queries of any long time series, there are problems of high time overhead and degradation of data index performance, especially due to dimension disasters and high computational complexity, resulting in low query efficiency.
The segmented feature representation method is adopted to calculate the multi-scale arrangement entropy and singular value decomposition, construct the arrangement entropy spectrum features, establish a compact lower bound distance index, and realize similarity query of any long time series.
It reduces the spatial overhead of data index and disk I/O time overhead, significantly improves query efficiency, and supports data standardization processing, ensuring the similarity and efficiency of query results.
Smart Images

Figure CN119202027A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of big data, database, data mining, etc., and specifically relates to a method and system for similarity query of arbitrary long time series data. Background Art
[0002] Time series are widely present in people's daily lives and industrial production, such as real-time transaction data of funds or stocks, daily sales data of the retail market, sensor monitoring data of process industries, astronomical observation data, aerospace radar, satellite monitoring data, real-time weather temperature and air quality index, etc.
[0003] Time series similarity query, also known as time series sample retrieval, has a wide range of application needs in life and production. For example, in the industrial Internet of Things, for abnormal alarms occurring on the assembly line, maintenance personnel want to quickly query the historical faults that are most similar to the current sensor sampling data from the massive sensor monitoring data as a reference, and solve the current problem based on the historical solution. Obviously, the simplest way to solve this problem is to perform a linear scan of the database. However, this method of comparing the query sequence with the database samples one by one has a high time overhead, so spatial indexing methods are usually used to index the database, such as R-tree, R*-tree, grid file, etc. However, the performance of most spatial indexing methods will decrease rapidly as the dimension of the time series increases, that is, the "dimensionality disaster" problem occurs. Therefore, before constructing a spatial index for the time series, it is necessary to first use a data representation method to extract the features of the time series for dimensionality reduction.
[0004] At present, the commonly used data representation methods can be divided into non-data adaptive methods and data adaptive methods. For the former, the transformation parameters are not affected by the individual time series and remain unchanged; this type of representation is mostly based on spectral decomposition, such as discrete Fourier transform, discrete wavelet transform, and discrete cosine transform. They mainly extract the main spectral coefficients as features by performing corresponding frequency domain transformations on the original time series; each of these methods has its own defects, such as discrete Fourier transform can only extract overall morphological features and ignore local features, discrete wavelet transform can only process time series with an exponential length of 2, and the lower bound of discrete cosine transform features is too weak, resulting in very low query efficiency. Data adaptive representation means that the determination of transformation parameters needs to rely on the data itself; by adding data-sensitive selection processing, most non-data adaptive methods can be transformed into data adaptive methods. This type of method includes segmented clustering approximation, segmented linear approximation, symbolic clustering approximation, singular value decomposition, principal component analysis, etc. The first three methods need to segment the original time series first, and then process each sub-segment separately: segmented clustering approximation is to find the average value of each segment; segmented linear approximation is to fit each segment; symbolic clustering approximation is to discretize the average value of each segment into symbols based on segmented clustering approximation; according to the different approximation degrees of the original time series, their query performance will be different. Singular value decomposition and principal component analysis are achieved by performing a unified feature matrix decomposition on all time series; the typical defects of these two methods are that they have high computational complexity, and the decomposition process can only be completed in memory, and the scalability of data scale is very low. Summary of the invention
[0005] In order to solve the shortcomings of the prior art and achieve the purpose of reducing data storage space overhead and improving query efficiency, the present invention adopts the following technical solutions:
[0006] A similarity query method for arbitrary long time series data includes the following steps:
[0007] (1) Segmented feature representation: Each sampling sequence of industrial monitoring data is segmented into equal length segments, and the multi-scale permutation entropy of each sub-segment is calculated. By changing the value of the time scale and the embedding dimension, the permutation entropy spectrum feature is constructed to obtain the segmented entropy representation of the time series. By keeping the feature scale unchanged, the influence of data normalization on the distance metric can be effectively avoided.
[0008] (2) Data index construction: For the piecewise entropy representation, a set of permutation entropy sequences is obtained with the dimension of each permutation entropy spectrum feature as the unit to construct the index;
[0009] (3) Query processing: divide the sequence of industrial query data into equal-length segments, calculate the multi-scale permutation entropy of each sub-segment, construct the query permutation entropy spectrum feature by changing the time scale and the value of the embedding dimension, so as to obtain the query segmented entropy representation of the time series; for the query segmented entropy representation, obtain a set of query permutation entropy sequences with the dimension of each query permutation entropy spectrum feature as the unit, calculate the similarity based on the query permutation entropy sequence and the sequence on the index, and take the industrial monitoring time series corresponding to the index node with high similarity as the intermediate candidate set; in the subsequent processing process, take the intersection of the intermediate candidate sets, compare the similarity between the original industrial monitoring data and the industrial query data corresponding to the final candidate set, and obtain the query result.
[0010] Furthermore, in step (1), for the time series T = {t 1 ,t 2 ,…,t n}, calculate each sub-segment t i The multi-scale permutation entropy of
[0011]
[0012] Where n is the number of segments, m is the embedding dimension, ρ is the time scale, and π is i Represents the ordinal pattern of the length m-dimensional sub-segments arranged from large to small, Π m ={π 0 ,π 1 ,…,π m!-1} contains all m-order ordinal patterns, p(π i ) represents the ordinal pattern π i The relative frequency of occurrence in T.
[0013] Furthermore, in the step (1), singular value decomposition is performed on the permutation entropy spectrum feature to reduce the dimension, and the time series segmented entropy representation is obtained; specifically, the permutation entropy matrix P is subjected to singular value decomposition to reduce the dimension of P to a k-order matrix
[0014] P=U∑V T
[0015]
[0016] in, represents the permutation entropy matrix of embedding dimension m and time scale ρ, and denote the left and right singular value matrices respectively, represents the eigenvalue diagonal matrix, represents the submatrix containing the k largest eigenvalues, U 1 and V 1 is the corresponding Σ 1The U and V sub-matrices of .
[0017] Furthermore, in the step (2), the prefix features of the permutation entropy sequence corresponding to each dimension are extracted, and the Euclidean distance of the prefix features of all dimensions is used as the lower bound distance to construct an index; in the step (3), the prefix features of the query permutation entropy sequence corresponding to each dimension are extracted, and the lower bound distance to each node in the index is calculated in turn to determine the similarity; the Euclidean distance based on the prefix feature is the lower bound of the piecewise entropy dynamic time warping distance, which can ensure the completeness of the query result, that is, the result of the query based on the piecewise entropy dynamic time warping distance on the original data must be included in the intermediate candidate set based on the prefix feature Euclidean distance query.
[0018] Furthermore, in step (2), the starting value, final value, maximum value, and minimum value of the prefix sequence are extracted as prefix features.
[0019] Furthermore, in step (2), the Euclidean distance of all dimension prefix features is used as the lower bound distance to construct a metric index or a spatial index.
[0020] Furthermore, in step (3), the nodes and their subtrees whose lower bound distance values are greater than the query threshold are pruned, and the time series contained in all leaf nodes whose lower bound distance values are less than or equal to the query threshold are returned as the intermediate candidate set.
[0021] Furthermore, in step (3), since the final candidate set obtained is an address value, a subsequent process is required to read the original industrial monitoring data contained in the leaf nodes (candidate sets) whose lower bound distance is less than or equal to the query threshold in sequence through disk I / O, calculate the piecewise entropy dynamic time warping distance between each original industrial monitoring data and the industrial query data, and return the data less than or equal to the query threshold as the result.
[0022] Furthermore, in step (3), the calculation of the piecewise entropy dynamic time warping distance specifically includes the following sub-steps:
[0023] (3.1) Obtain the piecewise entropy representation corresponding to the industrial query data and the intermediate candidate set;
[0024] (3.2) Construct two piecewise entropy sequences to calculate the point pair distance matrix, where each element value is the Euclidean distance of the corresponding permutation entropy feature vector;
[0025] (3.3) In the point-to-point distance matrix, a dynamic programming algorithm is used to find the optimal curved path so that the cumulative sum of the element values on the path is minimized. The cumulative sum of the path is used as the final distance metric to judge the similarity.
[0026] A similarity query system for arbitrary long time series data is applied to a distributed database. The system comprises a segment feature representation module, a data index construction module and a query processing module, which are respectively used for the segment feature representation, the data index construction and the query processing. The permutation entropy sequence data of each dimension is deployed in the distributed database.
[0027] The advantages and beneficial effects of the present invention are:
[0028] 1. The traditional similarity query method for arbitrary long time series requires the construction of multiple data indexes for various predetermined lengths, while the present invention only needs to construct one index to realize arbitrary length similarity query, which greatly reduces the space overhead of data index;
[0029] 2. The present invention is based on a compact lower bound distance construction, which can ensure that the intermediate candidate set has a small size, greatly reduces the disk I / O time overhead, and significantly improves the query efficiency;
[0030] 3. Traditional similarity query methods for arbitrary long time series cannot support data normalization processing, resulting in invalid similarity measurement and query results. The indexing technology based on multi-scale features proposed in the present invention introduces a unified lower bound distance for normalized subsequences of unequal lengths, effectively ensuring the similarity of query results and query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 is a flow chart of a method in an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.
[0033] like Figure 1 As shown, a similarity query method for arbitrary long time series data is implemented for industrial process sensor monitoring data (including 250 minute-level sampling sequences with a length of 240), and the similarity query of arbitrary length is realized. Specifically, the following steps are included:
[0034] (1) Segmented feature representation: Each sampling sequence in the data set is segmented into equal length segments, and the multi-scale permutation entropy of each sub-segment is calculated. By changing the values of the time scale and the embedding dimension, the permutation entropy spectrum feature is constructed, and the singular value decomposition is performed to reduce the dimension to obtain the time series segmented entropy representation. Specifically, it includes the following sub-steps:
[0035] (1.1) For the time series T = {t 1 ,t 2 ,…,t n}, calculate the multi-scale permutation entropy of each sub-segment according to formulas (1) and (2);
[0036]
[0037] Where n is the number of segments, m is the embedding dimension, ρ is the time scale, and π is i Represents the ordinal pattern of the length m-dimensional sub-segments arranged from large to small, Π m ={π 0 ,π 1 ,…,π m!-1} contains all m-order ordinal modes, and formula (2) calculates π i The relative frequency of occurrence in T.
[0038] In the embodiment of the present invention, each sampling sequence is divided into sub-segments of length 20, and the multi-scale permutation entropy of each sub-segment is calculated according to formulas (1) and (2), where the time scale and the embedding dimension take values of [3, 4, 5, 6] respectively, to construct a 4th-order permutation entropy matrix:
[0039]
[0040] (1.2) For the permutation entropy matrix of embedding dimension m and time scale ρ Perform singular value decomposition according to formula (3), where and are the left and right singular value matrices, is the eigenvalue diagonal matrix; then according to formula (4), P is reduced to a k-order matrix in is the submatrix containing the k largest eigenvalues, U 1 and V 1 is the corresponding Σ 1 The U and V sub-matrices of .
[0041] P = UΣV T (3)
[0042]
[0043] In the embodiment of the present invention, singular value decomposition is performed on the permutation entropy spectrum of each sub-segment according to formula (3), the two largest eigenvalues and their corresponding eigenvectors are retained, and the inverse operation of singular value decomposition is performed to obtain a second-order permutation entropy matrix.
[0044] (2) Data index construction: According to the above piecewise entropy representation, each permutation entropy spectrum contains 4 elements, so the piecewise entropy representation can be decomposed into 4 permutation entropy sequences. On each feature dimension sequence of the permutation entropy spectrum, the starting value, final value, maximum value, and minimum value of each prefix sequence with a sequence length of 8 are extracted as features and combined into a 16-dimensional prefix feature vector; the Euclidean distance of the prefix feature vectors of all dimensions is used as the lower bound distance to construct a metric index or a spatial index. In the embodiment of the present invention, an M-tree index is constructed on all 250 prefix feature vectors.
[0045] (3) Query processing: The query sequence is represented by the segmented entropy of the above parameters, and the 16-dimensional feature vector of the prefix sequence with a length of 8 is extracted. The lower bound distance to each node in the M-tree index is calculated in turn. The nodes and their subtrees with lower bound distance values greater than the query threshold are pruned, and the time series contained in all leaf nodes with lower bound distance values less than or equal to the query threshold are returned as the candidate set. The final query result is obtained through subsequent processing.
[0046] The subsequent process uses disk I / O to read the original data contained in the leaf nodes (candidate sets) whose lower bound distance is less than or equal to the query threshold in sequence, calculates the piecewise entropy dynamic time warping distance between each original data and the query sequence, and returns the data less than the query threshold as the result. The Euclidean distance based on prefix features is the lower bound of the piecewise entropy dynamic time warping distance, which can ensure the completeness of the query results, that is, the results of the query based on the piecewise entropy dynamic time warping distance on the original data must be included in the intermediate candidate set based on the prefix feature Euclidean distance query. The calculation of the piecewise entropy dynamic time warping distance specifically includes the following sub-steps:
[0047] (3.1) calculating the segment entropy representation of the query sequence and the candidate sequence according to step (1);
[0048] (3.2) Construct two piecewise entropy sequences to calculate the point pair distance matrix, where each element value is the Euclidean distance of the corresponding permutation entropy feature vector;
[0049] (3.3) Use the dynamic programming algorithm to find the optimal curved path on the point-to-point distance matrix so that the cumulative sum of the element values on the path is minimized, and the cumulative sum of the path is used as the final distance measurement value.
[0050] The present invention proposes a similarity query method for arbitrary long time series data, which can effectively avoid the influence of data normalization on distance measurement through scale-invariant features, realize unified query of time series of different lengths, significantly reduce index space overhead, and improve query efficiency.
[0051] An arbitrary long time series data similarity query system is applied to distributed databases. The system includes a segment feature representation module, a data index construction module, and a query processing module, which are respectively used for segment feature representation, data index construction, and query processing. The permutation entropy sequence data of each dimension is deployed in the distributed database.
[0052] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A similarity query method for arbitrary long time series data, characterized in that The steps include: (1) Segmented feature representation: Each sampling sequence of industrial monitoring data is divided into equal-length segments, and the multi-scale permutation entropy of each sub-segment is calculated. By changing the values of the time scale and the embedding dimension, the permutation entropy spectrum feature is constructed to obtain the segmented entropy representation of the time series; (2) Data index construction: For the piecewise entropy representation, a set of permutation entropy sequences is obtained with the dimension of each permutation entropy spectrum feature as the unit to construct the index; (3) Query processing: divide the sequence of industrial query data into equal-length segments, calculate the multi-scale permutation entropy of each sub-segment, construct the query permutation entropy spectrum feature by changing the time scale and the value of the embedding dimension, so as to obtain the query segmented entropy representation of the time series; for the query segmented entropy representation, obtain a set of query permutation entropy sequences with the dimension of each query permutation entropy spectrum feature as the unit, calculate the similarity based on the query permutation entropy sequence and the sequence on the index, and take the industrial monitoring time series corresponding to the index node with high similarity as the intermediate candidate set; in the subsequent processing process, take the intersection of the intermediate candidate sets, compare the similarity between the original industrial monitoring data and the industrial query data corresponding to the final candidate set, and obtain the query result.
2. The method for similarity query of arbitrary long time series data according to claim 1, characterized in that: In step (1), for the time series T = {t1, t2, ..., t n }, calculate each sub-segment t i The multi-scale permutation entropy of Where n is the number of segments, m is the embedding dimension, ρ is the time scale, and π is i Represents the ordinal pattern of the length m-dimensional sub-segments arranged from large to small, Π m ={π0,π1,…,π m!-1 } contains all m-order ordinal patterns, p(π i ) represents the ordinal pattern π i The relative frequency of occurrence in T.
3. The method for similarity query of arbitrary long time series data according to claim 2, characterized in that: In the step (1), singular value decomposition is performed on the permutation entropy spectrum feature to reduce the dimension, and the time series segmented entropy representation is obtained; specifically, the permutation entropy matrix P is subjected to singular value decomposition to reduce the dimension of P to a k-order matrix P=U∑V T in, represents the permutation entropy matrix of embedding dimension m and time scale ρ, and denote the left and right singular value matrices respectively, represents the eigenvalue diagonal matrix, represents the submatrix containing the k largest eigenvalues, and U1 and V1 are the U and V submatrices corresponding to Σ1.
4. The method for similarity query of arbitrary long time series data according to claim 1, characterized in that: In the step (2), the prefix sequence features of the permutation entropy sequence corresponding to each dimension are extracted, and the Euclidean distance of the prefix sequence features of all dimensions is used as the lower bound distance to construct an index; in the step (3), the prefix features of the query permutation entropy sequence corresponding to each dimension are extracted, and the lower bound distance to each node in the index is calculated in turn to determine the similarity.
5. The method for similarity query of arbitrary long time series data according to claim 4, characterized in that: In the step (2), the starting value, final value, maximum value, and minimum value of the prefix sequence are extracted as prefix features.
6. The method for similarity query of arbitrary long time series data according to claim 4, characterized in that: In the step (2), the Euclidean distance of all dimension prefix features is used as the lower bound distance to construct a metric index or a spatial index.
7. The method for similarity query of arbitrary long time series data according to claim 4, characterized in that: In the step (3), the nodes and their subtrees whose lower bound distance values are greater than the query threshold are pruned, and the time series contained in all leaf nodes whose lower bound distance values are less than or equal to the query threshold are returned as the intermediate candidate set.
8. The method for similarity query of arbitrary long time series data according to claim 1, characterized in that: In the step (3), the subsequent process sequentially reads the original industrial monitoring data contained in the leaf nodes whose lower bound distance is less than or equal to the query threshold through disk I / O, calculates the piecewise entropy dynamic time warping distance between each original industrial monitoring data and the industrial query data, and returns the data less than or equal to the query threshold as the result.
9. The method for similarity query of arbitrary long time series data according to claim 8, characterized in that: In the step (3), the calculation of the piecewise entropy dynamic time warping distance specifically includes the following sub-steps: (3.1) Obtain the piecewise entropy representation corresponding to the industrial query data and the intermediate candidate set; (3.2) Construct two piecewise entropy sequences to calculate the point pair distance matrix, where each element value is the Euclidean distance of the corresponding permutation entropy feature vector; (3.3) In the point-to-point distance matrix, a dynamic programming algorithm is used to find the optimal curved path so that the cumulative sum of the element values on the path is minimized. The cumulative sum of the path is used as the final distance metric to judge the similarity.
10. A query system for a similarity query method for arbitrary long time series data according to claim 1, applied to a distributed database, characterized in that: The system includes a segment feature representation module, a data index construction module, and a query processing module, which are respectively used for the segment feature representation, the data index construction, and the query processing. The permutation entropy sequence data of each dimension is deployed in the distributed database.
Citation Information
Cited By
Ship classification and identification method and device based on multi-channel underwater acoustic signal characteristics
CN121687117A