Big data retrieval method and device and readable storage medium
By dividing the points to be queried into sub-vectors and generating clusters in the sub-space, combined with Cartesian product operations, the problem of large computational complexity in massive and high-dimensional data retrieval is solved, and the efficiency and accuracy of big data retrieval are improved.
Patent Information
- Application Number
- CN202410805707.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-09-10
AI Technical Summary
Existing big data retrieval methods require large amounts of calculations and low computational efficiency in a massive, high-dimensional data environment, which seriously restricts the mining of the value of big data.
Divide the query point into the first sub-vector and the second sub-vector according to the dimension, generate sub-clusters in the two sub-spaces, use Cartesian product operation and hyperplane boundary algorithm to calculate the distance lower bound, and improve the distance lower bound calculation complexity to O (K), generates more clusters and improves lower bound compactness.
It greatly improves the computational efficiency of big data retrieval, reduces computational complexity, and improves nearest neighbor search efficiency, making big data retrieval no longer a factor restricting big data value mining.
Smart Images

Figure CN118626692A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data, and in particular to a big data retrieval method, a big data retrieval device and a readable storage medium. Background Art
[0002] With the booming development of big data, the majority of it is semi-structured and unstructured data (such as text, images, audio and video data, etc.), accounting for more than 85% of the total data volume and containing huge value.
[0003] In order to fully tap the value of unstructured big data, it is necessary to be able to efficiently retrieve unstructured data, that is, to quickly find the desired information from massive data. This problem currently faces two severe challenges: one is massiveness, and the other is high dimensionality.
[0004] At present, the retrieval methods for massive, high-dimensional big data have a large amount of computation and low computational efficiency, which seriously restricts the mining of the value of big data. Summary of the invention
[0005] In view of the above problems, the present invention proposes a big data retrieval method, a big data retrieval device and a readable storage medium.
[0006] An embodiment of the present invention provides a big data retrieval method, the big data retrieval method comprising:
[0007] Divide the query point into a first sub-vector and a second sub-vector according to its dimension;
[0008] Calculating in a first subspace the lower bound of the distance from the first subvector to all subcluster centers in the first subspace to form a first lower bound combination, and calculating in a second subspace the lower bound of the distance from the second subvector to all subcluster centers in the second subspace to obtain a second lower bound combination;
[0009] Based on the first lower bound combination and the second lower bound combination, a new lower bound combination is obtained by combining a Cartesian product operation;
[0010] Sort each distance lower bound in the new lower bound combination, and mark the sequence as i, i = 1, 2, 3, ..., K ′2 ;
[0011] With i=1, assuming that the initial nearest neighbor candidate point is empty and the initial distance from the query point to the initial nearest neighbor candidate point is used as the initial condition, the lower bound of the distance corresponding to the sequence number i=1 and the initial distance are judged;
[0012] If the lower bound of the distance corresponding to the sequence number i=1 is not greater than the initial distance, a new nearest neighbor candidate point is determined according to the first sub-cluster and the second sub-cluster corresponding to the sequence number i=1;
[0013] With i=i+1 and the target distance from the query point to the new nearest neighbor candidate point as a new condition, the steps are performed: judging the lower bound of the distance corresponding to the sequence number i=i+1 and the target distance;
[0014] If the lower bound of the distance corresponding to the sequence number i=1 is greater than the initial distance, the initial nearest neighbor candidate point is used as the final nearest neighbor point.
[0015] Optionally, calculating in a first subspace a lower bound of the distance from the first subvector to all subcluster centers in the first subspace to form a first lower bound combination, and calculating in a second subspace a lower bound of the distance from the second subvector to all subcluster centers in the second subspace to obtain a second lower bound combination, comprises:
[0016] Using a hyperplane boundary algorithm in the first subspace, calculating a lower bound of the distance from the first subvector to all subcluster centers in the first subspace to form the first lower bound combination;
[0017] The hyperplane boundary algorithm is used in the second subspace to calculate a lower bound of the distance from the second subvector to all subcluster centers in the second subspace to obtain the second lower bound combination.
[0018] Optionally, based on the first lower bound combination and the second lower bound combination, a new lower bound combination is obtained by combining a Cartesian product operation, including:
[0019] Take the Cartesian product of the first lower bound combination and the second lower bound combination to obtain K ′2 sub-lower bound combinations, each of which includes a distance lower bound from the first lower bound combination and a distance lower bound from the second lower bound combination;
[0020] A new distance lower bound is obtained by summing the two distance lower bounds contained in each of the sub-lower bound combinations, and the new distance lower bounds corresponding to all sub-lower bound combinations form the new lower bound combination.
[0021] Optionally, sorting each distance lower bound in the new lower bound combination includes:
[0022] Each distance lower bound in the new lower bound combination is sorted in order from small to large.
[0023] Optionally, assuming that the initial nearest neighbor candidate point is empty, the initial distance from the point to be queried to the initial nearest neighbor candidate point is infinite.
[0024] Optionally, determining a new nearest neighbor candidate point according to the first sub-cluster and the second sub-cluster corresponding to the sequence number i=1 includes:
[0025] According to the sequence number i=1, determining that in the new lower bound combination corresponding to the sequence number i=1, two distance lower bounds respectively correspond to a first sub-cluster center from the first subspace and a second sub-cluster center from the second subspace;
[0026] Determine the corresponding first sub-cluster based on the first sub-cluster center, and determine the corresponding second sub-cluster based on the second sub-cluster center;
[0027] Extracting data points in the first sub-cluster and data points in the second sub-cluster and taking their intersection to obtain intersection data points;
[0028] The true distance from the query point to each data point in the intersection data point is calculated, and the data point with the smallest true distance is selected as the new nearest neighbor candidate point.
[0029] Optionally, if the new nearest neighbor candidate point is x and the band query point is q, then the target distance from the band query point q to the new nearest neighbor candidate point x is equal to ‖q,x‖, which is smaller than the initial distance.
[0030] Optionally, before dividing the query point into the first sub-vector and the second sub-vector according to its dimension, the method further includes:
[0031] Divide the multidimensional space into the first subspace and the second subspace equally;
[0032] Performing a clustering operation on the sub-data set corresponding to the first subspace to obtain a plurality of corresponding sub-clusters, each of which includes a sub-cluster center;
[0033] Performing the clustering operation on the sub-data set corresponding to the second subspace to obtain a plurality of sub-clusters corresponding thereto, each sub-cluster including a sub-cluster center;
[0034] If the multidimensional space is of d dimensions, the first subspace and the second subspace each have d / 2 dimensions, and each cluster center is a d / 2-dimensional subvector.
[0035] An embodiment of the present invention provides a large data retrieval device, the large data retrieval device comprising:
[0036] A division module, used for dividing the query point into a first sub-vector and a second sub-vector according to its dimension;
[0037] a lower bound combination calculation module, configured to calculate in a first subspace a lower bound of the distance from the first subvector to all subcluster centers in the first subspace to form a first lower bound combination, and to calculate in a second subspace a lower bound of the distance from the second subvector to all subcluster centers in the second subspace to obtain a second lower bound combination;
[0038] A Cartesian operation module, configured to obtain a new lower bound combination based on the first lower bound combination and the second lower bound combination by performing a Cartesian product operation;
[0039] A sorting module is used to sort each distance lower bound in the new lower bound combination, and the sequence number is recorded as i, i = 1, 2, 3, ..., K ′2 ;
[0040] A judgment module, used to judge the lower bound of the distance corresponding to the sequence number i=1 and the initial distance with i=1 and assuming that the initial nearest neighbor candidate point is empty and the initial distance from the query point to the initial nearest neighbor candidate point as an initial condition;
[0041] A module for determining a new candidate point is used to determine a new nearest neighbor candidate point according to the first sub-cluster and the second sub-cluster corresponding to the sequence number i=1 if the lower bound of the distance corresponding to the sequence number i=1 is not greater than the initial distance;
[0042] The judgment module is further used to take i=i+1 and the target distance from the query point to the new nearest neighbor candidate point as a new condition, and execute the steps of: judging the distance lower bound corresponding to the sequence number i=i+1 and the target distance;
[0043] The final point module is used to use the initial nearest neighbor candidate point as the final nearest neighbor point if the distance lower bound corresponding to the sequence number i=1 is greater than the initial distance.
[0044] Optionally, the lower bound calculation combination module is specifically used for:
[0045] Using a hyperplane boundary algorithm in the first subspace, calculating a lower bound of the distance from the first subvector to all subcluster centers in the first subspace to form the first lower bound combination;
[0046] The hyperplane boundary algorithm is used in the second subspace to calculate a lower bound of the distance from the second subvector to all subcluster centers in the second subspace to obtain the second lower bound combination.
[0047] Optionally, the Cartesian operation module is specifically used for:
[0048] Take the Cartesian product of the first lower bound combination and the second lower bound combination to obtain K ′2sub-lower bound combinations, each of which includes a distance lower bound from the first lower bound combination and a distance lower bound from the second lower bound combination;
[0049] A new distance lower bound is obtained by summing the two distance lower bounds contained in each of the sub-lower bound combinations, and the new distance lower bounds corresponding to all sub-lower bound combinations form the new lower bound combination.
[0050] Optionally, the sorting module is specifically used to:
[0051] Each distance lower bound in the new lower bound combination is sorted in order from small to large.
[0052] Optionally, the module for determining new candidate points is specifically used for:
[0053] According to the sequence number i=1, determining that in the new lower bound combination corresponding to the sequence number i=1, two distance lower bounds respectively correspond to a first sub-cluster center from the first subspace and a second sub-cluster center from the second subspace;
[0054] Determine the corresponding first sub-cluster based on the first sub-cluster center, and determine the corresponding second sub-cluster based on the second sub-cluster center;
[0055] Extracting data points in the first sub-cluster and data points in the second sub-cluster and taking their intersection to obtain intersection data points;
[0056] The true distance from the query point to each data point in the intersection data point is calculated, and the data point with the smallest true distance is selected as the new nearest neighbor candidate point.
[0057] Optionally, the big data retrieval device further includes:
[0058] A space module, used for equally dividing the multidimensional space into the first subspace and the second subspace;
[0059] A clustering module, configured to perform a clustering operation on the sub-data set corresponding to the first subspace to obtain a plurality of sub-clusters corresponding thereto, each of which includes a sub-cluster center, and to perform the clustering operation on the sub-data set corresponding to the second subspace to obtain a plurality of sub-clusters corresponding thereto, each of which includes a sub-cluster center;
[0060] If the multidimensional space is of d dimensions, the first subspace and the second subspace each have d / 2 dimensions, and each cluster center is a d / 2-dimensional subvector.
[0061] An embodiment of the present invention further provides a readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps in any of the above-described big data retrieval methods.
[0062] The big data retrieval method provided by the present invention first divides the query point into a first sub-vector and a second sub-vector according to its dimension; then, in the first subspace, the lower bound of the distance from the first sub-vector to all sub-cluster centers in the first subspace is calculated to form a first lower bound combination; in the second subspace, the lower bound of the distance from the second sub-vector to all sub-cluster centers in the second subspace is calculated to obtain a second lower bound combination; and then, based on the first lower bound combination and the second lower bound combination, a new lower bound combination is obtained in combination with a Cartesian product operation.
[0063] Sort each distance lower bound in the new lower bound combination, and record the sequence number as i, i = 1, 2, 3, ..., K ′2 ; At the beginning, i=1 is assumed, and the initial nearest neighbor candidate point is assumed to be empty, and the initial distance from the query point to the initial nearest neighbor candidate point is used as the initial condition, and the lower bound of the distance corresponding to the serial number i=1 and the initial distance are judged; if the lower bound of the distance corresponding to the serial number i=1 is not greater than the initial distance, a new nearest neighbor candidate point is determined according to the first sub-cluster and the second sub-cluster corresponding to the serial number i=1; then i=i+1 is continued, and the target distance from the query point to the new nearest neighbor candidate point is used as the new condition, and the steps are iteratively executed: the lower bound of the distance corresponding to the serial number i=i+1 and the target distance are judged and the subsequent steps, until the lower bound of the distance corresponding to any serial number is greater than the distance obtained last time, then the nearest neighbor candidate point obtained this time is used as the final nearest neighbor point.
[0064] The big data retrieval method proposed in the present invention aims to solve the problem that the traditional hyperplane boundary algorithm has a large amount of computation. It creatively proposes to combine the Cartesian product and clustering algorithms to divide the multidimensional space and the query points into two subspaces, and generate K in the two subspaces. ′ The centers of two subclusters can be taken out from each subcluster to form a complete multidimensional vector.
[0065] There are K such vectors in total ′2 If this vector is used as the cluster center, the data set corresponding to the entire multidimensional space can be divided into K ′2 The lower bound of the distance from the query point to each such cluster is exactly equal to the sum of the lower bounds of the distances of each subspace component of the cluster, because the subspaces are orthogonal.
[0066] The amount of computation required to calculate the lower bound of the distance in each of the two subspaces is O(2K ′2 )=O(K ′2 ), if K ′ =K 1 / 2, then the total number of clusters generated in the multidimensional space is K, but the computational complexity of the distance lower bound is O(K). The method proposed in the present invention calculates the distance lower bound of K clusters with O(K) complexity, which is much faster than the O(K) complexity of the traditional hyperplane boundary algorithm. 2 ), greatly improving the computational complexity of the distance lower bound. As a result, more clusters can be obtained at a lower cost, the compactness of the lower bound is improved, the efficiency of the nearest neighbor search is improved, and the computational efficiency of big data retrieval is greatly improved, so that this problem no longer becomes a factor restricting the value mining of big data, and it has high practicality. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0068] Figure 1 This is a schematic diagram of the distance structure between simple query points and data points in the traditional HB algorithm;
[0069] Figure 2 is a flow chart of a big data retrieval method according to an embodiment of the present invention;
[0070] Figure 3 It is a block diagram of a big data retrieval device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0071] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, are only part of the embodiments of the present invention, not all of the embodiments, and are not used to limit the present invention.
[0072] The inventors found that the current main body is semi-structured and unstructured big data (such as text, images, audio and video data, etc.), accounting for more than 85% of the total data volume. In order to fully explore and utilize the value of unstructured big data, it is necessary to be able to efficiently retrieve unstructured data, that is, to quickly find the desired information from massive data. This problem currently faces two severe challenges: one is massive, and the other is high dimensional. The former is easy to understand. The amount of unstructured data is already extremely large. The total amount of data created, collected or copied each year has reached the ZB level (10^21), and is still growing rapidly.
[0073] The so-called high-dimensional challenge comes from the complexity of unstructured data. Due to the complex structure of unstructured data, it is difficult to directly calculate the similarity. It is necessary to first extract feature vectors for it, and then measure the similarity of the original data based on the distance between the feature vectors. For example, given two facial images, the computer does not calculate the similarity between the two facial images based on the pixel values one by one, but first locates some typical areas, extracts features, and then compares them based on features. For example, the shape of the corners of the mouth, the distance between the eyes, the position and size of the nose, eyebrows, face shape, etc. If all the above features are very similar, there is a good reason to believe that the two images are the same face; otherwise, they are not. For the convenience of calculation, each feature here is a numerical value, and when combined together, it becomes a vector, called a feature vector. In addition to images, the retrieval of other unstructured data also adopts this idea. It is not difficult to imagine that the more features, the more accurate the results. For example, if only the mouth shape is very similar, it does not mean that it is the same face, but if the features of the facial features are very close, there is a greater probability that it is the same face. The above is just an example. The feature vector dimensions actually used are very high, generally hundreds to thousands of dimensions.
[0074] The dimension of each vector is the same. If d is used to represent the dimension of the vector, then these feature vectors can be regarded as some points in the d-dimensional space. In this way, the retrieval of unstructured data is transformed into a nearest neighbor search problem on the feature vector. Take the face-scanning entry system of the high-speed rail department as an example: the system maintains a face image set containing every citizen in the country. Before the system goes online, features are first extracted from all faces to form a set of face feature vectors. After going online, a passenger waiting to enter the station uploads his own photo by scanning his face. The system will first extract a feature vector from the photo, and then use the vector as a query request to find the vector closest to the vector in the system's feature vector set (also called the nearest neighbor, Nearest Neighbor, abbreviated as NN), and the corresponding image is the result of face recognition.
[0075] The definition of the so-called nearest neighbor search is as follows: given a data set D containing n d-dimensional feature vectors, let ‖,‖ represent the Euclidean distance between two vectors. For a d-dimensional query vector q, the nearest neighbor search refers to finding the feature vector x from D. * , so that x * =argmin x∈D ‖x,q‖.
[0076] Since a d-dimensional feature vector can be regarded as a point in a d-dimensional space, the embodiments of the present invention define "vector" and "point" as the same concept. For example, a "vector to be queried" is a "point to be queried" and a "feature vector" is a "feature point".
[0077] At present, in order to solve the problem of nearest neighbor search, a "Filter and Refine" algorithm design strategy has been proposed. This strategy divides the nearest neighbor search into two steps:
[0078] 1) In the filtering stage, a large amount of irrelevant data (i.e., points far from the query point) is quickly filtered out in some way, leaving a smaller candidate set;
[0079] 2) Refining stage: Find the true nearest neighbors from the candidate set through some more sophisticated calculations (usually more time-consuming, such as calculating the original distance).
[0080] For nearest neighbor search, the key to the above strategy is to increase the filtering ratio of irrelevant points, which should be both fast and accurate, usually achieved by constructing a tighter distance bound.
[0081] There are two types of distance bounds: lower bound (LB) and upper bound (UB), which refers to an estimated distance constructed by the algorithm to quickly evaluate the original distance between data points. The lower bound must be less than or equal to the original distance, and the upper bound must be greater than or equal to the original distance.
[0082] The distance bound works in the following way. For example, let's take the distance lower bound as an example: Suppose at some point in the search process, the best nearest neighbor that the algorithm has found for the query point q is x nn , for the next data point x i Without calculating the original distance first, if we can quickly estimate the lower bound of the distance from the query point q by some method, LB(q,x i )>||q,x nn ||, which means x i Impossible to be better than x nn is closer to q, then x i Can be safely filtered, saving an original distance calculation.
[0083] Generally speaking, a good distance boundary must meet two requirements: one is fast calculation, otherwise it is meaningless; the other is to be as close to the original distance as possible, that is, the so-called "tighter". The tighter the distance boundary, the better the filtering effect. For example: suppose there are only three data points A, B, and C in the data set. The algorithm quickly calculates that the distance boundaries from q to them are [10, 20], [15, 30], and [40, 50] respectively. Then C can be safely filtered out because its lower bound is greater than the upper bound of A and B, indicating that the actual distances of A and B to q (the query point) are closer than C. However, it is impossible to determine which of A and B is the true nearest neighbor. Although A has a smaller lower bound than B, the actual distance from q to A may be 18, and the actual distance to B may be 16.
[0084] The distance bounds constructed by another algorithm are tighter. The distance bounds from q to the three calculated by it are [17, 20], [15, 16], and [42, 44]. Obviously, we can directly determine that B is the nearest neighbor without calculating the original distance.
[0085] Based on the above principles, many algorithms that perform well in high-dimensional space have emerged. A typical example is the Hyperplane Bound (HB) algorithm. The general process of the algorithm can be combined with Figure 1 Take the simple distance structure diagram of query points and data points as an example for a better understanding:
[0086] Figure 1 In the clustering of the data set corresponding to the d-dimensional space, 5 clustering results are obtained: C, C1, C2, C3, C4 ( Figure 1 In the figure, they represent the centers of the five clusters respectively); C and other clusters form a total of four boundaries: H1, H2, H3, and H4.
[0087] Given a query point q, it can be seen that the boundaries H2 and H3 can separate q and the center of C on both sides, but H1 and H4 cannot. Therefore, H2 and H3 are the separation boundaries of q relative to C. Use HB to calculate the distance from q to H2 and H3, and take the latter as the lower bound of the distance from q to C (because the distance from q to H2 is longer than the distance from q to H3). It can be seen that the lower bound of the distance from q to H3 is less than or equal to the distance from q to all possible data points in C (such as x), which meets the lower bound condition.
[0088] The specific method of the above HB algorithm can be obtained by consulting known technologies and will not be described in detail. The advantage of the HB algorithm is that it can avoid linear scanning. It divides the entire data set into clusters and visits these clusters in order from small to large according to the lower bound of the distance. This approach allows it to encounter the nearest neighbor earlier.
[0089] However, the disadvantage of the HB algorithm is that the computation of the distance lower bound is large, which will become a major bottleneck when encountering large-scale data sets. Its complexity is O(K 2 ), because each cluster needs to calculate the lower bound, and each cluster has K-1 boundaries. Since the tighter the lower bound, the better the filtering effect, the HB algorithm needs to increase the number of clusters to obtain a tighter lower bound, so that the granularity of each cluster becomes smaller. For example, a Chinese living in Beijing wants to estimate the distance from himself to the White House. If the world is divided into countries, the best distance lower bound can only reach the east coast of the Pacific Ocean. But if the world is divided into states, you can continue east to Maryland. For another example: For a data set containing one million feature vectors, the HB algorithm divides it into 1000 clusters to achieve a good balance between filtering ratio and computational complexity. But as the amount of data increases, data sets of 1 billion scale are becoming more and more common. If the same division granularity is maintained, K=1000,000 clusters are required. At this time O(K 2 ) has a huge computational overhead, a large amount of computation, and low computational efficiency, which seriously restricts the mining of big data value.
[0090] In order to solve the problems existing in the above HB algorithm, the inventor has creatively proposed a big data retrieval method, a big data retrieval device and a readable storage medium of the present invention after extensive research and actual measurement. The technical solution proposed in the present invention is explained and illustrated in detail below.
[0091] Reference Figure 2 A flowchart of a big data retrieval method is shown, the big data retrieval method comprising:
[0092] Step 201: Divide the point to be queried into a first sub-vector and a second sub-vector according to its dimension.
[0093] The big data retrieval method proposed in the present invention is different from the traditional HB algorithm that directly calculates the lower bound of the distance between the query point and each cluster. Instead, the query point is first divided into a first sub-vector and a second sub-vector according to its dimension. Prior to this, also different from the traditional HB algorithm that directly clusters the multidimensional space, the present invention divides the multidimensional space into a first subspace and a second subspace on average. For example: if the multidimensional space is a d-dimensional space, the first subspace and the second subspace each contain d / 2 dimensions, then the data set D corresponding to the d-dimensional space will also be divided into two sub-data sets D1 and D2, each of which contains n d / 2-dimensional vectors.
[0094] After dividing the multidimensional space, cluster the sub-datasets corresponding to the first subspace to obtain multiple sub-clusters corresponding to it, each of which contains a sub-cluster center; cluster the sub-datasets corresponding to the second subspace to obtain multiple sub-clusters corresponding to it, each of which contains a sub-cluster center; where each cluster center is a d / 2-dimensional sub-vector. For example: perform clustering on each sub-dataset separately (clustering can be performed using clustering algorithms such as KMeans) to generate K ′ clusters, denoted as To distinguish clusters in d-dimensional space, these clusters are called sub-clusters, and each cluster center is a d / 2-dimensional sub-vector.
[0095] Based on the above theory, the query point q can also be divided into two sub-vectors in the same way as above: the first sub-vector q1 and the second sub-vector q2. The sub-dataset D1 corresponding to the first subspace is clustered and recorded as C1, and the sub-dataset D2 corresponding to the second subspace is clustered and recorded as C2. The first sub-vector q1 corresponds to the first subspace, and the second sub-vector q2 corresponds to the second subspace. Step 101 and this part of the multi-dimensional space division can be completed in advance as pre-processing content.
[0096] Step 202: Calculate the lower bound of the distance from the first subvector to all subcluster centers in the first subspace in the first subspace to form a first lower bound combination, and calculate the lower bound of the distance from the second subvector to all subcluster centers in the second subspace in the second subspace to obtain a second lower bound combination.
[0097] After the aforementioned preprocessing is completed, during big data retrieval, the lower bound of the distance from the first subvector q1 to all subcluster centers in the first subspace (i.e., all subcluster centers in C1) is calculated in the first subspace to form a first lower bound combination LB1, and the lower bound of the distance from the second subvector q2 to all subcluster centers in the second subspace (i.e., all subcluster centers in C2) is calculated in the second subspace to obtain a second lower bound combination LB2.
[0098] There are many ways to calculate the lower bound of the distance in this step. A better way is to use the hyperplane boundary algorithm to calculate the respective lower bounds of the distance, that is: in the first subspace, the hyperplane boundary algorithm is used to calculate the lower bound of the distance from the first subvector q1 to all subcluster centers in the first subspace, forming a first lower bound combination LB1; in the second subspace, the hyperplane boundary algorithm is used to calculate the lower bound of the distance from the second subvector q2 to all subcluster centers in the second subspace, obtaining the second lower bound combination LB2.
[0099] Step 203: Based on the first lower bound combination and the second lower bound combination, a new lower bound combination is obtained by combining a Cartesian product operation.
[0100] After obtaining the first lower bound combination LB1 and the second lower bound combination LB2, a new lower bound combination is obtained based on the two lower bound combinations and combined with the Cartesian product operation. A better method for obtaining the new lower bound combination includes:
[0101] Taking the Cartesian product of the first lower bound combination LB1 and the second lower bound combination LB2, we can get K ′2 sub-lower bound combinations, each of which includes a distance lower bound from the first lower bound combination LB1 and a distance lower bound from the second lower bound combination LB2.
[0102] Then, we can get a new distance lower bound by summing the two distance lower bounds contained in each sub-lower bound combination. Then, the new distance lower bounds corresponding to all sub-lower bound combinations form a new lower bound combination. Then, there are K distance lower bounds in the new lower bound combination. ′2 It can be recorded as LB.
[0103] Step 204: Sort each distance lower bound in the new lower bound combination, with the sequence number being i, i = 1, 2, 3, ..., K ′2 .
[0104] After obtaining the new lower bound combination LB, sort each distance lower bound in the new lower bound combination LB, and the sequence number obtained by sorting is recorded as i, i = 1, 2, 3, ..., K ′2 There are many ways to sort. Generally, each distance lower bound in the new lower bound combination LB can be sorted from small to large, and then a new lower bound combination LB[i] sorted as i can be obtained.
[0105] Step 205: With i=1, assuming that the initial nearest neighbor candidate point is empty and the initial distance from the query point to the initial nearest neighbor candidate point is used as the initial condition, the lower bound of the distance corresponding to the sequence number i=1 and the initial distance are judged.
[0106] After obtaining the new lower bound combination LB[i] ranked as i, with i=1, assuming that the initial nearest neighbor candidate point NN is empty and the initial distance NNDist from the query point q to the initial nearest neighbor candidate point NN as the initial condition, the distance lower bound corresponding to the sequence number i=1 and the initial distance NNDist are judged.
[0107] The reason why the initial nearest neighbor candidate point NN is assumed to be empty is that at the beginning, it is not certain or known where the nearest neighbor candidate point NN is. Therefore, the initial nearest neighbor candidate point NN is assumed to be empty. Since it is assumed to be empty, the initial distance NNDist from the query point q to the initial nearest neighbor candidate point NN is infinite.
[0108] Step 206: If the lower bound of the distance corresponding to the sequence number i=1 is not greater than the initial distance, a new nearest neighbor candidate point is determined according to the first sub-cluster and the second sub-cluster corresponding to the sequence number i=1.
[0109] When making a judgment, if the lower bound of the distance corresponding to the serial number i=1 is not greater than the initial distance, then a new nearest neighbor candidate point is determined based on the first subcluster and the second subcluster corresponding to the serial number i=1. From the above, it can be seen that: because the initial distance NNDist is infinite, the lower bound of the distance corresponding to the serial number i=1 is naturally not greater than the initial distance, so it is necessary to determine a new nearest neighbor candidate point based on the first subcluster and the second subcluster corresponding to the serial number i=1. In the subsequent iteration process, the lower bound of the distance corresponding to the serial number i=n may not be greater than the subsequent target distance, but it may also be greater than the subsequent target distance (the distance from the query point to the new nearest neighbor candidate point is the target distance). The situation when it is greater is described in step 208 and will not be repeated here.
[0110] A better method for determining new nearest neighbor candidate points includes:
[0111] First, according to the sequence number i=1, determine the new lower bound combination corresponding to the sequence number i=1, and the two distance lower bounds correspond to the first subcluster center in the first subspace and the second subcluster center in the second subspace; then determine the corresponding first subcluster based on the first subcluster center, and determine the corresponding second subcluster based on the second subcluster center; since each of these two subclusters contains at least one data point, extract the data points in the first subcluster and the data points in the second subcluster and take the intersection to obtain the intersection data points; finally, calculate the true distance from the query point q to each data point in the intersection data point, and select the data point with the smallest true distance as the new nearest neighbor candidate point. If the new nearest neighbor candidate point is x, then the target distance from the query point q to the new nearest neighbor candidate point x is equal to ‖q,x‖, which is definitely less than the initial distance NNDi st9 (which is infinite).
[0112] Step 207: With i=i+1 and the target distance from the query point to the new nearest neighbor candidate point as a new condition, execute the step: judging the distance lower bound and the target distance corresponding to the sequence number i=i+1.
[0113] After obtaining the new nearest neighbor candidate point x, with i=i+1 and the target distance NNDi st1 from the query point q to the new nearest neighbor candidate point x as the new condition, execute the steps: judge the lower bound of the distance corresponding to the serial number i=i+1 and the target distance NNDi st1, and execute the subsequent steps 205 to 207 according to the judgment result. This process is iteratively executed until the condition of step 208 is met and stops.
[0114] For example: with i=i+1 and the target distance NNDi st1 from the query point q to the new nearest neighbor candidate point x as the new condition, the lower bound of the distance corresponding to the serial number i=i+1 and the target distance NNDi st1 are judged, and the lower bound of the distance corresponding to the serial number i=i+1 is not greater than the target distance NNDi st1, then a new nearest neighbor candidate point x1 is determined again according to the first subcluster and the second subcluster corresponding to the serial number i=i+1, and then i=i+2 and the target distance NNDi st2 from the query point q to the latest nearest neighbor candidate point x1 are used as the new condition, and the steps are continued: the lower bound of the distance corresponding to the serial number i=1+2 and the target distance NNDi st2 are judged, and then the subsequent steps 205 to 207 are continued according to the judgment result, and this process is iteratively executed until the condition of step 208 is met and stopped.
[0115] Step 208: If the distance lower bound corresponding to sequence number i=1 is greater than the initial distance, the initial nearest neighbor candidate point is used as the final nearest neighbor point.
[0116] If the lower bound of the distance corresponding to the sequence number i=1 is greater than the initial distance in the judgment result, the initial nearest neighbor candidate point is directly used as the final nearest neighbor point. As can be seen from the previous description, since the initial distance NNDi st is infinite, the lower bound of the distance corresponding to the sequence number i=1 cannot be greater than the initial distance NNDi st. However, with i=i+1 and the target distance NNDi st1 from the query point q to the new nearest neighbor candidate point x as the new condition, the lower bound of the distance corresponding to the sequence number i=i+1 and the target distance NNDi st1 are judged, and it may be obtained that the lower bound of the distance corresponding to the sequence number i=i+1 is greater than the target distance NNDist1, then the new nearest neighbor candidate point x is used as the final nearest neighbor point, which is the final result of the big data retrieval. Naturally, it can be understood that if i=i+1 and the target distance NNDi st1 from the query point q to the new nearest neighbor candidate point x are used as new conditions, the lower bound of the distance corresponding to the serial number i=i+1 and the target distance NNDi st1 are judged, and the lower bound of the distance corresponding to the serial number i=i+1 is still not greater than the target distance NNDi st1, then a new nearest neighbor candidate point x1 is determined again according to the first sub-cluster and the second sub-cluster corresponding to the serial number i=i+1, and then i=i+2 and the target distance NNDi st2 from the query point q to the latest nearest neighbor candidate point x1 are used as new conditions, and the steps are continued: the lower bound of the distance corresponding to the serial number i=1+2 and the target distance NNDi st2 are judged, and if the result is: the lower bound of the distance corresponding to the serial number i=1+2 is greater than the target distance NNDi st2, then the new nearest neighbor candidate point x1 is used as the final nearest neighbor point. The rest of the cases are analogous and will not be described one by one.
[0117] In the big data retrieval method proposed in the present invention, the distance lower bound of K clusters can be calculated with O(K) complexity, which is much faster than the O(K) complexity of the HB algorithm. 2 ), greatly improving the lower bound computational complexity. Thus, more clusters can be obtained at a lower cost, the lower bound compactness is improved, and the nearest neighbor search efficiency is improved. The reason why the big data retrieval method proposed in the present invention generates K clusters but the lower bound computational complexity is O(K) is as follows:
[0118] Generate K in two subspaces respectively ′ Sub-clustering, Take the center of one sub-cluster from each of the two sub-clusters and Then they can be spliced into a complete d-dimensional vector. There are K such vectors in total. ′2 If this vector is used as the cluster center, the data set corresponding to the entire multidimensional space can be divided into K ′2 The lower bound of the distance from the query point to each such cluster is exactly equal to the sum of the lower bounds of the distances of each subspace component of the cluster, because the subspaces are orthogonal.
[0119] The amount of computation required to calculate the lower bound of the distance in each of the two subspaces is O(2K ′2 )=O(K ′2 ), if K ′ =K 1 / 2 , then the total number of clusters generated in the multidimensional space is K, but the computational complexity of the distance lower bound is O(K).
[0120] Based on the above-mentioned big data retrieval method, the embodiment of the present invention also proposes a big data retrieval device, referring to Figure 3 The block diagram of the big data retrieval device shown includes:
[0121] A division module 310, configured to divide the query point into a first sub-vector and a second sub-vector according to its dimension;
[0122] A lower bound combination calculation module 320 is used to calculate the lower bound of the distance from the first subvector to all subcluster centers in the first subspace in the first subspace to form a first lower bound combination, and calculate the lower bound of the distance from the second subvector to all subcluster centers in the second subspace in the second subspace to obtain a second lower bound combination;
[0123] A Cartesian operation module 330, configured to obtain a new lower bound combination based on the first lower bound combination and the second lower bound combination by performing a Cartesian product operation;
[0124] The sorting module 340 is used to sort each distance lower bound in the new lower bound combination, and the sequence number is recorded as i, i = 1, 2, 3, ..., K′2 ;
[0125] A judgment module 350 is used to judge the lower bound of the distance corresponding to the sequence number i=1 and the initial distance, with i=1 and assuming that the initial nearest neighbor candidate point is empty and the initial distance from the query point to the initial nearest neighbor candidate point as an initial condition;
[0126] A new candidate point determination module 360 is configured to determine a new nearest neighbor candidate point according to the first sub-cluster and the second sub-cluster corresponding to the sequence number i=1 if the lower bound of the distance corresponding to the sequence number i=1 is not greater than the initial distance;
[0127] The judgment module 350 is further configured to use i=i+1 and the target distance from the query point to the new nearest neighbor candidate point as a new condition to perform the steps of: judging the distance lower bound corresponding to the sequence number i=i+1 and the target distance;
[0128] The final point module 370 is configured to use the initial nearest neighbor candidate point as the final nearest neighbor point if the distance lower bound corresponding to the sequence number i=1 is greater than the initial distance.
[0129] Optionally, the lower bound calculation combination module 320 is specifically used for:
[0130] Using a hyperplane boundary algorithm in the first subspace, calculating a lower bound of the distance from the first subvector to all subcluster centers in the first subspace to form the first lower bound combination;
[0131] The hyperplane boundary algorithm is used in the second subspace to calculate a lower bound of the distance from the second subvector to all subcluster centers in the second subspace to obtain the second lower bound combination.
[0132] Optionally, the Cartesian operation module 330 is specifically used for:
[0133] Take the Cartesian product of the first lower bound combination and the second lower bound combination to obtain K ′2 sub-lower bound combinations, each of which includes a distance lower bound from the first lower bound combination and a distance lower bound from the second lower bound combination;
[0134] A new distance lower bound is obtained by summing the two distance lower bounds contained in each of the sub-lower bound combinations, and the new distance lower bounds corresponding to all sub-lower bound combinations form the new lower bound combination.
[0135] Optionally, the sorting module 340 is specifically configured to:
[0136] Each distance lower bound in the new lower bound combination is sorted in order from small to large.
[0137] Optionally, the module 360 for determining new candidate points is specifically used for:
[0138] According to the sequence number i=1, determining that in the new lower bound combination corresponding to the sequence number i=1, two distance lower bounds respectively correspond to a first sub-cluster center from the first subspace and a second sub-cluster center from the second subspace;
[0139] Determine the corresponding first sub-cluster based on the first sub-cluster center, and determine the corresponding second sub-cluster based on the second sub-cluster center;
[0140] Extracting data points in the first sub-cluster and data points in the second sub-cluster and taking their intersection to obtain intersection data points;
[0141] The true distance from the query point to each data point in the intersection data point is calculated, and the data point with the smallest true distance is selected as the new nearest neighbor candidate point.
[0142] Optionally, the big data retrieval device further includes:
[0143] A space module, used for equally dividing the multidimensional space into the first subspace and the second subspace;
[0144] A clustering module, configured to perform a clustering operation on the sub-data set corresponding to the first subspace to obtain a plurality of sub-clusters corresponding thereto, each of which includes a sub-cluster center, and to perform the clustering operation on the sub-data set corresponding to the second subspace to obtain a plurality of sub-clusters corresponding thereto, each of which includes a sub-cluster center;
[0145] If the multidimensional space is of d dimensions, the first subspace and the second subspace each have d / 2 dimensions, and each cluster center is a d / 2-dimensional subvector.
[0146] Based on the above-mentioned big data retrieval method, an embodiment of the present invention further proposes a readable storage medium on which a program is stored. When the program is executed by a processor, the steps in the big data retrieval method as described in any one of steps 101 to 108 are implemented.
[0147] In summary, the big data retrieval method proposed in the present invention first divides the query point into a first sub-vector and a second sub-vector according to its dimension; then, the lower bound of the distance from the first sub-vector to all sub-cluster centers in the first sub-space is calculated in the first sub-space to form a first lower bound combination, and the lower bound of the distance from the second sub-vector to all sub-cluster centers in the second sub-space is calculated in the second sub-space to obtain a second lower bound combination; then, based on the first lower bound combination and the second lower bound combination, a new lower bound combination is obtained in combination with a Cartesian product operation.
[0148] Sort each distance lower bound in the new lower bound combination, and record the sequence number as i, i = 1, 2, 3, ..., K ′2 ; At the beginning, i=1 is assumed, and the initial nearest neighbor candidate point is assumed to be empty, and the initial distance from the query point to the initial nearest neighbor candidate point is used as the initial condition, and the lower bound of the distance corresponding to the serial number i=1 and the initial distance are judged; if the lower bound of the distance corresponding to the serial number i=1 is not greater than the initial distance, a new nearest neighbor candidate point is determined according to the first sub-cluster and the second sub-cluster corresponding to the serial number i=1; then i=i+1 is continued, and the target distance from the query point to the new nearest neighbor candidate point is used as the new condition, and the steps are iteratively executed: the lower bound of the distance corresponding to the serial number i=i+1 and the target distance are judged and the subsequent steps, until the lower bound of the distance corresponding to any serial number is greater than the distance obtained last time, then the nearest neighbor candidate point obtained this time is used as the final nearest neighbor point.
[0149] The big data retrieval method proposed in the present invention aims to solve the problem that the traditional hyperplane boundary algorithm has a large amount of computation. It creatively proposes to combine the Cartesian product and clustering algorithms to divide the d-dimensional space and the query points into two subspaces, and generate K in the two subspaces. ′ Sub-clustering, Take the center of one sub-cluster from each of the two sub-clusters and Then they can be spliced into a complete d-dimensional vector.
[0150] There are K such vectors in total ′2 If this vector is used as the cluster center, the data set corresponding to the entire multidimensional space can be divided into K ′2 The lower bound of the distance from the query point to each such cluster is exactly equal to the sum of the lower bounds of the distances of each subspace component of the cluster, because the subspaces are orthogonal.
[0151] The amount of computation required to calculate the lower bound of the distance in each of the two subspaces is O(2K ′2 )=O(K ′2 ), if K ′ =K 1 / 2 , then the total number of clusters generated in the multidimensional space is K, but the computational complexity of the distance lower bound is O(K). The method proposed in the present invention calculates the distance lower bound of K clusters with O(K) complexity, which is much faster than the O(K) complexity of the traditional hyperplane boundary algorithm. 2 ), greatly improving the computational complexity of the distance lower bound. As a result, more clusters can be obtained at a lower cost, the compactness of the lower bound is improved, the efficiency of the nearest neighbor search is improved, and the computational efficiency of big data retrieval is greatly improved, so that this problem no longer becomes a factor restricting the value mining of big data, and it has high practicality.
[0152] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0153] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0154] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
Claims
1. A big data retrieval method, characterized in that: The big data retrieval method comprises: Divide the query point into a first sub-vector and a second sub-vector according to its dimension; Calculating in a first subspace the lower bound of the distance from the first subvector to all subcluster centers in the first subspace to form a first lower bound combination, and calculating in a second subspace the lower bound of the distance from the second subvector to all subcluster centers in the second subspace to obtain a second lower bound combination; Based on the first lower bound combination and the second lower bound combination, a new lower bound combination is obtained by combining a Cartesian product operation; Sort each distance lower bound in the new lower bound combination, and mark the sequence number as i, i = 1, 2, 3, ..., K ′2 ; With i=1, assuming that the initial nearest neighbor candidate point is empty and the initial distance from the query point to the initial nearest neighbor candidate point is used as the initial condition, the lower bound of the distance corresponding to the sequence number i=1 and the initial distance are judged; If the lower bound of the distance corresponding to the sequence number i=1 is not greater than the initial distance, a new nearest neighbor candidate point is determined according to the first sub-cluster and the second sub-cluster corresponding to the sequence number i=1; With i=i+1 and the target distance from the query point to the new nearest neighbor candidate point as a new condition, the steps are performed: judging the lower bound of the distance corresponding to the sequence number i=i+1 and the target distance; If the lower bound of the distance corresponding to the sequence number i=1 is greater than the initial distance, the initial nearest neighbor candidate point is used as the final nearest neighbor point.
2. The big data retrieval method according to claim 1, characterized in that: Calculating the lower bound of the distance from the first subvector to all subcluster centers in the first subspace in the first subspace to form a first lower bound combination, and calculating the lower bound of the distance from the second subvector to all subcluster centers in the second subspace in the second subspace to obtain a second lower bound combination, including: Using a hyperplane boundary algorithm in the first subspace, calculating a lower bound of the distance from the first subvector to all subcluster centers in the first subspace to form the first lower bound combination; The hyperplane boundary algorithm is used in the second subspace to calculate a lower bound of the distance from the second subvector to all subcluster centers in the second subspace to obtain the second lower bound combination.
3. The big data retrieval method according to claim 1, characterized in that: Based on the first lower bound combination and the second lower bound combination, a new lower bound combination is obtained by combining a Cartesian product operation, including: Take the Cartesian product of the first lower bound combination and the second lower bound combination to obtain K ′2 sub-lower bound combinations, each of which includes a distance lower bound from the first lower bound combination and a distance lower bound from the second lower bound combination; A new distance lower bound is obtained by summing the two distance lower bounds contained in each of the sub-lower bound combinations, and the new distance lower bounds corresponding to all sub-lower bound combinations form the new lower bound combination.
4. The big data retrieval method according to claim 1, characterized in that: Sort each distance lower bound in the new lower bound combination, including: Each distance lower bound in the new lower bound combination is sorted in order from small to large.
5. The big data retrieval method according to claim 1, characterized in that: Assuming that the initial nearest neighbor candidate point is empty, the initial distance from the query point to the initial nearest neighbor candidate point is infinite.
6. The big data retrieval method according to claim 1, characterized in that: Determining a new nearest neighbor candidate point according to the first sub-cluster and the second sub-cluster corresponding to the sequence number i=1 includes: According to the sequence number i=1, determining that in the new lower bound combination corresponding to the sequence number i=1, two distance lower bounds respectively correspond to a first sub-cluster center from the first subspace and a second sub-cluster center from the second subspace; Determine the corresponding first sub-cluster based on the first sub-cluster center, and determine the corresponding second sub-cluster based on the second sub-cluster center; Extracting data points in the first sub-cluster and data points in the second sub-cluster and taking their intersection to obtain intersection data points; The true distance from the query point to each data point in the intersection data point is calculated, and the data point with the smallest true distance is selected as the new nearest neighbor candidate point.
7. The big data retrieval method according to claim 6, characterized in that: If the new nearest neighbor candidate point is x and the band query point is q, then the target distance from the band query point q to the new nearest neighbor candidate point x is equal to ‖q,x‖, which is less than the initial distance.
8. The big data retrieval method according to claim 7, characterized in that: Before dividing the query point into the first sub-vector and the second sub-vector according to its dimension, the following is also included: Divide the multidimensional space into the first subspace and the second subspace equally; Performing a clustering operation on the sub-data set corresponding to the first subspace to obtain a plurality of corresponding sub-clusters, each of which includes a sub-cluster center; Performing the clustering operation on the sub-data set corresponding to the second subspace to obtain a plurality of sub-clusters corresponding thereto, each sub-cluster including a sub-cluster center; If the multidimensional space is of d dimensions, the first subspace and the second subspace each have d / 2 dimensions, and each cluster center is a d / 2-dimensional subvector.
9. A big data retrieval device, characterized in that: The big data retrieval device comprises: A division module, used for dividing the query point into a first sub-vector and a second sub-vector according to its dimension; a lower bound combination calculation module, configured to calculate in a first subspace a lower bound of the distance from the first subvector to all subcluster centers in the first subspace to form a first lower bound combination, and to calculate in a second subspace a lower bound of the distance from the second subvector to all subcluster centers in the second subspace to obtain a second lower bound combination; A Cartesian operation module, configured to obtain a new lower bound combination based on the first lower bound combination and the second lower bound combination by performing a Cartesian product operation; A sorting module is used to sort each distance lower bound in the new lower bound combination, and the sequence number is recorded as i, i = 1, 2, 3, ..., K ′2 ; A judgment module, used to judge the lower bound of the distance corresponding to the sequence number i=1 and the initial distance with i=1 and assuming that the initial nearest neighbor candidate point is empty and the initial distance from the query point to the initial nearest neighbor candidate point as an initial condition; A module for determining a new candidate point is used to determine a new nearest neighbor candidate point according to the first sub-cluster and the second sub-cluster corresponding to the sequence number i=1 if the lower bound of the distance corresponding to the sequence number i=1 is not greater than the initial distance; The judgment module is further used to take i=i+1 and the target distance from the query point to the new nearest neighbor candidate point as a new condition, and execute the steps of: judging the distance lower bound corresponding to the sequence number i=i+1 and the target distance; The final point module is used to use the initial nearest neighbor candidate point as the final nearest neighbor point if the distance lower bound corresponding to the sequence number i=1 is greater than the initial distance.
10. A readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the steps in the big data retrieval method as described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Image retrieval method and server
CN106886553A
Three-party strong non-locality non-extensible orthogonal base group construction method, information security transmission method and device
CN114362943A
Internet of Things data processing method and device, equipment and medium
CN115357609A
Product quantization-based approximate nearest neighbor search method
CN116069829A
Similar data searching method and system and electronic equipment
CN116610840A
