Time series deep clustering method, device and medium based on multi-contrast learning
By introducing multiple contrast learning mechanisms and spatial information coding in the time series depth clustering method, the problem of existing methods ignoring spatial information and spatial correlation is solved, and a more accurate and robust time series clustering effect is achieved.
Patent Information
- Application Number
- CN202410810868.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-06-21
AI Technical Summary
The existing time series deep clustering methods ignore the spatial information of the data, fail to fully mine the internal temporal dynamic mode and spatial correlation of the data, and it is difficult to capture the spatial and temporal structure of the data, resulting in poor clustering effect and weak robustness.
The time series deep clustering method based on multi-contrast learning is adopted. By obtaining the time series data set and data augmentation, spatial position information is extracted and encoded, the multi-contrast clustering model is trained, and the model parameters are optimized using preset loss functions until the clustering requirements are met.
By fusing time series features and spatial position information, the accuracy and robustness of clustering are improved, the consistency and stability of clustering results are ensured, the impact of noise and data distribution changes is reduced, and the clustering quality and generalization ability of the model are improved.
Smart Images

Figure CN118839174B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data mining and analysis, and in particular to a method, device and medium for deep clustering of time series based on multi-contrast learning. Background Art
[0002] In the context of the big data era, large-scale time series data containing spatiotemporal information is increasing, and its importance in the fields of the Internet of Things, market analysis, environmental monitoring, etc. has been increasingly highlighted. In recent years, the rise of deep learning technology has promoted the development of the field of time series data analysis, especially the rise of deep clustering methods. In related technologies, deep neural networks are used to learn nonlinear mappings from data and map high-dimensional data to low-dimensional feature spaces, thereby improving clustering efficiency. The core idea is to make the clustering structure of data points more obvious through dimensionality reduction, so that traditional clustering methods (such as K-means) can be used for effective clustering.
[0003] However, the existing time series deep clustering methods have some shortcomings. For example, most of the existing methods ignore the spatial information of the data, or some methods use spatial information but do not fully explore the temporal dynamic patterns and spatial correlations inherent in the data; some methods only use a single reconstruction loss to optimize the model feature extraction and mapping capabilities when considering the spatially aware time series deep clustering model, and are unable to learn the discriminative and anti-interference feature representation of the data, and it is difficult to capture the temporal and spatial intrinsic structure of the data. In addition, most of the current clustering layers use traditional clustering algorithms such as K-means, which are difficult to fully utilize the correlation information of the deep embedded space, and have poor clustering effects on complex time series data and weak robustness. Summary of the invention
[0004] The embodiments of the present disclosure at least provide a method, device and medium for deep clustering of time series based on multi-contrast learning, which can introduce a multi-contrast learning mechanism by fusing the temporal information and spatial information of the data, thereby improving the accuracy and robustness of clustering.
[0005] The present disclosure provides a time series deep clustering method based on multi-contrast learning, including:
[0006] Acquire a time series data set, and perform data enhancement processing on the time series data set based on a preset data enhancement method to obtain an enhanced data set; the time series data set includes time series data at different locations; the time series data includes data information corresponding to different time points; the enhanced data in the enhanced data set corresponds one-to-one to the data information in the time series data;
[0007] Acquire spatial position information corresponding to each time series data in the time series data set, and encode each piece of spatial position information based on a spatial information encoder to obtain a spatial information vector set corresponding to the time series data set;
[0008] According to the time series data set, the enhanced data set and the spatial information vector set, the multi-contrast clustering model to be trained is trained; and based on the preset loss function, it is judged whether the target loss of the multi-contrast clustering model to be trained meets the preset loss condition, and the model parameters of the multi-contrast clustering model to be trained are adjusted according to the judgment result, and the above steps are repeated until the training result meets the preset clustering requirement, so as to obtain a trained multi-contrast clustering model; the target loss includes reconstruction loss, cluster distribution loss, spatial soft contrast loss, instance contrast loss and cluster contrast loss;
[0009] According to the spatial information vector set, clustering processing is performed on the time series data set based on the trained multi-contrast clustering model to obtain a target clustering result.
[0010] The present disclosure provides a time series deep clustering device based on multi-contrastive learning, including:
[0011] A data enhancement module is used to obtain a time series data set, and perform data enhancement processing on the time series data set based on a preset data enhancement method to obtain an enhanced data set; the time series data set includes time series data at different locations; the time series data includes data information corresponding to different time points; the enhanced data in the enhanced data set corresponds one-to-one to the data information in the time series data;
[0012] A spatial information encoding module is used to obtain spatial position information corresponding to each time series data in the time series data set, and encode each of the spatial position information based on a spatial information encoder to obtain a spatial information vector set corresponding to each time series data;
[0013] A model training module is used to train the multi-contrast clustering model to be trained according to the time series data set, the enhanced data set and the spatial information vector set; and based on a preset loss function, determine whether the target loss of the multi-contrast clustering model to be trained meets the preset loss condition, adjust the model parameters of the multi-contrast clustering model to be trained according to the determination result, and repeat the above steps until the training result meets the preset clustering requirements to obtain a trained multi-contrast clustering model; the target loss includes reconstruction loss, cluster distribution loss, spatial soft contrast loss, instance contrast loss and cluster contrast loss;
[0014] The data clustering module is used to perform clustering processing on the time series data set according to the spatial information vector set and based on the trained multi-contrast clustering model to obtain a target clustering result.
[0015] An embodiment of the present disclosure provides a computer device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, a time series deep clustering method based on multi-contrast learning as described in any possible implementation manner described above is performed.
[0016] An embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for deep clustering of time series based on multi-contrast learning as described in any possible implementation manner described above is implemented.
[0017] The time series deep clustering method, device, medium and equipment based on multi-contrast learning provided in the embodiments of the present disclosure first obtain a time series data set and process it using a preset data enhancement method to generate an enhanced data set; then extract the spatial position information of each time series data in the time series data set, and encode each spatial position information to generate a corresponding spatial information vector set; then use the time series data set, the enhanced data set and the spatial information vector set to train a multi-contrast clustering model; evaluate the target loss of the model through a preset loss function, adjust the model parameters according to the evaluation results and repeat the training until the preset clustering requirements are met, thereby obtaining a trained multi-contrast clustering model; finally, use the trained model to cluster the time series data set according to the spatial information vector set to obtain a final clustering result. In this way, by integrating the time series characteristics and spatial location information of the data, the clustering process can better capture the overall structure and internal connections of spatiotemporal data; the introduction of a multi-contrast learning mechanism drives the model to extract spatiotemporal features with better interference resistance and generalization, thereby improving the clustering performance, ensuring the consistency and stability of the clustering results, reducing the impact of noise and data distribution changes on clustering, and improving the clustering quality and the generalization ability of the model. It is suitable for application scenarios such as traffic flow analysis and meteorological monitoring that require intelligent analysis of spatiotemporal big data.
[0018] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required to be cited in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 A flowchart of a time series deep clustering method based on multi-contrast learning provided by an embodiment of the present disclosure is shown;
[0021] Figure 2 A flowchart of a data reconstruction method in a time series deep clustering method based on multi-contrast learning provided by an embodiment of the present disclosure is shown;
[0022] Figure 3 A schematic diagram of a time series deep clustering method based on multi-contrast learning provided by an embodiment of the present disclosure is shown;
[0023] Figure 4 A flowchart showing a specific method for calculating target loss in a time series deep clustering method based on multi-contrast learning provided by an embodiment of the present disclosure;
[0024] Figure 5 A schematic diagram of the structure of a time series deep clustering device based on multi-contrast learning provided by an embodiment of the present disclosure is shown;
[0025] Figure 6 A schematic diagram of the structure of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0027] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0028] The term "and / or" herein only describes an association relationship, indicating that three relationships may exist. For example, A and / or B may represent the following three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.
[0029] With the advent of the big data era, large-scale time series data containing spatiotemporal information are increasing. Time series data is becoming more and more important in various fields, especially in the fields of Internet of Things, market analysis, environmental monitoring, etc. The analysis of time series data is of great significance for prediction and decision-making. In recent years, the rise of deep learning technology has promoted the development of clustering analysis. Among them, deep clustering methods for time series can automatically learn low-dimensional representations of data, reduce data dimensions, and thus improve clustering efficiency. Its core idea is to use deep neural networks to learn a nonlinear mapping from data and map high-dimensional data to low-dimensional feature space. In this space, the clustering structure of data points is more obvious, so traditional clustering methods such as K-means can be used for effective clustering.
[0030] Research has found that existing deep clustering methods for time series have some shortcomings. For example, most methods ignore the spatial information of the data, or although they use spatial information, they do not fully explore the temporal dynamic patterns and spatial correlations inherent in the data. Some methods only use a single reconstruction loss to optimize the model's feature extraction and mapping capabilities when considering spatially aware time series deep clustering models, making it difficult to learn discriminative and anti-interference feature representations and unable to capture the temporal and spatial intrinsic structure of the data. In addition, traditional clustering algorithms such as K-means are difficult to fully utilize the correlation information of the deep embedded space, resulting in poor clustering effects on complex time series data and insufficient robustness.
[0031] Based on the above research, a method, device and medium for deep clustering of time series based on multi-contrast learning are provided in the embodiments of the present disclosure, which specifically include: first, obtaining a time series data set and processing it using a preset data enhancement method to generate an enhanced data set; then extracting the spatial position information of each time series data in the time series data set, and encoding each spatial position information to generate a corresponding spatial information vector set; then training a multi-contrast clustering model using the time series data set, the enhanced data set and the spatial information vector set; evaluating the target loss of the model through a preset loss function, adjusting the model parameters according to the evaluation results and repeating the training until the preset clustering requirements are met, thereby obtaining a trained multi-contrast clustering model; finally, using the trained model, clustering the time series data set according to the spatial information vector set to obtain a final clustering result.
[0032] In the disclosed embodiments, by fusing the time series features and spatial location information of the data, the clustering process can better capture the overall structure and internal connections of the spatiotemporal data; the multi-contrast learning mechanism is introduced to drive the model to extract spatiotemporal features with better interference resistance and generalization, thereby improving the clustering performance, ensuring the consistency and stability of the clustering results, reducing the impact of noise and data distribution changes on clustering, and improving the clustering quality and the generalization ability of the model. It is suitable for application scenarios such as traffic flow analysis and meteorological monitoring that require intelligent analysis of spatiotemporal big data.
[0033] To facilitate understanding of this embodiment, the execution subject of the time series deep clustering method based on multi-contrast learning provided by the embodiment of the present disclosure is first introduced in detail. The execution subject of the time series deep clustering method based on multi-contrast learning provided by the embodiment of the present disclosure is a computer device. The computer device can be a server. Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, big data and artificial intelligence platforms.
[0034] The time series deep clustering method based on multi-contrast learning provided by the embodiment of the present application is described in detail below in conjunction with the accompanying drawings. Figure 1 As shown, it is a flowchart of a time series deep clustering method based on multi-contrast learning provided by an embodiment of the present disclosure, and the method includes the following S101-S104:
[0035] S101, obtaining a time series data set, and performing data enhancement processing on the time series data set based on a preset data enhancement method to obtain an enhanced data set.
[0036] Here, the time series data set includes time series data at different locations, and each time series data includes data information corresponding to different time points. In some possible embodiments, the time series data set may be traffic flow data (traffic flow data information at different locations and at different times), or may be meteorological monitoring data (meteorological monitoring data information at different locations and at different times) or other time series data sets related to space, which are not specifically limited here. In order to enhance the generalization ability of the model, the time series data set is subjected to data enhancement processing, and the preset data enhancement method may be any one of the methods such as time series scaling, time reversal, and noise addition, which are not specifically limited here. The enhanced data in the enhanced data set obtained by the data enhancement processing corresponds one-to-one to the data information in the time series data.
[0037] S102, obtaining spatial position information corresponding to each time series data in the time series data set, and encoding each piece of spatial position information based on a spatial information encoder to obtain a spatial information vector set corresponding to the time series data set.
[0038] It is understandable that when processing a time series data set, the spatial location information corresponding to each time series data is first obtained. This means that it is necessary to clarify the location represented by each data information, such as the location of different roads or intersections in traffic flow data, or the location of different meteorological stations in meteorological monitoring data. After obtaining the spatial location information, each spatial location information is position-encoded to obtain a set of spatial information vectors. Among them, position encoding is a process of converting the spatial location information of a data point into a useful feature representation. Through a preset encoding method, the spatial location information of each data point (such as longitude and latitude, address or other geographic identifier) can be mapped to a vector representation (spatial information vector) in a space. This vector captures the relative position and relationship of the data point in space. In the disclosed embodiment, the spatial location information is encoded using a pre-trained Space2Vec model to obtain a set of spatial information vectors. Among them, Space2Vec is a multi-scale representation learning model for learning spatial feature distribution.
[0039] S103, training the multi-contrast clustering model to be trained according to the time series data set, the enhanced data set and the spatial information vector set; and judging whether the target loss of the multi-contrast clustering model to be trained meets the preset loss condition based on the preset loss function, adjusting the model parameters of the multi-contrast clustering model to be trained according to the judgment result, repeating the above steps until the training result meets the preset clustering requirements, and obtaining a trained multi-contrast clustering model.
[0040] Specifically, when training the multi-contrast clustering model to be trained according to the time series data set, the enhanced data set, and the spatial information vector set, the following (1) to (3) may be included:
[0041] (1) obtaining a multi-contrast clustering model to be trained; the multi-contrast clustering model to be trained includes a data reconstruction model to be trained;
[0042] (2) inputting the time series data set and the spatial information vector set into the data reconstruction model to be trained to obtain an original data input reconstruction set; and inputting the enhanced data set and the spatial information vector set into the data reconstruction model to be trained to obtain an enhanced data input reconstruction set;
[0043] (3) Training the multi-contrast clustering model to be trained based on the original data input reconstruction set and the enhanced data input reconstruction set.
[0044] Here, the multi-contrast clustering model to be trained includes a data reconstruction model to be trained, and the data reconstruction model to be trained includes a feature encoding module and a feature decoding module. In the process of inputting the time series data set and the spatial information vector set, the enhanced data set and the spatial information vector set into the data reconstruction model to be trained, see Figure 2 FIG. 2 is a flow chart of a data reconstruction method provided by an embodiment of the present disclosure, and the method includes the following S201 to S203:
[0045] S201, merging the time series data set and the spatial information vector set to obtain an original data input set; and merging the enhanced data set and the spatial information vector set to obtain an enhanced data input set.
[0046] It can be understood that the time series data set and the enhanced data set are respectively merged with the spatial information vector set, so that the obtained original data input set and enhanced data input set can retain the temporal characteristics and spatial characteristics of the data to better represent the overall characteristics of the data. Specifically, in some possible embodiments, before merging the time series data set and the enhanced data set with the spatial information vector set, the time series data set can also be encoded to obtain the time data vector set, and the enhanced data set can be encoded to obtain the enhanced data vector set. Then, the time data vector set and the spatial information vector set are merged through the reconstruction coding module to obtain the original data input set; similarly, the enhanced data vector set and the spatial information vector set are merged through the reconstruction coding module to obtain the enhanced data input set. In some other embodiments, the time series data set and the enhanced data set can also be directly merged with the spatial information vector, respectively, which is not specifically limited here.
[0047] S202, mapping the original data input set to a latent space based on the feature encoding module to obtain an original data latent feature set; and mapping the enhanced data input set to a latent space based on the feature encoding module to obtain an enhanced data latent feature set.
[0048] Exemplarily, the feature encoding module uses the reconstruction mapping technology to convert the data in the original data input set into feature representations in the latent space, and obtains the original data latent feature set, which captures the important features of the original data input set; similarly, for the enhanced data input set, the feature encoding module maps the data in the enhanced data input set into the latent space through the reconstruction mapping technology, and obtains the enhanced data latent feature set about the enhanced data input set. In this way, the original data input set and the enhanced data input set are converted into low-dimensional latent feature sets that retain the key features of the data through the feature encoding module.
[0049] See also Figure 3As shown, in the embodiment of the present disclosure, a fusion of efficient optimization transformer and quantum representation learning model is used, the spatiotemporal relationship and complexity between data are considered at the same time, and the data can be converted into a low-dimensional feature representation that retains the key features of the data, thereby improving the efficiency and performance of data processing and analysis. Specifically, the feature encoding module of the present disclosure is composed of N efficient optimization transformer blocks, a quantum representation learning network and a multi-layer perceptron containing two hidden layers. Before inputting the transformer block, the embedding vector of length L is divided into segment patches of segment length S, and each segment patch is injected with a sine-based position encoding as the input of the transformer, thereby reducing the input dimension of the input transformer from L to L / S. Each transformer block is composed of a sparse attention mechanism, a feedforward neural network, layer normalization and residual connection. The sparse attention mechanism adopts BIGBIRD, in which the white area indicates that attention is not calculated. This sparse attention mechanism combines the advantages of sliding connection, global connection and random connection, so that the model can significantly improve the computational efficiency while maintaining performance. After the transformer module is the quantum representation learning network, which is first transformed into a quantum superposition state feature representation through a Hadamard gate, then through an Rx(θ0) rotation gate and a Ry(θ1) rotation gate, and finally uses a Pauli-Z gate to perform quantum measurement on each quantum bit to obtain the output. Taking advantage of the good feature representation ability of quantum computing, the model training process adjusts the angle of the rotation gate through back propagation to learn the best feature representation, and then the output of the quantum representation learning network is passed to the multi-layer perceptron to generate the final potential feature representation. Correspondingly, the structure of the feature decoding module is approximately symmetrical with the feature encoding module, and consists of a multi-layer perceptron, a quantum representation learning network, and N efficient optimized transformer blocks. In this way, the present disclosure utilizes the powerful self-attention mechanism of the transformer model and the ability of the quantum representation learning model to achieve comprehensive learning and expression of data features.
[0050] S203, decoding and reconstructing the original data potential feature set based on the feature decoding module to obtain an original data input reconstruction set; and decoding and reconstructing the enhanced data potential feature set based on the feature decoding module to obtain an enhanced data input reconstruction set.
[0051] Specifically, after the original data input set and the enhanced data input set are respectively subjected to latent space mapping processing by the feature encoding module to obtain the original data latent feature set and the enhanced data latent feature set, they are then decoded by the feature decoding module to convert them back to the original data space.
[0052] It can be understood that the multi-contrast clustering model to be trained also includes a data clustering model to be trained. After obtaining the original data potential feature set and the enhanced data potential feature set through the data reconstruction model to be trained, the original data potential feature set and the enhanced data potential feature set are respectively input into the data clustering model to be trained for training. Specifically, the original data potential feature set is input into the data clustering model to be trained, and the CorClustST algorithm based on cosine similarity is used to cluster the original data potential feature set to obtain the original clustering result; and the enhanced data potential feature set is input into the data clustering model to be trained, and the CorClustST algorithm based on cosine similarity is used to cluster the enhanced data potential feature set to obtain the enhanced clustering result. Here, the CorClustST algorithm based on cosine similarity is a clustering algorithm for space-time data, which combines spatiotemporal correlation and cluster analysis to discover and describe potential patterns and cluster structures in space-time series data sets.
[0053] Here, after obtaining the original clustering results corresponding to the potential feature set of the original data and the enhanced clustering results corresponding to the potential feature set of the enhanced data, it is determined whether the target loss of the multi-contrast clustering model to be trained meets the preset loss condition based on the preset loss function according to the potential feature set of the original data, the reconstruction set of the original data input, the original clustering results and the potential feature set of the enhanced data, the reconstruction set of the enhanced data input, and the enhanced clustering results. Specifically, the preset loss function includes a reconstruction loss function, a cluster distribution loss function, a spatial soft contrast loss function, an instance contrast loss function, and a cluster contrast loss function; the target loss includes a reconstruction loss, a cluster distribution loss, a spatial soft contrast loss, an instance contrast loss, and a cluster contrast loss. See Figure 4 As shown, when judging whether the target loss of the multi-contrast clustering model to be trained meets the preset loss condition based on the preset loss function, the following S401 to S406 may be included:
[0054] S401, determining the reconstruction loss of the multi-contrast clustering model to be trained based on a reconstruction loss function according to the original data input set, the original data input reconstruction set, the enhanced data input set, and the enhanced data input reconstruction set.
[0055] Among them, reconstruction loss is an indicator used to measure the feature extraction and representation performance of the data reconstruction model to be trained. The model parameters of the data reconstruction model can be adjusted through reconstruction loss. Specifically, the difference between the time series data set and the enhanced data set and their respective data reconstruction output data (original data input reconstruction set and enhanced data input reconstruction set) is evaluated through mean square error. The reconstruction loss function for calculating reconstruction loss based on the original data input set, the original data input reconstruction set and the enhanced data input set, and the enhanced data input reconstruction set includes:
[0056]
[0057] Where N is the number of samples, L is reconstruction represents the reconstruction loss; L recon-org represents the original data reconstruction loss; L recon-aug represents the loss of enhanced data reconstruction; X i Represents the i-th data in the original data input set; represents the i-th data in the enhanced data input set; y i Represents the i-th data in the original data input reconstruction set; Represents the i-th data in the enhanced data input reconstruction set.
[0058] S402: Determine the cluster distribution loss of the multi-contrast clustering model to be trained based on the cluster distribution loss function according to the original clustering result and the enhanced clustering result.
[0059] Here, the cluster distribution loss is used to measure the accuracy of the clustering algorithm in assigning each data point to the cluster center. The cluster distribution loss function calculates the similarity difference between the potential feature representation of each data point and its assigned cluster center. Its function is expressed as follows:
[0060]
[0061] Among them, L cd represents the cluster distribution loss; L cluster-org Represents the original data clustering distribution loss; L cluster-aug represents the enhanced data clustering distribution loss; m is the number of clusters obtained by clustering; r ij ∈{0,1} represents X i Whether it belongs to the jth cluster; z i Represents X i The latent feature representation of express The potential feature representation of j It is the potential feature representation of the cluster center of the jth cluster in the original clustering result; is the potential feature representation of the cluster center of the jth cluster in the enhanced clustering result; sim(z i ,μ j ) represents z i and μ j The cosine similarity between ; express and The cosine similarity between .
[0062] S403, determining a positive sample set and a negative sample set regarding the time series data set according to the spatial position information; and determining the spatial soft contrast loss of the multi-contrast clustering model to be trained based on the spatial soft contrast loss function according to the positive sample set, the negative sample set, the original data potential feature set and the enhanced data potential feature set.
[0063] It can be understood that the spatial soft contrast loss function is an optimization function for data clustering models, which aims to ensure that the potential feature representation of individual data points not only reflects temporal similarity, but also takes into account spatial proximity. By comparing the feature representation of each data point in the latent space with their distance in the actual space, the parameters of the model are adjusted so that data points that are spatially adjacent are also close in the latent space. Here, the positive sample set includes a set of data points in the time series data set whose position distance between each data point is less than a first preset distance; the negative sample set includes a set of data points in the time series data set whose position distance between each data point is greater than a second preset distance. The first preset distance and the second preset distance can be set according to the spatial distance between the data points of the actual clustering problem, and are not specifically limited here. The spatial soft contrast loss function includes:
[0064]
[0065] Among them, L spatial represents the spatial soft contrast loss; L s-org represents the soft contrast loss of the original data; L s-aug represents the soft contrast loss of enhanced data; τ represents the temperature parameter, which is used to control the smoothness of the distribution; p represents the positive sample set P i The data points in; n represents the negative sample set N i The data points in λ ip Represents the positive sample set P i The weight parameter of the i-th data; Φ in Represents the negative sample set N i The weight parameter of the i-th data; z p represents the potential feature representation of the original data of p; represents the augmented data latent feature representation of p; z n represents the potential feature representation of the original data of n; represents the enhanced data potential feature representation of n; sim(z i ,z n ) represents z i and z n The cosine similarity between sim(z i ,z p ) represents z i and z pThe cosine similarity between ; express and The cosine similarity between ; express and The cosine similarity between .
[0066] S404, according to the potential feature set of the original data and the potential feature set of the enhanced data, determine the instance contrast loss of the multi-contrast clustering model to be trained based on the instance contrast loss function. Among them, the instance contrast loss is to learn the distinguishing characteristics of the model for data by comparing the potential feature representations of positive samples (a time series data sample and the corresponding enhanced data sample) and negative samples (other time series data samples in the data set and the corresponding enhanced data samples). The instance contrast loss function aims to maximize the similarity between the feature representations of the original time series samples and the corresponding enhanced data samples, while minimizing the similarity between the feature representations of different time series samples, thereby enhancing the generalization ability of the model. Specifically, the instance contrast loss function is as follows:
[0067]
[0068] Among them, L instance represents instance contrast loss; represents the original data instance contrast loss; represents the contrast loss of enhanced data instance; X j Represents the jth data in the original data input set; represents the jth data in the enhanced data input set; z j Represents data X j The latent feature representation of Representation data The latent feature representation of Indicates z i and The cosine similarity between sim(z i ,z j ) represents z i and z j The cosine similarity between ; Indicates z i and The cosine similarity between ; express and z i The cosine similarity between ; express and The cosine similarity between ; express and z j The cosine similarity between .
[0069] S405 , determining the clustering contrast loss of the multi-contrast clustering model to be trained based on the clustering contrast loss function according to the original clustering result and the enhanced clustering result.
[0070] Here, the clustering contrast loss function is an optimization function used to ensure that the original data and the enhanced data remain consistent during the clustering process. The model parameters of the data clustering model are adjusted by comparing the clustering results of the data points in the original clustering results and the enhanced clustering results to promote the consistency of the clustering distribution. The clustering contrast loss function is expressed as:
[0071]
[0072] Among them, L cluster represents cluster contrast loss; c i Represents X i The original clustering results of Represents X i The enhanced clustering result; δ is an indicator function, when c i and If they are the same, it takes 1; otherwise, it takes 0.
[0073] S406, determining a target loss based on a preset loss calculation formula according to the reconstruction loss, cluster distribution loss, spatial soft contrast loss, instance contrast loss and cluster contrast loss; and judging whether the target loss meets a preset loss condition.
[0074] It is understandable that after the reconstruction loss, cluster distribution loss, spatial soft contrast loss, instance contrast loss and cluster contrast loss are calculated, the target loss of the multi-contrast clustering model is calculated by the preset loss calculation formula, and it is determined whether the target loss meets the preset loss condition. The preset loss calculation formula is as follows:
[0075] L=L reconstruction +α0L spatial +α1L instance +α2(L cd +L cluster )
[0076] Among them, L represents the target loss; α0 represents the first weight; α1 represents the second weight; α2 represents the third weight.
[0077] When the target loss does not meet the preset loss conditions, the model parameters of the data reconstruction model to be trained and the model parameters of the data clustering model to be trained are adjusted respectively according to the judgment results; then the above steps are repeated until the training results meet the preset clustering requirements, and a trained multi-comparison clustering model is obtained.
[0078] S104, performing clustering processing on the time series data set based on the trained multi-contrast clustering model according to the spatial information vector set to obtain a target clustering result.
[0079] It can be understood that after obtaining the trained multi-contrast clustering model, the time series data set is clustered using the trained multi-contrast clustering model according to the spatial information vector set to obtain the target clustering result of the time series considering the spatial factors.
[0080] In the disclosed embodiments, by fusing the time series features and spatial location information of the data, the clustering process can better capture the overall structure and internal connections of the spatiotemporal data; the multi-contrast learning mechanism is introduced to drive the model to extract spatiotemporal features with better interference resistance and generalization, thereby improving the clustering performance, ensuring the consistency and stability of the clustering results, reducing the impact of noise and data distribution changes on clustering, and improving the clustering quality and the generalization ability of the model. It is suitable for application scenarios such as traffic flow analysis and meteorological monitoring that require intelligent analysis of spatiotemporal big data.
[0081] Reference Figure 5 , which is a schematic diagram of a time series deep clustering device 500 based on multi-contrast learning provided by an embodiment of the present disclosure, the device includes:
[0082] The data enhancement module 501 is used to obtain a time series data set, and perform data enhancement processing on the time series data set based on a preset data enhancement method to obtain an enhanced data set; the time series data set includes time series data at different locations; the time series data includes data information corresponding to different time points; the enhanced data in the enhanced data set corresponds one-to-one to the data information in the time series data;
[0083] A spatial information encoding module 502 is used to obtain spatial position information corresponding to each time series data in the time series data set, and encode each of the spatial position information based on a spatial information encoder to obtain a spatial information vector set corresponding to each time series data;
[0084] The model training module 503 is used to train the multi-contrast clustering model to be trained according to the time series data set, the enhanced data set and the spatial information vector set; and judge whether the target loss of the multi-contrast clustering model to be trained meets the preset loss condition based on the preset loss function, adjust the model parameters of the multi-contrast clustering model to be trained according to the judgment result, and repeat the above steps until the training result meets the preset clustering requirement, so as to obtain the trained multi-contrast clustering model; the target loss includes reconstruction loss, cluster distribution loss, spatial soft contrast loss, instance contrast loss and cluster contrast loss;
[0085] The data clustering module 504 is used to perform clustering processing on the time series data set according to the spatial information vector set and based on the trained multi-contrast clustering model to obtain a target clustering result.
[0086] In some possible embodiments, the model training module 503 is specifically used to:
[0087] Acquire a multi-contrast clustering model to be trained; the multi-contrast clustering model to be trained includes a data reconstruction model to be trained;
[0088] Inputting the time series data set and the spatial information vector set into the data reconstruction model to be trained to obtain an original data input reconstruction set; and inputting the enhanced data set and the spatial information vector set into the data reconstruction model to be trained to obtain an enhanced data input reconstruction set;
[0089] The multi-contrast clustering model to be trained is trained based on the original data input reconstruction set and the enhanced data input reconstruction set.
[0090] In some possible embodiments, the data reconstruction model includes a feature encoding module and a feature decoding module; the model training module 503 is also used for:
[0091] The time series data set and the spatial information vector set are combined to obtain an original data input set; and the enhanced data set and the spatial information vector set are combined to obtain an enhanced data input set;
[0092] Mapping the original data input set to a latent space based on the feature encoding module to obtain an original data latent feature set; and mapping the enhanced data input set to a latent space based on the feature encoding module to obtain an enhanced data latent feature set;
[0093] Based on the feature decoding module, the original data potential feature set is decoded and reconstructed to obtain the original data input reconstruction set; and based on the feature decoding module, the enhanced data potential feature set is decoded and reconstructed to obtain the enhanced data input reconstruction set.
[0094] In some possible embodiments, the multi-contrast clustering model to be trained also includes a data clustering model to be trained; and the model training module 503 is further used to:
[0095] Inputting the original data potential feature set into the data clustering model to be trained, clustering the original data potential feature set based on the CorClustST algorithm of cosine similarity to obtain an original clustering result; and inputting the enhanced data potential feature set into the data clustering model to be trained, clustering the enhanced data potential feature set based on the CorClustST algorithm of cosine similarity to obtain an enhanced clustering result;
[0096] According to the original data potential feature set, the original data input reconstruction set, the original clustering result and the enhanced data potential feature set, the enhanced data input reconstruction set, and the enhanced clustering result, judging whether the target loss of the multi-contrast clustering model to be trained meets the preset loss condition based on a preset loss function; and adjusting the model parameters of the data reconstruction model to be trained and the model parameters of the data clustering model to be trained respectively based on the judgment result;
[0097] Repeat the above steps until the training results meet the preset clustering requirements, and obtain the trained multi-contrast clustering model.
[0098] In some possible embodiments, the preset loss function includes a reconstruction loss function, a cluster distribution loss function, a spatial soft contrast loss function, an instance contrast loss function and a cluster contrast loss function; the model training module 503 is further used to:
[0099] Determining the reconstruction loss of the multi-contrast clustering model to be trained based on a reconstruction loss function according to the original data input set, the original data input reconstruction set, the enhanced data input set, and the enhanced data input reconstruction set;
[0100] Determining the cluster distribution loss of the multi-contrast clustering model to be trained based on the cluster distribution loss function according to the original clustering result and the enhanced clustering result;
[0101] Determine a positive sample set and a negative sample set about the time series data set according to the spatial position information; and determine the spatial soft contrast loss of the multi-contrast clustering model to be trained based on the spatial soft contrast loss function according to the positive sample set, the negative sample set, the original data potential feature set and the enhanced data potential feature set; the positive sample set includes a set of data points whose position distances between each data point in the time series data set are less than a first preset distance; the negative sample set includes a set of data points whose position distances between each data point in the time series data set are greater than a second preset distance;
[0102] Determining, according to the original data potential feature set and the enhanced data potential feature set, the instance contrast loss of the multi-contrast clustering model to be trained based on the instance contrast loss function;
[0103] According to the reconstruction loss, cluster distribution loss, spatial soft contrast loss, instance contrast loss and cluster contrast loss, the target loss is determined based on a preset loss calculation formula; and it is determined whether the target loss meets the preset loss condition.
[0104] In some possible embodiments, the reconstruction loss function includes:
[0105]
[0106] L reconstruction =L recon-org +L recon-aug
[0107] Where N is the number of samples, L is reconstruction represents the reconstruction loss; L recon-org represents the original data reconstruction loss; L recon-aug represents the loss of enhanced data reconstruction; X i Represents the i-th data in the original data input set; represents the i-th data in the enhanced data input set; y i Represents the i-th data in the original data input reconstruction set; represents the i-th data in the enhanced data input reconstruction set;
[0108] The cluster distribution loss function includes:
[0109]
[0110] Among them, L cd represents the cluster distribution loss; L cluster-org Represents the original data clustering distribution loss; L cluster-aug represents the enhanced data clustering distribution loss; m is the number of clusters obtained by clustering; r ij ∈{0,1} represents X i Whether it belongs to the jth cluster; z i Represents X i The latent feature representation of express The potential feature representation of j It is the potential feature representation of the cluster center of the jth cluster in the original clustering result; is the potential feature representation of the cluster center of the jth cluster in the enhanced clustering result; sim(z i ,μ j ) represents z i and μ j The cosine similarity between ; express and The cosine similarity between ;
[0111] The spatial soft contrast loss function includes:
[0112]
[0113] Among them, L spatial represents the spatial soft contrast loss; L s-org represents the soft contrast loss of the original data; L s-aug represents the soft contrast loss of enhanced data; τ represents the temperature parameter, which is used to control the smoothness of the distribution; p represents the positive sample set P i The data points in; n represents the negative sample set N i The data points in λ ip Represents the positive sample set P i The weight parameter of the i-th data; Φ in Represents the negative sample set N i The weight parameter of the i-th data; z p represents the potential feature representation of the original data of p; represents the augmented data latent feature representation of p; z n represents the potential feature representation of the original data of n; represents the enhanced data potential feature representation of n; sim(z i ,z n ) represents z i and z n The cosine similarity between sim(z i ,z p ) represents z i and z p The cosine similarity between ; express and The cosine similarity between ; express and The cosine similarity between ;
[0114] The example contrast loss function includes:
[0115]
[0116] Among them, L instance represents instance contrast loss; l zi represents the original data instance contrast loss; represents the contrast loss of enhanced data instance; X j Represents the jth data in the original data input set; represents the jth data in the enhanced data input set; z j Represents data X j The latent feature representation of Representation data The latent feature representation of Indicates z i and The cosine similarity between sim(z i ,z j ) represents z i and z j The cosine similarity between ; Indicates z i and The cosine similarity between ; express and z i The cosine similarity between ; express and The cosine similarity between ; express and z j The cosine similarity between ;
[0117] The clustering contrast loss function includes:
[0118]
[0119] Among them, L cluster represents cluster contrast loss; c i Represents X i The original clustering results of Represents X i The enhanced clustering result; δ is an indicator function, when c i and If they are the same, it takes 1; otherwise, it takes 0.
[0120] In some possible embodiments, the preset loss calculation formula includes:
[0121] L=L reconstruction +α0L spatial +α1L instance +α2(L cd +L cluster )
[0122] Among them, L represents the target loss; α0 represents the first weight; α1 represents the second weight; α2 represents the third weight.
[0123] Based on the same technical concept, the embodiment of the present disclosure also provides a computer device. Figure 6, which is a schematic diagram of the structure of a computer device 600 provided in an embodiment of the present disclosure, including a processor 601, a memory 602, and a bus 603. The memory 602 is used to store execution instructions, including a memory 6021 and an external memory 6022; the memory 6021 is also called an internal memory, which is used to temporarily store the operation data in the processor 601 and the data exchanged with the external memory 6022 such as a hard disk. The processor 601 exchanges data with the external memory 6022 through the memory 6021.
[0124] In the embodiment of the present application, the memory 602 is specifically used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 601. That is, when the computer device 600 is running, the processor 601 communicates with the memory 602 through the bus 603, so that the processor 601 executes the application code stored in the memory 602, and then executes the method described in any of the above embodiments.
[0125] Among them, the memory 602 can be, but is not limited to, random access memory (Random Access Memory, RAM), read only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
[0126] Processor 601 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present invention may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0127] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the computer device 600. In other embodiments of the present application, the computer device 600 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0128] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the time series deep clustering method based on multi-contrast learning described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0129] The present disclosure also provides a computer program product that carries a program code. The program code includes instructions that can be used to execute the steps of the time series deep clustering method based on multi-contrast learning described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0130] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0131] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0132] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0133] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0134] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0135] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A time series deep clustering method based on multi-contrast learning, characterized in that: include: Acquire a time series data set, and perform data enhancement processing on the time series data set based on a preset data enhancement method to obtain an enhanced data set; The time series data set includes a traffic flow data set or a meteorological monitoring data set; the time series data set includes time series data of different locations; The time series data includes data information corresponding to different time points; the enhanced data in the enhanced data set corresponds one-to-one to the data information in the time series data; Acquire spatial location information corresponding to each time series data in the time series data set, and encode each piece of spatial location information based on a spatial information encoder to obtain a spatial information vector set corresponding to the time series data set; wherein the spatial location information includes latitude and longitude, address or geographic identifier; According to the time series data set, the enhanced data set and the spatial information vector set, the multi-contrast clustering model to be trained is trained; and based on the preset loss function, it is judged whether the target loss of the multi-contrast clustering model to be trained meets the preset loss condition, and the model parameters of the multi-contrast clustering model to be trained are adjusted according to the judgment result, and the above steps are repeated until the training result meets the preset clustering requirement, so as to obtain a trained multi-contrast clustering model; the target loss includes reconstruction loss, cluster distribution loss, spatial soft contrast loss, instance contrast loss and cluster contrast loss; According to the spatial information vector set, clustering processing is performed on the time series data set based on the trained multi-contrast clustering model to obtain a target clustering result; The spatial soft contrast loss is calculated by a spatial soft contrast loss function, and the spatial soft contrast loss function includes: Among them, L spatial represents the spatial soft contrast loss; L s-org represents the soft contrast loss of the original data; L s-aug represents the soft contrast loss of enhanced data; τ represents the temperature parameter, which is used to control the smoothness of the distribution; p represents the positive sample set P i The data points in; n represents the negative sample set N i The data points in λ ip Represents the positive sample set P i The weight parameter of the i-th data; Φ in Represents the negative sample set N i The weight parameter of the i-th data; z p represents the potential feature representation of the original data of p; represents the augmented data latent feature representation of p; z n represents the potential feature representation of the original data of n; represents the enhanced data potential feature representation of n; sim(z i ,z n ) represents z i and z n The cosine similarity between sim(z i ,z p ) represents z i and z p The cosine similarity between ; express and The cosine similarity between ; express and The cosine similarity between .
2. The method according to claim 1, characterized in that The training of the multi-contrast clustering model to be trained according to the time series data set, the enhanced data set and the spatial information vector set includes: Acquire a multi-contrast clustering model to be trained; the multi-contrast clustering model to be trained includes a data reconstruction model to be trained; Inputting the time series data set and the spatial information vector set into the data reconstruction model to be trained to obtain an original data input reconstruction set; and inputting the enhanced data set and the spatial information vector set into the data reconstruction model to be trained to obtain an enhanced data input reconstruction set; The multi-contrast clustering model to be trained is trained based on the original data input reconstruction set and the enhanced data input reconstruction set.
3. The method according to claim 2, characterized in that The data reconstruction model includes a feature encoding module and a feature decoding module; the time series data set and the spatial information vector set are input into the data reconstruction model to be trained to obtain an original data input reconstruction set; and the enhanced data set and the spatial information vector set are input into the data reconstruction model to be trained to obtain an enhanced data input reconstruction set; include: The time series data set and the spatial information vector set are combined to obtain an original data input set; and the enhanced data set and the spatial information vector set are combined to obtain an enhanced data input set; Mapping the original data input set to a latent space based on the feature encoding module to obtain an original data latent feature set; and mapping the enhanced data input set to a latent space based on the feature encoding module to obtain an enhanced data latent feature set; Based on the feature decoding module, the original data potential feature set is decoded and reconstructed to obtain the original data input reconstruction set; and based on the feature decoding module, the enhanced data potential feature set is decoded and reconstructed to obtain the enhanced data input reconstruction set.
4. The method according to claim 3, characterized in that The multi-contrast clustering model to be trained also includes a data clustering model to be trained; and the training of the multi-contrast clustering model to be trained based on the original data input reconstruction set and the enhanced data input reconstruction set includes: Inputting the original data potential feature set into the data clustering model to be trained, clustering the original data potential feature set based on the CorClustST algorithm of cosine similarity to obtain an original clustering result; and inputting the enhanced data potential feature set into the data clustering model to be trained, clustering the enhanced data potential feature set based on the CorClustST algorithm of cosine similarity to obtain an enhanced clustering result; According to the original data potential feature set, the original data input reconstruction set, the original clustering result and the enhanced data potential feature set, the enhanced data input reconstruction set, and the enhanced clustering result, judging whether the target loss of the multi-contrast clustering model to be trained meets the preset loss condition based on a preset loss function; and adjusting the model parameters of the data reconstruction model to be trained and the model parameters of the data clustering model to be trained respectively based on the judgment result; Repeat the above steps until the training results meet the preset clustering requirements, and obtain the trained multi-contrast clustering model.
5. The method according to claim 4, characterized in that The preset loss function includes a reconstruction loss function, a cluster distribution loss function, an instance contrast loss function, and a cluster contrast loss function; the step of judging whether the target loss of the multi-contrast clustering model to be trained meets the preset loss condition based on the preset loss function includes: Determining the reconstruction loss of the multi-contrast clustering model to be trained based on a reconstruction loss function according to the original data input set, the original data input reconstruction set, the enhanced data input set, and the enhanced data input reconstruction set; Determining the cluster distribution loss of the multi-contrast clustering model to be trained based on the cluster distribution loss function according to the original clustering result and the enhanced clustering result; Determine a positive sample set and a negative sample set about the time series data set according to the spatial position information; and determine the spatial soft contrast loss of the multi-contrast clustering model to be trained based on the spatial soft contrast loss function according to the positive sample set, the negative sample set, the original data potential feature set and the enhanced data potential feature set; the positive sample set includes a set of data points whose position distances between each data point in the time series data set are less than a first preset distance; the negative sample set includes a set of data points whose position distances between each data point in the time series data set are greater than a second preset distance; Determining, according to the original data potential feature set and the enhanced data potential feature set, the instance contrast loss of the multi-contrast clustering model to be trained based on the instance contrast loss function; Determining, according to the original clustering result and the enhanced clustering result, a clustering contrast loss of the multi-contrast clustering model to be trained based on the clustering contrast loss function; According to the reconstruction loss, cluster distribution loss, spatial soft contrast loss, instance contrast loss and cluster contrast loss, the target loss is determined based on a preset loss calculation formula; and it is determined whether the target loss meets the preset loss condition.
6. The method according to claim 5, characterized in that The reconstruction loss function includes: L reconstruction =L recon-org +L recon-aug Where N is the number of samples, L is reconstruction represents the reconstruction loss; L recon-org represents the original data reconstruction loss; L recon-aug represents the loss of enhanced data reconstruction; X i Represents the i-th data in the original data input set; represents the i-th data in the enhanced data input set; y i Represents the i-th data in the original data input reconstruction set; represents the i-th data in the enhanced data input reconstruction set; The cluster distribution loss function includes: Among them, L cd represents the cluster distribution loss; L cluster-org Represents the original data clustering distribution loss; L cluster-aug represents the enhanced data clustering distribution loss; m is the number of clusters obtained by clustering; r ij ∈{0,1} represents X i Whether it belongs to the jth cluster; z i Represents X i The latent feature representation of express The potential feature representation of j It is the potential feature representation of the cluster center of the jth cluster in the original clustering result; is the potential feature representation of the cluster center of the jth cluster in the enhanced clustering result; sim(z i ,μ j ) represents z i and μ j The cosine similarity between ; express and The cosine similarity between ; The example contrast loss function includes: Among them, L instance represents instance contrast loss; represents the original data instance contrast loss; represents the contrast loss of enhanced data instance; X j Represents the jth data in the original data input set; represents the jth data in the enhanced data input set; z j Represents data X j The latent feature representation of Representation data The latent feature representation of Indicates z i and The cosine similarity between sim(z i ,z j ) represents z i and z j The cosine similarity between ; Indicates z i and The cosine similarity between ; express and z i The cosine similarity between ; express and The cosine similarity between ; express and z j The cosine similarity between ; The clustering contrast loss function includes: Among them, L cluster represents cluster contrast loss; c i Represents X i The original clustering results of Represents X i The enhanced clustering result; δ is an indicator function, when c i and If they are the same, it takes 1; otherwise, it takes 0.
7. The method according to claim 6, characterized in that The preset loss calculation formula include: L=L reconstruction +α0L spatial +α1L instance +α2(L cd +L cluster ) Among them, L represents the target loss; α0 represents the first weight; α1 represents the second weight; α2 represents the third weight.
8. A time series deep clustering device based on multi-contrast learning, characterized in that: The device is used to implement the method according to any one of claims 1 to 7.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Clustering method and device based on two-dimensional multivariable time sequence feature fusion
CN118035778A