Multi-stage spatial-temporal clustering method and system based on fused mahalanobis distance
By integrating Mahalanobis distance and a multi-stage assignment strategy, a spatiotemporal clustering method is developed to address the issues of dimensional inconsistency and error propagation in spatiotemporal data, achieving higher accuracy and robustness in spatiotemporal clustering.
Patent Information
- Application Number
- CN202511575406.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-31
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2045-10-31
AI Technical Summary
Existing density peak clustering algorithms cannot effectively handle the dimensional differences and physical heterogeneity between spatial and temporal dimensions when processing spatiotemporal data, resulting in distorted similarity measurements. Furthermore, single-step allocation strategies are prone to chain-like error propagation.
A multi-stage spatiotemporal clustering method based on fused Mahalanobis distance is adopted. By calculating the spatial connectivity distance and temporal decay distance of samples, these distances are fused using Mahalanobis distance. The sample allocation is performed in combination with a multi-stage allocation strategy, including necessary allocation and similarity allocation stages, to identify cluster centers and handle abnormal samples.
It achieves a more scientific measure of spatiotemporal data similarity, significantly improves clustering accuracy and the accuracy of boundary sample allocation, effectively suppresses error propagation, and enhances the robustness of clustering results.
Smart Images

Figure CN121051489A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing technology, and in particular relates to a multi-stage spatiotemporal clustering method and system based on fused Mahalanobis distance. Background Technology
[0002] Density Peak Clustering (DPC) is widely used due to its simple parameters and ability to identify clusters of arbitrary shapes. However, it has inherent limitations when processing spatiotemporal data: 1. Traditional methods use Euclidean distance, which cannot effectively handle the dimensional differences and physical heterogeneity between spatial and temporal dimensions, leading to distortion of similarity metrics; 2. Its single-step allocation strategy follows the "nearest to furthest" principle, resulting in severe chain error propagation and sensitivity to boundary points and noise points.
[0003] While existing improved algorithms attempt to optimize, their distance metrics still adhere to the Euclidean distance paradigm, and their assignment strategies fail to fundamentally address the error propagation problem. Therefore, existing spatiotemporal clustering methods exhibit significant shortcomings in both "heterogeneous distance fusion" and "assignment error control." Summary of the Invention
[0004] To address these issues, this invention provides a multi-stage spatiotemporal clustering method and system based on fused Mahalanobis distance, which solves the above problems.
[0005] In a first aspect, the present invention provides a multi-stage spatiotemporal clustering method based on fused Mahalanobis distance, comprising: Obtain the spatiotemporal dataset and determine the spatiotemporal nearest neighbor relationships of samples in the dataset; Calculate the spatial connectivity distance and temporal decay distance of the samples; The relative distance of the samples is obtained by fusing the spatial connectivity distance and the time decay distance using Mahalanobis distance; Cluster centers are selected from the dataset based on the local density of the samples and the relative distance. A multi-stage allocation strategy is adopted to assign non-cluster center samples to the corresponding clusters; wherein, the multi-stage allocation strategy includes a necessary allocation stage based on spatiotemporal shared nearest neighbors and a similarity allocation stage based on a weighted similarity matrix.
[0006] Secondly, the present invention provides a multi-stage spatiotemporal clustering system based on fused Mahalanobis distance, comprising: The data acquisition and nearest neighbor determination module is configured to acquire a spatiotemporal dataset and determine the spatiotemporal nearest neighbor relationships of samples in the dataset. The distance calculation module is configured to calculate the spatial connectivity distance and temporal decay distance of samples. The distance fusion module is configured to fuse the spatial connectivity distance and the time decay distance using Mahalanobis distance to obtain the relative distance of the samples; The cluster center selection module is configured to select cluster centers from the dataset based on the local density of samples and the relative distance. A multi-stage allocation module is configured to use a multi-stage allocation strategy to allocate non-cluster center samples to the corresponding clusters; wherein, the multi-stage allocation strategy includes a necessary allocation stage based on spatiotemporal shared nearest neighbors and a similarity allocation stage based on a weighted similarity matrix; The anomaly identification module is configured to calculate the outlier threshold based on the Mahalanobis nearest neighbor distance and interquartile range of the sample, and identify samples whose distance is greater than the outlier threshold as anomalous samples.
[0007] Thirdly, an electronic device is provided, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the steps of the multi-stage spatiotemporal clustering method based on fused Mahalanobis distance according to any embodiment of the present invention.
[0008] Fourthly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor performs the steps of the multi-stage spatiotemporal clustering method based on fused Mahalanobis distance according to any embodiment of the present invention.
[0009] This application presents a multi-stage spatiotemporal clustering method and system based on Mahalanobis distance fusion, which has the following advantages: 1) A more scientific distance measurement paradigm is proposed: By fusing spatiotemporal heterogeneous distances with Mahalanobis distance, the problems of inconsistent dimensions and attribute correlation are solved, making the similarity measurement more in line with the essence of spatiotemporal data, and the clustering accuracy is significantly higher than the improved scheme based on Euclidean distance.
[0010] 2) A more robust allocation mechanism was designed: a multi-stage allocation strategy was adopted, especially the allocation stage based on the global similarity matrix, which changed the traditional "from near to far" allocation logic, suppressed the propagation of chain errors from the mechanism, and greatly improved the accuracy of boundary sample allocation. Attached Figure Description
[0011] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1A flowchart of a multi-stage spatiotemporal clustering method based on fused Mahalanobis distance is provided in an embodiment of the present invention; Figure 2 This is a structural block diagram of a multi-stage spatiotemporal clustering system based on fused Mahalanobis distance, provided in an embodiment of the present invention. Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0014] Please see Figure 1 The diagram shows a flowchart of a multi-stage spatiotemporal clustering method based on fused Mahalanobis distance according to this application.
[0015] Step S1: Obtain the spatiotemporal dataset and determine the spatiotemporal nearest neighbor relationships of samples in the dataset; In this step, the spatiotemporal dataset is read. Each sample Includes spatial coordinates and timestamp The data is preprocessed (e.g., standardized, deduplicated). Then, the spatiotemporal nearest neighbor set for each sample is determined: According to the formula: ; Calculate samples Spatial K-nearest neighbor ( )gather .
[0016] According to the formula: ; Calculate samples Time K nearest neighbors ( )gather .
[0017] For any two samples and , and Let each be a spatial nearest neighbor set of two different samples. The common part of their spatial nearest neighbor sets is called their shared spatial nearest neighbor set. : .
[0018] For any two samples and , and The common part of the time nearest neighbor sets of two different samples is called their time-shared nearest neighbor set. : .
[0019] Step S2: Calculate the spatial connectivity distance and temporal decay distance of the samples; Specifically, the spatial connectivity distance is the shortest path distance between two samples among all reachable paths, and the time decay distance is calculated using a formula that includes an exponential decay term and a quadratic correction term.
[0020] In this step, spatial connectivity distance and temporal decay distance are calculated as more scientific distances based on spatial and temporal attributes, respectively.
[0021] Spatial connectivity distance In the spatial dimension, construct a weighted undirected graph with all samples as nodes. The weight of the edge is the spatial Euclidean distance between the samples. arrive Spatial connectivity distance can be expressed as: ; in, Indicates connection sample and Any path containing 1 node It is a path The first in 1 node For its successor node, For the sample arrive The set of all paths. Traverse the samples. and For all feasible paths between them, the spatial Euclidean distance between adjacent nodes is accumulated to obtain the total path weight. The sum of the weights of the shortest path is then taken as the sample. arrive Spatial connectivity distance. Compared to Euclidean distance, connectivity distance, by constructing a spatial neighborhood graph and describing the actual reachability between samples based on connectivity constraints, better reflects the spatial relationships of data.
[0022] Time decay distance To reflect the nonlinear characteristics of time decay, a time distance metric method including an exponential decay term and a quadratic correction term is proposed, the expression of which is as follows: ; in, This is the decay coefficient (default value is 1), used to control the decay rate of the exponential term over time. The first part simulates the natural decay process of the time influence through the exponential term, approaching a linear relationship when the sample time interval is short, and decaying rapidly when the time interval is long. The second part uses a quadratic term to correct the fitting of the nonlinear relationship, avoiding the loss of temporal details of short-distance samples due to the linearization of a single exponential term.
[0023] When sample for space When two objects are neighbors, their spatial locations highly overlap, so the impact of path constraints on distance can be ignored, and the Euclidean distance can be used directly to simplify the calculation of connected distance; similarly, for samples... for space When the distance is close to the nearest neighbor, the time interval is so short that the attenuation effect is approximately linear, and the calculation of the time attenuation distance can be simplified using the basic time difference. This explains why Euclidean distance is still used in most cases for local density calculations.
[0024] Step S3: Use Mahalanobis distance to fuse the spatial connectivity distance and the time decay distance to obtain the relative distance of the samples; Specifically, the method of obtaining the relative distance of samples by fusing the spatial connectivity distance and the time decay distance using Mahalanobis distance includes: The spatial connectivity distance and temporal decay distance of a pair of samples are combined to form a spatiotemporal feature vector; Calculate the covariance matrix of the spatiotemporal feature vectors of all samples; The Mahalanobis distance between two samples is calculated based on the covariance matrix and the spatiotemporal feature vector.
[0025] Relative distance of Mahalanobis distance To consider the correlation between features of different dimensions, spatial connectivity distance and temporal decay distance are fused based on Mahalanobis distance, and the relative distance of samples is determined accordingly.
[0026] ; ; ; in, For sample pairs The spatiotemporal feature vector is composed of spatial connectivity distance and temporal decay distance; It is the global mean of all spatiotemporal feature vectors, reflecting the average level of the features; It is the covariance matrix of the spatiotemporal eigenvectors, which can quantitatively describe the degree of linear correlation of the spatiotemporal dimensions and the degree of dispersion of each dimension itself; It is the inverse of the covariance matrix, used to eliminate dimensionality correlation and standardize distance weights; The Mahalanobis distance between samples is calculated by inverting the covariance matrix. This distance adapts to the actual distribution characteristics of the data, ignoring the heterogeneity of different attributes in terms of numerical scale and physical meaning, and weights the spatial connectivity distance and temporal decay distance. This process avoids interference from differences in the dimensions of different dimensions, enabling the relative distance to accurately characterize the relative positional relationship of samples in the spatiotemporal dimensions.
[0027] Step S4: Select cluster centers from the dataset based on the local density of the samples and the relative distance; Specifically, the calculation of the local density of the sample includes: Calculate the initial local density of the sample based on its spatiotemporal nearest neighbor set; Weighted similarity is calculated based on the spatiotemporally shared nearest neighbor set between samples; The final local density of the sample is determined based on the initial local density and the weighted similarity.
[0028] In this step, the local density based on the sample is first calculated.
[0029] Initial local density Under spatiotemporal constraints, based on Nearest neighbor definition samples The initial local density is expressed as follows:
[0030] ; in, It is the number of nearest neighbor samples. For the sample With The weighted sum of the distances of the nearest neighbors in space. For the sample With The distance-weighted sum of the nearest neighbor samples at each time.
[0031] This formula performs a weighted summation of the spatiotemporal nearest neighbor distances, with... The denominator is the normalized sum of distances. By analyzing the density of spatiotemporal nearest neighbor distributions, it reflects the concentration of samples within a local area. As defined, samples... Time and Space The smaller the overall distance between neighbors, the higher the density of the region, and the more likely it is to become a cluster center; conversely, a larger distance indicates a sparse surrounding environment, possibly indicating a cluster boundary or an anomalous sample. This is achieved by limiting the calculation range to the area with... Close relationship A number of spatiotemporal nearest neighbor samples can better highlight its spatiotemporal local features and enhance the difference between density peaks and non-peaks.
[0032] Weighted similarity The similarity of spatiotemporal shared neighbors is constructed by weighting the proximity of each shared neighbor, and its definition is as follows: ; ; in, For the sample and The intersection of spatially shared neighbors and temporally shared neighbors. This represents the number of samples within the set. A greater number of shared nearest neighbors among samples across different dimensions indicates a stronger correlation in that dimension. Therefore, the number of shared nearest neighbors is introduced as a weight to perform a weighted summation of mutual proximity. The final part calculates the number of nearest neighbor samples that simultaneously satisfy both spatial and temporal sharing conditions and normalizes the value to reflect the tightness with which a sample is surrounded by its nearest neighbors in the spatiotemporal dimension. This similarity considers spatiotemporal overlap to highlight the combined effect of the surrounding environment and balance the local density of samples in different density regions.
[0033] Final local density According to space and time The initial density of nearest neighbors and the weighted similarity of spatiotemporally shared nearest neighbors are used to define the local density of spatiotemporally nearby neighbors as follows: ; The final local density designed in this invention uses the nearest neighbor number. As the sole input parameter, this method considers both the local spatiotemporal environment of the sample at the microscopic level and the interaction of global samples at the macroscopic level. The first part determines the initial density by calculating the sum of the Euclidean distances between a sample and its spatiotemporal nearest neighbors. This effectively identifies cluster centers in high-density regions while avoiding situations where the local density of non-spatiotemporal nearest neighbors cannot be calculated due to a lack of shared spatiotemporal neighbors. The second part calculates the weighted similarity sum of non-spatiotemporal nearest neighbor samples based on the number of shared spatiotemporal neighbors; the more shared spatiotemporal neighbors a sample has, the higher its similarity. For sparse regions, this method does not determine a low density value simply because a sample is far from its spatiotemporal nearest neighbors. Instead, it calculates the relative contributions of more non-spatiotemporal nearest neighbors to appropriately increase the local density, thus ensuring that the algorithm correctly selects cluster centers in different density regions.
[0034] In obtaining the local density of all samples and relative distance Then, calculate the decision value for each sample: ; Based on decision value Draw a decision graph and select cluster centers; With final local density and relative distance A decision graph is plotted on the horizontal and vertical axes. Based on the characteristic of density peak classes being characterized by "high local density and large relative distance," samples in the upper right (or upper left) region of the decision graph are selected as cluster centers. Simultaneously, decision values are introduced. Quantitative selection of cluster centers, decision value The largest number of samples are the cluster centers.
[0035] Step S5: A multi-stage allocation strategy is adopted to allocate non-cluster center samples to the corresponding clusters; wherein, the multi-stage allocation strategy includes a necessary allocation stage based on spatiotemporal shared nearest neighbors and a similarity allocation stage based on a weighted similarity matrix.
[0036] Specifically, the necessary allocation stage based on the number of shared nearest neighbors in spatiotemporal space is as follows: If the number of spatiotemporally shared neighbors of a sample and the center of a certain cluster both exceed a preset threshold, then the sample will inevitably be assigned to the cluster where the center of that cluster is located.
[0037] The similarity allocation stage based on weighted similarity between samples is as follows: Iterate through the unassigned samples and assign them to the cluster of the assigned sample with the highest weighted similarity.
[0038] In this step, a three-stage strategy is used to allocate non-cluster center samples.
[0039] Necessary allocation phase: Assuming samples The cluster centers are selected by the decision graph, and the samples... Not yet allocated. and The number of spatiotemporal nearest neighbors can be considered as a criterion when the following conditions are met simultaneously. Inevitably and Belonging to the same cluster and being a core member of that cluster: ; In the time and space dimensions, when the two samples each When the proportion of shared neighbors in a neighborhood is not less than half, the two can be considered sufficiently close and classified into the same cluster.
[0040] Similarity assignment phase: By traversing the weighted similarity matrix, the unassigned sample with the highest similarity is matched with the assigned sample and assigned to the corresponding cluster. This operation is repeated until all samples are assigned, or the unassigned samples no longer have similarity.
[0041] Density peaks clustering (DPC) allocation stage: For the very small number of samples that have not been allocated after the above two stages, the traditional DPC strategy is used to assign them to the cluster of their nearest neighbor with higher density and Mahalanobis distance.
[0042] Specifically, after the multi-stage allocation strategy is used to allocate non-cluster center samples to the corresponding clusters, step S6 is further included: calculating the outlier threshold based on the Mahalanobis nearest neighbor distance and interquartile range of the samples, and identifying samples with a distance greater than the outlier threshold as abnormal samples.
[0043] To identify anomalous samples, the Mahalanobis nearest neighbor distance of the sample is defined. Then, the outlier threshold is calculated by combining the interquartile range (IQR). All samples whose Mahalanobis nearest neighbor distance is greater than this threshold constitute an anomaly set.
[0044] ; ; in, It is the distance sample under the Mahalanobis distance metric. No. Recent samples; This is the median of the Mahalanobis nearest neighbor distances for all samples; Sort by Mahalanobis nearest neighbor distance in ascending order and place the first one at the top. The numerical value of the position; Corresponding to the previous The numerical value of the position; and Covering the middle 50% of the data can better reflect the central tendency of the data; This is a scaling factor (default value is 1.5). A smaller value indicates more lenient judgment criteria, resulting in more detected outliers. Outliers are often not globally absolute deviations, but rather exhibit "discretion" in their local neighborhood. The Mahalanobis nearest neighbor distance is used to determine this. It can reflect the degree of isolation of a sample within a local population. When the distance between a sample and its nearest neighbors is significantly larger than normal, it indicates that the sample does not conform to the normal distribution in the local environment and is likely an anomalous sample.
[0045] Final output: a set of cluster labels and a set of outliers for the samples.
[0046] To evaluate the effectiveness of the clustering results, the following verification is performed using examples on synthetic datasets and real earthquake datasets.
[0047] 1) Validation using a synthetic dataset. The parameters of the method in this invention are set as follows: nearest neighbor number k=15, attenuation coefficient... =1.0, scaling factor =1.5. ST-DBSCAN (Spatial-temporal density based spatial clustering of applications with noise) and ST-CFSFDP (Spatial-temporal clustering by fastsearch and find of density peaks) were selected as comparison algorithms.
[0048] Adjusted mutual information (AMI), adjusted Land coefficient (ARI), and FM index (FMI) were selected as external evaluation indicators. The closer their values are to 1, the stronger the consistency between the clustering results and the true labels.
[0049] Experimental Results: Table 1 lists the performance metrics of each algorithm on representative synthetic datasets D1 and D2 (bold data represents the optimal values).
[0050] Table 1: Performance metrics of each algorithm on synthetic datasets
[0051] , As shown in Table 1, on two synthetic datasets of different sizes and structures, the method of this invention significantly outperforms all comparative algorithms in all evaluation metrics. Particularly on dataset D2, the ARI value of this invention is more than 10 percentage points higher than the suboptimal ST-DBSCAN algorithm. This fully demonstrates that this invention effectively solves the problems of spatiotemporal heterogeneous distance metrics and chain-like error propagation through Mahalanobis distance fusion and a multi-stage allocation strategy, resulting in high clustering accuracy and strong robustness.
[0052] 2) Application of Real Earthquake Datasets. The dataset originates from the National Earthquake Science Data Center and covers 1329 records of earthquakes with a magnitude ≥ 4.0 that occurred within China from January 2008 to August 2009. The Davidson-Bourdin Index (DBI) and the Calinski-Harabasz Index (CHI) were used for evaluation; a lower DBI value and a higher CHI value indicate a better clustering structure.
[0053] Application Results: Using the method of this invention, five major spatiotemporal earthquake sequences (clusters) were successfully identified, including the mainshock-aftershock sequence of the Wenchuan 8.0 magnitude earthquake on May 12, 2008 (containing 795 events). The performance comparison of each algorithm is shown in the table below: Table 2: Performance metrics of various algorithms on earthquake datasets
[0054] , As shown in Table 2, the method of this invention has the lowest DBI index and the highest CHI index, indicating that its clustering results have the highest intra-cluster cohesion and inter-cluster separation. This invention successfully extracts complete earthquake sequences from complex real-world spatiotemporal data, verifying its excellent practicality and reliability in real-world scenarios, and providing an effective technical tool for scientific problems such as earthquake sequence analysis.
[0055] Please see Figure 2 The diagram shows a structural block diagram of a multi-stage spatiotemporal clustering system based on fused Mahalanobis distance according to this application.
[0056] like Figure 2 As shown, the module includes a data acquisition and nearest neighbor determination module 200, a distance calculation module 201, a distance fusion module 202, a cluster center selection module 203, a multi-stage allocation module 204, and an anomaly identification module 205.
[0057] Among them, the data acquisition and nearest neighbor determination module 200 is configured to acquire a spatiotemporal dataset and determine the spatiotemporal nearest neighbor relationship of samples in the dataset; Distance calculation module 201 is configured to calculate the spatial connectivity distance and time decay distance of a sample. The distance fusion module 202 is configured to fuse the spatial connectivity distance and the time decay distance using Mahalanobis distance to obtain the relative distance of the samples; The cluster center selection module 203 is configured to select cluster centers from the dataset based on the local density of the samples and the relative distance. The multi-stage allocation module 204 is configured to use a multi-stage allocation strategy to allocate non-cluster center samples to the corresponding clusters; wherein, the multi-stage allocation strategy includes a necessary allocation stage based on spatiotemporal shared nearest neighbors and a similarity allocation stage based on a weighted similarity matrix; The anomaly identification module 205 is configured to calculate the outlier threshold based on the Mahalanobis nearest neighbor distance and interquartile range of the sample, and to identify samples whose distance is greater than the outlier threshold as anomalies.
[0058] It should be understood that Figure 2 The modules and references described in the document Figure 1The steps described in the text correspond to those in the method described above. Therefore, the operations, features, and corresponding technical effects described above also apply to the method described in the text. Figure 2 The various modules in the document will not be described in detail here.
[0059] In other embodiments, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor performs the multi-stage spatiotemporal clustering method based on fused Mahalanobis distance in any of the above method embodiments. In one embodiment, the computer-readable storage medium of the present invention stores computer-executable instructions, which are configured as follows: Obtain the spatiotemporal dataset and determine the spatiotemporal nearest neighbor relationships of samples in the dataset; Calculate the spatial connectivity distance and temporal decay distance of the samples; The relative distance of the samples is obtained by fusing the spatial connectivity distance and the time decay distance using Mahalanobis distance; Cluster centers are selected from the dataset based on the local density of the samples and the relative distance. A multi-stage allocation strategy is adopted to assign non-cluster center samples to the corresponding clusters; wherein, the multi-stage allocation strategy includes a necessary allocation stage based on spatiotemporal shared nearest neighbors and a similarity allocation stage based on a weighted similarity matrix.
[0060] Computer-readable storage media may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application program required for at least one function; the data storage area may store data created based on the use of a multi-stage spatiotemporal clustering system based on fused Mahalanobis distance, etc. Furthermore, the computer-readable storage medium may include high-speed random access memory, and may also include memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the computer-readable storage medium may optionally include memory remotely disposed relative to a processor, which can be connected to the multi-stage spatiotemporal clustering system based on fused Mahalanobis distance via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0061] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiment of the present invention, such as... Figure 3 As shown, the device includes a processor 310 and a memory 320. The electronic device may also include an input device 330 and an output device 340. The processor 310, memory 320, input device 330, and output device 340 can be connected via a bus or other means. Figure 3Taking a bus connection as an example, the memory 320 is the computer-readable storage medium described above. The processor 310 executes various server functions and data processing by running non-volatile software programs, instructions, and modules stored in the memory 320, thereby implementing the multi-stage spatiotemporal clustering method based on fused Mahalanobis distance described in the above method embodiment. The input device 330 can receive input digital or character information and generate key signal inputs related to user settings and function control of the multi-stage spatiotemporal clustering system based on fused Mahalanobis distance. The output device 340 may include a display screen or other display device.
[0062] The aforementioned electronic device can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in the embodiments of the present invention.
[0063] In one implementation, the above-described electronic device is applied to a multi-stage spatiotemporal clustering system based on fused Mahalanobis distance, serving as a client, and includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Obtain the spatiotemporal dataset and determine the spatiotemporal nearest neighbor relationships of samples in the dataset; Calculate the spatial connectivity distance and temporal decay distance of the samples; The relative distance of the samples is obtained by fusing the spatial connectivity distance and the time decay distance using Mahalanobis distance; Cluster centers are selected from the dataset based on the local density of the samples and the relative distance. A multi-stage allocation strategy is adopted to assign non-cluster center samples to the corresponding clusters; wherein, the multi-stage allocation strategy includes a necessary allocation stage based on spatiotemporal shared nearest neighbors and a similarity allocation stage based on a weighted similarity matrix.
[0064] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0065] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-stage spatiotemporal clustering method based on fused Mahalanobis distance, characterized in that, include: Obtain the spatiotemporal dataset and determine the spatiotemporal nearest neighbor relationships of samples in the dataset; Calculate the spatial connectivity distance and temporal decay distance of the samples; The relative distance of the samples is obtained by fusing the spatial connectivity distance and the time decay distance using Mahalanobis distance; Cluster centers are selected from the dataset based on the local density of the samples and the relative distance. A multi-stage allocation strategy is adopted to assign non-cluster center samples to the corresponding clusters; wherein, the multi-stage allocation strategy includes a necessary allocation stage based on spatiotemporal shared nearest neighbors and a similarity allocation stage based on a weighted similarity matrix.
2. The multi-stage spatiotemporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, The spatial connectivity distance is the shortest path distance between two samples across all reachable paths, and the time decay distance is calculated using a formula that includes an exponential decay term and a quadratic correction term.
3. The multi-stage spatiotemporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, The method of obtaining the relative distance of samples by fusing the spatial connectivity distance and the time decay distance using Mahalanobis distance includes: The spatial connectivity distance and temporal decay distance of a pair of samples are combined to form a spatiotemporal feature vector; Calculate the covariance matrix of the spatiotemporal feature vectors of all samples; The Mahalanobis distance between two samples is calculated based on the covariance matrix and the spatiotemporal feature vector.
4. The multi-stage spatiotemporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, The calculation of the local density of the sample includes: Calculate the initial local density of the sample based on its spatiotemporal nearest neighbor set; Weighted similarity is calculated based on the spatiotemporally shared nearest neighbor set between samples; The final local density of the sample is determined based on the initial local density and the weighted similarity.
5. The multi-stage spatiotemporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, The necessary allocation stage based on the number of spatiotemporally shared nearest neighbors is as follows: If the number of spatiotemporally shared neighbors of a sample and the center of a certain cluster both exceed a preset threshold, then the sample will inevitably be assigned to the cluster where the center of that cluster is located.
6. The multi-stage spatiotemporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, The similarity allocation stage based on weighted similarity between samples is as follows: Iterate through the unassigned samples and assign them to the cluster of the assigned sample with the highest weighted similarity.
7. The multi-stage spatiotemporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, The process of assigning non-cluster center samples to their corresponding clusters using a multi-stage allocation strategy also includes... The outlier threshold is calculated based on the Mahalanobis nearest neighbor distance and interquartile range of the samples, and samples with a distance greater than the outlier threshold are identified as anomalous samples.
8. A multi-stage spatiotemporal clustering system based on fused Mahalanobis distance, characterized in that, include: The data acquisition and nearest neighbor determination module is configured to acquire a spatiotemporal dataset and determine the spatiotemporal nearest neighbor relationships of samples in the dataset. The distance calculation module is configured to calculate the spatial connectivity distance and temporal decay distance of samples. The distance fusion module is configured to fuse the spatial connectivity distance and the time decay distance using Mahalanobis distance to obtain the relative distance of the samples; The cluster center selection module is configured to select cluster centers from the dataset based on the local density of samples and the relative distance. A multi-stage allocation module is configured to use a multi-stage allocation strategy to allocate non-cluster center samples to the corresponding clusters; wherein, the multi-stage allocation strategy includes a necessary allocation stage based on spatiotemporal shared nearest neighbors and a similarity allocation stage based on a weighted similarity matrix; The anomaly identification module is configured to calculate the outlier threshold based on the Mahalanobis nearest neighbor distance and interquartile range of the sample, and identify samples whose distance is greater than the outlier threshold as anomalous samples.
9. An electronic device, characterized in that, include: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Urban functional area gridding identification and classification method based on multi-source spatio-temporal data
CN119903441A
Data management method of cross-domain data automatic clustering algorithm
CN119989010A
Earthquake event space-time density peak value clustering method and device, medium and electronic equipment
CN120123802A
Generating incident explanations using spatio-temporal log clustering
US20240126630A1
Massive high-dimensional AIS trajectory data clustering method
WO2023029461A1
Cited By
Spectrum turning time identification method and device, electronic equipment and storage medium
CN121434995A
Spectrum turning time identification method and device, electronic equipment and storage medium
CN121434995B
Space-time density peak value clustering method based on local covariance and space-time shared neighbor
CN121456519A
spatiotemporal density peak clustering method based on local covariance and spatiotemporal shared nearest neighbors
CN121456519B
Track clustering method and device based on space-time mahalanobis distance and density peak value
CN121524664A
