High-dimensional data search method and device, storage medium, and electronic device

By determining the initial value in high-dimensional data search and adopting alternating iteration strategies, the problems of low accuracy and high calculation cost in the existing technology are solved, and efficient and stable top-k element search is achieved, which is suitable for all data in a low rank representation.

CN117407419BActive Publication Date: 2024-11-01PEKING UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311160042.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-08
Publication Date
2024-11-01
Estimated Expiration
2043-09-08

AI Technical Summary

Technical Problem

The top-k element search method for existing high-dimensional data has insufficient calculation cost and accuracy. The sampling method has low accuracy and unstable accuracy, and the eigenvalue method has high calculation cost and is sensitive to hyperparameters, making it difficult to ensure in practical applications. Convergence and accuracy.

Method used

By determining the initial value in the search space, finding the single-dimensional maximum value of a single dimension based on the initial value, and updating the initial value in each iteration, using alternating iteration strategies and block alternating iteration methods, reducing dependence on hyperparameters and improving search Efficiency and accuracy.

Benefits of technology

It improves the accuracy and stability of high-dimensional data search, reduces calculation costs, adapts to various low-rank representations, reduces dependence on hyperparameters, and improves search efficiency and convergence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117407419B_ABST
    Figure CN117407419B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for searching high-dimensional data, a storage medium, and an electronic device. The method includes: determining an initial value in a search space, wherein the initial value includes an initial position value and an initial element value, the initial position value is composed of N vectors, each vector length is the dimension size of the corresponding order of the high-dimensional array, and N is a positive integer greater than 2; searching for the single-dimensional maximum value of the search space in a single dimension and the array position of the single-dimensional maximum value based on the initial value; outputting the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle. Through the present invention, the technical problem of low accuracy in searching for high-dimensional maximum elements in the search space in the related art is solved, and it can be adapted to data in various low-rank representation forms, with high versatility, and convergence is guaranteed by the strategy of alternating iterations, and the dependence on hyperparameters is reduced, whether it is artificial data or real data, and the accuracy and stability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of databases, and in particular to a method and device for searching high-dimensional data, a storage medium, and an electronic device. Background Art

[0002] In related technologies, the task of searching for top-k elements of high-dimensional data refers to finding the top k largest elements and their corresponding positions of the tensor corresponding to the high-dimensional data with a certain low-rank representation. It is one of the most basic tasks in many application fields such as recommendation systems, network communications, quantum computing, etc. A direct method is to explicitly restore the data through the low-rank representation of the tensor corresponding to the high-dimensional data, and then find the top k largest elements and their corresponding positions from it, but the computational and memory costs of this method are extremely high and are basically not feasible in practical applications. An effective way to reduce costs is to find the top-k elements through the low-rank representation of the tensor corresponding to the high-dimensional data.

[0003] In the related art, the search methods can be mainly divided into two categories: 1) sampling method; 2) eigenvalue method. The sampling method is a random algorithm that obtains samples by decomposing factor information. The correlation between the decomposition factor and the element size in high-dimensional data is affected by many factors, such as the decomposition format, the size of the rank, and the data set. It is difficult to obtain good samples only from the decomposition factor information. Therefore, the sampling method is generally low in accuracy and unstable in practical applications. The eigenvalue method is proposed based on the equivalent model corresponding to the top-k element search task. It does not have model error, so it can achieve higher accuracy than the sampling method. However, there are still some problems with the existing eigenvalue method. For example, the power iteration method can only be used to find the largest element, and its corresponding position needs to be further processed. In addition, since the recompression operation needs to be introduced during the iteration process to control the excessive growth of the rank of the eigenvector, the power iteration method has a high computational cost. The existing optimization method is too sensitive to hyperparameters such as step size and translation parameters. For different data sets, it is necessary to carefully select appropriate hyperparameters, so in practical applications, convergence and accuracy are often not guaranteed.

[0004] With respect to the above-mentioned problems existing in the related technologies, no effective solutions have been found so far. Summary of the invention

[0005] The embodiments of the present invention provide a method and device for searching high-dimensional data, a storage medium, and an electronic device.

[0006] According to one aspect of an embodiment of the present application, a method for searching high-dimensional data is provided, comprising: determining an initial value in a search space, wherein the initial value comprises an initial position value and an initial element value, the initial position value being composed of N vectors, each vector length being the dimension size of the corresponding order of the high-dimensional array, and N being a positive integer greater than 2; searching for a single-dimensional maximum value of the search space in a single dimension and the array position of the single-dimensional maximum value based on the initial value; and outputting the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle.

[0007] Further, searching for the single-dimensional maximum value of the search space in a single dimension based on the initial value includes: constructing N first-order intermediate tensors based on the position of the initial value; searching for the maximum values ​​of the N first-order intermediate tensors in the search space respectively to obtain N maximum values ​​in corresponding dimensions; and selecting the maximum value among the N maximum values ​​in corresponding dimensions as the single-dimensional maximum value.

[0008] Further, if N=3, constructing N first-order intermediate tensors based on the position of the initial value includes: determining the position A[i0,j0,k0] of the initial value in the [i,j,k] dimension; constructing the following three first-order intermediate tensors: A[:,j0,k0], A[i0,:,k0], A[i0,j0,:].

[0009] Further, searching for the single-dimensional maximum value of the search space in a single dimension based on the initial value includes: obtaining a preconfigured block parameter b; constructing (N-1)b first-order intermediate tensors based on the position of the initial value; searching for the maximum values ​​of the (N-1)b intermediate tensors in the search space respectively to obtain (N-1)b maximum values ​​in corresponding dimensions; selecting the maximum value among the (N-1)b maximum values ​​of corresponding dimensions as the intermediate maximum value, and determining the maximum intermediate tensor corresponding to the intermediate maximum value; searching for the first b single-dimensional maximum values ​​of the maximum intermediate tensor in the search space.

[0010] Further, if N=3, b=2, constructing (N-1)b first-order intermediate tensors based on the position of the initial value includes: determining the position of the initial value in the [i,j,k] dimension, A[i0,j0,k0], A[i1,j0,k0]; constructing the following 4 first-order intermediate tensors: A[i0,:,k0], A[i1,:,k0], A[i0,j0,:], A[i1,j0,:].

[0011] Furthermore, before searching for the first b single-dimensional maximum values ​​of the maximum intermediate tensor in the search space, the method further includes: updating the first dimension index by using the tensor value of the initial value in the first dimension.

[0012] Further, after outputting the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle, the method also includes: using the element position and element value of the maximum element to update the initial value of the next iteration cycle, and continuing to search for the current maximum element in the search space until a preset convergence condition is met.

[0013] According to another aspect of an embodiment of the present application, a high-dimensional data search device is also provided, including: a determination module, used to determine an initial value in a search space, wherein the initial value includes an initial position value and an initial element value, and the initial position value is composed of N vectors, each vector length is the dimension size of the corresponding order of the high-dimensional array, and N is a positive integer greater than 2; a search module, used to search for a single-dimensional maximum value of the search space in a single dimension and the array position of the single-dimensional maximum value based on the initial value; an output module, used to output the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle.

[0014] Furthermore, the search module includes: a first construction unit, used to construct N first-order intermediate tensors based on the position of the initial value; a first search unit, used to search for the maximum values ​​of the N first-order intermediate tensors in the search space respectively to obtain N maximum values ​​in corresponding dimensions; a first selection unit, used to select the maximum value among the N maximum values ​​in corresponding dimensions as a single-dimensional maximum value.

[0015] Further, if N=3, the first construction unit includes: a determination subunit, used to determine the position A[i0,j0,k0] of the initial value in the [i,j,k] dimension; a construction subunit, used to construct the following three first-order intermediate tensors: A[:,j0,k0], A[i0,:,k0], A[i0,j0,:].

[0016] Furthermore, the search module includes: an acquisition unit, used to acquire a preconfigured block parameter b; a second construction unit, used to construct (N-1)b first-order intermediate tensors based on the position of the initial value; a second search unit, used to search for the maximum values ​​of the (N-1)b intermediate tensors in the search space respectively, and obtain (N-1)b maximum values ​​in corresponding dimensions; a second selection unit, used to select the maximum value among the (N-1)b maximum values ​​of corresponding dimensions as the intermediate maximum value, and determine the maximum intermediate tensor corresponding to the intermediate maximum value; a third search unit, used to search for the first b single-dimensional maximum values ​​of the maximum intermediate tensor in the search space.

[0017] Further, if N=3, b=2, the second construction unit includes: a determination subunit, used to determine the position of the initial value in the [i,j,k] dimension, A[i0,j0,k0], A[i1,j0,k0]; a construction subunit, used to construct the following 4 first-order intermediate tensors: A[i0,:,k0], A[i1,:,k0], A[i0,j0,:], A[i1,j0,:].

[0018] Furthermore, the search module also includes: an updating unit, which is used to update the first dimension index using the tensor value of the first dimension of the initial value before the third search unit searches for the first b single-dimensional maximum values ​​of the maximum intermediate tensor in the search space.

[0019] Furthermore, the device also includes: an updating module, which is used to update the initial value of the next iteration cycle using the element position and element value of the maximum element after the output module outputs the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle, and continue to search for the current maximum element in the search space until a preset convergence condition is met.

[0020] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and the above steps are executed when the program is run.

[0021] According to another aspect of an embodiment of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the program stored in the memory.

[0022] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps in the above method.

[0023] Through the present invention, an initial value in the search space is determined, wherein the order of the initial value is N, each order corresponds to a dimension of a high-dimensional array in the search space, and N is a positive integer greater than 2. The single-dimensional maximum value of the search space in a single dimension and the array position of the single-dimensional maximum value are searched based on the initial value, and the single-dimensional maximum value and the array position are output as the current maximum element of the search space in the current iteration cycle. By searching the single-dimensional maximum value of the search space in a single dimension, only a small number of vectors need to be accurately searched during each iteration process, thereby improving the search efficiency and solving the technical problem of low accuracy in searching for high-dimensional maximum elements in the search space in the related art. The present invention can be adapted to data in various low-rank representation forms, has high versatility, ensures convergence through an alternating iteration strategy, and reduces dependence on hyperparameters, thereby improving accuracy and stability for both artificial data and real data. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0025] Figure 1 is a hardware structure block diagram of a computer according to an embodiment of the present invention;

[0026] Figure 2 is a flow chart of a method for searching high-dimensional data according to an embodiment of the present invention;

[0027] Figure 3 It is a flow chart of searching for a single-dimensional maximum value of a search space in a single dimension based on an initial value according to an embodiment of the present invention;

[0028] Figure 4 It is another method of searching for the maximum value of a single dimension in a single dimension of a search space based on an initial value in an embodiment of the present invention;

[0029] Figure 5 It is a structural block diagram of a high-dimensional data search device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] Example 1

[0033] The method embodiment provided in the first embodiment of the present application can be executed in a server, a computer, a database, or a similar computing device. Taking running on a computer as an example, Figure 1 is a hardware structure block diagram of a computer according to an embodiment of the present invention. Figure 1 As shown, the computer 10 may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0034] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a method for searching high-dimensional data in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the computer program corresponding to a method for searching high-dimensional data in an embodiment of the present invention, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory, for storing a database, the database including high-dimensional data in the search space, and storing the search results of each iteration cycle and the final search results. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0035] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly, and is used to transmit a search instruction for high-dimensional data from the human-computer interaction device to the processor 102, and to transmit the search result from the processor 102 to the display device.

[0036] In this embodiment, a method for searching high-dimensional data is provided. Figure 2 is a flow chart of a method for searching high-dimensional data according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0037] Step S202, determining an initial value in the search space, wherein the initial value includes an initial position value and an initial element value, the initial position value is composed of N vectors, each vector length is the dimension size of the corresponding order of the high-dimensional array, and N is a positive integer greater than 2;

[0038] Before the first iteration, it is also necessary to construct a tensor corresponding to the high-dimensional data and perform preprocessing so that the tensor satisfies the non-negative property. The initial value selected in the first iteration can be a random value selected from the search space. Optionally, the high-dimensional data in the search space in this embodiment can be an artificial data set and a real data set. Artificial data sets include random high-dimensional data generated by Gaussian distribution and high-dimensional data generated by multivariate functions; real data sets include bookmark data (Book), movie tag data (MovieLens Tag), handwritten digit set (Mnist), fluid simulation data (Cavity), etc.

[0039] Taking the movie label data in the recommendation system as an example, the search space is all the elements to be recommended. The search space includes multiple movies, and each movie includes rating data in three dimensions, namely: 1. Director, editing, and photography; 2. Plot and performance; 3. Sound and visual art, forming a three-order tensor. Each dimension corresponds to a score of a single dimension and a total score. For example, the scores of the three dimensions are 5, 6, and 5 respectively, and the three-dimensional array is [5,6,5], with a total score of 16 points. The maximum element is the element with the highest recommendation degree (highest total score).

[0040] Step S204, searching for a single-dimensional maximum value in a single dimension of the search space and an array position of the single-dimensional maximum value based on the initial value;

[0041] In this embodiment, the single-dimensional maximum value is the maximum value in the set of one-dimensional maximum values ​​in all one-dimensional arrays of the high-dimensional array. Continuing with the above example, if the maximum scores of dimension 1, dimension 2, and dimension 3 are [8, 4, 2], [7, 6, 8], and [7, 5, 9] respectively, then the single-dimensional maximum value is [7, 5, 9], which is the same as the maximum value of dimension 3.

[0042] Optionally, the number of maximum values ​​may be determined according to the size of the search space in each round of iteration, and may be one or more.

[0043] Step S206, outputting the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle;

[0044] In this embodiment, after outputting the single-dimensional maximum value and array position as the current maximum element of the search space in the current iteration cycle, it also includes: using the element position and element value of the maximum element to update the initial value of the next iteration cycle, and continuing to search for the current maximum element in the search space until the preset convergence condition is met.

[0045] In the process of repeated iterations, the result of the previous iteration is used as the initial value (position, initial value) of the current iteration cycle. Optionally, the preset convergence condition can be that the number of iteration steps reaches the preset number of steps, or that the maximum value found in the current iteration cycle is less than or equal to the maximum value found in the previous iteration cycle. When the maximum value is not updated, it is considered to be converged and no longer updated.

[0046] The task of searching for the top-k elements of high-dimensional data is a discrete optimization problem, which is solved by designing an effective algorithm for searching for the maximum element of high-dimensional data. In order to solve the problem of searching for the maximum element of high-dimensional data, this embodiment is based on the idea of ​​the eigenvalue method, and further combines the rank-one structure of the eigenvector to establish an equivalent general continuous optimization model, using the search result obtained in the previous cycle iteration as the initial value of the next iteration cycle for continuous search and optimization until the maximum element in the search space is found. Therefore, the task of searching for the maximum element of high-dimensional data can be considered from the perspective of continuous optimization. The optimization model established in this embodiment has good universality and can be adapted to various low-rank representations such as CP, Tucker, Tensor-Train (TT), Tensor Ring (TR), etc.

[0047] Through the above steps, the initial value in the search space is determined, wherein the order of the initial value is N, each order corresponds to a dimension of the high-dimensional array in the search space, and N is a positive integer greater than 2. Based on the initial value, the single-dimensional maximum value of the search space in a single dimension and the array position of the single-dimensional maximum value are searched, and the single-dimensional maximum value and the array position are output as the current maximum element of the search space in the current iteration cycle. By searching the single-dimensional maximum value of the search space in a single dimension, only a small number of vectors need to be accurately searched in each iteration process, which improves the search efficiency and solves the technical problem of low accuracy in searching for high-dimensional maximum elements in the search space in related technologies. The method can be adapted to data in various low-rank representation forms, has high versatility, ensures convergence through an alternating iteration strategy, and reduces dependence on hyperparameters, improving accuracy and stability for both artificial data and real data.

[0048] The solution of this embodiment can be applied in the fields of recommendation systems, network communications, quantum computing, etc., and data search tasks are basic tasks in the fields of recommendation systems, network communications, quantum computing, etc. For example, movie rating data is usually represented as high-dimensional data, and its missing values ​​can generally be filled by tensor completion technology. The filled high-dimensional data is stored in a certain tensor low-rank representation, and the recommendation system determines the highest-rated movies by finding the first k largest elements in the high-dimensional data and their corresponding positions; quantum circuit simulation is one of the most important tasks in quantum computing. In the simulation process, quantum states are usually represented by tensor networks, and actual quantum algorithms such as Grover's algorithm only care about the ground state corresponding to the first k largest amplitudes of the quantum state, which is also equivalent to finding the first k largest elements of the tensor corresponding to the quantum state and their corresponding positions (equivalent to the ground state).

[0049] Figure 3 1 is a flowchart of searching for a single-dimensional maximum value of a search space in a single dimension based on an initial value according to an embodiment of the present invention. In one implementation of the present embodiment, searching for a single-dimensional maximum value of a search space in a single dimension based on an initial value includes:

[0050] S11, construct N first-order intermediate tensors based on the positions of the initial values;

[0051] In one example, if N=3, constructing N first-order intermediate tensors based on the position of the initial value includes: determining the position A[i0,j0,k0] of the initial value in the [i,j,k] dimension; constructing the following three first-order intermediate tensors: A[:,j0,k0], A[i0,:,k0], A[i0,j0,:].

[0052] In another example, if N=5, corresponding to the [i,j,k,m,n] dimension, position A[i0,j0,k0,m0,n0], then 5 first-order intermediate tensors are constructed: A[:,j0,k0,m0,n0], A[i0,:,k0,m0,n0], A[i0,j0,:,m0,n0], A[i0,j0,k0,:,n0], A[i0,j0,k0,m0,:].

[0053] S12, respectively searching for the maximum values ​​of N intermediate tensors in the search space, and obtaining N maximum values ​​in corresponding dimensions;

[0054] S13, selecting a maximum value from the N maximum values ​​in the corresponding dimension as the single-dimensional maximum value.

[0055] In order to ensure the convergence of the alternating algorithm, this implementation introduces a non-sequential strategy. It does not set a specific search order and search path. The dimension of the intermediate tensor with the largest value among the N first-order intermediate tensors is used as the search dimension, that is, the maximum block growth strategy. Each time, the variable that brings the greatest benefit is selected for update, that is, the variable update makes the objective function value increase the largest, while other variables remain unchanged. The introduction of this strategy can theoretically guarantee the convergence of the alternating iterative method.

[0056] In an implementation scenario, taking three-dimensional data A as an example, assuming that the initial point position is A[i0,j0,k0], the specific algorithm process is as follows:

[0057] Find the maximum values ​​of vectors A[:,j0,k0], A[i0,:,k0], A[i0,j0,:] and their corresponding positions, namely A[i1,j0,k0], A[i0,j1,k0], A[i0,j0,k1];

[0058] Find the maximum value among these three values, such as A[i0,j1,k0], and only update the corresponding dimension position, that is, the second dimension, which can solve the convergence problem of the naive alternating iterative algorithm;

[0059] Update the elements and their corresponding position indices, i.e. A[i0,j1,k0]; the task is to find the maximum element and its corresponding position. If a larger element is found during the iteration, it is naturally necessary to update it, that is, to update the previous value with the maximum value found.

[0060] Repeat the above process until the preset convergence condition is met, terminate the iteration, and output the top k.

[0061] Figure 4 It is another embodiment of the present invention to find the single-dimensional maximum value of the search space in a single dimension based on the initial value. In another implementation of this embodiment, finding the single-dimensional maximum value of the search space in a single dimension based on the initial value includes:

[0062] S21, obtaining a pre-configured block parameter b;

[0063] S22, construct (N-1)b first-order intermediate tensors based on the positions of the initial values;

[0064] In one example, if N=3, b=2, constructing (N-1)b first-order intermediate tensors based on the position of the initial value includes: determining the position of the initial value in the [i,j,k] dimension, A[i0,j0,k0], A[i 1,j0,k0]; constructing the following 4 first-order intermediate tensors: A[i0,:,k0], A[i1,:,k0], A[i0,j0,:], A[i1,j0,:].

[0065] S23, respectively searching for the maximum values ​​of (N-1)b intermediate tensors in the search space, and obtaining (N-1)b maximum values ​​in corresponding dimensions;

[0066] S24, selecting a maximum value among the maximum values ​​of (N-1)b corresponding dimensions as an intermediate maximum value, and determining a maximum intermediate tensor corresponding to the intermediate maximum value;

[0067] Optionally, before searching for the first b single-dimensional maximum values ​​of the maximum intermediate tensor in the search space, the method further includes: updating the first dimension index by using the tensor value of the first dimension with the initial value.

[0068] Taking a third-order tensor as an example, any element in the third-order tensor can be represented as A(i,j,k), and the first dimension is the i index, which is the first index of the location of the element A(i,j,k). By updating, the search space can be prevented from exploding.

[0069] S25, find the first b single-dimensional maximum values ​​of the largest intermediate tensor in the search space.

[0070] This embodiment proposes a block search strategy, namely, a block alternating iteration method, which can further improve the accuracy of the alternating iteration method. Compared with the alternating iteration method of the above embodiment, the block alternating iteration method retains the first b largest elements each time it is updated, and its search space is expanded from N to (N-1)b, so the accuracy of this method is significantly improved.

[0071] In an implementation scenario, assuming that the block parameter is 2 and the positions are A[i0,j0,k0], A[i1,j0,k0], the specific algorithm flow is as follows:

[0072] Find the maximum values ​​of vectors A[i0,:,k0], A[i1,:,k0], A[i0,j0,:], A[i1,j0,:] and their corresponding positions, namely A[i0,j1,k0], A[i1,j2,k0], A[i0,j0,k1], A[i1,j0,k2];

[0073] Find the maximum value among these four values, such as A[i0,j0,k1], and update the first dimension index, i=i0;

[0074] Find the first two maximum values ​​of the vector A[i0,j0,:] and their corresponding position indices, such as A[i0,j0,k1], A[i0,j0,k2];

[0075] Use the result of the current iteration as the initial value of the next iteration, continue iterating, and repeat the above process. When the maximum value is not updated, it is determined that the convergence condition is met, stop updating, and output the top k (the largest k values).

[0076] This implementation achieves the purpose of improving the accuracy by expanding the search space. The search space in one round of iteration of the block alternating iterative algorithm is (N-1)b, so it is more likely to find the maximum element and the accuracy is higher.

[0077] Here, high-dimensional data generated by multivariate functions is taken as an example to illustrate the efficiency of the high-dimensional data search algorithm of this embodiment, and the computational efficiency of the existing power iteration method and optimization method is compared by high-dimensional data generated by two multivariate functions (the data scale is 4096 to the power of 10), including convergence and computational time. Table 1 shows the computational efficiency performance of each algorithm on high-dimensional data generated by multivariate functions.

[0078] Table 1

[0079]

[0080]

[0081] In the process of searching for high-dimensional data, the iteration termination criterion is that the difference between the loss functions of adjacent iteration steps is less than 10 to the power of -12, and the maximum allowed number of iteration steps is set to 1000. As can be seen from Table 1, the method proposed in the present invention has obvious advantages in convergence compared with the existing power iteration and optimization methods, and the single-step iteration calculation efficiency is improved by 62.95 to 179.24 and 3.92 to 8.57 times respectively. In addition, compared with the existing optimization method, the method proposed in the present invention is more accurate in the maximum value search task.

[0082] Here, we continue to use random high-dimensional data generated by Gaussian distribution and real high-dimensional data as examples to illustrate the efficiency of the high-dimensional data search algorithm of this embodiment. This embodiment compares the accuracy and stability performance of the existing optimization method in the top-k search task through random high-dimensional data generated by Gaussian distribution and real high-dimensional data. Table 2 shows the accuracy and stability performance of each algorithm on real high-dimensional data.

[0083] Table 2

[0084]

[0085]

[0086]

[0087] Compared with the existing optimization method, the method proposed in this embodiment has a significantly improved accuracy in the maximum element search task of random high-dimensional data, and the variance is also smaller, indicating that it is more stable. As can be seen from Table 2, compared with the existing optimization method, the method proposed in this embodiment has a significantly improved accuracy in the top-5, -10, and -15 element search tasks of different real high-dimensional data, and its variance is smaller, which also indicates its stability.

[0088] By using the alternating iteration method of the present embodiment, only a small number of vectors need to be accurately searched in each iteration process. It can be seen from the results of Tables 1 and 2 above that, compared with the existing power iteration method, the computational efficiency of the method of the present embodiment is improved by nearly 100 times, the accuracy is high and the stability is good, the convergence is guaranteed, and the dependence on hyperparameters is reduced. Compared with the existing sampling method and optimization method, the accuracy of this method is significantly improved, whether it is artificial data or real data, and it is more stable.

[0089] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the relevant technology, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0090] Example 2

[0091] In the present embodiment, a high-dimensional data search device is also provided to implement the above-mentioned embodiments and preferred implementation modes, which have been described and will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0092] Figure 5 is a structural block diagram of a high-dimensional data search device according to an embodiment of the present invention. Figure 5 As shown, the device comprises:

[0093] A determination module 50 is used to determine an initial value in the search space, wherein the initial value includes an initial position value and an initial element value, the initial position value is composed of N vectors, each vector length is the dimension size of the corresponding order of the high-dimensional array, and N is a positive integer greater than 2;

[0094] A search module 52, configured to search for a single-dimensional maximum value of the search space in a single dimension and an array position of the single-dimensional maximum value based on the initial value;

[0095] The output module 54 is used to output the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle.

[0096] Optionally, the search module includes: a first construction unit, used to construct N first-order intermediate tensors based on the position of the initial value; a first search unit, used to search for the maximum values ​​of the N first-order intermediate tensors in the search space respectively to obtain N maximum values ​​in corresponding dimensions; and a first selection unit, used to select the maximum value among the N maximum values ​​in corresponding dimensions as a single-dimensional maximum value.

[0097] Optionally, if N=3, the first construction unit includes: a determination subunit, used to determine the position A[i0,j0,k0] of the initial value in the [i,j,k] dimension; a construction subunit, used to construct the following three first-order intermediate tensors: A[:,j0,k0], A[i0,:,k0], A[i0,j0,:].

[0098] Optionally, the search module includes: an acquisition unit, used to acquire a preconfigured block parameter b; a second construction unit, used to construct (N-1)b first-order intermediate tensors based on the position of the initial value; a second search unit, used to search for the maximum values ​​of the (N-1)b intermediate tensors in the search space respectively, and obtain (N-1)b maximum values ​​in corresponding dimensions; a second selection unit, used to select the maximum value among the (N-1)b maximum values ​​of corresponding dimensions as the intermediate maximum value, and determine the maximum intermediate tensor corresponding to the intermediate maximum value; a third search unit, used to search for the first b single-dimensional maxima of the maximum intermediate tensor in the search space.

[0099] Optionally, if N=3, b=2, the second construction unit includes: a determination subunit, used to determine the position of the initial value in the [i,j,k] dimension, A[i0,j0,k0], A[i1,j0,k0]; a construction subunit, used to construct the following 4 first-order intermediate tensors: A[i0,:,k0], A[i1,:,k0], A[i0,j0,:], A[i1,j0,:].

[0100] Optionally, the search module also includes: an updating unit, used to update the first dimension index using the tensor value of the initial value in the first dimension before the third search unit searches for the first b single-dimensional maximum values ​​of the maximum intermediate tensor in the search space.

[0101] Optionally, the device also includes: an updating module, which is used to update the initial value of the next iteration cycle using the element position and element value of the maximum element after the output module outputs the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle, and continue to search for the current maximum element in the search space until a preset convergence condition is met.

[0102] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0103] Example 3

[0104] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0105] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0106] S1, determining an initial value in the search space, wherein the initial value includes an initial position value and an initial element value, the initial position value is composed of N vectors, each vector length is the dimension size of the corresponding order of the high-dimensional array, and N is a positive integer greater than 2;

[0107] S2, searching for a single-dimensional maximum value of the search space in a single dimension and an array position of the single-dimensional maximum value based on the initial value;

[0108] S3, outputting the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle.

[0109] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0110] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0111] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0112] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0113] S1, determining an initial value in the search space, wherein the initial value includes an initial position value and an initial element value, the initial position value is composed of N vectors, each vector length is the dimension size of the corresponding order of the high-dimensional array, and N is a positive integer greater than 2;

[0114] S2, searching for a single-dimensional maximum value of the search space in a single dimension and an array position of the single-dimensional maximum value based on the initial value;

[0115] S3, outputting the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle.

[0116] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0117] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0118] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0119] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0120] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0121] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0122] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.

[0123] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for searching high-dimensional data, characterized in that: include: Determine an initial value in the search space, wherein the initial value includes an initial position value and an initial element value, the initial position value is composed of N vectors, each vector length is the dimension size of the corresponding order of the high-dimensional array, and N is a positive integer greater than 2; Finding the single-dimensional maximum value of the search space in a single dimension and the array position of the single-dimensional maximum value based on the initial value; Outputting the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle; Wherein, searching for the single-dimensional maximum value of the search space in a single dimension based on the initial value comprises: Constructing N first-order intermediate tensors based on the positions of the initial values; Searching for the maximum values ​​of the N first-order intermediate tensors in the search space respectively, and obtaining N maximum values ​​in corresponding dimensions; Selecting a maximum value among the N maximum values ​​in the corresponding dimension as a single-dimensional maximum value; Wherein, if N=3, the step of constructing N first-order intermediate tensors based on the position of the initial value includes: Determine the position A[i0,j0,k0] of the initial value in the [i,j,k] dimension; Construct the following three first-order intermediate tensors: A[:,j0,k0], A[i0,:,k0], A[i0,j0,:].

2. The method according to claim 1, characterized in that Finding the single-dimensional maximum value of the search space in a single dimension based on the initial value includes: Get the preconfigured block parameter b; Constructing (N-1)b first-order intermediate tensors based on the positions of the initial values; Searching for the maximum values ​​of the (N-1)b intermediate tensors in the search space respectively, and obtaining the (N-1)b maximum values ​​in the corresponding dimensions; Selecting a maximum value among the maximum values ​​of the (N-1)b corresponding dimensions as an intermediate maximum value, and determining a maximum intermediate tensor corresponding to the intermediate maximum value; Find the first b single-dimensional maximum values ​​of the maximum intermediate tensor in the search space; Wherein, if N=3, b=2, constructing (N-1)b first-order intermediate tensors based on the position of the initial value includes: Determine the position of the initial value in the [i,j,k] dimension, A[i0,j0,k0], A[i 1,j0,k0]; Construct the following four first-order intermediate tensors: A[i0,:,k0], A[i 1,:,k0], A[i0,j0,:], A[i 1,j0,:].

3. The method according to claim 2, characterized in that Before searching for the first b single-dimensional maximum values ​​of the maximum intermediate tensor in the search space, the method further includes: The first dimension index is updated using the tensor value of the first dimension with the initial value.

4. The method according to claim 1, characterized in that: After outputting the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle, the method further includes: The element position and element value of the maximum element are used to update the initial value of the next iteration cycle, and the current maximum element is continuously searched in the search space until a preset convergence condition is met.

5. A high-dimensional data search device, characterized in that: include: A determination module, used to determine an initial value in the search space, wherein the initial value includes an initial position value and an initial element value, the initial position value is composed of N vectors, each vector length is the dimension size of the corresponding order of the high-dimensional array, and N is a positive integer greater than 2; A search module, used for searching the single-dimensional maximum value of the search space in a single dimension and the array position of the single-dimensional maximum value based on the initial value; An output module, used for outputting the single-dimensional maximum value and the array position as the current maximum element of the search space in the current iteration cycle; Wherein, searching for the single-dimensional maximum value of the search space in a single dimension based on the initial value comprises: Constructing N first-order intermediate tensors based on the positions of the initial values; Searching for the maximum values ​​of the N first-order intermediate tensors in the search space respectively, and obtaining N maximum values ​​in corresponding dimensions; Selecting a maximum value among the N maximum values ​​in the corresponding dimension as a single-dimensional maximum value; Wherein, if N=3, the step of constructing N first-order intermediate tensors based on the position of the initial value includes: Determine the position A[i0,j0,k0] of the initial value in the [i,j,k] dimension; Construct the following three first-order intermediate tensors: A[:,j0,k0], A[i0,:,k0], A[i0,j0,:].

6. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method steps of any one of claims 1 to 4 when running.

7. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface, and the memory communicate with each other via a communication bus; wherein: Memory, used to store computer programs; A processor, configured to execute the method steps of any one of claims 1 to 4 by running a program stored in a memory.

Citation Information

Patent Citations

  • High-dimensional data quick search method

    CN111858578A

  • Data processing method and device, electronic device and storage medium

    CN114611675A