A time series data clustering model establishment and time series data clustering method
The deep neural network combines multiple network structures to extract time series data features, and uses comparison learning and cross-entropy parameter adjustment for clustering, which solves the problem of low accuracy of time series data clustering in the existing technology, and achieves more efficient Feature representation and clustering effects.
Patent Information
- Application Number
- CN202111457339.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-02
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-12-02
AI Technical Summary
When existing clustering algorithms process time series data, there are problems such as high error rate between clustering results and real categories, high randomness, easy degradation to ordinary solutions, and insufficient consideration of the characteristics of time series data.
Deep neural networks, including convolutional neural networks, bidirectional long and short-term memory networks, multi-head attention mechanisms and graph convolutional networks, extract local and long-distance features of time series data, and fuse structural features between the data, and learn through comparison Cluster with cross-entropy parameter adjustment.
It improves the accuracy of time series data clustering, enriches feature extraction capabilities, and effectively solves the problems of insufficient feature extraction expression capabilities and insufficient structural information mining.
Smart Images

Figure CN114168822B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data clustering, and in particular to the establishment of a time series data clustering model and a time series data clustering method. Background Art
[0002] Time series data has temporal continuity, such as electrocardiograms commonly used in the medical field, or temperature data collected by temperature sensors, which usually have temporal continuity. With the help of various automated equipment and sensors, the massive data collected are arranged in chronological order, so the original data contains rich, relevant, and worthy of in-depth mining information. With the increase in various electronic devices, the scale of time series data has increased, and massive unlabeled raw data is constantly being generated. The huge amount of data and the chaos of the data itself hinder the further classification and in-depth use of such data.
[0003] Existing clustering algorithms generally have the disadvantages of high error rate between clustering results and true categories, excessive randomness of clustering results, a certain risk of degenerating into trivial solutions, and insufficient consideration of the characteristics of time series data. There are also problems such as insufficient feature extraction expression ability and insufficient mining of structural information between similar data, which affects the feature mining and extraction of time series data. Summary of the invention
[0004] The problem solved by the present invention is how to improve the accuracy of time series data clustering.
[0005] To solve the above problems, the present invention provides a method for establishing a time series data clustering model, comprising: obtaining original time series data, inputting the original time series data into a deep neural network for training, wherein the training process of the deep neural network comprises: extracting features of the original time series data at adjacent time steps through a convolutional neural network, extracting features of the original time series data at long-distance time steps through a bidirectional long short-term memory network, fusing features at each time step through a multi-head attention mechanism, and fusing structural features between the original time series data through a graph convolutional network to obtain a final feature representation of the original time series data; wherein the original time series data includes electrocardiogram data, traffic flow data, temperature and humidity sensor data, or posture sensor data; clustering time series samples through contrast learning according to the final feature representation, and adjusting parameters according to cross entropy until training is completed to establish a time series data clustering model.
[0006] The method for establishing a time series data clustering model described in the present invention fully captures the local features of time series data through a convolutional neural network, captures the long-distance periodic trend features of time series data through a bidirectional long short-term memory network, and focuses on time segments with large information and significant features through a multi-head attention mechanism, introduces a graph convolutional network to fuse the structural features between time series data, that is, fuses the implicit features between clusters obtained by unsupervised contrastive learning, and realizes efficient feature representation for the characteristics of time series data; adopts a similarity threshold partitioning method to dynamically construct an adjacency graph in the model learning process, applies a graph convolutional network to update neighbor nodes of data, and simultaneously adopts a contrastive learning method to create pseudo-class labels under unsupervised conditions, and through a cross-entropy training model, can complete the clustering of time series data without using a traditional clustering algorithm, enriches the feature extraction capability of the model, effectively solves the problems of insufficient feature extraction expression capability and insufficient structural information mining between similar data in the current existing algorithms, and improves the accuracy of clustering of time series data such as electrocardiogram data, traffic flow data, temperature and humidity sensor data or posture sensor data.
[0007] Optionally, obtaining the original time series data includes: obtaining the original time series data from different fields and preprocessing the data, wherein the preprocessing specifically includes: using the Z-Score standardization method to adjust the mean of the original time series data to 0, and adjusting the standard deviation of the original time series data to 1; for time series of unequal lengths, adding random values with a preset amplitude fluctuation to the tail of a relatively shorter time series; and performing linear interpolation processing on missing time steps.
[0008] The time series data clustering model establishment method described in the present invention performs standardized preprocessing on the original time series data, which is beneficial for subsequent input into a deep neural network for training.
[0009] Optionally, the fusing of the structural features between the original time series data through the graph convolutional network includes: constructing a similarity matrix, constructing an adjacency matrix based on the similarity matrix, and fusing the structural features between the original time series data based on the adjacency matrix and the graph convolutional network.
[0010] The time series data clustering model establishment method described in the present invention constructs an adjacency matrix by constructing a similarity matrix, thereby realizing feature aggregation of neighbor nodes through a graph convolutional network, and realizing structural feature fusion between original time series data.
[0011] Optionally, constructing the similarity matrix includes: determining similarity matrix elements according to hidden representation pairs output by the multi-head attention mechanism, and constructing the similarity matrix according to the similarity matrix elements.
[0012] The method for establishing a time series data clustering model described in the present invention determines the similarity matrix elements through the hidden representation pairs output by the multi-head attention mechanism, thereby constructing the similarity matrix.
[0013] Optionally, constructing an adjacency matrix based on the similarity matrix includes: setting a threshold value, determining intermediate matrix elements based on a comparison result between the similarity matrix elements and the threshold value, constructing an intermediate matrix based on the intermediate matrix elements, and constructing the adjacency matrix based on the intermediate matrix and a unit matrix.
[0014] The method for establishing a time series data clustering model of the present invention determines the constituent elements of the intermediate matrix according to the comparison results between the similarity matrix elements and the threshold value, so that the intermediate matrix can be constructed to construct the adjacency matrix.
[0015] Optionally, the fusing of the structural features between the original time series data according to the adjacency matrix and the graph convolutional network includes: determining a layer feature propagation formula of the graph convolutional network according to the adjacency matrix, and aggregating features of first-order neighbor nodes and second-order neighbor nodes according to the graph convolutional network.
[0016] The method for establishing a time series data clustering model described in the present invention determines the layer feature propagation formula of the graph convolutional network according to the adjacency matrix, so that the features of the first-order neighbor nodes and the second-order neighbor nodes can be aggregated according to the graph convolutional network.
[0017] Optionally, clustering the time series samples through contrastive learning according to the final feature representation includes: determining cosine similarity according to the final feature representation, establishing a loss function according to the cosine similarity, and clustering the time series samples according to the loss function.
[0018] The method for establishing a time series data clustering model described in the present invention determines cosine similarity according to the final feature representation, establishes a loss function according to the cosine similarity, and clusters the time series samples according to the loss function, so that dissimilar samples are separated as much as possible in the feature space, and similar samples are clustered as much as possible, thereby completing the clustering task.
[0019] Optionally, the method for establishing a time series data clustering model further includes: comparing the clustering categories output by the time series data clustering model with the real categories corresponding to the original time series data to verify the performance of the time series data clustering model.
[0020] The method for establishing a time series data clustering model of the present invention can verify the performance and effectiveness of the time series data clustering model by comparing the clustering categories output by the time series data clustering model with the real category labels of the original data.
[0021] The present invention also provides a time series data clustering method, comprising: inputting time series data into the time series data clustering model established by the above-mentioned time series data clustering model establishment method to obtain a clustering result of the time series data. The time series data clustering method has the same advantages as the above-mentioned time series data clustering model establishment method over the prior art, which will not be described in detail here.
[0022] The present invention also provides a computer-readable storage medium, including a computer-readable storage medium storing a computer program and a processor, wherein when the computer program is read and executed by the processor, the above-mentioned method for establishing a time series data clustering model or the time series data clustering method is implemented. The advantages of the computer-readable storage medium and the above-mentioned method for establishing a time series data clustering model over the prior art are the same, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A schematic diagram of a process for establishing a time series data clustering model according to an embodiment of the present invention;
[0024] Figure 2 A schematic diagram of constructing a time series data clustering model according to an embodiment of the present invention;
[0025] Figure 3 Schematic diagram of a multi-head attention mechanism according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] First, the background technology is introduced in detail.
[0027] At present, traditional clustering algorithms are mainly divided into partition clustering (k-means, k-medoids, k-modes, k-medians, kernel k-means, etc.), density clustering (DBSCAN, OPTICS, etc.), hierarchical clustering (BIRCH, CURE, ROCK, Chameleon, AGNES, etc.), grid clustering (STING, CLIQUE, etc.), model-based clustering (Gaussian mixture model clustering, SOM, etc.), kernel clustering and spectral clustering. Such methods can divide similar data into a class based on a certain similarity measure (such as Euclidean distance, etc.). The similarity measure calculation efficiency of these methods is low, and the performance is poor for high-dimensional data. The overall computational complexity of the algorithm is high, and it is difficult to apply to large-scale data sets. It is often necessary to use linear or nonlinear transformations such as principal component analysis, kernel methods and spectral methods to reduce the dimension and transform the features of the data in order to map the original data to a new feature space. Therefore, the high complexity of time series data is a considerable challenge for traditional methods. With the development of deep learning, the ability of neural networks to extract features has gradually increased. Using neural networks to convert data into representations that are more conducive to clustering has become a direction of exploration for researchers.
[0028] The DEC (Deep Embedded Clustering) algorithm was an early method to embed data using deep neural networks. It uses a fully connected network as an autoencoder, and adjusts model parameters by using reconstruction error as the loss function during pre-training. The decoder is then discarded, and only the encoder is retained as the embedding. The cluster center is obtained using the traditional k-means algorithm in the new feature space, and the soft assignment probability of each data point to the cluster center is calculated. A target probability distribution is constructed based on this, and the network parameters are adjusted using relative entropy as the loss function. In order to solve the problem of distorted embedding space caused by discarding the decoder, IDEC (Improved Deep Embedded Clustering) proposes to keep the decoder unchanged and set the loss function to the sum of relative entropy and reconstruction loss. In addition, the DCEC (Deep Convolutional Embedded Clustering) algorithm replaces the fully connected network with a convolutional neural network to improve the feature extraction capability. The algorithm DTC (Deep Temporal Clustering) takes into account the characteristics of time series data on this basis. The feature extraction network adds a bidirectional long short-term memory network on the basis of the convolutional neural network in order to improve the network's extraction ability. However, existing algorithms generally have the disadvantages of high error rate between clustering results and true categories, excessive randomness of clustering results, a certain risk of degenerating to trivial solutions, and insufficient consideration of the characteristics of time series data.
[0029] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0030] like Figure 1 As shown, an embodiment of the present invention provides a method for establishing a time series data clustering model, including: obtaining original time series data, inputting the original time series data into a deep neural network for training, wherein the training process of the deep neural network includes: extracting features of the original time series data at adjacent time steps through a convolutional neural network, extracting features of the original time series data at long-distance time steps through a bidirectional long short-term memory network, fusing features at each time step through a multi-head attention mechanism, and fusing structural features between the original time series data through a graph convolutional network to obtain a final feature representation of the original time series data; wherein the original time series data includes electrocardiogram data, traffic flow data, temperature and humidity sensor data, or posture sensor data; clustering time series samples through contrast learning according to the final feature representation, and adjusting parameters according to cross entropy until training is completed to establish a time series data clustering model.
[0031] Specifically, in this embodiment, combined with Figure 2 As shown in the figure, the deep neural network includes three layers of one-dimensional convolutional neural networks (Conv1D), one layer of bidirectional long short-term memory network (Bi-LSTM), a multi-head attention mechanism layer (Multi-HeadAttention), a fully connected layer (Linear) and two layers of graph convolutional networks (GCN Layer1&Layer2). During training, the Conv1D layer is activated with the Leaky Relu activation function to extract the local features of the original time series data, that is, the features of the adjacent time steps of the original time series data; the Bi-LSTM layer is then used to extract the global features of the original time series data (that is, the features of the long-distance time steps of the original time series data). Considering that the time series data in the real world may be related to future information, a bidirectional LSTM (Bi-LSTM) is used to avoid using external information to obtain more features of the time series data; then the multi-head attention mechanism is used to further process the output of each time step of the Bi-LSTM layer (see Figure 3 Although the multi-head attention mechanism directly processes the output of the Bi-LSTM layer at each time step, the Bi-LSTM layer also processes the output of the Conv1D layer. Therefore, the multi-head attention mechanism actually integrates the features at each time step), so that the model focuses on the fragments with more information and more significant features.
[0032] Combination Figure 2As shown in the figure, the Conv1D layer and the Leaky Relu layer are connected through the Batch Normalization layer. The calculation result of the multi-head attention mechanism will pass through a fully connected linear layer to transform all d-dimensional feature vectors into k-dimensional ones, and then pass through the non-parametric Softmax layer to obtain the intermediate result of feature embedding.
[0033] The calculation process of the multi-head attention mechanism is shown in formulas (1), (2) and (3).
[0034]
[0035]
[0036] MultiHead(Q,K,V)=Concat(head1,…,head h )W O (3)
[0037] Among them, Q represents the output of the last time step of the Bi-LSTM layer, K and V represent the concatenation of the output of each time step of the Bi-LSTM layer, and W represents the weight matrix. The structure of the combination of the multi-head attention mechanism with the convolutional neural network and the bidirectional long short-term memory network at each time step of the time series data is shown in the figure. Figure 3 shown.
[0038] Combination Figure 3 As shown, input samples X0 to X T , through CNNEmbedding Layer (convolutional embedding layer) e0 to e T , after Bi-LSTM Layer (bidirectional long short-term memory layer) outputs h f0 、h b0 to h fT 、h bT , after Multi-Head Attention (multi-head attention mechanism layer), the feature representation is output.
[0039] In order to add the structural information of the data, we can construct a normalized similarity measurement matrix by calculating the similarity of the feature vectors. On this basis, we can further construct the adjacency matrix between time series, add the structural information between the time series data to the model, and fuse the information of the neighbor nodes of the feature vectors through the graph convolutional network to obtain the final hidden representation of the time series data.
[0040] The similarity of feature vectors will be calculated as follows. Let H = f enc (X input ), where f encrepresents the aforementioned convolutional neural network, long short-term memory network and multi-head attention mechanism model, H is the feature representation obtained in this part, then for any input time series sample pair <x i ,x j >, we can get the hidden representation pair <h i ,h j >, calculate the similarity of the two embedding vectors and normalize the result.
[0041]
[0042] Thus, we can get the similarity matrix S, which is a symmetric matrix with diagonal elements of 1, where the matrix element s ij Represents the similarity between the representation vectors of two time series. On this basis, by setting the threshold θ, the adjacency matrix Adj between samples can be constructed:
[0043] Adj=MI (5)
[0044] Where I is the identity matrix, and the elements in the matrix M satisfy:
[0045]
[0046] The relationship between samples is described by the adjacency matrix mentioned above, which will be dynamically updated during the model learning process to update neighbor nodes. The feature aggregation of neighbor nodes uses GCN (graph convolutional network). The calculation process of a single-layer structure is as follows:
[0047]
[0048] Where H represents layer, and the superscript is the number of layers; This matrix represents the original graph structure with self-loops added to it, and is numerically equal to M described in formula (6); Similar to the degree matrix of a graph, it is used to Regularize and get the normalized symmetric matrix after adding the self-loop
[0049] Using graph convolutional networks, the hidden layer vectors learned from the upper layer representation are aggregated between nodes. The information of first-order and second-order neighbor nodes is aggregated through two layers of graph convolutional networks. Finally, after a Softmax layer, the final feature representation of the original time series data is obtained.
[0050] The initial weights of the neural network are initialized randomly using Kaiming distribution. After the original time series data passes through the model, the final feature representation of any two sample pairs can be obtained (h i ,h j), through the cosine distance, a similarity metric, we can calculate the similarity s between two samples in the feature space after representation learning. ij , as shown in formula (8):
[0051]
[0052] For clustering tasks, the true labels of the two samples are unknown at this time. Through contrastive learning and threshold division, the clustering process is controlled by adjusting the threshold. The similarity above this value will be regarded as the two samples belonging to the same category. Therefore, the unsupervised clustering task is transformed into comparing two samples to determine whether the sample pair belongs to the same category. A binary classification problem of a sample pair is obtained, and the binary cross entropy (BCE) is used as the loss function to train and optimize the model. The loss function of contrastive learning can be expressed by formula (9):
[0053] L ij =BCE(r ij ,s ij )=-r ij ·log(s ij )-(1-r ij )·log(1-s ij ) (9)
[0054] where r ij is a pseudo-class label obtained according to the threshold value, and its value is {0,1}. The model will separate dissimilar samples as much as possible in the feature space and cluster similar samples as much as possible during the learning process according to the guidance of the loss function. By adjusting the threshold parameters, the learning process of the model can be optimized and the effect of the clustering task can be improved. For example, in the application of ECG detection, the clustering of ECG heartbeat data is more accurate, which greatly saves the doctor's examination time and improves the diagnosis efficiency.
[0055] In this embodiment, the local features of the time series data are fully captured by a convolutional neural network, the long-distance periodic trend features of the time series data are captured by a bidirectional long short-term memory network, and the multi-head attention mechanism is used to focus on the time segments with large information and significant features. A graph convolutional network is introduced to fuse the structural features between the time series data, that is, to fuse the implicit features between clusters obtained by unsupervised contrastive learning, so as to achieve efficient feature representation for the characteristics of the time series data; a similarity threshold partitioning method is used to dynamically construct an adjacency graph in the model learning process, and a graph convolutional network is applied to update the neighbor nodes of the data. At the same time, a contrastive learning method is used to create pseudo-class labels under unsupervised conditions. Through the cross-entropy training model, the clustering of time series data can be completed without using a traditional clustering algorithm, which enriches the feature extraction capability of the model, effectively solves the problems of insufficient feature extraction expression capability and insufficient structural information mining between similar data in the current existing algorithms, and improves the accuracy of clustering of time series data such as electrocardiogram data, traffic flow data, temperature and humidity sensor data, or posture sensor data.
[0056] Optionally, obtaining the original time series data includes: obtaining the original time series data from different fields and preprocessing the data, wherein the preprocessing specifically includes: using the Z-Score standardization method to adjust the mean of the original time series data to 0, and adjusting the standard deviation of the original time series data to 1; for time series of unequal lengths, adding random values with a preset amplitude fluctuation to the tail of a relatively shorter time series; and performing linear interpolation processing on missing time steps.
[0057] Specifically, in this embodiment, the original time series data can be various data with time series characteristics such as electrocardiogram, traffic flow, temperature and humidity sensors, and posture sensors. For example, the time series data in the time series classification archive of the University of California, Riverside includes electronic equipment, electrocardiogram, pictures, posture movements, sensors, analog signals, spectra, traffic flow, and trajectory. Since the data comes from different fields, some of the original data needs to be standardized. The standardization method used for the original data is Z-Score standardization, that is, the mean of the original data is adjusted to 0, and the standard deviation of the data is adjusted to 1. In addition, for a small number of time series with unequal lengths, random values with low amplitude fluctuations are added to the tail of relatively short sequences. For a small number of time series data with missing values, linear interpolation is performed for occasionally missing time steps. The category label information contained in the classified data set will be hidden and will not be passed into the model to cause data leakage problems.
[0058] In this embodiment, standardization preprocessing is performed on the original time series data, which facilitates the subsequent input into the deep neural network for training.
[0059] Optionally, the fusing of the structural features between the original time series data through the graph convolutional network includes: constructing a similarity matrix, constructing an adjacency matrix based on the similarity matrix, and fusing the structural features between the original time series data based on the adjacency matrix and the graph convolutional network.
[0060] Specifically, in this embodiment, as shown in the above formulas (4), (5) and (6), the structural features between the original time series data are fused through the graph convolution network, including: constructing a similarity matrix s, constructing an adjacency matrix Adj according to the similarity matrix, the relationship between samples is described by the adjacency matrix, which will be dynamically updated during the model learning process to realize the update of neighbor nodes, and the feature aggregation of neighbor nodes is realized through the graph convolution network, that is, the structural features between the original time series data are fused.
[0061] In this embodiment, an adjacency matrix is constructed by constructing a similarity matrix, so that feature aggregation of neighbor nodes is achieved through a graph convolutional network, thereby achieving structural feature fusion between original time series data.
[0062] Optionally, constructing the similarity matrix includes: determining similarity matrix elements according to hidden representation pairs output by the multi-head attention mechanism, and constructing the similarity matrix according to the similarity matrix elements.
[0063] Specifically, in this embodiment, constructing the similarity matrix includes: according to the hidden representation pair output by the multi-head attention mechanism <h i ,h j >Determine the similarity matrix element s ij , so that the similarity matrix S can be constructed.
[0064] In this embodiment, the similarity matrix elements are determined by the hidden representation pairs output by the multi-head attention mechanism, so that the similarity matrix can be constructed.
[0065] Optionally, constructing an adjacency matrix based on the similarity matrix includes: setting a threshold value, determining intermediate matrix elements based on a comparison result between the similarity matrix elements and the threshold value, constructing an intermediate matrix based on the intermediate matrix elements, and constructing the adjacency matrix based on the intermediate matrix and a unit matrix.
[0066] Specifically, in this embodiment, constructing an adjacency matrix according to the similarity matrix includes: setting a threshold value θ, see formula (6), according to the similarity matrix element s ij The comparison result with the threshold value θ determines the intermediate matrix element m ij , so that the intermediate matrix M can be constructed, see formula (5), and then the adjacency matrix Adj is constructed based on the intermediate matrix M and the identity matrix I.
[0067] In this embodiment, the constituent elements of the intermediate matrix are determined according to the comparison result between the similarity matrix elements and the threshold value, so that the intermediate matrix can be constructed to construct the adjacency matrix.
[0068] Optionally, the fusing of the structural features between the original time series data according to the adjacency matrix and the graph convolutional network includes: determining a layer feature propagation formula of the graph convolutional network according to the adjacency matrix, and aggregating features of first-order neighbor nodes and second-order neighbor nodes according to the graph convolutional network.
[0069] Specifically, in this embodiment, referring to the above formula (7), the layer feature propagation formula of the graph convolutional network is determined according to the adjacency matrix, that is, formula (7), so that the features of the first-order neighbor nodes and the second-order neighbor nodes can be aggregated according to the graph convolutional network.
[0070] In this embodiment, the layer feature propagation formula of the graph convolutional network is determined according to the adjacency matrix, so that the features of the first-order neighbor nodes and the second-order neighbor nodes can be aggregated according to the graph convolutional network.
[0071] Optionally, clustering the time series samples through contrastive learning according to the final feature representation includes: determining cosine similarity according to the final feature representation, establishing a loss function according to the cosine similarity, and clustering the time series samples according to the loss function.
[0072] Specifically, in this embodiment, referring to the above formula (8), according to the final feature representation (h i ,h j ) Determine the cosine similarity s ij , so the loss function of contrastive learning can be established according to formula (9), and the time series samples are clustered according to the loss function, so that dissimilar samples are separated as much as possible in the feature space, and similar samples are clustered as much as possible.
[0073] In this embodiment, the cosine similarity is determined according to the final feature representation, a loss function is established according to the cosine similarity, and the time series samples are clustered according to the loss function, so that dissimilar samples are separated as much as possible in the feature space, and similar samples are clustered as much as possible, thereby completing the clustering task.
[0074] Optionally, the method for establishing a time series data clustering model further includes: comparing the clustering categories output by the time series data clustering model with the real categories corresponding to the original time series data to verify the performance of the time series data clustering model.
[0075] Specifically, in this embodiment, the feature vector obtained by learning can represent the probability that the sample belongs to each cluster after passing through the last Softmax layer. Therefore, after the training is completed, the maximum value subscript of the feature vector is used as the category label to obtain the clustering result representing the learning.
[0076] c i = argmax(h i ) (10)
[0077] Generally, the original time series data contains real category labels. The clustering algorithm used in the present invention does not use label information during the training process, but the label information can be used to evaluate the effectiveness of the clustering results of the present invention. Formula (10) is used to process the output of the time series data clustering model, and the obtained cluster categories are compared with the real category labels of the original data to verify the performance and effectiveness of the time series data clustering model.
[0078] In this embodiment, the performance and effectiveness of the time series data clustering model can be verified by comparing the clustering categories output by the time series data clustering model with the true category labels of the original data.
[0079] Another embodiment of the present invention provides a time series data clustering method, comprising: inputting time series data into the time series data clustering model established by the above-mentioned time series data clustering model establishment method to obtain a clustering result of the time series data.
[0080] Another embodiment of the present invention provides a computer-readable storage medium, including a computer-readable storage medium storing a computer program and a processor. When the computer program is read and executed by the processor, the above-mentioned time series data clustering model establishment method or time series data clustering method is implemented.
[0081] Although the present invention is disclosed as above, the protection scope of the present invention is not limited thereto. Those skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention, and these changes and modifications will fall within the protection scope of the present invention.
Claims
1. A method for establishing a time series data clustering model, characterized in that: include: Obtaining original time series data, and inputting the original time series data into a deep neural network for training, wherein the training process of the deep neural network includes: extracting features of the original time series data at adjacent time steps through a convolutional neural network, extracting features of the original time series data at long-distance time steps through a bidirectional long short-term memory network, fusing features at each time step through a multi-head attention mechanism, and fusing structural features between the original time series data through a graph convolutional network to obtain a final feature representation of the original time series data; wherein the original time series data includes electrocardiogram data, traffic flow data, temperature and humidity sensor data, or posture sensor data; Clustering the time series samples through contrastive learning according to the final feature representation, and adjusting parameters according to the cross entropy until the training is completed to establish a time series data clustering model; Wherein, the obtaining of original time series data includes: obtaining the original time series data from different fields and performing preprocessing, wherein the preprocessing specifically includes: The Z-Score standardization method is used to adjust the mean of the original time series data to 0 and the standard deviation of the original time series data to 1; For time series of unequal length, random values fluctuating with a preset amplitude are added to the tail of the relatively shorter time series; Missing time steps are linearly interpolated.
2. The method for establishing a time series data clustering model according to claim 1, characterized in that: The structural features of the original time series data are fused through the graph convolutional network, including: A similarity matrix is constructed, an adjacency matrix is constructed according to the similarity matrix, and structural features between the original time series data are fused according to the adjacency matrix and the graph convolution network.
3. The method for establishing a time series data clustering model according to claim 2, characterized in that: The constructing similarity matrix comprises: Determine similarity matrix elements according to the hidden representation pairs output by the multi-head attention mechanism, and construct the similarity matrix according to the similarity matrix elements.
4. The method for establishing a time series data clustering model according to claim 2, characterized in that: The constructing an adjacency matrix according to the similarity matrix comprises: A threshold is set, an intermediate matrix element is determined according to a comparison result between the similarity matrix element and the threshold, an intermediate matrix is constructed according to the intermediate matrix element, and the adjacency matrix is constructed according to the intermediate matrix and a unit matrix.
5. The method for establishing a time series data clustering model according to claim 2, characterized in that: The step of fusing the structural features of the original time series data according to the adjacency matrix and the graph convolution network includes: A layer feature propagation formula of the graph convolutional network is determined according to the adjacency matrix, and features of first-order neighbor nodes and second-order neighbor nodes are aggregated according to the graph convolutional network.
6. The method for establishing a time series data clustering model according to claim 1, characterized in that: The clustering of time series samples by contrastive learning according to the final feature representation includes: The cosine similarity is determined according to the final feature representation, a loss function is established according to the cosine similarity, and the time series samples are clustered according to the loss function.
7. The method for establishing a time series data clustering model according to claim 1, characterized in that: Also includes: The clustering categories output by the time series data clustering model are compared with the true categories corresponding to the original time series data to verify the performance of the time series data clustering model.
8. A time series data clustering method, characterized in that: include: The time series data is input into the time series data clustering model established by the time series data clustering model establishment method according to any one of claims 1 to 7 to obtain a clustering result of the time series data.
9. A computer-readable storage medium, characterized in that: It comprises a computer-readable storage medium storing a computer program and a processor. When the computer program is read and executed by the processor, the method for establishing a time series data clustering model as described in any one of claims 1 to 7 or the time series data clustering method as described in claim 8 is implemented.
Citation Information
Patent Citations
Time series data clustering method based on noise reduction encoder and attention mechanism
CN112348068A
Structured depth incomplete multi-view clustering method
CN113128600A