Method and device for querying closest pair of mobile objects based on learning index
Through a learning index-based method, combining clustering and dimensionality reduction, a minimum enclosure matrix is constructed and a learning curve is trained using a multi-layer perceptron. The problem of inefficiency in high-dimensional data is solved, and efficient and accurate recent pair queries are achieved.
Patent Information
- Application Number
- CN202411831773.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-12
AI Technical Summary
Traditional k-d trees and other query methods have significantly reduced efficiency in high-dimensional data and cannot effectively handle dynamic changes in mobile objects, resulting in insufficient query delay and accuracy.
Using a learning index-based method, a minimum enclosure matrix is constructed through a combination of clustering and dimensionality reduction, and a multi-layer perceptron is used as a learning model to train the learning curve to calculate the nearest pair of moving objects.
It improves the performance and accuracy of recent queries in high-dimensional mobile data, can effectively handle dynamic changes of mobile objects, and reduces query delay.
Smart Images

Figure CN119293306B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data indexing, and in particular to a method and device for querying the closest pair of mobile objects based on a learning index. Background Art
[0002] With the development of mobile objects and big data technology, real-time nearest neighbor query has become particularly important. Traditional query methods, such as kd-tree, perform well in low-dimensional space, but their efficiency drops significantly in high-dimensional data and cannot effectively handle the dynamic changes of mobile objects, resulting in query delays and insufficient accuracy. Therefore, a novel method combining clustering and dimensionality reduction is needed to improve the performance and accuracy of nearest neighbor query in high-dimensional mobile data. Summary of the invention
[0003] Based on this, it is necessary to provide a mobile object closest pair query method based on learning index to address the above technical problems.
[0004] A mobile object closest pair query method based on learning index, the method comprising:
[0005] According to the position attribute and speed attribute of the mobile object, the mobile object is clustered by using a pre-constructed clustering function to obtain a plurality of mobile object clusters, and a minimum enclosing matrix is constructed for each of the mobile object clusters;
[0006] The first data and the second data to be queried are respectively reduced in dimension to a one-dimensional space using a Z-order curve, and stored in a one-dimensional sorted array;
[0007] According to the one-dimensional sorted array corresponding to the first data and the second data, a multilayer perceptron is used as a learning model for training to obtain a first learning curve and a second learning curve as well as a corresponding first error and a second error;
[0008] The minimum enclosing matrix is pruned, and the remaining minimum enclosing matrix is mapped to the first learning curve and the second learning curve, and the closest pair of the minimum enclosing matrix mapped to the first learning curve and the second learning curve is calculated.
[0009] In one of the embodiments, the method further includes: determining a cluster center for clustering according to a position attribute and a speed attribute of the moving object;
[0010] Calling the K-Means++ clustering algorithm to cluster the moving objects according to the cluster centers and the position attributes and speed attributes of the moving objects to obtain a plurality of moving object clusters;
[0011] A minimum bounding matrix is constructed for each moving object cluster; each edge of the minimum bounding matrix contains data points.
[0012] In one embodiment, the method further includes: integerizing the coordinates of each dimension of the first data and the second data to be queried, and calculating the Z address thereof by converting the scalar value of each dimension of the coordinate vector into binary and interleaving the binary bits;
[0013] After the dimensionality reduction is completed, the Z addresses of the first data and the second data are sorted and stored in a one-dimensional array, and a key corresponding to each Z address is assigned and added to the mobile object attributes.
[0014] In one of the embodiments, it further includes: for a one-dimensional sorted array, taking the Z address as input and the key Key as output, respectively constructing a multilayer perceptron for the first data and the second data;
[0015] According to the real key Key and the predicted key Key output by the multi-layer perceptron, a loss function is constructed to reversely train the multi-layer perceptron through the loss function, so as to obtain the first learning curve and the second learning curve and the corresponding first error and second error
[0016] In one embodiment, the further step includes: constructing a distance function as follows:
[0017] ;
[0018]
[0019] Wherein, P and Q are the moving object clusters corresponding to the first data and the second data, respectively. are the four edges between P and Q, minDIST( )yes The minimum distance between )yes The maximum distance between
[0020] According to the distance function, the distance between any two points in P and Q satisfies:
[0021]
[0022] in, , ;
[0023] Given a pruning parameter T, initialize T to infinity;
[0024] Calculate all the values between the first data and the second data , and sort from largest to smallest, ) is stored in the temporary queue W, where is numbered;
[0025] Select according to the number of queries K provided, traverse the temporary queue W, when Update T when The minimum enclosing matrix of .
[0026] In one of the embodiments, it further includes: mapping the minimum bounding matrix remaining after pruning to the first learning curve and the second learning curve;
[0027] Traverse all points on the mapped first learning curve, select o points on the second learning curve that are closest to the first learning curve in Z distance, calculate the distance between the point pairs in the original space, take the minimum distance as D, and get the id of the moving object according to the key of the denormalized point to form an array ( ), insert them into the priority queue CP in ascending order of D until CP is full and the top D is the largest, and output all the nearest pairs.
[0028] In one embodiment, the method further includes: translating the moving object, wherein the translation distance is:
[0029]
[0030] in, The moving object is The original data range on the dimension, d is the number of dimensions, ;
[0031] Compute the closest pair based on the translated moving object.
[0032] A mobile object closest pair query device based on a learning index, the device comprising:
[0033] A minimum enclosing matrix construction module is used to cluster the moving objects according to the position attributes and speed attributes of the moving objects using a pre-constructed clustering function to obtain a plurality of moving object clusters, and to construct a minimum enclosing matrix for each of the moving object clusters;
[0034] A dimension reduction module, used to reduce the dimensions of the first data and the second data to be queried into a one-dimensional space using a Z-order curve, and store them in a one-dimensional sorted array;
[0035] A learning module, for obtaining a first learning curve and a second learning curve and corresponding first errors and second errors by training a multi-layer perceptron as a learning model according to a one-dimensional sorted array corresponding to the first data and the second data;
[0036] The closest pair query module is used to prune the minimum enclosing matrix, map the remaining minimum enclosing matrix to the first learning curve and the second learning curve, and calculate the closest pair of the minimum enclosing matrix mapped to the first learning curve and the second learning curve.
[0037] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0038] According to the position attribute and speed attribute of the mobile object, the mobile object is clustered by using a pre-constructed clustering function to obtain a plurality of mobile object clusters, and a minimum enclosing matrix is constructed for each of the mobile object clusters;
[0039] The first data and the second data to be queried are respectively reduced in dimension to a one-dimensional space using a Z-order curve, and stored in a one-dimensional sorted array;
[0040] According to the one-dimensional sorted array corresponding to the first data and the second data, a multilayer perceptron is used as a learning model for training to obtain a first learning curve and a second learning curve as well as a corresponding first error and a second error;
[0041] The minimum enclosing matrix is pruned, and the remaining minimum enclosing matrix is mapped to the first learning curve and the second learning curve, and the closest pair of the minimum enclosing matrix mapped to the first learning curve and the second learning curve is calculated.
[0042] The above-mentioned mobile object nearest pair query method and device based on learning index first constructs a clustering function according to the position attribute and speed attribute of the mobile object, clusters similar mobile objects with similar motion states in the same data set into a cluster, and constructs its minimum enclosing rectangle. In order to realize the subsequent distance function pruning step, it is necessary to make at least one mobile object on each side of the minimum enclosing rectangle. Then use the Z-order curve to reduce the dimension of the data, map the d-dimensional data to one dimension, and the Z-order curve can better maintain the distance relationship of the data in the high-dimensional space in one dimension, that is, objects that are close in one dimension must be close in the original space. After that, the data is organized and stored in a one-dimensional array, and a multi-layer perceptron is constructed as a learning index for each of the two data sets to learn the distribution pattern of the data in one dimension. After that, a series of distance functions are used for pruning, and the remaining MBR is displayed on two learning curves, and only the remaining part is retained. The nearest pair is obtained through the two learning curves and smaller object pairs are continuously stored in the priority queue. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A schematic diagram of a flow chart of a method for querying the closest pair of mobile objects based on a learning index in one embodiment;
[0044] Figure 2 A graph showing the MBR construction results in one embodiment;
[0045] Figure 3 Schematic diagram of the Z-order dimensionality reduction process in one embodiment; (a) is a schematic diagram of the Z-curve dimensionality reduction, and (b) the corresponding point is a schematic diagram of the value after dimensionality reduction, i.e., the Z address;
[0046] Figure 4 A schematic diagram of obtaining Z addresses in a staggered arrangement in one embodiment;
[0047] Figure 5 A schematic diagram of a distance function definition diagram in one embodiment;
[0048] Figure 6 A schematic diagram of pruning in one embodiment;
[0049] Figure 7 A schematic diagram of a future nearest pair query in one embodiment;
[0050] Figure 8 A structural block diagram of a mobile object nearest pair query device based on a learning index in one embodiment;
[0051] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0053] In one embodiment, Figure 1 As shown, a mobile object closest pair query method based on a learning index is provided, comprising the following steps:
[0054] Step 102 : clustering the moving objects according to the position attributes and speed attributes of the moving objects using a pre-built clustering function to obtain a plurality of moving object clusters, and constructing a minimum enclosing matrix for each moving object cluster.
[0055] Step 104: Reduce the dimensions of the first data and the second data to be queried into a one-dimensional space using a Z-order curve, and store them in a one-dimensional sorting array.
[0056] Step 106: Based on the one-dimensional sorted array corresponding to the first data and the second data, a multilayer perceptron is used as a learning model for training to obtain a first learning curve and a second learning curve as well as corresponding first errors and second errors.
[0057] Step 108, pruning the minimum bounding matrix, and mapping the remaining minimum bounding matrix to the first learning curve and the second learning curve, and calculating the closest pair of the minimum bounding matrix mapped to the first learning curve and the second learning curve.
[0058] The above-mentioned learning index-based mobile object nearest pair query method first constructs a clustering function according to the position attribute and speed attribute of the mobile object, clusters similar mobile objects with similar motion states in the same data set into a cluster, and constructs its minimum enclosing rectangle. In order to realize the subsequent distance function pruning step, it is necessary to make at least one mobile object on each side of the minimum enclosing rectangle. Then use the Z-order curve to reduce the dimension of the data and map the d-dimensional data to one dimension. At the same time, the Z-order curve can better maintain the distance relationship of the data in the high-dimensional space in one dimension, that is, objects that are close in one dimension must be close in the original space. After that, the data is organized and stored in a one-dimensional array, and a multi-layer perceptron is constructed as a learning index for each of the two data sets to learn the distribution pattern of the data in one dimension. After that, a series of distance functions are used for pruning, and the remaining MBR (minimum enclosing matrix) is displayed on two learning curves, and only the remaining part is retained. The nearest pair is obtained through the two learning curves and smaller object pairs are continuously stored in the priority queue.
[0059] In one of the embodiments, the cluster center for clustering is determined according to the position attribute and speed attribute of the mobile object; the K-Means++ clustering algorithm is called to cluster the mobile objects according to the cluster center and the position attribute and speed attribute of the mobile object to obtain multiple mobile object clusters; a minimum enclosing matrix is constructed for each mobile object cluster; each edge of the minimum enclosing matrix contains data points.
[0060] Specifically, for each data set, move the object , which is The state at a moment is represented as ,in .
[0061] S1: Assume that the velocity is in time ( The n moving objects in a cluster are expected to move together for a period of time due to their similar motion states. The cluster center of the cluster is determined as ,in ;
[0062] S2: Select neighboring points with similar motion states to form clusters by calling the K-Means++ clustering algorithm, and use a distance metric that considers position and velocity information. ,in is the weight of the speed attribute, which is because in the process of clustering, the speed attribute of the data point is more important. According to this distance formula, the K-Means++ clustering algorithm is modified to perform clustering;
[0063] S3: For each cluster, construct a minimum bounding rectangle MBR for it. At the same time, in order to ensure the feasibility of the subsequent distance function, ensure that each edge of each MBR has at least one point. Taking two dimensions as an example, the minimum x and y values in the cluster are used as the lower left corner of the MBR. The maximum x and y values are at the upper right corner of the MBR. .like Figure 2 The following are the MBR construction results. The red color belongs to dataset A and the blue color belongs to dataset B.
[0064] In one of the embodiments, the coordinates of each dimension of the first data and the second data to be queried are integerized, and the Z address is calculated by converting the scalar value of each dimension of the coordinate vector into binary and interleaving the binary bits; after the dimensionality reduction is completed, the Z addresses of the first data and the second data are sorted and stored in a one-dimensional array, and a key Key is assigned to each Z address and added to the moving object attributes.
[0065] Specifically, in a one-dimensional data space, all data are naturally in linear order. Therefore, if the data is sorted, it is easy to construct a learning index. However, there is no such order for moving objects in a multidimensional data space. At the same time, it is impractical to directly perform quite a number of distance calculations for high-dimensional and large data sets. If the distance relationship between objects in the high-dimensional data space can be retained as much as possible in one dimension, fast pre-screening and pre-calculation can be performed in one dimension, greatly reducing the number of point pairs for accurate distance calculation. In order to solve these problems, the present invention chooses to use the Z-order curve for dimensionality reduction. On the basis of retaining the distance relationship between objects in the original space as much as possible, dominance can also be guaranteed. The so-called dominance means that: given two points and Point ,like All dimension values are not less than , then it is called Dominate , The dimension reduction value must be less than , and in and The dimension reduction value of all data points between the MBRs must be within and The dimension reduction value is between . Figure 3 As shown, (a) is a schematic diagram of the dimension reduction of the Z curve, and (b) the corresponding point is a schematic diagram of the value after dimension reduction, that is, the Z address. The specific steps are:
[0066] S1: Place the two data sets in the same space and use the Z-order curve for dimensionality reduction;
[0067] S11: To ensure the implementation of the subsequent Z-order binary dimensionality reduction, the coordinates of each dimension of the data are integerized;
[0068] S12: Calculate the Z address by converting the scalar value of each dimension of the coordinate vector into binary and interleaving the binary bits. For example, the binary form of the coordinate point (5, 6) in two dimensions is (101, 110). The interleaving process is as follows: Figure 4 As shown, the final Z address is 110110 (decimal 54), such as Figure 3 (b) shown in gray;
[0069] S2: After the dimensionality reduction is completed, the Z addresses of the two data sets are sorted and stored in a one-dimensional array, and a key corresponding to each Z address is assigned and added to the moving object attributes, that is, .
[0070] In one of the embodiments, for a one-dimensional sorted array, a multilayer perceptron for the first data and a multilayer perceptron for the second data are constructed respectively with the Z address as input and the key Key as output; a loss function is constructed according to the real key Key and the predicted key Key output by the multilayer perceptron, so as to reversely train the multilayer perceptron through the loss function, so as to obtain a first learning curve and a second learning curve and the corresponding first error and second error.
[0071] Specifically, since the array is sorted, the learning curve must be increasing, but it must be an irregular curve. The multilayer perceptron has a strong ability to fit the curve. In order to reduce the error, the multilayer perceptron is used as the learning model.
[0072] S1: For the sorted array of the first data, take Z as input, Key as output (target value), and normalize the data;
[0073] S2: Build a multi-layer perceptron model:
[0074] S21: construct the input layer, input Z, the number of nodes is 1;
[0075] S22: Construct hidden layers. You can construct multiple hidden layers, which need to be determined according to the data. Assume that the hidden layer has H neurons, and the activation function of each neuron is ReLU.
[0076] For the hidden layer l, its output is:
[0077]
[0078] in, is the weight matrix of the lth layer, is the output of the previous layer (the activation value of the l-1 layer), is the bias of the lth layer, and the activation function is ReLU:
[0079]
[0080] S23: Construct the output layer, output is the predicted , that is, the target value , the number of layers is 1, and the output formula is:
[0081]
[0082] in, is the weight of the output layer, is the activation value of the last layer, is the bias of the output layer;
[0083] S3: Define the loss function to measure the error between the model prediction value and the true value:
[0084]
[0085] in, is the real index, is the predicted value through MLP;
[0086] S4: Use the Adam optimizer to minimize the loss function, which is a gradient descent method with adaptive learning rate:
[0087]
[0088] in, are the current model parameters, is the learning rate, is the momentum estimate of the gradient, is the momentum estimate of the squared gradient, It is the decimal term that ensures the correct operation of division;
[0089] S5: Train the neural network by updating the network weights and biases through the back-propagation algorithm;
[0090] S51: Forward propagation, pass the input Z through the network and calculate the predicted value ;
[0091] S52: Calculate the loss based on the predicted value And Key calculates the loss function ;
[0092] S53: Back propagation, by calculating the gradient of the loss function for each parameter in the network, updating the weights and biases of each layer.
[0093] S54: Update network parameters using Adam optimizer.
[0094] S6: After the learning index training is completed, the learning index error threshold is obtained
[0095] The same is true for the second data. Finally, we get two first learning curves S1 and second learning curves S2, as well as the corresponding error thresholds. and .
[0096] In one embodiment, the distance function is constructed as:
[0097] ;
[0098]
[0099] Wherein, P and Q are the moving object clusters corresponding to the first data and the second data, respectively. are the four edges between P and Q, minDIST( )yes The minimum distance between )yes The maximum distance between them; According to the distance function, the distance between any two points in P and Q satisfies:
[0100]
[0101] in, , ; Given a pruning parameter T, initialize T to infinity; calculate all the , and sort from largest to smallest, ) is stored in the temporary queue W, where is the number; select according to the number of queries K provided, traverse the temporary queue W, when Update T when The minimum enclosing matrix of .
[0102] Specifically, by pruning the distance function of MBRs, the remaining MBRs are reflected in the learning curve. The specific steps are:
[0103] S1: pruning based on the distance function of MBRs;
[0104] S11: Construct a distance function, such as Figure 5 Take P and Q in as an example, where , ,remember are the four edges between P and Q, minDIST( )yes The minimum distance between )yes The maximum distance between them, the distance function is defined as follows:
[0105] ;
[0106]
[0107] According to the characteristics of the MBR constructed in step 1, there is at least one moving object on each edge, so the following properties can be obtained:
[0108]
[0109] in, , ;
[0110] S12: Given a pruning parameter T, with a smaller The MBRs pairs are more likely to contain the most recent pair, so only keep MBRs pair, initialize T to ;
[0111] S13: In order to minimize T as much as possible, according to the inequality proposed in S11, we calculate all the differences between the two data sets And sort from small to large, ) is stored in the temporary queue W, where is numbered;
[0112] S14: Select according to the provided K and traverse W. Update T when
[0113] S15: Reserved The MBRs are, for example Figure 6 shown.
[0114] In one embodiment, the minimum bounding matrix remaining after pruning is mapped to the first learning curve and the second learning curve; all points on the mapped first learning curve are traversed, and o points on the second learning curve whose Z distance is closest to the first learning curve are selected, and the distance between the point pairs in the original space is calculated, and the minimum distance is taken as D, and the id of the moving object is obtained according to the key of the point after denormalization, and an array is formed ( ), insert them into the priority queue CP in ascending order of D until CP is full and the top D is the largest, and output all the nearest pairs.
[0115] Specific:
[0116] S21: Map the remaining MBRs after pruning the first learning curve to the learning curve. According to the dimension reduction property of the Z-order curve, the dimension reduction value of an object in an MBR must be between the dimension reduction values of the lower left corner L and the upper right corner R. Calculate , we can get the corresponding learning index . Then the curve retains [ ],in , the first learning curve takes 1, and the second learning curve takes 2;
[0117] S22: Traverse all points in the remaining part of the first learning curve, select the o points on the second learning curve that are closest to it on the x (Z distance) axis, calculate their distances in the original space, take the minimum distance as D, and get the id of the moving object according to the key of the denormalized point to form an array ( ), insert the priority queue CP in ascending order of D until CP is full and the top D is the largest. The queue is adjusted only when the new D is smaller than the top D;
[0118] In one embodiment, the moving object is translated by a distance of:
[0119]
[0120] in, The moving object is The original data range on the dimension, d is the number of dimensions, ; Calculate the closest pair based on the translated moving object.
[0121] Specifically, there will be losses in dimensionality reduction. Although the Z-order curve retains the distance relationship of the data in the original space as much as possible, there are still objects that are close to each other in the original space, but are far apart in one dimension. Therefore, a single dimensionality reduction may not be able to capture the proximity relationship of all points well, resulting in a decrease in the accuracy of the algorithm. The present invention can obtain more position information about neighboring objects at different translation positions by translating the data object d times, thereby making up for the shortcomings of a single dimensionality reduction and gradually improving the accuracy of the nearest pair query. The specific steps are:
[0122] For moving objects , remember its The original data range on the dimension (all data of A and B) is , the translation distance in this dimension is:
[0123]
[0124] d is the number of dimensions, , so that the translation can maintain the distance relationship and proximity.
[0125] S1: Take 1, pass Shift the data in all dimensions;
[0126] S2: repeat steps 104-108;
[0127] S21: When the first learning curve of step 108 is reached, the pruning parameter T is set to the top D of CP;
[0128] S22: CP is adjusted only when D is less than the top D of CP;
[0129] S3: ;
[0130] S4: If , continue iterating.
[0131] S5: After the final iteration d times, the returned CP is the required closest pair.
[0132] In one embodiment, the nearest query at a future time is usually given a query range, and the query is At the moment, the K closest pairs within the specified range. To satisfy the future closest pair query, the present invention uses an idea of expanding the query range to form a time backoff, such as Figure 7 As shown, the black solid line is the current The dotted line represents the query range when the query falls back to time t.
[0133] S1: According to all moving objects The maximum speed and time in each direction are calculated using the formula To expand the scope of the query, With positive and negative;
[0134] S2: Perform steps 102-108 on all moving objects included in the query range to obtain a final result CP.
[0135] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0136] In one embodiment, Figure 8 As shown, a mobile object closest pair query device based on learning index is provided, comprising: a minimum enclosing matrix construction module 802, a dimension reduction module 804, a learning module 806 and a closest pair query module 808, wherein:
[0137] The minimum enclosing matrix construction module 802 is used to cluster the moving objects according to the position attributes and speed attributes of the moving objects using a pre-constructed clustering function to obtain multiple moving object clusters, and to construct a minimum enclosing matrix for each of the moving object clusters;
[0138] A dimension reduction module 804 is used to reduce the dimensions of the first data and the second data to be queried into a one-dimensional space using a Z-order curve, and store them in a one-dimensional sorting array;
[0139] A learning module 806 is used to obtain a first learning curve and a second learning curve and a corresponding first error and a second error by using a multilayer perceptron as a learning model for training according to the one-dimensional sorted array corresponding to the first data and the second data;
[0140] The closest pair query module 808 is used to prune the minimum enclosing matrix, map the remaining minimum enclosing matrix to the first learning curve and the second learning curve, and calculate the closest pair of the minimum enclosing matrix mapped to the first learning curve and the second learning curve.
[0141] For the specific definition of the mobile object recent pair query device based on learning index, please refer to the definition of the mobile object recent pair query method based on learning index above, which will not be repeated here. Each module in the above-mentioned mobile object recent pair query device based on learning index can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0142] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig. 9As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a mobile object nearest pair query method based on a learning index is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0143] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0144] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in the above embodiment when executing the computer program.
[0145] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in the above embodiment are implemented.
[0146] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0147] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0148] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A mobile object closest pair query method based on learning index, characterized in that: The method comprises: According to the position attribute and speed attribute of the mobile object, the mobile object is clustered by using a pre-constructed clustering function to obtain a plurality of mobile object clusters, and a minimum enclosing matrix is constructed for each of the mobile object clusters; The first data and the second data to be queried are respectively reduced in dimension to a one-dimensional space using a Z-order curve, and stored in a one-dimensional sorted array; According to the one-dimensional sorted array corresponding to the first data and the second data, a multilayer perceptron is used as a learning model for training to obtain a first learning curve and a second learning curve as well as a corresponding first error and a second error; Pruning the minimum enclosing matrix, mapping the remaining minimum enclosing matrix to the first learning curve and the second learning curve, and calculating the closest pair of the minimum enclosing matrix mapped to the first learning curve and the second learning curve; Prune the minimum bounding matrix, including: The distance function is constructed as: ; ; Wherein, P and Q are the moving object clusters corresponding to the first data and the second data, respectively. are the four edges between P and Q, minDIST( )yes The minimum distance between )yes The maximum distance between According to the distance function, the distance between any two points in P and Q satisfies: ; in, , ; Given a pruning parameter T, initialize T to infinity; Calculate all the values between the first data and the second data , and sort from largest to smallest, Stored in the temporary queue W, where For numbering; Select according to the number of queries K provided, traverse the temporary queue W, when Update T when The minimum enclosing matrix of ; Mapping the remaining minimum bounding matrix to the first learning curve and the second learning curve, and calculating the closest pair of the minimum bounding matrix mapped to the first learning curve and the second learning curve, comprising: Mapping the minimum bounding matrix remaining after pruning to the first learning curve and the second learning curve; Traverse all points on the mapped first learning curve, select o points on the second learning curve that are closest to the first learning curve in Z distance, calculate the distance between the point pairs in the original space, take the minimum distance as D, and get the id of the moving object according to the key of the denormalized point to form an array , insert them into the priority queue CP in ascending order of D until CP is full and the top D is the largest, and output all the nearest pairs.
2. The method according to claim 1, characterized in that According to the position attribute and speed attribute of the mobile object, the mobile object is clustered using a pre-constructed clustering function to obtain multiple mobile object clusters, and a minimum enclosing matrix is constructed for each of the mobile object clusters, including: According to the location and speed attributes of the moving object, the cluster center for clustering is determined; Calling the K-Means++ clustering algorithm to cluster the moving objects according to the cluster centers and the position attributes and speed attributes of the moving objects to obtain a plurality of moving object clusters; A minimum bounding matrix is constructed for each moving object cluster; each edge of the minimum bounding matrix contains data points.
3. The method according to claim 1, characterized in that The first data and the second data to be queried are respectively reduced in dimension to a one-dimensional space using a Z-order curve, and stored in a one-dimensional array, including: Integerize the coordinates of each dimension of the first data and the second data to be queried, and calculate the Z address thereof by converting the scalar value of each dimension of the coordinate vector into binary and interleaving the binary bits; After the dimensionality reduction is completed, the Z addresses of the first data and the second data are sorted and stored in a one-dimensional array, and a key corresponding to each Z address is assigned and added to the mobile object attributes.
4. The method according to claim 3, characterized in that According to the one-dimensional sorted array corresponding to the first data and the second data, a multilayer perceptron is used as a learning model for training to obtain a first learning curve and a second learning curve as well as a corresponding first error and a second error, including: For a one-dimensional sorted array, take the Z address as input and the key Key as output, and construct a multilayer perceptron for the first data and the second data respectively; A loss function is constructed according to the real key Key and the predicted key Key output by the multilayer perceptron, so as to reversely train the multilayer perceptron through the loss function, thereby obtaining a first learning curve and a second learning curve as well as corresponding first errors and second errors.
5. The method according to claim 1, characterized in that The method comprises: Translate the moving object by the following distance: ; in, The moving object is The original data range on the dimension, d is the number of dimensions, ; Compute the closest pair based on the translated moving object.
6. A mobile object closest pair query device based on learning index, used to implement the mobile object closest pair query method based on learning index according to any one of claims 1 to 5, characterized in that: The device comprises: A minimum enclosing matrix construction module is used to cluster the moving objects according to the position attributes and speed attributes of the moving objects using a pre-constructed clustering function to obtain a plurality of moving object clusters, and to construct a minimum enclosing matrix for each of the moving object clusters; A dimension reduction module, used to reduce the dimensions of the first data and the second data to be queried into a one-dimensional space using a Z-order curve, and store them in a one-dimensional sorted array; A learning module, for obtaining a first learning curve and a second learning curve and corresponding first errors and second errors by training a multi-layer perceptron as a learning model according to a one-dimensional sorted array corresponding to the first data and the second data; The closest pair query module is used to prune the minimum enclosing matrix, map the remaining minimum enclosing matrix to the first learning curve and the second learning curve, and calculate the closest pair of the minimum enclosing matrix mapped to the first learning curve and the second learning curve.
Citation Information
Patent Citations
An online nearest neighbor query method for high-dimensional data based on hash learning
CN109299097A
Nearest neighbor search method and apparatus, terminal, and storage medium
WO2023065696A1