A multi-stage spatiotemporal clustering method and system based on Mahalanobis distance fusion

By integrating Mahalanobis distance and a multi-stage assignment strategy, a spatiotemporal clustering method was developed to address the issues of dimensional inconsistencies and error propagation in spatiotemporal data, achieving higher clustering accuracy and stronger error resistance.

CN121051489BActive Publication Date: 2026-03-10NANCHANG INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing density peak clustering algorithms cannot effectively handle the differences in dimensionality and physical heterogeneity between spatial and temporal dimensions when processing spatiotemporal data, resulting in distortion of similarity measurement. Furthermore, the single-step allocation strategy leads to severe chain error propagation and is sensitive to boundary points and noise points.

Method used

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, Mahalanobis distance is used to fuse these distances. A multi-stage allocation strategy is combined to select cluster centers and allocate samples, including inevitable allocation based on spatiotemporal shared nearest neighbors and similarity allocation based on weighted similarity matrix.

Benefits of technology

It achieves more scientific spatiotemporal data measurement, significantly improves clustering accuracy, suppresses chain error propagation, and enhances the accuracy and error resistance of boundary sample allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121051489B_ABST
    Figure CN121051489B_ABST
Patent Text Reader

Abstract

This invention discloses a multi-stage spatiotemporal clustering method and system based on Mahalanobis distance fusion. The method includes: acquiring a spatiotemporal dataset and determining the spatiotemporal nearest neighbor relationships of samples in the dataset; calculating the spatial connectivity distance and temporal decay distance of the samples; fusing the spatial connectivity distance and temporal decay distance using Mahalanobis distance to obtain the relative distance of the samples; selecting cluster centers from the dataset based on the local density of the samples and the relative distance; and employing a multi-stage allocation strategy to assign non-cluster center samples to their corresponding clusters. 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. This invention solves the key problems of insufficient handling of spatiotemporal attribute coupling and sensitivity to allocation errors in existing spatiotemporal clustering algorithms, significantly improving the clustering accuracy, robustness, and practicality in fields such as intelligent traffic analysis and earthquake sequence identification.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of data processing, and particularly relates to a multi-stage spatio-temporal clustering method and system based on fused Mahalanobis distance. BACKGROUND

[0002] The density peak clustering (DPC) algorithm is widely used due to its simple parameters and ability to identify clusters of arbitrary shapes. However, it has inherent defects when processing spatio-temporal data: 1. The traditional method uses Euclidean distance, which cannot effectively handle the dimensional difference and physical meaning heterogeneity between spatial and temporal dimensions, resulting in distortion of the similarity metric; 2. Its single-step assignment strategy follows the "from near to far" principle, with serious chain error propagation and sensitivity to boundary points and noise points.

[0003] Although existing improved algorithms attempt to optimize, their distance metrics still do not deviate from the Euclidean distance paradigm, and the assignment strategy has not fundamentally solved the error propagation problem. Therefore, existing spatio-temporal clustering methods have significant deficiencies in "heterogeneous distance fusion" and "assignment error control". SUMMARY

[0004] To address these issues, the present application provides a multi-stage spatio-temporal clustering method and system based on fused Mahalanobis distance to solve the above problems.

[0005] In a first aspect, the present application provides a multi-stage spatio-temporal clustering method based on fused Mahalanobis distance, comprising:

[0006] Obtaining a spatio-temporal data set and determining the spatio-temporal neighborhood relationship of samples in the data set;

[0007] Calculating the spatial connectivity distance and temporal decay distance of the samples;

[0008] Fusing the spatial connectivity distance and temporal decay distance using Mahalanobis distance to obtain the relative distance of the samples;

[0009] Selecting cluster centers from the data set according to the local density of the samples and the relative distance;

[0010] Assigning non-cluster center samples to corresponding clusters using a multi-stage assignment strategy; wherein the multi-stage assignment strategy includes a certain assignment stage based on spatio-temporal shared neighbors and a similarity assignment stage based on a weighted similarity matrix.

[0011] In a second aspect, the present application provides a multi-stage spatio-temporal clustering system based on fused Mahalanobis distance, comprising:

[0012] A data acquisition and neighborhood determination module configured to obtain a spatio-temporal data set and determine the spatio-temporal neighborhood relationship of samples in the data set;

[0013] a distance calculation module configured to calculate a spatial connectivity distance and a time decay distance of the sample;

[0014] a distance fusion module configured to fuse the spatial connectivity distance and the time decay distance by using Mahalanobis distance to obtain a relative distance of the sample;

[0015] a cluster center selection module configured to select a cluster center from the data set according to a local density of the sample and the relative distance;

[0016] a multi-stage allocation module configured to allocate non-cluster center samples to corresponding clusters by using a multi-stage allocation strategy; wherein the multi-stage allocation strategy comprises a certain allocation stage based on a spatio-temporal shared neighbor and a similarity allocation stage based on a weighted similarity matrix;

[0017] an anomaly recognition module configured to calculate an outlier threshold based on a Mahalanobis neighbor distance of the sample and a quartile range, and recognize a sample with a distance greater than the outlier threshold as an abnormal sample.

[0018] In a third aspect, an electronic device is provided, which comprises at least one processor and a memory connected to the at least one processor in communication, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the multi-stage spatio-temporal clustering method based on fused Mahalanobis distance of any embodiment of the present application.

[0019] In a fourth aspect, the present application further provides a computer readable storage medium having a computer program stored thereon, and the program instructions are executed by a processor to enable the processor to perform the steps of the multi-stage spatio-temporal clustering method based on fused Mahalanobis distance of any embodiment of the present application.

[0020] The multi-stage spatio-temporal clustering method and system based on fused Mahalanobis distance of the present application have the following beneficial effects:

[0021] 1) A more scientific distance measurement paradigm is proposed: the spatio-temporal heterogeneous distance is fused by Mahalanobis distance, which solves the problem of different dimensions and attribute correlation, so that the similarity measurement is more consistent with the nature of spatio-temporal data, and the clustering accuracy is significantly higher than that of the improved scheme based on Euclidean distance.

[0022] 2) An error-resistant allocation mechanism is designed: a multi-stage allocation strategy is adopted, especially the allocation stage based on the global similarity matrix, which changes the traditional "from near to far" allocation logic, and suppresses the propagation of chain errors from the mechanism, greatly improving the accuracy of boundary sample allocation. BRIEF DESCRIPTION OF DRAWINGS

[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0024] Figure 1 A flow chart of a multi-stage spatio-temporal clustering method based on fused Mahalanobis distance provided by an embodiment of the present application;

[0025] Figure 2 A structural block diagram of a multi-stage spatio-temporal clustering system based on fused Mahalanobis distance provided by an embodiment of the present application;

[0026] Figure 3 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort fall within the protection scope of the present application.

[0028] Please refer to Figure 1 , which shows a flow chart of a multi-stage spatio-temporal clustering method based on fused Mahalanobis distance.

[0029] Step S1, acquiring a spatio-temporal data set and determining the spatio-temporal neighbor relationship of samples in the data set;

[0030] In this step, the spatio-temporal data set is read , wherein each sample contains spatial coordinates and a timestamp . The data is preprocessed (such as normalization, de-duplication). Then, the spatio-temporal neighbor set of each sample is determined:

[0031] According to the formula:

[0032] ;

[0033] The spatial K-neighbor (Kspatial) set of the sample is calculated .

[0034] According to the formula: ​

[0035] ;

[0036] Calculate samples Time K nearest neighbors ( )gather .

[0037] 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. :

[0038] .

[0039] 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. :

[0040] .

[0041] Step S2: Calculate the spatial connectivity distance and temporal decay distance of the samples;

[0042] 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.

[0043] In this step, spatial connectivity distance and temporal decay distance are calculated as more scientific distances based on spatial and temporal attributes, respectively.

[0044] 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:

[0045] ;

[0046] in, Indicates connection sample and Any path containing 1 node It is a path The first in a node, for its successor node, for a sample to a set of all paths. Traverse all feasible paths between the sample and , accumulate the spatial Euclidean distance of adjacent nodes for each path to obtain the total weight of the path, and take the sum of the weights of the shortest paths as the spatial connection distance of the sample to . Compared with the Euclidean distance, the connection distance can better reflect the spatial correlation of data by constructing a spatial neighborhood graph and describing the actual accessibility between samples based on connectivity constraints.

[0047] Time-decay distance : In order to reflect the nonlinear characteristics of time decay, a time distance measurement method containing an exponential decay term and a quadratic correction term is proposed, and its expression is as follows:

[0048] ;

[0049] Where, is the decay coefficient (the default value is 1), which is used to control the decay rate of the exponential term to the time distance. The first part simulates the natural decay process of time influence by the exponential term, which tends to be linear when the sample time interval is short, and quickly decays when the time interval is long; The second part uses the quadratic correction to fit the nonlinear relationship, avoiding the loss of time details of short distance samples caused by the linearization of a single exponential term.

[0050] When the sample is spatial neighbor of , because the spatial positions of the two are highly coincident, the influence of path constraint on distance can be ignored, and the Euclidean distance is directly used to simplify the connection distance calculation; Similarly, when the sample is spatial neighbor of

[0051] , the time interval is short enough to approximate linear decay, and the basic time difference can be used to simplify the time-decay distance calculation. This explains why the Euclidean distance is still used in most cases in local density calculation.

[0052] Step S3, fusing the spatial connection distance and the time-decay distance by using Mahalanobis distance to obtain the relative distance of the sample;

[0053] Specifically, the method for obtaining the relative distance of the sample by fusing the spatial connection distance and the time-decay distance by using Mahalanobis distance comprises:

[0054] computing a covariance matrix of all sample spatiotemporal feature vectors;

[0055] computing Mahalanobis distance between two samples according to the covariance matrix and the spatiotemporal feature vectors.

[0056] relative distance of Mahalanobis distance : To consider the correlation between each dimension feature, the spatial connectivity distance and the time decay distance are fused based on the Mahalanobis distance, and the relative distance of the sample is determined.

[0057] ;

[0058] ;

[0059] ;

[0060] wherein, is the spatiotemporal feature vector of sample pair , composed of spatial connectivity distance and time decay distance; is the global mean of all spatiotemporal feature vectors, reflecting the average level of features; is the covariance matrix of spatiotemporal feature vectors, which can quantitatively describe the linear correlation degree of spatiotemporal dimensions and the dispersion degree of each dimension itself; is the inverse of the covariance matrix, used to eliminate the dimension correlation and standardize the distance weight; is the Mahalanobis distance between samples. By calculating the inverse of the covariance matrix, the Mahalanobis distance can adapt to the actual distribution characteristics of the data, ignore the heterogeneity of different attributes in numerical scale and physical meaning, and adjust the weight of spatial connectivity distance and time decay distance. This process avoids the interference of different dimension differences, so that the relative distance can accurately describe the relative position relationship of samples in spatiotemporal dimensions.

[0061] Step S4, selecting cluster centers from the data set according to the local density of the sample and the relative distance;

[0062] Specifically, the calculation of the local density of the sample includes:

[0063] computing the initial local density of the sample according to the spatiotemporal neighbor set of the sample;

[0064] computing the weighted similarity according to the spatiotemporal shared neighbor set between samples;

[0065] determining the final local density of the sample according to the initial local density and the weighted similarity.

[0066] In this step, the local density of the sample is first calculated.

[0067] initial local density Under spatiotemporal constraints, based on Nearest neighbor definition sample The initial local density is expressed as follows:

[0068] ;

[0069] 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.

[0070] 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.

[0071] Weighted similarity The similarity of spatiotemporal shared neighbors is constructed by weighting the proximity of each shared neighbor, and its definition is as follows:

[0072] ;

[0073] ;

[0074] 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.

[0075] Final local density : according to the spatiotemporal neighborhood, and the weighted similarity of the spatiotemporal shared neighborhood, the local density of the spatiotemporal neighborhood is defined as follows:

[0076] ;

[0077] The final local density designed by the present application adopts the number of spatiotemporal neighbors as the only input parameter, which not only concerns the spatiotemporal local environment of the sample from the microscopic level, but also considers the interaction of the global sample from the macroscopic level. The first part determines the initial density by calculating the sum of the Euclidean distances between the sample and its spatiotemporal neighbors, which can effectively identify the cluster center in the high-density area, and at the same time avoid the situation that the local density of the non-spatiotemporal neighbor sample cannot be calculated due to the lack of spatiotemporal shared neighbors; the second part calculates the sum of the weighted similarity of the non-spatiotemporal neighbor sample according to the number of spatiotemporal shared neighbors, and the more the number of spatiotemporal shared neighbors between samples, the higher the similarity. For the sparse area, this method will not determine that the density value of the sample is low due to the long distance between the sample and the spatiotemporal neighbor, but will calculate the relative contribution of more non-spatiotemporal neighbors to appropriately increase the local density, thereby ensuring that the algorithm correctly selects the cluster center in different density areas.

[0078] After obtaining the local density and the relative distance of all samples, the decision value of each sample is calculated:

[0079] ;

[0080] The decision graph is drawn with the decision value , and the cluster center is screened;

[0081] The decision graph is drawn with the final local density and the relative distance as the horizontal and vertical coordinates, and according to the characteristics of the density peak class “high local density and far relative distance”, the samples in the upper right (or upper left) area of the decision graph are selected as the cluster center. At the same time, the decision value is introduced to quantitatively select the cluster center, and the samples with the maximum decision value are the cluster center.

[0082] Step S5, a multi-stage allocation strategy is adopted to allocate the non-cluster center samples to the corresponding cluster; wherein the multi-stage allocation strategy includes a certain allocation stage based on the number of spatiotemporal shared neighbors and a similarity allocation stage based on the weighted similarity matrix.

[0083] Specifically, the certain allocation stage based on the number of spatiotemporal shared neighbors is:

[0084] If the number of spatiotemporal shared neighbors of a sample and a cluster center exceeds the preset threshold, the sample will be definitely assigned to the cluster center.

[0085] The similarity assignment stage based on the weighted similarity between samples is:

[0086] Traverse the unassigned samples and assign them to the cluster to which the assigned sample with the highest weighted similarity belongs.

[0087] In this step, a three-stage strategy is used to assign non-cluster center samples.

[0088] Definite assignment stage: assume that sample is a cluster center selected by the decision graph, and sample has not been assigned. When the number of spatiotemporal neighbors of satisfies the following conditions at the same time, it can be considered that belongs to the same cluster as , and is a core member of the cluster:

[0089] ;

[0090] In the time and space dimensions, when the shared neighbors in the respective neighbors of the two samples account for more than half, the two samples can be considered to be close enough to belong to the same cluster.

[0091] Similarity assignment stage: by traversing the weighted similarity matrix, the highest similarity unassigned sample is matched for the assigned sample and is divided into the corresponding cluster, and the operation is repeated until all samples are assigned or there is no similarity for the unassigned sample.

[0092] Density peak clustering (DPC) assignment stage: for the small number of samples that have not been assigned after the above two stages, the traditional DPC strategy is used to assign them to the cluster to which the nearest neighbor with higher density belongs.

[0093] In particular, after the multi-stage assignment strategy is used to assign non-cluster center samples to the corresponding cluster, step S6 is further included, which calculates the outlier threshold based on the Mahalanobis neighbor distance of the sample and the interquartile range, and identifies the sample with a distance greater than the outlier threshold as an abnormal sample.

[0094] To identify abnormal samples, the Mahalanobis neighbor distance of a sample is defined , and the interquartile range (IQR) is combined to calculate the outlier threshold . All samples with a Mahalanobis neighbor distance greater than the threshold form an abnormal set.

[0095] ;

[0096] ;

[0097] wherein, is the Mahalanobis distance metric, distance sample The first nearest neighbor of sample is the median of Mahalanobis distance of all samples; is the value located at the front position after sorting the Mahalanobis distance in ascending order; corresponds to the value located at the front position; and covers the middle 50% of the data, which can better reflect the concentration trend of the data; is the scaling factor (the default value is 1.5), and the smaller the value, the more relaxed the determination condition, and the more abnormal samples detected. The abnormal sample is not always globally and absolutely deviated, but behaves as "out of the group" in the local neighborhood, and the Mahalanobis distance can reflect the isolation degree of the sample in the local group. When the distance of a sample from the surrounding neighbors is significantly larger, it indicates that it does not conform to the regular distribution in the local environment, and it is likely to be an abnormal sample.

[0098] The final output: the class cluster label set and the abnormal point set of the sample.

[0099] To evaluate the effectiveness of the clustering results, the following examples are verified on synthetic data sets and real earthquake data sets.

[0100] 1) Synthetic data set verification. The parameter settings of the method of the present application are as follows: the number of neighbors k = 15, the attenuation coefficient = 1.0, and the scaling factor = 1.5. ST-DBSCAN (spatial-temporal density based spatial clustering of applications with noise) and ST-CFSFDP (spatial-temporal clustering by fast search and find of density peaks) are selected as comparative algorithms.

[0101] Adjusted mutual information (AMI), adjusted Rand index (ARI), and FM index (FMI) are selected as external evaluation indexes, and the closer the value is to 1, the stronger the consistency of the clustering results with the real labels.

[0102] Experimental results: Table 1 lists the performance index comparison results of each algorithm on the representative synthetic data sets D1 and D2 (the bold data is the optimal value).

[0103] Table 1: Performance index comparison of each algorithm on synthetic data sets

[0104] ,

[0105] As shown in Table 1, on two synthetic data sets of different sizes and structures, all evaluation indexes of the method of the application are significantly better than all comparison algorithms. In particular, on data set D2, the ARI value of the application is more than 10 percentage points higher than the second-best ST-DBSCAN algorithm. This fully proves that the method of the application effectively solves the problems of spatiotemporal heterogeneous distance measurement and chain error propagation through Mahalanobis distance fusion and multi-stage allocation strategy, has high clustering accuracy and strong robustness.

[0106] 2) Real earthquake data set application. The data set is from the National Earthquake Scientific Data Center and covers 1329 records of earthquakes with a magnitude of 4.0 or more occurring in China from January 2008 to August 2009. The Davies-Bouldin index (DBI) and Calinski-Harabasz index (CHI) are used for evaluation, and the smaller the DBI value and the larger the CHI value represent the better clustering structure.

[0107] Application results: By applying the method of the application, five main spatiotemporal earthquake sequences (clusters) are successfully identified, including the main shock-aftershock sequence of the 2008 May 12 Wenchuan 8.0 earthquake (containing 795 events). The performance comparison of each algorithm is shown in the following table:

[0108] Table 2: Performance index comparison of each algorithm on the earthquake data set

[0109] ,

[0110] As shown in Table 2, the DBI index of the method of the application is the lowest, and the CHI index is the highest, indicating that the clustering result has the highest intra-cluster cohesion and inter-cluster separation. The application successfully parses the complete earthquake sequence from complex real spatiotemporal data, verifies its excellent practicality and reliability in real-world scenarios, and provides an effective technical tool for scientific problems such as earthquake sequence analysis.

[0111] Please refer to Figure 2 which shows the structure block diagram of a multi-stage spatiotemporal clustering system based on fused Mahalanobis distance of the application.

[0112] As Figure 2The data acquisition and neighbor determination module 200, the distance calculation module 201, the distance fusion module 202, the class cluster center selection module 203, the multi-stage assignment module 204, and the anomaly identification module 205 are shown.

[0113] The data acquisition and neighbor determination module 200 is configured to acquire a spatio-temporal data set and determine spatio-temporal neighbor relationships of samples in the data set.

[0114] The distance calculation module 201 is configured to calculate spatial connectivity distances and temporal decay distances of the samples.

[0115] The distance fusion module 202 is configured to fuse the spatial connectivity distances and the temporal decay distances by using Mahalanobis distances to obtain relative distances of the samples.

[0116] The class cluster center selection module 203 is configured to select class cluster centers from the data set according to local densities of the samples and the relative distances.

[0117] The multi-stage assignment module 204 is configured to assign non-class cluster center samples to corresponding class clusters by using a multi-stage assignment strategy. The multi-stage assignment strategy includes a certain assignment stage based on spatio-temporal shared neighbors and a similarity assignment stage based on a weighted similarity matrix.

[0118] The anomaly identification module 205 is configured to calculate an outlier threshold based on Mahalanobis neighbor distances of the samples and interquartile ranges, and identify samples with distances greater than the outlier threshold as abnormal samples.

[0119] It should be understood that, Figure 2 the modules described in the above Figure 1 correspond to the respective steps in the methods described in the above Figure 2 The operations and features described above for the methods also apply to the modules in the above

[0120] In some other embodiments, the present application also provides a computer readable storage medium having a computer program stored thereon. When the program instructions are executed by a processor, the processor executes the multi-stage spatio-temporal clustering method based on fused Mahalanobis distances in any of the above method embodiments.

[0121] As an implementation, the computer readable storage medium of the present application stores computer executable instructions, which are configured to:

[0122] acquire a spatio-temporal data set and determine spatio-temporal neighbor relationships of samples in the data set;

[0123] calculate spatial connectivity distances and temporal decay distances of the samples;

[0124] The relative distance of the samples is obtained by fusing the spatial connectivity distance and the time decay distance using Mahalanobis distance;

[0125] Cluster centers are selected from the dataset based on the local density of the samples and the relative distance.

[0126] 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.

[0127] 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.

[0128] 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 3 Taking 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.

[0129] 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.

[0130] As an implementation form, the electronic device is applied to a multi-stage spatio-temporal clustering system based on fused Mahalanobis distance, and is used for a client, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:

[0131] acquire a spatio-temporal data set, and determine spatio-temporal neighborhood relations of samples in the data set;

[0132] calculate spatial connected distances and temporal decay distances of the samples;

[0133] fuse the spatial connected distances and the temporal decay distances by using Mahalanobis distance to obtain relative distances of the samples;

[0134] select cluster centers from the data set according to local densities of the samples and the relative distances;

[0135] distribute non-cluster center samples into corresponding clusters by using a multi-stage distribution strategy; wherein the multi-stage distribution strategy comprises a certain distribution stage based on spatio-temporal shared neighbors and a similarity distribution stage based on a weighted similarity matrix.

[0136] Through the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software plus necessary general hardware platforms, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of software products, and the computer software products can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and include a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of the embodiments or some parts of the embodiments.

[0137] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features; and these modifications 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 application.

Claims

1. A multi-stage spatio-temporal clustering method based on fused Mahalanobis distance, characterized in that, The method comprises the following steps: acquiring and reading a spatio-temporal dataset, and calculating time neighbor sets and space neighbor sets of each sample in the spatio-temporal dataset after preprocessing data in the spatio-temporal dataset; wherein a common part of the space neighbor sets of any two different samples is a space shared neighbor set of the two different samples, and a common part of the time neighbor sets of any two different samples is a time shared neighbor set of the two different samples, thereby determining a spatio-temporal neighbor relationship of samples in the dataset; calculating a space connection distance and a time decay distance of the samples; fusing the space connection distance and the time decay distance by using Mahalanobis distance to obtain a relative distance of the samples; selecting class cluster centers from the dataset according to local densities of the samples and the relative distance; adopting a multi-stage allocation strategy to allocate non-class cluster center samples to corresponding class clusters; wherein the multi-stage allocation strategy comprises a certain allocation stage based on spatio-temporal shared neighbors, a similarity allocation stage based on a weighted similarity matrix, and a density peak clustering allocation stage based on density peaks. The certain allocation stage based on the number of spatio-temporal shared neighbors is that if the number of spatio-temporal shared neighbors of a sample and a class cluster center both exceeds a preset threshold, the sample is certainly allocated to a class cluster in which the class cluster center is located. The similarity allocation stage based on the weighted similarity matrix is that unallocated samples are iterated, and each unallocated sample is allocated to a class cluster to which an allocated sample with the highest weighted similarity is located. The density peak clustering allocation stage based on density peaks is that for a small amount of samples that are not allocated after the above two stages, a traditional density peak clustering strategy is used to allocate the samples to a class cluster to which a neighbor with the closest Mahalanobis distance and a higher density is located.

2. The multi-stage spatio-temporal clustering method based on fused Mahalanobis distance according to claim 1, wherein the space connection distance is a shortest path distance of two samples in all reachable paths, and the time decay distance is calculated by a formula containing an exponential decay term and a quadratic term correction term.

3. The multi-stage spatio-temporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, The use of Mahalanobis distance to fuse the space connection distance and the time decay distance to obtain the relative distance of the samples comprises: forming a spatio-temporal feature vector by using the space connection distance and the time decay distance of a pair of samples; calculating a covariance matrix of spatio-temporal feature vectors of all samples; calculating a Mahalanobis distance between two samples according to the covariance matrix and the spatio-temporal feature vectors.

4. The multi-stage spatio-temporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, The calculation of the local density of the samples comprises: calculating an initial local density of a sample according to a spatio-temporal neighbor set of the sample; calculating a weighted similarity according to a spatio-temporal shared neighbor set between samples; determining a final local density of the sample according to the initial local density and the weighted similarity.

5. The multi-stage spatio-temporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, The certain allocation stage based on the number of spatio-temporal shared neighbors is that if the number of spatio-temporal shared neighbors of a sample and a class cluster center both exceeds a preset threshold, the sample is certainly allocated to a class cluster in which the class cluster center is located. The similarity allocation stage based on the weighted similarity matrix is that unallocated samples are iterated, and each unallocated sample is allocated to a class cluster to which an allocated sample with the highest weighted similarity is located.

6. The multi-stage spatio-temporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, ​ ​ 7. The multi-stage spatio-temporal clustering method based on fused Mahalanobis distance according to claim 1, characterized in that, The multi-stage distribution strategy further comprises, An outlier threshold is calculated based on Mahalanobis neighbor distance and quartile distance of the samples, and samples with a distance greater than the outlier threshold are identified as abnormal samples.

8. A multi-stage spatio-temporal clustering system based on fused Mahalanobis distance characterized in that, The method comprises: a data acquisition and neighbor determination module configured to acquire and read a spatio-temporal dataset, and calculate time neighbor set and space neighbor set of each sample in the spatio-temporal dataset after pre-processing the data in the spatio-temporal dataset; wherein a common part of the space neighbor set of any two different samples is a space shared neighbor set of the two different samples, and a common part of the time neighbor set of any two different samples is a time shared neighbor set of the two different samples, thereby determining spatio-temporal neighbor relationship of the samples in the dataset; a distance calculation module configured to calculate space connected distance and time decay distance of the samples; a distance fusion module configured to fuse the space connected distance and the time decay distance by using Mahalanobis distance to obtain relative distance of the samples; a cluster center selection module configured to select cluster centers from the dataset according to local density of the samples and the relative distance; a multi-stage distribution module configured to distribute non-cluster center samples to corresponding clusters by using a multi-stage distribution strategy; wherein the multi-stage distribution strategy comprises a certain distribution stage based on spatio-temporal shared neighbor, a similarity distribution stage based on a weighted similarity matrix, and a density peak clustering distribution stage based on density peak; wherein the certain distribution stage based on the number of spatio-temporal shared neighbors is that if the number of spatio-temporal shared neighbors of a sample and a cluster center both exceeds a preset threshold, the sample is distributed to the cluster center; the similarity distribution stage based on the weighted similarity matrix is that the undistributed sample is distributed to the cluster to which the distributed sample with the highest weighted similarity belongs; and the density peak clustering distribution stage based on the density peak is that for a small amount of samples that have not been distributed after the above two stages, a traditional density peak clustering strategy is used to distribute them to the cluster to which the neighbor with the closest Mahalanobis distance and higher density belongs. An abnormality identification module configured to calculate an outlier threshold based on Mahalanobis neighbor distance and quartile distance of the samples, and identify samples with a distance greater than the outlier threshold as abnormal samples.

9. An electronic device, comprising: The method comprises: at least one processor, and a memory connected to the at least one processor in communication, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 7.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the method of any one of claims 1 to 7.