A ship trajectory clustering method
By constructing a core point prediction model and improving the hyperparameters of the DBSCAN algorithm through Bayesian optimization, the problem of low efficiency in ship trajectory clustering under large data volumes was solved, and efficient and stable clustering analysis was achieved.
Patent Information
- Application Number
- CN202511180728.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-22
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-08-22
AI Technical Summary
The existing DBSCAN algorithm has low computational efficiency and is sensitive to hyperparameters when processing large amounts of ship trajectory clustering, making it difficult to obtain stable recognition results.
By constructing a core point prediction model to screen candidate core points, and combining an adaptive acquisition function with an improved Bayesian optimization algorithm to optimize the hyperparameters of the DBSCAN algorithm, the clustering efficiency and stability are improved.
While ensuring computational accuracy, the DBSCAN algorithm's operating efficiency and clustering analysis effect are improved, enhancing the stability and accuracy of the clustering results.
Smart Images

Figure CN120670883B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of ship trajectory analysis, in particular to a ship trajectory clustering method. BACKGROUND
[0002] With the development of shipping economy and the popularity of Automatic Identification System (AIS), a large amount of ship motion trajectory AIS data is generated, which is of great significance to the analysis and supervision of global shipping. Through the mining of ship AIS data, valuable information can be provided for the analysis of ship motion patterns and behavior characteristics, trajectory prediction, etc., and clustering analysis plays an important role in it.
[0003] Ship trajectories have the characteristics of uncertain density distribution, and density methods can be used to cluster ship trajectories. Among them, DBSCAN algorithm is an algorithm widely used in ship AIS trajectory clustering, the core of which is to define the neighborhood of ship trajectory line and a threshold for limiting the density of trajectory distribution, to investigate the density of trajectory in the neighborhood, and then to realize the clustering of ship trajectory. However, such algorithm has low operation efficiency in the case of large amount of data, and is sensitive to two hyperparameters (minimum neighborhood radius (Eps), minimum number of points in neighborhood (MinPts)), so the method of clustering ship trajectory by traditional DBSCAN algorithm often fails to obtain good and stable recognition results. SUMMARY
[0004] One of the purposes of the present application is to provide a ship trajectory clustering method which can solve at least one of the defects in the background art.
[0005] To achieve the above at least one purpose, the technical solution adopted by the present application is as follows: a ship trajectory clustering method, comprising the following steps:
[0006] S100: cleaning the AIS data and grouping them according to MMSI, arranging the trajectory points in each group according to the collection time to obtain multiple ship navigation trajectories in a set time period;
[0007] S200: calculating the Hausdorff distance between any two navigation trajectories to obtain a similarity measurement matrix of all navigation trajectories, which is used as the basis for calculation of DBSCAN algorithm;
[0008] S300: constructing a core point prediction model and screening out high probability data points in the navigation trajectory as candidate core points, performing neighborhood query on the candidate core points and clustering expansion by DBSCAN algorithm;
[0009] S400: improving the Bayesian optimization algorithm by an adaptive acquisition function, and optimizing the hyperparameters of the DBSCAN algorithm based on the improved Bayesian optimization algorithm, so as to output the clustering result by the optimized DBSCAN algorithm.
[0010] Preferably, in step S300, the construction of the core point prediction model includes the following process: clustering a small amount of representative data by the DBSCAN algorithm to generate core point training data; constructing a core point prediction model by a lightweight model algorithm and training it by the core point training data; extracting the local statistical features of each data point in the navigation trajectory as the input of the core point prediction model, predicting the probability of each data point as a core point, and taking the data points with a predicted probability exceeding a set threshold as candidate core points.
[0011] Preferably, the local statistical features of each data point in the navigation trajectory include k-nearest neighbor distance mean, local grid density, distance distribution variance, and relative density ratio; when predicting the candidate core points, it is suitable to calculate the prediction confidence of the data point currently completed prediction; based on the calculated prediction confidence distribution, the set threshold of the probability required for judging the candidate core points is adaptively adjusted; wherein the specific value of the set threshold for judging the candidate core points is 0.7-0.9.
[0012] Preferably, in the process of clustering expansion, if the newly added neighboring point is marked as a low-probability core point in the core point prediction model, the neighboring point is still subjected to neighborhood query; based on the neighborhood query result, if the neighboring point is a true core point, the neighboring point and its neighborhood statistical features are taken as new training samples of the core point prediction model.
[0013] Preferably, a sliding window mechanism is set for the core point prediction model, so that the core point prediction model is retrained every interval of a set time or data volume.
[0014] Preferably, the process of improving the Bayesian optimization algorithm in step S400 is as follows: a Gaussian process function is used as a surrogate function and a prior distribution is given, then an adaptive acquisition function is used for multiple iterations of the objective function until the maximum number of iterations is reached; the process of each iteration is as follows: according to the dynamic weight mechanism of the adaptive acquisition function, the search intensity of the updated data points in the search space is automatically adjusted in the iteration process; the new data points are evaluated in the objective function and the corresponding results are obtained, the surrogate function is updated according to the new data points and the corresponding results and a posterior distribution is obtained, which is used as the prior distribution of the next iteration process.
[0015] Preferably, the expression of the adaptive acquisition function a t (x) is as follows:
[0016] ;
[0017] ;
[0018] ;
[0019] ;
[0020] wherein UCB(x) represents an upper confidence bound function, EI(x) represents an expected improvement function, η(t) represents a Sigmoid decay function, t represents a current iteration number, T represents a total iteration number, μ(x) represents a mean value of a target function predicted by a Gaussian process, σ(x) represents a standard deviation predicted by the Gaussian process, and β represents an exploration coefficient. * x represents a currently known optimal solution, and f(x) represents a target function.
[0021] Preferably, the quality of the clustering result of the ship navigation trajectory is represented by a silhouette coefficient; in step S400, the silhouette coefficient of the navigation trajectory is taken as the objective function of the improved Bayesian optimization algorithm; the to-be-optimized hyperparameters of the DBSCAN algorithm are adjusted within the corresponding parameter variation range, and clustering is performed once in each adjustment process; the clustering result is substituted into the improved Bayesian optimization algorithm for iteration and output of the corresponding silhouette coefficient; the hyperparameters corresponding to the maximum value of the silhouette coefficient returned by the improved Bayesian optimization algorithm are taken as the final parameters of the DBSCAN algorithm.
[0022] Preferably, the expression of the silhouette coefficient S used to measure the quality of the clustering result of the navigation trajectory is as follows:
[0023] ; ;
[0024] wherein N represents the total number of data points of clustering, s(i) represents the silhouette coefficient of a single data point, a(i) represents the intra-cluster compactness, i.e., the average distance from the data point i to other points in the same cluster, and b(i) represents the inter-cluster separation, i.e., the average distance from the data point i to all points in the nearest other cluster.
[0025] Preferably, when clustering is performed by the DBSCAN algorithm, part of the outlying trajectory segments are divided into noise data; for the noise data, at least one clustering analysis is repeatedly performed by the DBSCAN algorithm; the noise data obtained again is identified as real abnormal driving trajectories and recorded as data for subsequent abnormal trajectory analysis.
[0026] Compared with the prior art, the application has the beneficial effects that:
[0027] (1) In view of the problem that the density clustering algorithm has low operation efficiency in the case of large data volume, the DBSCAN algorithm is improved to ensure the calculation accuracy while improving the operation efficiency of the algorithm.
[0028] (2) The Bayesian optimization algorithm is introduced to automatically optimize the two hyperparameters that need to be manually set in the DBSCAN algorithm, thereby improving the effect and stability of the clustering analysis. BRIEF DESCRIPTION OF DRAWINGS
[0029] Figure 1 It is a schematic diagram of the overall workflow of the present application. DETAILED DESCRIPTION
[0030] In the following, the present application will be further described in conjunction with specific embodiments. It should be noted that in the description of the present application, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In the present description, the illustrative description of the above terms should not be understood as necessarily referring to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in the present description.
[0031] In the description of the present application, it should be noted that for orientation words such as the terms "center", "transverse", "longitudinal", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", etc. The orientation and positional relationship shown in the drawings is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and cannot be understood as limiting the specific protection scope of the present application.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and do not necessarily describe a specific order or sequence.
[0033] In the present application, unless specifically defined and limited otherwise, the terms "mount", "connect", "connection", "fixed", and like terms should be construed broadly and, for example, can be a connection, a detachable connection, or integral; can be a mechanical connection, or an electrical connection; can be a direct connection, or an indirect connection via an intermediate medium; can be a communication inside two elements, or an interaction between two elements. The specific meaning of the above terms in the present application can be understood according to the specific circumstances by those skilled in the art.
[0034] In the present application, unless specifically defined and limited otherwise, the first feature "on" or "under" the second feature can include that the first and second features are in direct contact, or that the first and second features are not in direct contact but are in contact through another feature between them. Moreover, the first feature "on", "above", and "over" the second feature includes that the first feature is directly above and obliquely above the second feature, or only indicates that the first feature is higher in horizontal height than the second feature. The first feature "under", "below", and "underneath" the second feature includes that the first feature is directly below and obliquely below the second feature, or only indicates that the first feature is lower in horizontal height than the second feature.
[0035] The terms "comprising" and "having" and any variations thereof in the specification and claims of the present application are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device comprising a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0036] As shown in one of the preferred embodiments of the present application, Figure 1 A ship trajectory clustering method includes the following steps:
[0037] S100: Clean the AIS data and group them according to MMSI. Arrange the trajectory points in each group according to the collection time to obtain the sailing trajectories of multiple ships within a set time period.
[0038] S200: Calculate the Hausdorff distance between any two sailing trajectories to obtain a similarity measurement matrix of all sailing trajectories, which is used as the basis for calculation of the DBSCAN algorithm.
[0039] S300: Construct a core point prediction model and select high-probability data points in the sailing trajectory as candidate core points. Perform neighborhood query on the candidate core points and expand the clustering through the DBSCAN algorithm.
[0040] S400: The Bayesian optimization algorithm is improved by an adaptive acquisition function, and the hyperparameters of the DBSCAN algorithm are optimized based on the improved Bayesian optimization algorithm, so that the clustering result is output by the optimized DBSCAN algorithm.
[0041] It can be understood that by cleaning the AIS data, part of the data of the trajectory that does not meet the requirements at all can be removed, thereby reducing the amount of calculation of the subsequent clustering algorithm, so as to improve the clustering speed. The Hausdorff distance is introduced to measure the similarity between two trajectories, and the calculation result has stronger robustness compared with other methods. In view of the problem that the operation efficiency of the density clustering algorithm is low in the case of large amount of data, the DBSCAN algorithm is improved in the embodiment, a core point prediction model is constructed by a small amount of data, and then the core point of the data point is judged by the constructed core point prediction model. The data identified as core points are clustered, so that the operation data amount of the clustering algorithm can be effectively reduced, and then the calculation accuracy is guaranteed while the operation efficiency of the algorithm is improved. The Bayesian optimization (Bayesian Optimization) algorithm is introduced to automatically optimize the two hyperparameters: minimum neighborhood radius (Eps) and minimum number of points in the neighborhood (MinPts) which need to be manually set for the DBSCAN algorithm, thereby improving the effect and stability of the clustering analysis.
[0042] In the embodiment, the cleaning of the AIS data in step S100 mainly includes two parts of contents of deleting abnormal trajectories and extracting trajectory data; for the convenience of understanding, the two parts of contents will be described in detail below.
[0043] I. Deletion of abnormal trajectories.
[0044] Since the ship AIS signal will exist in the process of transmitting, transmitting and receiving signal interruption or abnormal situation, the original AIS data generally exists data anomaly, redundancy, therefore, some measures need to be taken to delete the obviously abnormal trajectory data in the original AIS data, so as to obtain effective trajectory data.
[0045] Specifically, the data whose MMSI is not 9 bits is deleted. It should be known that since the MMSI unique identification code of the ship is composed of 9 bits, the data that does not meet the requirement is removed. At the same time, the data in the normal navigation state is selected. At the same time, the trajectory data with a continuous duration less than the first threshold is deleted.
[0046] It should be known that the spatial characteristics of the trajectory are not obvious when the trajectory duration is too short, which will be an interference term in the subsequent clustering, and thus is deleted; the specific value of the first threshold can be selected by the person skilled in the art according to the actual needs, for example, can be 20 minutes or half an hour, etc. At the same time, the trajectory with the maximum ground speed less than the set second threshold is deleted; it should be known that the specific value of the second threshold can be determined by the person skilled in the art according to the actual needs, for example, the value of the second threshold can be 5 knots, and the ship is considered to be not in the running state when the maximum speed is less than 5 knots.
[0047] II. Extraction of trajectory data after deletion of abnormal trajectories.
[0048] All trajectory data is divided into multiple groups according to MMSI, and the trajectory points in each group are arranged in ascending order of collection time, so as to obtain the ship navigation trajectory data set represented by the same MMSI in a time period. When the time difference or distance between the adjacent two trajectory points of the same ship is greater than the set third threshold, the adjacent two trajectory points are respectively regarded as the end point and the starting point of different trajectories, and then the ship navigation trajectory is divided into multiple sub-trajectories.
[0049] It should be known that the specific value of the third threshold can be selected by the person skilled in the art according to the actual needs; for example, when the time difference between the adjacent two trajectory points is used for judgment, the value of the third threshold can be half an hour; when the distance between the adjacent two trajectory points is used for judgment, the value of the third threshold can be 120 m. It should be noted that after obtaining the multiple sub-trajectories, the sub-trajectory with a duration less than the first threshold is deleted to avoid interfering with the subsequent clustering process.
[0050] After the cleaning of the AIS data, the trajectories are grouped according to MMSI; when the time difference or distance between the adjacent two trajectory points corresponding to the same ship is greater than the set third threshold, the adjacent two trajectory points are respectively regarded as the end point and the starting point of different trajectories, and then the ship navigation trajectory is divided into multiple sub-trajectories.
[0051] In this embodiment, the navigation track of the ship is a set of coordinate points arranged in time sequence, and the length of the set is not fixed. Therefore, the Hausdorff distance is used to measure the similarity between any two tracks to form the required distance matrix, i.e., the similarity measurement matrix between the tracks. That is, when calculating the Hausdorff distance, the entire navigation track can be regarded as a high-dimensional point, and the Hausdorff distance can convert the distance between the tracks into a normal number. The DBSCAN algorithm only needs to know the distance between points to realize clustering, so the distance matrix calculated by the Hausdorff distance can be directly used as the distance input of the DBSCAN algorithm. More simply, the Hausdorff distance not only retains the shape information of the entire navigation track, but also gives a single value distance, so it can directly convert the track point set corresponding to the navigation track into a "point-distance" problem that can be processed by the DBSCAN algorithm, thereby becoming a natural calculation basis for the DBSCAN algorithm. For ease of understanding, the specific calculation process of the Hausdorff distance will be described in detail below.
[0052] Specifically, the Hausdorff distance is the maximum distance from one set to the nearest point in another set. In general, the one-way Hausdorff distance between two sets is not equal, so the maximum value in the two-way Hausdorff distance can be taken as the Hausdorff distance between any two navigation tracks in this embodiment.
[0053] Two tracks T r1 =(p1,p2,……,p n ) and T r2 =(q1,q2,……,q m ) can be given, where p and q represent the track points corresponding to the two tracks, respectively, and n and m represent the lengths of the two tracks, i.e., the total number of track points. Then the calculation formula of the Hausdorff distance H(T r1 , T r2 ) of the two tracks is as follows:
[0054] .
[0055] .
[0056] .
[0057] where h(T r1 , T r2 ) and h(T r2 , T r1 ) represent two one-way Hausdorff distances, respectively.
[0058] It should be known that, for N ship voyage trajectory samples, the Hausdorff distance between trajectories is calculated between each other, and the Hausdorff distance matrix corresponding to all sample pairs, that is, the similarity measurement matrix between different trajectory data in the sample, can be obtained; the matrix data can be directly used as the calculation basis for subsequent DBSCAN algorithm clustering analysis.
[0059] In this embodiment, the construction of the core point prediction model in step S300 includes the following process: clustering a small amount of representative data by the DBSCAN algorithm to generate core point training data. A core point prediction model is constructed by a lightweight model algorithm, and is trained by the core point training data. Local statistical features of each data point in the voyage trajectory are extracted as inputs of the core point prediction model, the probability of each data point being a core point is predicted, and data points with a predicted probability exceeding a set threshold are taken as candidate core points.
[0060] It can be understood that, according to the principle of the DBSCAN algorithm, the algorithm needs to query the neighborhood of each sample in the clustering process to mark each sample point, but in fact, the neighborhoods of many nodes have intersections, and when the data set is very large, it will cause the efficiency of the algorithm to be reduced due to repeated queries of many nodes. The time overhead of the traditional DBSCAN algorithm is also increased by this repeated query problem. In this embodiment, the core point prediction model constructed by the lightweight model algorithm can filter out samples that are obviously not core points in advance, so that the subsequent DBSCAN algorithm only performs accurate neighborhood queries on high-probability candidate core points, which can greatly reduce the number of repeated node queries, thereby improving the efficiency of the algorithm.
[0061] It should be known that the specific type of the lightweight model algorithm is various, such as random forest algorithm, decision tree algorithm, logistic regression algorithm, etc., which can be selected by the person skilled in the art according to the actual needs, and the specific principle and working process of the algorithm are known to the person skilled in the art, so they will not be described in detail here.
[0062] It should also be known that the local statistical features of each data point in the voyage trajectory include k-neighbor distance mean, local grid density, distance distribution variance, and relative density ratio. Among them, the k-neighbor distance mean represents the average value of the distance calculated from point x to k-neighbor, which is used to reflect the local density; the local grid density is to divide the data into coarse-grained grids, and count the number of points in the grid where point x is located and the total number of points in the adjacent grid; the distance distribution variance represents the variance of the distance from point x to k-neighbor, which is used to capture the uniformity of the local data distribution; the relative density ratio represents the ratio of the density of the grid where point x is located to the overall local density.
[0063] It can be understood that the specific value of the set threshold for judging the candidate core point can be selected by the person skilled in the art according to the actual needs, for example, the value can be 0.7-0.9, that is, the probability of the data point being a core point is more than 0.7-0.9, and the data point is marked as a candidate core point.
[0064] It should be noted that when the candidate core point is predicted based on the core point prediction module, there is a possibility of overfitting, that is, the high-probability candidate core point is actually noise, which will further cause the invalid neighbor query of the subsequent DBSCAN algorithm. Therefore, when predicting the candidate core point, the prediction confidence of the data point currently completed can be calculated; and then the set threshold of the probability required for judging the candidate core point can be adaptively adjusted according to the calculated prediction confidence distribution, for example, the set threshold of the probability required for judging the candidate core point can be increased from 0.7 to 0.8 when the prediction confidence is low. The specific calculation process of the prediction confidence is known to the person skilled in the art, and therefore will not be described in detail here; that is, the prediction confidence required is calculated according to the probability of whether the candidate core point predicted by the core point prediction model is a real core point.
[0065] The person skilled in the art should know that the clustering process of the trajectory point by the DBSCAN algorithm is mainly triggered from the candidate core point, and all density-reachable points are connected into a piece, and the remaining data points are noise. That is, a neighborhood radius ε and a minimum neighbor number MinPts are set; when the candidate core point has more than MinPts neighbor points within the neighborhood radius ε, the candidate core point can be regarded as a real core point, and then its neighbor points are continuously included to form a cluster, and finally the cluster set and the noise set can be output. Based on the above clustering process, it can be known that the neighborhood radius ε and the minimum neighbor number MinPts are the two most important hyperparameters of the DBSCAN algorithm. In the traditional way, they need to be manually set by artificial, which cannot adapt to the change of the algorithm, so that the clustering accuracy of the DBSCAN algorithm is low; in the subsequent scheme, the two hyperparameters will be optimized by the improved Bayesian optimization algorithm, so as to improve the clustering accuracy of the DBSCAN algorithm.
[0066] In this embodiment, after obtaining the candidate core points, neighborhood query and cluster expansion will be started; the candidate core point list can be dynamically updated during the cluster expansion process. That is, if the newly added neighboring point is a low-probability core point marked in the core point prediction model, neighborhood query will still be performed on the neighboring point, thereby avoiding misjudgment of the core point prediction model. Based on the neighborhood query result, if the neighboring point is a real core point, the neighboring point and its neighborhood statistical features will be used as new training samples of the core point prediction model. Based on the new training samples, the small batch gradient descent algorithm is used to dynamically update the parameters of the core point prediction model, so that the core point prediction model gradually adapts to the changes in data distribution, thereby improving the subsequent prediction accuracy of the core point prediction model.
[0067] It should be noted that the navigation trajectory data of the present application belongs to streaming data, and the core point prediction model may drift when predicting the core points of streaming data, that is, the change of data distribution over time will cause the core point prediction model to fail. Therefore, for streaming data, the prediction error rate of the core point prediction model needs to be monitored, and the model needs to be retrained when the error rate reaches a set value. The calculation amount of directly calculating the prediction error rate is large, and the embodiment replaces the calculation of the prediction error rate by setting a sliding window mechanism, that is, the core point prediction model is retrained every interval of a set time or data amount.
[0068] It can be understood that, as known from the foregoing, the DBSCAN algorithm is particularly sensitive to two hyperparameters, and a large number of parameter combinations need to be manually adjusted to obtain a relatively ideal clustering effect in the traditional way. However, this way is time-consuming and laborious, has poor stability, and may not necessarily obtain the optimal clustering result. Therefore, the technical solution of the present application adjusts the hyperparameters of the DBSCAN algorithm by introducing the Bayesian optimization algorithm, thereby greatly improving the clustering analysis effect and calculation efficiency of the DBSCAN algorithm.
[0069] The Bayesian optimization algorithm is an algorithm that uses a probability model to model and infer the target function based on Bayes' theorem. Specifically, it fits an existing function to evaluate points by constructing a proxy model (usually a Gaussian process), which can capture the uncertainty of the target function. Based on this proxy model, the Bayesian optimization algorithm uses acquisition functions (probability improvement (PI), expected improvement (EI), upper confidence bound (UCB)) to decide the next point to evaluate, so as to find the global optimal solution in fewer evaluation times.
[0070] The traditional acquisition functions have advantages and disadvantages, which leads to a trade-off problem. Among them, the PI concept is intuitive, simple to calculate and can quickly converge, but it may converge to a local optimal solution too early because it is sensitive to the probability of improvement and less concerned about the size of the improvement. EI not only considers the probability of improvement, but also considers the magnitude of improvement, so it is more robust than PI and can better balance exploration and exploitation, but it has the problems of complex calculation and may fall into a suboptimal solution in a multi-peak function. The UCB algorithm is simple and easy to understand, and can effectively balance exploration and exploitation, but it may not perform well for target functions with high noise. Therefore, the traditional acquisition function can be improved in the technical solution of the present application to obtain an adaptive acquisition function. The adaptive acquisition function can be dynamically adjusted according to the operation process of the Bayesian optimization algorithm, so that the Bayesian algorithm has the best iteration effect on the target function at different operation stages.
[0071] In the embodiment, the process of improving the Bayesian optimization algorithm in step S400 is: using a Gaussian process function as a proxy function and giving a prior distribution, then using an adaptive acquisition function to perform multiple iterations of the target function until the maximum number of iterations is reached. The process of each iteration is: according to the dynamic weight mechanism of the adaptive acquisition function, automatically adjusting the search intensity of the updated data points in the search space in the iteration process. Evaluate the new data points in the target function and obtain the corresponding results, update the proxy function according to the new data points and the corresponding results and obtain a posterior distribution, which is used as the prior distribution of the next iteration process.
[0072] It can be understood that the expression of the proxy function F(x) is:
[0073] .
[0074] ; .
[0075] Wherein, m(x) represents the mean function, K(x, x') represents the covariance function, and x and x' represent any two input points, i.e. any two different combinations of hyperparameter groups (ε, MinPts).
[0076] The expression of the adaptive acquisition function a t (x) is:
[0077] .
[0078] ; ; .
[0079] wherein UCB(x) represents an upper confidence bound function, EI(x) represents an expected improvement function, η(t) represents a Sigmoid decay function, t represents a current iteration number, T represents a total iteration number, μ(x) represents a mean of a target function predicted by a Gaussian process, σ(x) represents a standard deviation predicted by the Gaussian process, and β represents an exploration coefficient; x * represents a currently known optimal solution, and f(x) represents a target function.
[0080] In this embodiment, the quality of the clustering result of the ship navigation trajectory is represented by a silhouette coefficient. The silhouette coefficient reflects the compactness and separation of the clustering result by quantifying the distance relationship of the sample with the same cluster and other clusters. In step S400, the silhouette coefficient of the navigation trajectory is taken as the objective function of the improved Bayesian optimization algorithm. The to-be-optimized hyperparameters of the DBSCAN algorithm are adjusted in the corresponding parameter variation range, and clustering is performed once in each adjustment process. The clustering result is substituted into the improved Bayesian optimization algorithm for iteration and output of the corresponding silhouette coefficient. The hyperparameters corresponding to the maximum value of the silhouette coefficient returned by the improved Bayesian optimization algorithm are taken as the final parameters of the DBSCAN algorithm.
[0081] It can be understood that the silhouette coefficient is a parameter with an upper limit of 1, and the closer it is to 1, the more compact the clustering is and the more separated the clusters are. The process of optimizing the hyperparameters of the DBSCAN algorithm by the Bayesian optimization algorithm can be simply understood as follows: selecting the most promising parameter value in the parameter variation range for clustering test by using the surrogate model of the Bayesian optimization algorithm, calculating the silhouette coefficient based on the clustering test result of the DBSCAN algorithm, and selecting the parameter value used in the clustering test corresponding to the maximum value of the silhouette coefficient as the optimal hyperparameter to be substituted into the DBSCAN algorithm.
[0082] Specifically, the expression of the silhouette coefficient S for measuring the quality of the clustering result of the navigation trajectory is as follows:
[0083] ; .
[0084] wherein N represents the total number of data points of clustering, s(i) represents the silhouette coefficient of a single data point, a(i) represents the compactness within the cluster, i.e., the average distance from the data point i to other points in the same cluster, and b(i) represents the separation between clusters, i.e., the average distance from the data point i to all points in the nearest other cluster.
[0085] In this embodiment, when performing the above clustering analysis, some outlier trajectory segments will appear, that is, this part of data does not belong to any category, and the program will automatically divide these outlier trajectory data into noise data. Noise data is data containing a large number of abnormal driving trajectories, but at the same time, due to the adjustment of the hyperparameters from a global perspective, it is inevitable that part of the normal trajectory data will be divided into noise data. Therefore, the noise data can be repeatedly clustered at least once by the DBSCAN algorithm; the noise data obtained again is identified as the real driving abnormal trajectory and is recorded. Compared with the traditional method, the application first proposes a method of repeatedly clustering the noise data in the clustering result, which can effectively extract the real driving abnormal trajectory data and provide data support for subsequent abnormal trajectory analysis.
[0086] The above describes the basic principles, main features and advantages of the application. Those skilled in the art should understand that the application is not limited to the above embodiments, and the above embodiments and descriptions in the specification are only the principles of the application. Without departing from the spirit and scope of the application, various changes and improvements can be made to the application, and these changes and improvements all fall within the scope of the claimed application. The scope of protection claimed by the application is defined by the appended claims and their equivalents.
Claims
1. A ship trajectory clustering method, characterized by, The method comprises the following steps: S100: cleaning AIS data and grouping according to MMSI, arranging track points in each group according to collection time to obtain a plurality of ship navigation tracks in a set time period; S200: calculating the Hausdorff distance between any two navigation tracks to obtain a similarity measurement matrix of all navigation tracks, and taking the similarity measurement matrix as a calculation basis of a DBSCAN algorithm; S300: constructing a core point prediction model and screening high-probability data points in the navigation track as candidate core points, performing neighborhood query on the candidate core points and cluster expansion through the DBSCAN algorithm; S400: improving a Bayesian optimization algorithm through an adaptive collection function, optimizing hyperparameters of the DBSCAN algorithm based on the improved Bayesian optimization algorithm, and outputting a clustering result through the optimized DBSCAN algorithm; In step S300, the construction of the core point prediction model comprises the following processes: cluster a small amount of representative data through the DBSCAN algorithm to generate core point training data; constructing a core point prediction model through a lightweight model algorithm, and training the core point prediction model through the core point training data; extracting local statistical features of each data point in the navigation track as inputs of the core point prediction model, predicting the probability of each data point as a core point, and taking data points with a predicted probability higher than a set threshold as candidate core points.
2. The ship trajectory clustering method of claim 1, wherein, The local statistical features of each data point in the navigation track include k-nearest neighbor distance mean, local grid density, distance distribution variance, and relative density ratio; When predicting the candidate core points, the prediction confidence of the currently predicted data point is calculated; based on the calculated prediction confidence distribution, the set threshold of the probability required for judging the candidate core points is adaptively adjusted; wherein the specific value of the set threshold for judging the candidate core points is 0.7-0.
9.
3. The ship trajectory clustering method of claim 1, wherein, In the process of cluster expansion, if a newly added neighboring point is marked as a low-probability core point in the core point prediction model, the neighboring point is still subjected to neighborhood query; based on the neighborhood query result, if the neighboring point is a true core point, the neighboring point and its neighborhood statistical features are taken as new training samples of the core point prediction model.
4. The ship trajectory clustering method of claim 1, wherein, A sliding window mechanism is set for the core point prediction model, so that the core point prediction model is retrained every interval of a set time or data volume.
5. The ship track clustering method according to any one of claims 1-4, characterized in that, The process of improving the Bayesian optimization algorithm in step S400 is as follows: a Gaussian process function is used as a proxy function and a prior distribution is given, then a plurality of iterations of the target function are performed by using an adaptive collection function until a maximum iteration number is reached; the process of each iteration is as follows: according to the dynamic weight mechanism of the adaptive collection function, the search intensity of the updated data points in the search space is automatically adjusted in the iteration process; the new data points are evaluated in the target function and the corresponding results are obtained, the proxy function is updated according to the new data points and the corresponding results, and a posterior distribution is obtained, which is taken as the prior distribution of the next iteration process.
6. The ship trajectory clustering method of claim 5, wherein, Adaptive acquisition function The expression for the adaptive acquisition function is: ; ; ; ; where UCB(x) denotes the upper confidence bound function, denotes the expected improvement function, denotes the Sigmoid decay function, t denotes the current iteration number, and T denotes the total iteration number, denotes the mean of the objective function predicted by the Gaussian process, denotes the standard deviation of the objective function predicted by the Gaussian process, denotes the exploration coefficient; x * denotes the current known optimal solution, and f(x) denotes the objective function.
7. The ship trajectory clustering method of claim 5, wherein, The continuity and uniformity of the ship navigation track are represented by a contour coefficient. In step S400, the profile coefficient of the navigation trajectory is taken as the objective function of the improved Bayesian optimization algorithm; Adjust the to-be-optimized hyperparameters of the DBSCAN algorithm in the corresponding parameter variation range, and perform clustering once in each adjustment process; Put the clustering result into the improved Bayesian optimization algorithm for iteration and output the corresponding profile coefficient; Take the hyperparameters corresponding to the maximum profile coefficient returned by the improved Bayesian optimization algorithm as the final parameters of the DBSCAN algorithm.
8. The ship trajectory clustering method of claim 7, wherein, The expression of the profile coefficient S for measuring the continuity and uniformity of the navigation trajectory is: ; ; Wherein, N represents the total number of clustered data points, s(i) represents the profile coefficient of a single data point, a(i) represents the intra-cluster compactness, i.e. the average distance from data point i to other points in the same cluster, and b(i) represents the inter-cluster separation, i.e. the average distance from data point i to all points in the nearest other cluster.
9. The ship trajectory clustering method of claim 1, wherein, When performing clustering of the DBSCAN algorithm, it is suitable to divide part of the outlying trajectory segments into noise data; For noise data, it is suitable to repeatedly perform clustering analysis at least once through the DBSCAN algorithm; The noise data obtained again is identified as real abnormal driving trajectory and recorded as data for subsequent abnormal trajectory analysis.