A multivariate time series retrieval method and system
Multivariate time series are encoded and trained through encoders and adversarial networks, and Hamming distance and similarity pair loss functions are used to solve the problems of complexity and large amount of calculation in multivariate time series retrieval in the existing technology, and achieve more efficiency and accuracy. search results.
Patent Information
- Application Number
- CN202110452020.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-26
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-04-26
AI Technical Summary
Existing multivariate time series retrieval methods are not ideal when processing complex multivariate time series. They cannot effectively learn the correlation between multiple attributes. The calculation is complex and time-consuming. Moreover, the complex coded time series requires professional knowledge, which increases the complexity of the time series. Error rate.
Encoders and adversarial networks are used for multivariate time series encoding. Hamming distance and similarity pair loss functions are used to reduce the amount of calculation, improve retrieval speed and accuracy, and use Hamming distance to determine similarity and simplify the encoding process.
It reduces the calculation amount of multivariate time series retrieval, improves the retrieval speed and accuracy, reduces the error rate, and improves the accuracy of state identification.
Smart Images

Figure CN113159192B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of time series retrieval, and in particular to a multivariate time series retrieval method and system. Background Art
[0002] Multivariate time series are widely present in our daily life and practical applications, such as wearable devices, disk monitoring, and status monitoring. With the continuous development of computer technology and sensor technology, the amount of multivariate time series data is becoming increasingly large. Therefore, research based on multivariate time series also faces great challenges. Among them, for a given time series, the technology of retrieving similar fragments from previous time series (time series retrieval) is widely used in the fields of state recognition, anomaly detection, etc., and is an extremely important research direction.
[0003] At present, there have been many studies on time series retrieval. Existing research works mainly use traditional machine learning methods such as discrete Fourier transform (DFT), discrete wavelet transform (DWT) and basic neural networks such as long short-term memory network (LSTM) to encode and represent time series, and use methods such as Euclidean distance or dynamic time warping (DTW) to measure the similarity of time series by calculating pairwise distance in feature space. These methods have achieved certain results in experimental univariate time series retrieval, but in the face of complex multivariate time series data, these methods are not ideal: first, univariate time series has only one attribute, while multivariate time series has multiple attributes, and existing methods cannot learn the correlation between multiple attributes of multivariate time series; second, the existing similarity measurement methods are complex to calculate, and when the time series fragment is long, it takes a lot of computational cost; fourth, the existing methods simply encode the characteristics of the time series, and the encoded time series is very complex, which not only requires the prior knowledge of professionals, but also further increases the calculation amount of similarity measurement and increases the error rate.
[0004] Therefore, how to reduce the amount of calculation in the multivariate time series retrieval process and improve the speed and accuracy of multivariate time series retrieval is an urgent problem to be solved. Summary of the invention
[0005] The purpose of the present invention is to provide a multivariate time series retrieval method and system, which can reduce the amount of calculation in the multivariate time series retrieval process and improve the speed and accuracy of the multivariate time series retrieval.
[0006] To achieve the above object, the present invention provides the following solutions:
[0007] A multivariate time series retrieval method, comprising:
[0008] Acquire a test set and a multivariate time series to be retrieved; the test set includes a plurality of encoded test time series feature matrices; the encoded test time series feature matrices are obtained by inputting the test multivariate time series into a trained encoder;
[0009] Inputting the multivariate time series to be retrieved into the trained encoder to obtain an encoded time series feature matrix to be retrieved;
[0010] Respectively calculating the Hamming distance between the to-be-retrieved timing feature matrix and each of the test timing feature matrices;
[0011] Arrange the Hamming distances in ascending order, and determine the test multivariate time series corresponding to the preset number of Hamming distances as similar multivariate time series to the multivariate time series to be retrieved;
[0012] The state represented by the to-be-searched multivariate time series is determined according to the state of the similar multivariate time series.
[0013] Optionally, after obtaining the test set and the multivariate time series to be retrieved, the following is also included:
[0014] Acquire a sample set; the sample set includes a plurality of true multivariate time series;
[0015] Dividing the sample set into a training set and a validation set;
[0016] Using the training set to train the encoder to obtain a trained encoder;
[0017] The trained encoder is verified using the verification set to determine whether the number of times the hyperparameters are adjusted reaches a first preset number of iterations; if not, the hyperparameters are adjusted and the step of "training the encoder using the training set to obtain a trained encoder" is executed; if so, the trained encoder is output.
[0018] Optionally, the using the training set to train the encoder to obtain a trained encoder specifically includes:
[0019] Constructing an adversarial network; the adversarial network includes an encoder, a decoder and a discriminator;
[0020] Inputting random binary codes and uniformly randomly distributed connections into the decoder to obtain a plurality of pseudo multivariate time series;
[0021] Inputting the plurality of true multivariate time series and the plurality of false multivariate time series into the discriminator for training, and adjusting the parameters of the discriminator until the adversarial loss function is less than a first threshold;
[0022] Input multiple true multivariate time series into the encoder for training, adjust the parameters of the encoder according to the identification result of the discriminator until the similarity pair loss function is less than a second threshold, and execute the step of "randomly input multiple true multivariate time series into the decoder to obtain multiple false multivariate time series" until the number of iterations reaches a second preset number of iterations.
[0023] Optionally, the similarity pair loss function is:
[0024] In the formula, s i,j is the value after binarization of the cosine similarity between the i-th segment in the true multivariate time series and the j-th segment in the false multivariate time series, T is the transpose of the matrix; l pairloss is the similarity pair loss function, b i is the binary code of the ith segment in the true multivariate time series, b j is the binary code of the jth segment in the pseudo multivariate time series, and L is the number of bits of the binary code.
[0025] A multivariate time series retrieval system, comprising:
[0026] A data acquisition module is used to acquire a test set and a multivariate time series to be retrieved; the test set includes a plurality of encoded test time series feature matrices; the encoded test time series feature matrices are obtained by inputting the test multivariate time series into a trained encoder;
[0027] A time series feature matrix encoding module to be retrieved, used for inputting the multivariate time series to be retrieved into the trained encoder to obtain an encoded time series feature matrix to be retrieved;
[0028] A Hamming distance calculation module, used to respectively calculate the Hamming distance between the to-be-retrieved timing feature matrix and each of the test timing feature matrices;
[0029] A similar multivariate time series determination module is used to arrange the Hamming distances in ascending order, and determine the test multivariate time series corresponding to a preset number of Hamming distances as similar multivariate time series to the multivariate time series to be retrieved;
[0030] The state determination module is used to determine the state represented by the multivariate time series to be retrieved according to the state of the similar multivariate time series.
[0031] Optionally, the system further includes:
[0032] A sample set acquisition module, used to acquire a sample set; the sample set includes a plurality of true multivariate time series;
[0033] A sample set division module, used for dividing the sample set into a training set and a validation set;
[0034] An encoder training module, used to train the encoder using the training set to obtain a trained encoder;
[0035] The encoder verification module is used to verify the trained encoder using the verification set to determine whether the number of times the hyperparameters are adjusted reaches a first preset number of iterations; if not, the hyperparameters are adjusted and the step of "training the encoder using the training set to obtain a trained encoder" is executed; if yes, the trained encoder is output.
[0036] Optionally, the encoder training module specifically includes:
[0037] An adversarial network construction unit, used to construct an adversarial network; the adversarial network includes an encoder, a decoder and a discriminator;
[0038] A decoding unit, configured to input the random binary code and the uniformly randomly distributed connection into the decoder to obtain a plurality of pseudo multivariate time series;
[0039] A discriminator training unit, used for inputting the plurality of true multivariate time series and the plurality of false multivariate time series into the discriminator for training, and adjusting the parameters of the discriminator until the adversarial loss function is less than a first threshold;
[0040] The encoder training unit is used to input the multiple true multivariate time series into the encoder for training, adjust the parameters of the encoder according to the identification result of the discriminator until the similarity pair loss function is less than a second threshold, and execute the step of "randomly inputting multiple true multivariate time series into the decoder to obtain multiple false multivariate time series" until the number of iterations reaches a second preset number of iterations.
[0041] Optionally, the similarity pair loss function is:
[0042] In the formula, s i,j is the value after binarization of the cosine similarity between the i-th segment in the true multivariate time series and the j-th segment in the false multivariate time series, T is the transpose of the matrix; l pairloss is the similarity pair loss function, b i is the binary code of the ith segment in the true multivariate time series, b j is the binary code of the jth segment in the pseudo multivariate time series, and L is the number of bits of the binary code.
[0043] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0044] The present invention provides a multivariate time series retrieval method and system, the method includes obtaining a test set and a multivariate time series to be retrieved; the test set includes a plurality of encoded test time series feature matrices; the encoded test time series feature matrix is obtained by inputting the test multivariate time series into a trained encoder; the multivariate time series to be retrieved is input into the trained encoder to obtain the encoded time series feature matrix to be retrieved; the Hamming distance between the time series feature matrix to be retrieved and each test time series feature matrix is calculated respectively; the Hamming distances are arranged in ascending order, and the test multivariate time series corresponding to a preset number of Hamming distances are all determined as similar multivariate time series to the multivariate time series to be retrieved; and the state represented by the multivariate time series to be retrieved is determined according to the state of the similar multivariate time series. The method and system provided by the present invention can reduce the amount of calculation in the multivariate time series retrieval process, improve the speed and accuracy of the multivariate time series retrieval, and further improve the accuracy of the state recognition of the multivariate time series to be retrieved by performing similar binary encoding on similar multivariate time series and judging the degree of similarity between multivariate time series by Hamming distance. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0046] Figure 1 A flow chart of a multivariate time series retrieval method provided in an embodiment of the present invention;
[0047] Figure 2 A flow chart of an encoder training method provided in an embodiment of the present invention;
[0048] Figure 3 It is a schematic diagram of the structure of the multivariate time series retrieval system provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] The purpose of the present invention is to provide a multivariate time series retrieval method and system, which can reduce the amount of calculation in the multivariate time series retrieval process and improve the speed and accuracy of the multivariate time series retrieval.
[0051] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0052] Figure 1 Flow chart of the multivariate time series retrieval method provided in an embodiment of the present invention, as shown in Figure 1 As shown, the present invention provides a multivariate time series retrieval method, comprising:
[0053] Step 101: obtaining a test set and a multivariate time series to be retrieved; the test set includes a plurality of encoded test time series feature matrices; the encoded test time series feature matrices are obtained by inputting the test multivariate time series into a trained encoder;
[0054] Step 102: input the multivariate time series to be retrieved into the trained encoder to obtain an encoded time series feature matrix to be retrieved;
[0055] Step 103: respectively calculating the Hamming distance between the time series feature matrix to be retrieved and each test time series feature matrix;
[0056] Step 104: Arrange the Hamming distances in ascending order, and determine the test multivariate time series corresponding to the preset number of Hamming distances as similar multivariate time series to the multivariate time series to be retrieved;
[0057] Step 105: Determine the state represented by the multivariate time series to be retrieved according to the states of similar multivariate time series.
[0058] The multivariate time series retrieval method provided by the present invention further includes, after step 101: obtaining a sample set; the sample set includes multiple true multivariate time series; dividing the sample set into a training set and a verification set; using the training set to train the encoder to obtain a trained encoder; using the verification set to verify the trained encoder, and judging whether the number of times the hyperparameters are adjusted reaches a first preset number of iterations; if not, adjusting the hyperparameters and executing the step of "using the training set to train the encoder to obtain a trained encoder"; if so, outputting the trained encoder.
[0059] Specifically, the encoder is trained using the training set to obtain a trained encoder, which specifically includes:
[0060] Construct an adversarial network; the adversarial network includes an encoder, a decoder, and a discriminator;
[0061] The random binary codes and uniformly randomly distributed connections are input into the decoder to obtain multiple pseudo multivariate time series;
[0062] Inputting a plurality of true multivariate time series and a plurality of false multivariate time series into a discriminator for training, and adjusting the parameters of the discriminator until the adversarial loss function is less than a first threshold;
[0063] Input multiple true multivariate time series into the encoder for training, adjust the parameters of the encoder according to the identification result of the discriminator until the similarity pair loss function is less than a second threshold, and execute the step of "randomly input multiple true multivariate time series into the decoder to obtain multiple false multivariate time series" until the number of iterations reaches a second preset number of iterations.
[0064] Among them, the similarity loss function is:
[0065] In the formula, s i,j is the value after binarization of the cosine similarity between the i-th segment in the true multivariate time series and the j-th segment in the false multivariate time series, T is the transpose of the matrix; l pairloss is the similarity pair loss function, b i is the binary code of the ith segment in the true multivariate time series, b j is the binary code of the jth segment in the pseudo multivariate time series, and L is the number of bits of the binary code.
[0066] Figure 2 Flowchart of the encoder training method provided in an embodiment of the present invention Specifically, in the multivariate time series retrieval method provided by the present invention, encoder training includes the following steps:
[0067] Step 1: Obtain three multivariate time series datasets to be trained.
[0068] Obtain the EEG Eye State dataset (EEG Eye State, EES), the Physical Activity Monitoring dataset (Physical Activity Monitoring, PAMAP2) and the Sussex-Huawei Locomotion Dataset (SHL). The EEG Eye State dataset is obtained from the continuous EEG measurement of the emotion EEG headset, "1" represents eyes closed and "0" represents eyes open; the PAMAP2 dataset is a dataset for monitoring physical activities, containing data of different physical activities, such as walking, cycling, playing football, etc.; the Sussex-Huawei Locomotion Dataset is a multi-functional annotation dataset about the movement and transportation patterns of mobile users.
[0069] Step 2: Convert the data in the dataset in step 1 into a two-dimensional feature form similar to an image, construct a time series feature matrix, and normalize the time series feature matrix so that the value of each attribute is between [0,1], and divide it into training set, validation set and test set.
[0070] The two important properties of multivariate time series are timing properties and correlation between multiple variables. Therefore, we apply sliding windows to obtain the lagged features (deep features) of time series data to reflect the timing properties of multivariate time series, and construct the time series fragments into an image-like two-dimensional matrix. We represent the multivariate time series through an image-like tensor pattern to learn the interactions between variables and apply it to convolutional neural networks.
[0071] In order to express the relationship between different time series pairs in the multivariate time segment from time t-w+1 to time t, an n×n time series feature matrix M is constructed based on the pairwise inner products of different time series pairs in the time segment. t The elements of the time series feature matrix are is the i-th time series segment in the multivariate time series and the jth time segment Timing characteristics of:
[0072]
[0073] Where κ = w
[0074]
[0075]
[0076] In the formula, κ is the scaling factor, w is the size of the sliding window, and δ is the time. The time series features between all time series segments of a multivariate time series constitute the time series feature matrix M t Because the data in the time series feature matrix have different value ranges, the time series feature matrix is normalized using min-max standardization, so that The value range is between [0,1]. After constructing the multivariate time series in the data set into a time series feature matrix, 50% are randomly selected as the training set, 10% as the validation set, and 40% as the test set.
[0077] Step 3: Pre-train to obtain the time series similarity matrix for constructing the similarity pair loss function, train the encoder, improve the identifiability of time segments, and make similar time series have similar binary codes and different time series have different codes.
[0078] Only adversarial loss and reconstruction of input are not enough to make binary coding have more accurate retrieval ability. Therefore, similarity pair loss function is introduced in multivariate time series retrieval to force binary coding to maintain the structure of similar matrix through training.
[0079] A large number of studies have shown that the deep architecture can extract the deep features of each segment in the multivariate time series by inputting the training set, and construct the time series similarity matrix based on the deep features. Among them, the deep architecture is based on convolutional neural networks, which are trained on a large amount of time series data using LSTM encoding.
[0080] According to the deep features, using the formula Calculate the cosine similarity of every two fragments; construct a cosine similarity matrix with cosine similarity as an element; perform a nearest neighbor (K-NearestNeighbor, KNN) search based on cosine distance similarity, arrange all elements in the cosine similarity matrix in ascending order, and determine the elements with a sequence number of the first preset number as the third threshold;
[0081] According to the third threshold, the cosine similarity matrix is binarized: the values of the elements in the cosine similarity matrix that are less than or equal to the third threshold are all set to 1, and the values of the elements in the cosine similarity matrix that are greater than the third threshold are all set to -1.
[0082] Construct similarity pair loss function:
[0083]
[0084] In the formula, s i,j is the value after binarization of the cosine similarity between the i-th segment in the true multivariate time series and the j-th segment in the false multivariate time series, z i is the deep features of the true time series feature matrix corresponding to the i-th segment in the multivariate time series, z j is the deep features of the jth segment in the pseudo-time series feature matrix corresponding to the multivariate time series, and T is the transpose of the matrix; l pairloss is the similarity pair loss function, b i is the binary code of the ith segment in the true multivariate time series, b j is the binary code of the jth segment in the pseudo multivariate time series, L is the number of bits of the binary code, Cos Sim i,j is the cosine similarity between the i-th segment in the true multivariate time series and the j-th segment in the false multivariate time series.
[0085] Step 4: Use a CNN-based deep unsupervised binary adversarial network (Deep Unsupervised CNNBinary Adversarial Network, DUCBA) to train the time series feature matrix dataset.
[0086] The network includes a decoder, an encoder and a discriminator. The discriminator and the encoder share all parameters except the last layer. The decoder input is the connection of two randomly distributed data, random binary coding and uniform random distribution, to generate a false time series feature matrix; the true time series feature matrix (training set) and the false time series feature matrix are input into the discriminator, and the discriminator outputs its judgment; the true time series feature matrix is input into the encoder for binary encoding. During the training process, reconstruction loss, adversarial loss and similarity pair loss are introduced to compensate the decoder, discriminator and discriminator respectively until the number of iterations reaches the second preset number of iterations, where the similarity pair loss is used to characterize the degree of deviation of the training results relative to the time series similarity matrix.
[0087] Step 5: According to the training model obtained in step 4, use the validation set to verify the encoder in step 4, update the hyperparameters (learning rate, number of encoding bits, weights of each loss function, and batch size), return to step 4 to retrain the model, and repeat steps 4 to 5 until all hyperparameters are trained (that is, the number of times the hyperparameters are adjusted reaches the first preset number of iterations) to obtain the optimal training model.
[0088] Step 6: Randomly extract a multivariate time series from the data set as the multivariate time series to be retrieved; input the multivariate time series to be retrieved and the test set into the trained encoder for binary encoding, respectively, and calculate the Hamming distance between the time series feature matrix to be retrieved and each test time series feature matrix; sort the Hamming distances in ascending order, and determine the test multivariate time series corresponding to the preset number of Hamming distances as similar multivariate time series to the multivariate time series to be retrieved. Determine the state represented by the multivariate time series to be retrieved based on the state of the similar multivariate time series.
[0089] After determining multiple (preset number) detection results (similar multivariate time series), the detection accuracy indicators (Precision@k, MAP and MAP@k) are calculated to determine the detection accuracy of the present invention:
[0090]
[0091]
[0092] in,
[0093]
[0094]
[0095] Where tp@k is the number of top k query results that are identical to the top k actual results, fp@k is the number of top k query results that are different from the top k actual results, Precision@k is the top k precision (the proportion of the top k query results in the top k actual results), AP is the average precision of each query result, rel(k) is the indicator function (1 for positive correlation and 0 for no correlation), n represents the number of positive correlations, MAP is the average precision of all query results, Q is the total number of queries, q is the number of queries, AP(q) is the average precision of the qth query, AP@k(q) represents the average precision of the top k query results, and MAP@k is the average of the average precisions of the top k query results when multiple queries are performed.
[0096] The data set is obtained and cleaned. By converting the 1D multivariate time series data into a 2D image-like matrix, a sliding window is used to obtain the lag features of the time series data, and a multivariate time series is represented by an image-like tensor pattern to learn the interaction between variables, so as to apply it to the convolutional neural network. This is conducive to utilizing the advantages of automatic feature extraction of convolutional neural networks, and then using the model to extract domain-invariant features. Compared with traditional similar multivariate time series retrieval methods, the method in the present invention has certain performance improvements in evaluation indicators such as Precision@k, MAP@k and MAP. Hyperparameters in the experimental part: learning rate, number of bits, 3 weights of the loss function, batch size, where the learning rate is {1e-6, 1e-5, 1e-4, 1e-3}, the number of bits is {32, 64, 128}, the weight of the loss function is {1, 1, 0.001}, and the batch size is 100.
[0097] The data extracted from the three data sets by the present invention are shown in Table 1. For the acquisition segments of each data set, the length of each time segment is 10.
[0098] Table 1 Dataset data extraction
[0099] Dataset Number of features Number of time slices Number of categories EEGEyeState 14 1460 2 PAMAP2 51 35720 13 SHL 22 981745 8
[0100] In order to verify the effectiveness of the present invention for multivariate time series retrieval, we conducted comprehensive experiments on three datasets and compared the Precision@k, MAP@k and MAP indicators when the binary encoding is 32 bits, 64 bits and 128 bits respectively. The comparison results are shown in Table 2. Where k represents the first k query results, and b represents the number of binary encoding bits. EEGEye State (k = 100), PAMAP2 (k = 500), SHL (k = 1000),
[0101] Table 2 Precision index of the present invention when encoding different number of bits
[0102]
[0103] As shown in Table 2, the present invention has good effects on the three data sets, and the retrieval effect is optimal when the binary encoding bit number is 128 bits.
[0104] In addition, the technicians also compared the accuracy indicators of the present invention with other time series retrieval methods, and the comparison results are shown in Table 3. Among them, method 1 is the locality sensitive hashing method (LSH), method 2 is the iterative quantization method (ITQ), method 3 is the model that the present invention does not use the similarity pair loss function training; method 4 is the model that the present invention uses the similarity pair loss function training.
[0105] Table 3 Comparison of retrieval accuracy of different time series retrieval methods
[0106]
[0107] As can be seen from Table 3, the retrieval effect of the present invention in multivariate time series retrieval is better than that of the other three methods, which verifies the effectiveness of the present invention for multivariate time series retrieval. In particular, from the data of 3 and method 4, it can be seen that the similarity pair loss added in the present invention improves the retrieval effect of the model.
[0108] Figure 3 FIG. 1 is a schematic diagram of the structure of a multivariate time series retrieval system provided in an embodiment of the present invention. Figure 3 As shown, the present invention also provides a multivariate time series retrieval system, comprising:
[0109] The data acquisition module 301 is used to acquire a test set and a multivariate time series to be retrieved; the test set includes a plurality of encoded test time series feature matrices; the encoded test time series feature matrices are obtained by inputting the test multivariate time series into a trained encoder;
[0110] The time series feature matrix encoding module 302 is used to input the multivariate time series to be retrieved into the trained encoder to obtain the encoded time series feature matrix to be retrieved;
[0111] A Hamming distance calculation module 303 is used to calculate the Hamming distance between the time series feature matrix to be retrieved and each test time series feature matrix;
[0112] A similar multivariate time series determination module 304 is used to arrange the Hamming distances in ascending order, and determine all the test multivariate time series corresponding to the preset number of Hamming distances as similar multivariate time series to the multivariate time series to be retrieved;
[0113] The state determination module 304 is used to determine the state represented by the multivariate time series to be retrieved according to the states of similar multivariate time series.
[0114] The multivariate time series retrieval system provided by the present invention further includes:
[0115] A sample set acquisition module is used to acquire a sample set; the sample set includes multiple true multivariate time series;
[0116] A sample set partitioning module is used to partition the sample set into a training set and a validation set;
[0117] An encoder training module is used to train the encoder using a training set to obtain a trained encoder;
[0118] The encoder verification module is used to verify the trained encoder using the verification set to determine whether the number of times the hyperparameters are adjusted reaches a first preset number of iterations; if not, the hyperparameters are adjusted and the step of "training the encoder using the training set to obtain the trained encoder" is executed; if yes, the trained encoder is output.
[0119] Specifically, the encoder training module includes:
[0120] An adversarial network building unit, used to build an adversarial network; the adversarial network includes an encoder, a decoder and a discriminator;
[0121] A decoding unit, used for inputting the random binary code and the uniformly randomly distributed connection into a decoder to obtain a plurality of pseudo multivariate time series;
[0122] A discriminator training unit, used for inputting a plurality of true multivariate time series and a plurality of false multivariate time series into the discriminator for training, and adjusting the parameters of the discriminator until the adversarial loss function is less than a first threshold;
[0123] The encoder training unit is used to input multiple true multivariate time series into the encoder for training, adjust the parameters of the encoder according to the identification result of the discriminator until the similarity pair loss function is less than a second threshold, and execute the step of "randomly inputting multiple true multivariate time series into the decoder to obtain multiple false multivariate time series" until the number of iterations reaches a second preset number of iterations.
[0124] Among them, the similarity loss function is:
[0125] In the formula, s i,j is the value after binarization of the cosine similarity between the i-th segment in the true multivariate time series and the j-th segment in the false multivariate time series, T is the transpose of the matrix; l pairloss is the similarity pair loss function, b iis the binary code of the ith segment in the true multivariate time series, b j is the binary code of the jth segment in the pseudo multivariate time series, and L is the number of bits of the binary code.
[0126] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0127] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A multivariate time series retrieval method, characterized in that: The method comprises: Acquire a test set and a multivariate time series to be retrieved; the test set includes a plurality of encoded test time series feature matrices; the encoded test time series feature matrices are obtained by inputting the test multivariate time series into a trained encoder; Inputting the multivariate time series to be retrieved into the trained encoder to obtain an encoded time series feature matrix to be retrieved; Respectively calculating the Hamming distance between the to-be-retrieved timing feature matrix and each of the test timing feature matrices; Arrange the Hamming distances in ascending order, and determine the test multivariate time series corresponding to the preset number of Hamming distances as similar multivariate time series to the multivariate time series to be retrieved; Determine the state represented by the to-be-searched multivariate time series according to the state of the similar multivariate time series; After obtaining the test set and the multivariate time series to be retrieved, it also includes: Acquire a sample set; the sample set includes a plurality of true multivariate time series; Dividing the sample set into a training set and a validation set; Using the training set to train the encoder to obtain a trained encoder; Using the validation set to validate the trained encoder, determining whether the number of times the hyperparameters are adjusted reaches a first preset number of iterations; if not, adjusting the hyperparameters and executing the step of "using the training set to train the encoder to obtain a trained encoder"; if so, outputting the trained encoder; The using the training set to train the encoder to obtain a trained encoder specifically includes: Constructing an adversarial network; the adversarial network includes an encoder, a decoder and a discriminator; Inputting random binary codes and uniformly randomly distributed connections into the decoder to obtain a plurality of pseudo multivariate time series; Inputting the plurality of true multivariate time series and the plurality of false multivariate time series into the discriminator for training, and adjusting the parameters of the discriminator until the adversarial loss function is less than a first threshold; Input a plurality of true multivariate time series into the encoder for training, adjust the parameters of the encoder according to the identification result of the discriminator until the similarity pair loss function is less than a second threshold, and execute the step of "randomly input a plurality of true multivariate time series into the decoder to obtain a plurality of false multivariate time series" until the number of iterations reaches a second preset number of iterations.
2. The multivariate time series retrieval method according to claim 1, characterized in that: The similarity pair loss function is: In the formula, s i,j is the value after binarization of the cosine similarity between the i-th segment in the true multivariate time series and the j-th segment in the false multivariate time series, T is the transpose of the matrix; l pairloss is the similarity pair loss function, b i is the binary code of the ith segment in the true multivariate time series, b j is the binary code of the jth segment in the pseudo multivariate time series, and L is the number of bits of the binary code.
3. A multivariate time series retrieval system, characterized in that: The system comprises: A data acquisition module is used to acquire a test set and a multivariate time series to be retrieved; the test set includes a plurality of encoded test time series feature matrices; the encoded test time series feature matrices are obtained by inputting the test multivariate time series into a trained encoder; A time series feature matrix encoding module to be retrieved, used for inputting the multivariate time series to be retrieved into the trained encoder to obtain an encoded time series feature matrix to be retrieved; A Hamming distance calculation module, used to respectively calculate the Hamming distance between the to-be-retrieved timing feature matrix and each of the test timing feature matrices; A similar multivariate time series determination module is used to arrange the Hamming distances in ascending order, and determine the test multivariate time series corresponding to a preset number of Hamming distances as similar multivariate time series to the multivariate time series to be retrieved; A state determination module, used to determine the state represented by the multivariate time series to be retrieved according to the state of the similar multivariate time series; A sample set acquisition module, used to acquire a sample set; the sample set includes a plurality of true multivariate time series; A sample set division module, used for dividing the sample set into a training set and a validation set; An encoder training module, used to train the encoder using the training set to obtain a trained encoder; An encoder verification module is used to verify the trained encoder using the verification set to determine whether the number of times the hyperparameters are adjusted reaches a first preset number of iterations; if not, the hyperparameters are adjusted and the step of "training the encoder using the training set to obtain a trained encoder" is performed; if so, the trained encoder is output; The encoder training module specifically includes: An adversarial network construction unit, used to construct an adversarial network; the adversarial network includes an encoder, a decoder and a discriminator; A decoding unit, configured to input the random binary code and the uniformly randomly distributed connection into the decoder to obtain a plurality of pseudo multivariate time series; A discriminator training unit, used for inputting the plurality of true multivariate time series and the plurality of false multivariate time series into the discriminator for training, and adjusting the parameters of the discriminator until the adversarial loss function is less than a first threshold; The encoder training unit is used to input the multiple true multivariate time series into the encoder for training, adjust the parameters of the encoder according to the identification result of the discriminator until the similarity pair loss function is less than a second threshold, and execute the step of "randomly inputting the multiple true multivariate time series into the decoder to obtain multiple false multivariate time series" until the number of iterations reaches a second preset number of iterations.
4. The multivariate time series retrieval system according to claim 3, characterized in that: The similarity pair loss function is: In the formula, s i,j is the value after binarization of the cosine similarity between the i-th segment in the true multivariate time series and the j-th segment in the false multivariate time series, T is the transpose of the matrix; l pairloss is the similarity pair loss function, b i is the binary code of the ith segment in the true multivariate time series, b j is the binary code of the jth segment in the pseudo multivariate time series, and L is the number of bits of the binary code.
Citation Information
Patent Citations
Video stream processing method and device, computer equipment and storage medium
CN111898416A
