Range determination device and range determination method
The range determination device optimizes k-nearest neighbor methods by using space-filling curves to create one-dimensional data and select the smallest candidate area as the search region, addressing increased computational complexity with higher dimensions.
Patent Information
- Application Number
- JP2024510823
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2022-03-29
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2042-03-29
AI Technical Summary
As the number of dimensions of data increases, the computational complexity in k-nearest neighbor methods using space-filling curves for range search increases, reducing the effectiveness of reducing calculation time.
A range determination device and method that utilizes one-dimensionalization through multiple space-filling curves to create candidate areas, determining a neighborhood range, and selecting the area with the smallest data amount as the search area, thereby optimizing the search process.
Maintains the effectiveness of reducing calculation time by selecting the optimal search area, even with increasing dimensions, thus enhancing computational efficiency.
Smart Images

Figure 0007806885000001 
Figure 0007806885000002 
Figure 0007806885000003
Abstract
Description
[Technical Field]
[0001] The present invention relates to a range determination apparatus and method using space-filling curves. [Background technology]
[0002] Supervised learning is one of the learning methods in machine learning. In supervised learning, the more training data there is, the more accurate the classification and prediction becomes. However, when there is a large amount of training data, implementing supervised learning on a computer using a naive implementation method increases the calculation time.
[0003] K-nearest neighbors is one of the machine learning techniques used for regression and classification. A computer that implements k-nearest neighbors plots multiple pieces of training data that have already been given to it in a vector space. From the points plotted in the vector space, i.e., the training data, the computer extracts the k nearest neighbors to the unknown data (hereafter referred to as query data). The computer calculates the average of the k nearest neighbors or takes a majority vote of the k nearest neighbors. The computer then outputs the average or majority vote result.
[0004] To determine whether each point of the training data is a neighboring point of the query data, the computer calculates the distance between all of the training data and the query data. Therefore, the amount of calculation required to determine whether the training data is a neighboring point of the query data is large.
[0005] In order to narrow the search range for determining whether a point is a neighbor, it is possible to use a range search technique. Also, the use of a space-filling curve for range search has been proposed (see, for example, Patent Document 1 and Non-Patent Document 1).
[0006] By narrowing the search range, the amount of calculation required to determine whether a point is a neighboring point is reduced. [Prior art documents] [Patent documents]
[0007] [Patent Document 1] Japanese Patent Application Laid-Open No. 2015-18497 [Non-patent literature]
[0008] [Non-Patent Document 1] Michael Connor, et al., "Fast construction of k-Nearest Neighbor Graphs for Point Clouds", IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS, September 2009 Summary of the Invention [Problem to be solved by the invention]
[0009] However, the amount of calculation increases as the number of dimensions of the training data increases. In the following specific example, the amount of calculation is exemplified as the value obtained by dividing the number of data in the search range (hereinafter also referred to as the search area) by the number of training data.
[0010] 17A to 17C are explanatory diagrams illustrating a search area. As shown in FIG. 17A, assume that there are 64 pieces of data. In FIGS. 17A to 17C, training data are indicated by black dots. As shown in FIG. 17B, when a search area is set, the number of pieces of data is 64 and the number of pieces of training data is also 64, so the amount of calculation is 64 / 64=1. In FIG. 17B, the area inside the rectangle indicated by the dashed line is the search area. The example shown in FIG. 17B is equivalent to no search range being set. In the example shown in FIG. 17C, the number of pieces of data is 32 and the number of pieces of training data is 64. Therefore, the amount of calculation is 32 / 64=0.5. In FIG. 17C, the area inside the rectangle indicated by the dashed line is the search area.
[0011] As can be seen from the above specific example, when the search area is limited, that is, when a range search technique is used, the amount of calculation is reduced.
[0012] However, the amount of calculation increases as the dimension of the data increases. Below, we will use the k-nearest neighbor method to find the nearest points of the query data as an example.
[0013] Figure 18 shows the computational complexity when using the k-nearest neighbor algorithm in a search region obtained using a space-filling curve. The number of data, dimensions, and values of the training data and query data are assumed to be the same. The number of training data and the number of query data are set to 1,000,000. The values of the training data and the query data are non-negative integers in the range [0, 1,000,000]. The training data and the query data are each uniformly distributed. A Z-curve was used as the space-filling curve.
[0014] The number of neighboring points was set to 2, and the number of dimensions of the data was set to 2, 3, 4, and 5, and computer simulations were performed.
[0015] As shown in Figure 18, when the number of dimensions of the data is 2, the amount of calculation is 0.0023. The amount of calculation is about 1 / 430 of that when using a simple k-nearest neighbor method, that is, when using a k-nearest neighbor method that does not use a range search based on a space-filling curve. Therefore, the amount of calculation is sufficiently small. In other words, the calculation speed is fast. Note that the amount of calculation when using a simple k-nearest neighbor method that does not use a range search technique is 1.
[0016] However, when the number of dimensions of the data was 3, the amount of calculation was 0.028. This is about 1 / 35 of the amount of calculation compared to when using the simple k-nearest neighbor method. When the number of dimensions of the data was 4, the amount of calculation was 0.104. This is about 1 / 10 of the amount of calculation compared to when using the simple k-nearest neighbor method. When the number of dimensions of the data was 5, the amount of calculation was 0.238. This is about 1 / 4 of the amount of calculation compared to when using the simple k-nearest neighbor method.
[0017] As described above, there is a problem that as the number of dimensions of data increases, the effect of reducing the amount of calculation obtained by range search using a space-filling curve decreases.
[0018] An object of the present invention is to provide a range determination device and a range determination method that can maintain the effect of reducing the amount of calculation achieved by range search using a space-filling curve. [Means for solving the problem]
[0019] A range determination device of one embodiment of the present invention includes: one-dimensionalization means that creates multiple types of one-dimensional data from multiple pieces of multidimensional data using each of multiple space-filling curves; query data placement means that places query data on each of the multiple space-filling curves on which the one-dimensional data is placed; candidate area determination means that determines a neighborhood range of the query data on each of the multiple space-filling curves and sets areas in each of multiple multidimensional planes that correspond to the neighborhood ranges as candidate areas; and search range determination means that sets, among the multiple candidate areas, the area that includes the smallest amount of data as the search area.
[0020] A range determination method according to one embodiment of the present invention creates multiple types of one-dimensional data from multiple multidimensional data using multiple space-filling curves, places query data on each of the multiple space-filling curves on which the one-dimensional data is placed, determines a neighborhood of the query data on each of the multiple space-filling curves, sets regions on each of multiple multidimensional planes corresponding to the neighborhood ranges as candidate regions, and sets the region among the multiple candidate regions that contains the smallest amount of data as a search region.
[0021] A range determination program according to one embodiment of the present invention causes a computer to create multiple types of one-dimensional data from multiple multidimensional data using each of multiple space-filling curves, place query data on each of the multiple space-filling curves on which the one-dimensional data is placed, determine a neighborhood of the query data on each of the multiple space-filling curves, set areas on each of multiple multidimensional planes corresponding to the neighborhood ranges as candidate areas, and set the area among the multiple candidate areas that includes the smallest amount of data as a search area. [Effects of the Invention]
[0022] According to the present invention, it is possible to maintain the effect of reducing the amount of calculation obtained by range search using a space-filling curve. [Brief explanation of the drawings]
[0023] [Figure 1] FIG. 1 is an explanatory diagram for explaining mapping from n-dimensional data to one-dimensional data using a space-filling curve. [Figure 2] FIG. 1 is an explanatory diagram for explaining mapping from n-dimensional data to one-dimensional data using a space-filling curve. [Figure 3] 1 is a block diagram showing a configuration of a range search device according to a first embodiment; [Figure 4A] FIG. 10 is an explanatory diagram for explaining a method for determining a search region using a space-filling curve. [Figure 4B] FIG. 10 is an explanatory diagram for explaining a method for determining a search region using a space-filling curve. [Figure 5A] FIG. 10 is an explanatory diagram for explaining a method for finding neighboring points using the k-nearest neighbor method. [Figure 5B] FIG. 10 is an explanatory diagram for explaining a method for finding neighboring points using the k-nearest neighbor method. [Figure 5C] FIG. 10 is an explanatory diagram for explaining a method for finding neighboring points using the k-nearest neighbor method. [Figure 6A] FIG. 10 is an explanatory diagram for explaining determination of a search range based on a space-filling curve. [Figure 6B] FIG. 10 is an explanatory diagram for explaining determination of a search range based on a space-filling curve. [Figure 6C] FIG. 10 is an explanatory diagram for explaining determination of a search range based on a space-filling curve. [Figure 7] FIG. 10 is an explanatory diagram for explaining a method for determining a search area. [Figure 8] FIG. 10 is an explanatory diagram for explaining how to determine a search range in a space-filling curve. [Figure 9] FIG. 1 is an explanatory diagram showing a search region on a two-dimensional plane corresponding to a search range in a space-filling curve. [Figure 10A]FIG. 10 is an explanatory diagram showing points included in a search area set using a space-filling curve. [Figure 10B] FIG. 10 is an explanatory diagram showing points included in a search area set using a space-filling curve. [Figure 10C] FIG. 10 is an explanatory diagram showing points included in a search area set using a space-filling curve. [Figure 11] 4 is a flowchart showing the operation of the range search device of the first embodiment. [Figure 12] An explanatory diagram showing the amount of calculation required when using the k-nearest neighbor method in a search region obtained using a space-filling curve. [Figure 13] FIG. 10 is a block diagram showing the configuration of a range search device according to a second embodiment. [Figure 14] 10 is a flowchart showing the operation of the range search device of the second embodiment. [Figure 15] FIG. 1 is a block diagram illustrating an example of a computer having a CPU. [Figure 16] FIG. 2 is a block diagram showing the main parts of a range determination device. [Figure 17A] FIG. 10 is an explanatory diagram showing an example of data arrangement. [Figure 17B] FIG. 10 is an explanatory diagram for explaining a search range. [Figure 17C] FIG. 10 is an explanatory diagram for explaining a search range. [Figure 18] FIG. 10 is an explanatory diagram showing the amount of calculation when using the k-nearest neighbor method in a search region obtained using a space-filling curve. DETAILED DESCRIPTION OF THE INVENTION
[0024] Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
[0025] In the following embodiment, two-dimensional data (x1, y1), (x2, y2),..., (x m ,y m ), for example, x l and y l(l=1 to m) are expressed as "numerical values" or "elements." Multidimensional data, i.e., n-dimensional data (n>2), is also expressed as "numerical values" or "elements." In the following explanation, n in n-dimensional data is assumed to be 2 or greater. Furthermore, training data and query data are assumed to be n-dimensional data.
[0026] Figures 1 and 2 are explanatory diagrams for explaining mapping from n-dimensional data to one-dimensional data using a space-filling curve. Figure 1 shows a Z-curve in a two-dimensional space. Figure 2 shows a Hilbert curve. Two-dimensional space is an example of an n-dimensional space. The Z-curve and the Hilbert curve are examples of space-filling curves.
[0027] In the following explanation, converting n-dimensional data into one-dimensional data is called mapping. Arranging one-dimensional data along a space-filling curve is called sorting (ordering). In other words, one-dimensional data is sorted by a space-filling curve. In the following explanation, a space-filling curve is represented as a line that bends at multiple points on a two-dimensional plane, as shown in Figures 1 and 2. However, a space-filling curve can also be represented as a single line (line segment).
[0028] Embodiment 1. Fig. 3 is a block diagram showing the configuration of the range search device of the first embodiment. The range search device 1 shown in Fig. 3 includes a numerical value replacement unit (first numerical value replacement unit) 11, a sorting unit 12, a candidate area determination unit 13, a search range determination unit 14, and a distance calculation unit 15.
[0029] The numerical value replacement unit 11, the sorting unit 12, the candidate area determination unit 13, and the search range determination unit 14 constitute a range determination unit 10.
[0030] The numerical value replacement unit 11 replaces the numerical values of the training data, i.e., the numerical values that make up the training data. The numerical value replacement unit 11 outputs information indicating which numerical values have been replaced to the sorting unit 12.
[0031] The sorting unit 12 converts the training data into one-dimensional data using a predetermined specific space-filling curve, i.e., one type of space-filling curve (for example, a Z-curve). In other words, a mapping of the training data onto a space-filling curve is obtained. There are multiple types of training data. The sorting unit 12 can use any space-filling curve, including a Z-curve or a Hilbert curve. The sorting unit 12 can sort the training data using a space-filling curve. The sorting unit 12 obtains index information of the training data before and after sorting. The sorting unit 12 executes the above process a predetermined number of times to obtain index information of the training data before and after sorting. The index information indicates the ordinal position of the data of interest in the data set.
[0032] The sorting unit 12 outputs the training data, information indicating which numerical values in the training data have been replaced, the results of mapping the training data onto the space-filling curve, and index information of the training data before and after sorting to the candidate area determination unit 13.
[0033] The candidate area determination unit 13 performs a numerical value replacement process on the input query data in the same manner as the process performed on the teacher data by the sorting unit 12. Therefore, the candidate area determination unit 13 functions as a second numerical value replacement unit.
[0034] The candidate area determination unit 13 calculates candidates (candidate areas) for the search area to be finally determined, using the information input from the sorting unit 12. The candidate area determination unit 13 executes the process of calculating candidate areas a predetermined number of times.
[0035] For example, if the training data is three-dimensional data (x, y, z), there are six possible combinations of numerical values after the replacement: (x, y, z), (x, z, y), (y, x, z), (y, z, x), (z, y, y), (z, y, x). Generally speaking, if the training data is n-dimensional data, the number of possible combinations of numerical values after the replacement is n! (the factorial of n). Therefore, the predetermined number of times can be selected to be a value equal to or less than the factorial value of the dimension.
[0036] The candidate area determination unit 13 supplies the teacher data, the query data, information indicating which numerical values have been replaced, index information of the teacher data before and after sorting, and the candidate areas to the search range determination unit 14. Note that the candidate area determination unit 13 supplies the search range determination unit 14 with the teacher data corresponding to each area, the query data, information indicating which numerical values have been replaced, and index information of the teacher data before and after sorting, along with the multiple candidate areas.
[0037] The search range determination unit 14 selects the candidate area containing the least amount of data from the multiple types of candidate areas supplied by the candidate area determination unit 13. The selected candidate area corresponds to the determined search area. In this example, the number of data corresponds to the number of training data. The search range determination unit 14 outputs to the distance calculation unit 15 the determined search area, as well as the training data corresponding to the search area, the query data, information indicating which numerical values have been swapped, and index information of the training data before and after sorting.
[0038] The distance calculation unit 15 calculates the distance in an n-dimensional plane between the query data and all data (teaching data in this embodiment) in the search area input from the search range determination unit 14. The distance calculation unit 15 selects k distances in ascending order of value. Then, the distance calculation unit 15 determines the points at which the data corresponding to the selected k distances are located as k-neighbor points.
[0039] Next, we will explain an example of how to use space-filling curves.
[0040] First, a process for mapping n-dimensional data to one-dimensional data using a space-filling curve will be described with reference to FIGS. 1 and 17A. That is, the data is assumed to be two-dimensional data. The elements (numeric values) of the two-dimensional data are assumed to be non-negative integers. In the embodiment, the data of the lattice points corresponds to the training data. In the example shown in FIG. 1, the data of the lattice points in the two-dimensional space are sorted on the space-filling curve in the order of (0,0), (1,0), (0,1), (7,7).
[0041] Mapping of n-dimensional data to one-dimensional data is done as follows:
[0042] First, the numerical value of the grid point data is expressed in binary. For example, if the numerical value of the two-dimensional data is (4,2), it is expressed in binary as (100,10). Note that if the number of bits in the binary-expressed data, i.e., the numerical value of the bit string, differs, it is unified to the number of bits with the largest number. In this example, since the number of bits in the bit string differs, as in (100,10), it is unified to 3 bits, as in (100,010).
[0043] The first bit of each value in the two-dimensional data expressed in binary, that is, each bit string, is extracted. Taking two-dimensional data (100,010) as an example, "1" is extracted for "100". "0" is extracted for "010". The two extracted values are then sorted in order. In this example, they are sorted as "10".
[0044] The same process as that for the first bit is also performed on the second and third bits of the numerical values "100" and "010" of the two-dimensional data (100,010).
[0045] That is, the second bit of "100", "0", is extracted, and the second bit of "010", "1", is extracted. Then, the extracted "0" and "1" are arranged to form "01". Also, the third bit of "100", "0", is extracted, and the third bit of "010", "0", is extracted. Then, the extracted "0" and "0" are arranged to form "00".
[0046] Furthermore, by combining the bit strings "10", "01", and "00" extracted from the first bit, second bit, and third bit, respectively, the bit string "100100" ("36" in decimal) is obtained.
[0047] By performing the above process on all of the n-dimensional data (two-dimensional data in this example), the n-dimensional data is mapped into one-dimensional data.
[0048] On the space-filling curve, the bit string "100100" corresponding to the two-dimensional data (100,010) is placed at the 36th point. By using the space-filling curve, all n-dimensional data (in this example, two-dimensional data) can be sorted. In other words, all n-dimensional data is sorted by the space-filling curve.
[0049] Next, an example of a general range determination process using a space-filling curve will be described. Figures 4A and 4B are explanatory diagrams for explaining a method of determining a search area using a space-filling curve. Reference will be made to the data arrangement example shown in Figure 17A. Also, take the rectangular area indicated by the dashed line in Figure 4A as an example. The horizontal axis in Figure 4A is the x direction, and the vertical axis is the y direction. Also, two-dimensional data is represented as (x, y). That is, the numerical values (elements) of the two-dimensional data are represented by x and y.
[0050] A simple method for determining whether data is included in the area search range illustrated in Fig. 4A is to check whether (x, y) (x: 0 to 63, y: 0 to 63) representing the data shown in Fig. 17A satisfies 2≦x≦5 and 1≦y≦3. In this method, calculations are made to determine whether the above two inequalities are satisfied for each of the 64 pieces of data.
[0051] When using a space-filling curve, the range search process is performed as follows.
[0052] First, n-dimensional data is mapped to one-dimensional data using the method described above. Next, the locations of point S (two-dimensional data value: (2,1)) with the smallest numerical value in the two-dimensional data in the area search range and point G (two-dimensional data value: (5,3)) with the largest numerical value in the two-dimensional data are determined on the space-filling curve, for example, by binary search.
[0053] Next, it is calculated whether the above two inequalities are satisfied for all points between point S and point G on the space-filling curve in a two-dimensional plane. In FIG. 4B, the arrows connecting two points indicate parts of the space-filling curve. In FIG. 4B, point S, the points at the end of each arrow, and point G correspond to points between point S and point G on the space-filling curve.
[0054] In the example shown in FIG. 4B, there are 22 points between point S and point G. Therefore, the calculation target for whether the above two inequalities are satisfied is 22 points. On the other hand, when the above simple method is used, the calculation target for whether the above two inequalities are satisfied is 64 points.
[0055] When performing a range search using a space-filling curve, the search area in a two-dimensional space is not necessarily a rectangle (see Figures 17B and 17C). This is because when a space-filling curve is used, the range is set on a one-dimensional space-filling curve, not in a two-dimensional space.
[0056] Next, a method for finding neighboring points using the k-nearest neighbor method will be described. FIGS. 5A to 5 are explanatory diagrams for explaining a method for finding neighboring points using the k-nearest neighbor method. It is assumed that seven pieces of training data exist on a two-dimensional plane as shown in FIG. 5A. It is also assumed that query data is given as shown in FIG. 5B. It is assumed that two neighboring points of the query data are to be found.
[0057] When using the naive method (a method that does not use space-filling curves), the distances between the query data and the seven training data are calculated, and the two training data with the smallest distance are determined as neighboring points (see Figure 5C).
[0058] Next, we will explain the k-nearest neighbor method, which uses a range search based on a space-filling curve. Figures 6A to 6C are explanatory diagrams for explaining how a search region is determined based on a space-filling curve. In Figures 6A to 6B, arrows indicate space-filling curves. Black circles indicate training data. Circles with black dots inside indicate query data (point P). This notation will also be used in Figure 8, which will be described later.
[0059] As shown in Figure 6A, assume that there are seven training data on a space-filling curve, and query data denoted by P is given. Let us take the example of finding two neighboring points for the query data (when k = 2). When a naive method is used, the distance between each of the seven training data and the query data is calculated.
[0060] When using the range search method, several points (teaching data) around the query data are selected. Figure 6B shows an example in which two points on the right side close to point P and two points on the left side close to point P are selected. Then, the distances between each of the four selected points and point P on a two-dimensional plane are calculated (see Figure 6C).
[0061] The four distances are arranged in order from shortest to largest. The kth distance (2nd in this example) is called the tentative neighborhood sphere radius. The tentative neighborhood sphere radius is converted to an integer. For example, the tentative neighborhood sphere radius is converted to an integer using a ceiling function (a function that returns the smallest integer greater than or equal to a numerical value). Let the converted integer value be r.
[0062] 7 is an explanatory diagram for explaining a method for determining a search area. The point indicated by the value obtained by subtracting r from each numerical value (element) of the n-dimensional (in this example, two-dimensional) data representing point P is defined as point P-. The point indicated by the value obtained by adding r to each numerical value (element) of the n-dimensional data is defined as point P+. Point P- is defined as the start point of the candidate area. Point P+ is defined as the end point of the candidate area. The area between point P- and point P+ corresponds to the neighborhood range set by candidate area determination unit 13.
[0063] FIG. 8 is an explanatory diagram illustrating a specific method for determining a search region on a space-filling curve. As shown in FIG. 8, training data and query data are mapped onto a space-filling curve. Furthermore, the locations of point P- and point P+ on the space-filling curve are determined, for example, by binary search. On the space-filling curve, k neighboring points for the query data always exist between point P- and point P+ (range Q).
[0064] Fig. 9 is an explanatory diagram showing a search area on a two-dimensional plane corresponding to the search area (specifically, the candidate area) on the space-filling curve exemplified in Fig. 8. Fig. 9 shows the arrangement on a two-dimensional plane of the teacher data, query data, P- point, and P+ point on the space-filling curve exemplified in Fig. 8.
[0065] As will be described later, the distance calculation unit 15 calculates the distance between the query data and each of the plurality of teacher data in order to find, for example, neighboring points of the query data. In this embodiment, the distance calculation unit 15 calculates the distance between the query data on a two-dimensional plane and each of the teacher data existing between point P- and point P+. Therefore, the number of targets for distance calculation is reduced, and the amount of calculation required for distance calculation is reduced.
[0066] As mentioned above, when a range search is performed using a space-filling curve, the search area is not necessarily rectangular in two-dimensional space (see Figure 4B). This is because when a space-filling curve is used, the range is set on a one-dimensional space-filling curve, not in two-dimensional space.
[0067] 10A to 10C are explanatory diagrams showing points included in a search area set using a space-filling curve. In the example shown in FIG. 10A, a certain Z curve is used. Two-dimensional data is mapped to one-dimensional data and sorted by the Z curve. In FIG. 10A, point P indicates query data. The tentative neighborhood sphere radius is set to 1. In the example shown in FIG. 10A, 22 points of data (e.g., training data) are included in the area from point P- to point P+.
[0068] In the example shown in FIG. 10B, another Z curve is used. Two-dimensional data is mapped to one-dimensional data and sorted by the Z curve. In FIG. 10B, point P indicates query data. The tentative neighborhood sphere radius is set to 1. In the example shown in FIG. 10B, the area from point P- to point P+ contains 13 points of data (e.g., training data).
[0069] For example, when calculating the distance between each piece of data in the region from point P- to point P+ and the query data, the amount of calculation is less when using the Z curve illustrated in Fig. 10B than when using the Z curve illustrated in Fig. 10A. In other words, when calculating the distance between each piece of data in a predetermined region and the query data, the amount of calculation may differ if the shape of the Z curve differs.
[0070] 10C shows an example in which a Hilbert curve is used as the space-filling curve. In the example shown in FIG. 10C, 12 data points (e.g., training data) are included in the area from point P- to point P+. Therefore, when a different space-filling curve is used, the search area changes, and the amount of calculation required to obtain neighboring points of the query data may differ.
[0071] Next, the operation of the range search device 1 will be described with reference to the flowchart of FIG.
[0072] The numerical value replacement unit 11 receives a plurality of pieces of teacher data (step S11). The numerical value replacement unit 11 replaces the numerical values (elements) of each piece of teacher data that has been received (step S12). For example, if the teacher data is three-dimensional data (x, y, z), two or three of x, y, and z are replaced. The numerical value replacement unit 11 outputs the teacher data and information indicating which numerical values have been replaced to the sorting unit 12.
[0073] The sorting unit 12 sorts the sets of multiple training data after numerical value replacement using a space-filling curve (step S13). There are as many types of numerical value replacement as there are factorials of the dimensions. For example, if the training data is three-dimensional data, there are six (=3!) types of numerical value replacement. The processing of steps S12 and S13 can be executed a maximum number of times equivalent to the factorial value of the dimension. In this embodiment, the processing of steps S12 and S13 is executed a predetermined number of times that is less than or equal to the factorial value of the dimension. Note that the sets of multiple training data that have been input (the original multiple training data) are also included in the sets of multiple training data after numerical value replacement.
[0074] After the processes of steps S12 and S13 have been executed a predetermined number of times, the process proceeds to step S21 (step S14). That is, after the process of replacing the values (the process of step S12) has been executed a predetermined number of times (not more than the number of times corresponding to the factorial value of the dimension), the process proceeds to step S21. If the number of times the processes of steps S12 and S13 have been executed is less than the predetermined number of times, the processes of steps S12 and S13 are executed again. In the process of step S12 that is executed again, the value replacement unit 11 replaces values of types that have not yet been used.
[0075] The sorting unit 12 outputs the plurality of teacher data to the candidate area determination unit 13. Furthermore, the sorting unit 12 outputs to the candidate area determination unit 13 information indicating which values have been replaced, corresponding to each of the number replacement processes (processing of step S12) executed a predetermined number of times, the mapping results (positions) of each teacher data on the space-filling curve, and index information of each teacher data before and after sorting.
[0076] In step S21, the candidate area determination unit 13 receives query data. Then, the candidate area determination unit 13 replaces the numerical values (elements) of the query data with reference to the information received from the candidate area determination unit 13 (step S22). When performing the process of step S21, the candidate area determination unit 13 replaces the numerical values of the query data based on the information received from the sorting unit 12 indicating which numerical values have been replaced.
[0077] Next, the candidate area determination unit 13 performs calculations related to the search area (step S23). The calculations related to the search area are processes for obtaining candidate areas for each type of numerical value replacement. For example, the candidate area determination unit 13 obtains candidate areas by the processes already described with reference to Figures 6A to 6C and 7 to 9.
[0078] In the process of step S23, the candidate area determination unit 13 uses the query data in which the numerical values have been replaced by the same type of replacement as that applied to the training data.
[0079] When performing the processing described with reference to Figures 6A to 6C and Figures 7 to 9, candidate area determination unit 13 outputs to search range determination unit 14 information that can identify at least each of the multiple candidate areas on the space-filling curve, the position of the teacher data in each candidate area, the position of the query data in each candidate area, the P- point, and the position of the P+ point in each candidate area.
[0080] Once the processes of steps S22 and S23 have been executed for all replacements, the process proceeds to step S31. If the processes of steps S22 and S23 have not yet been executed for all replacements, the processes of steps S22 and S23 are executed again. In the process of step S22 that is executed again, the value replacement unit 11 replaces types of values that have not yet been used. Note that "all replacements" corresponds to all types of replacement of values used in the process of step S12 multiple times.
[0081] In step S31, the search range determination unit 14 calculates the number of pieces of training data included in each candidate area input from the candidate area determination unit 13. The distance calculation unit 15 selects the candidate area that includes the least amount of data. The search range determination unit 14 sets the selected candidate area as the search area.
[0082] The distance calculation unit 15 calculates the distance between the query data and each of all the teacher data in the search area determined by the search range determination unit 14 (step S32). The distance calculation unit 15 selects k distances in ascending order. Then, the distance calculation unit 15 determines the points where the data corresponding to the selected k distances are located as k-neighbor points.
[0083] The effect of this embodiment will be explained. FIG. 12 is an explanatory diagram showing the amount of calculation when the k-nearest neighbor method is used in a search area obtained using a space-filling curve. The upper part of FIG. 12 shows the amount of calculation when the k-nearest neighbor method using one fixed space-filling curve is used. In other words, the upper part of FIG. 12 shows the amount of calculation when the idea of this embodiment is not applied. The values shown in the upper part of FIG. 12 are the same as the values shown in FIG. 18.
[0084] The lower part of FIG. 12 shows the amount of calculation in this embodiment.
[0085] As in the case shown in Figure 18, the number of data, dimensions, and values of the training data and query data were assumed to be the same. The number of training data and query data was set to 1,000,000. The values of the training data and query data were non-negative integers in the range [0, 1,000,000]. The training data and query data were each uniformly distributed. A Z-curve was used as the space-filling curve.
[0086] The number of neighboring points was set to 2, and the number of dimensions of the data was set to 2, 3, 4, and 5, and computer simulations were performed.
[0087] As shown in the lower part of Figure 12, when the number of dimensions of the data was 2, the amount of calculation was 0.0016. The amount of calculation is about two-thirds of the value shown in the upper part of Figure 12. In other words, the calculation speed is faster.
[0088] When the number of dimensions of the data was 3, the computational complexity was 0.014. This is half the value shown in the upper part of FIG. 12. When the number of dimensions of the data was 4, the computational complexity was 0.0446. This is about 2.5 times the value shown in the upper part of FIG. 12. When the number of dimensions of the data was 5, the computational complexity was 0.0888. This is about one-third the value shown in the upper part of FIG. 12. In other words, the computational complexity was reduced even when the number of dimensions increased.
[0089] Therefore, the range search device 1 of this embodiment can reduce the amount of calculation required for processing that utilizes a range search using a space-filling curve.
[0090] Embodiment 2. 13 is a block diagram showing the configuration of a range search device according to the second embodiment. The range search device 2 shown in FIG. 13 includes a sorting unit 12, a candidate area determination unit 13A, a search range determination unit 14, and a distance calculation unit 15.
[0091] The sorting unit 12, the candidate area determination unit 13A, and the search range determination unit 14 constitute a range determination unit 20.
[0092] The sorting unit 12 maps the training data onto a space-filling curve. That is, it obtains a mapping of the training data onto the space-filling curve. There are a plurality of training data.
[0093] In this embodiment, multiple types of space-filling curves are input to sorting unit 12. The multiple types of space-filling curves include, for example, a Z curve and a Hilbert curve. Note that the multiple types of space-filling curves may be stored in advance in range searching device 2. In that case, for example, sorting unit 12 stores the multiple types of space-filling curves.
[0094] The sorting unit 12 sorts the training data using each of the plurality of types of space-filling curves. The other processes executed by the sorting unit 12 are the same as those in the first embodiment.
[0095] Candidate area determination unit 13A calculates a search area using the teacher data, query data, mapping results (positions) of the teacher data on each of a plurality of types of space-filling curves, and index information before and after sorting the teacher data.
[0096] The search range determination unit 14 and the distance calculation unit 15 execute the same processes as those in the first embodiment.
[0097] Next, the operation of the range search device 2 will be described with reference to the flowchart of FIG.
[0098] Sorting unit 12 receives input of a plurality of types of space-filling curves (step S10). If sorting unit 12 stores a plurality of types of space-filling curves in advance, the processing of step S10 is not necessary. In this embodiment, a plurality of pieces of training data are input to sorting unit 12 (step S11).
[0099] The sorting unit 12 sorts the plurality of training data using each of the plurality of types of space-filling curves (step S13). The sorting unit 12 outputs the mapping result (position) of each training data on the space-filling curve and the index information of each training data before and after sorting to the candidate area determination unit 13A.
[0100] The candidate area determination unit 13A receives query data (step S21). Next, the candidate area determination unit 13A performs calculations related to a search area (step S23A). The calculations related to the search area are processes for obtaining candidate areas using each of a plurality of space-filling curves. For example, the candidate area determination unit 13A obtains candidate areas through the processes described with reference to FIGS. 6A to 6C and 7 to 9.
[0101] When performing the processing described with reference to Figures 6A to 6C and Figures 7 to 9, candidate area determination unit 13 outputs to search range determination unit 14 information that can identify at least the candidate area in each of the multiple types of space-filling curves, the position of the teacher data in each candidate area, the position of the query data in each candidate area, the P- point in each candidate area, and the position of the P+ point in each candidate area.
[0102] The search range determination unit 14 and the distance calculation unit 15 execute the same processes as those in the first embodiment (steps S31 and S32).
[0103] The effects of this embodiment will be described. In this embodiment, the range search device 2 performs mapping and sorting of training data into a one-dimensional space using each of a plurality of types of space-filling curves. As described above, when different space-filling curves are used, the amount of calculation required to obtain neighboring points of the query data may differ even if the search area is the same. Specifically, the number of training data in the search area may differ.
[0104] Therefore, by selecting a candidate area with the smallest amount of training data as the search area, range search device 2 can reduce the amount of calculation required for processing range search using a space-filling curve. Furthermore, since the shapes of the multiple types of space-filling curves are different, it is possible to determine a search area that contains less training data than in the first embodiment, and this is expected to further reduce the amount of calculation.
[0105] Each component in the above embodiment can be configured as a single piece of hardware, or as a single piece of software. Each component can also be configured as multiple pieces of hardware, or as multiple pieces of software. Furthermore, some of the components can be configured as hardware, and the other parts can be configured as software.
[0106] Each function (each process) in the above-described embodiments can be realized by a computer having a processor such as a CPU (Central Processing Unit), a memory, etc. For example, a program for implementing the method (process) in the above-described embodiments may be stored in a storage device (storage medium), and each function may be realized by executing the program stored in the storage device by a CPU.
[0107] 15 is a block diagram showing an example of a computer having a CPU. The computer is implemented in a range search device. The CPU 1000 executes processing in accordance with a program stored in a storage device 1001, thereby realizing the functions of the numerical value replacement unit 11, sorting unit 12, candidate area determination units 13 and 13A, search range determination unit 14, and distance calculation unit 15 in the above embodiment. The CPU 1000 can also realize the functions of the range determination units 10 and 20.
[0108] The storage device 1001 is, for example, a non-transitory computer-readable medium. The non-transitory computer-readable medium includes various types of tangible storage media. Specific examples of non-transitory computer-readable media include magnetic recording media (e.g., hard disks), magneto-optical recording media (e.g., magneto-optical disks), CD-ROMs (Compact Disc-Read Only Memory), CD-Rs (Compact Disc-Recordable), CD-R / Ws (Compact Disc-ReWritable), and semiconductor memories (e.g., mask ROMs, PROMs (Programmable ROMs), EPROMs (Erasable PROMs), and flash ROMs).
[0109] The program may also be stored in various types of transitory computer-readable media, to which the program is supplied, for example, via a wired or wireless communication path, i.e., via an electrical signal, an optical signal, or an electromagnetic wave.
[0110] The memory 1002 is realized by, for example, a random access memory (RAM), and is a storage means for temporarily storing data when the CPU 1000 executes processing. A configuration is also conceivable in which a program held in the storage device 1001 or a temporary computer-readable medium is transferred to the memory 1002, and the CPU 1000 executes processing based on the program in the memory 1002.
[0111] 16 is a block diagram showing the main components of a range determination device. The range determination device 100 shown in FIG. 16 (implemented by range determination units 10 and 20 in the embodiment) includes a one-dimensionalization unit (one-dimensionalization means) 101 (implemented by a numerical value replacement unit 11 and a sorting unit 12 in the embodiment) that creates multiple types of one-dimensional data from multiple pieces of multidimensional data (for example, teacher data that is two-dimensional data) using multiple space-filling curves, and a query data placement unit (query data placement means) 102 (implemented by a candidate area determination unit 13 in the embodiment) that places query data on each of the multiple space-filling curves on which the one-dimensional data has been placed. , 13A), a candidate area determination unit (candidate area determination means) 103 (realized by the candidate area determination units 13, 13A in the embodiment) that determines a neighborhood range of the query data on each of the plurality of space-filling curves and sets areas corresponding to the neighborhood ranges (areas on a multidimensional plane corresponding to each of the plurality of space-filling curves) as candidate areas, and a search range determination unit (search range determination means) 104 (realized by the search range determination unit 14 in the embodiment) that sets the area containing the smallest amount of data among the plurality of candidate areas as the search area.
[0112] Some or all of the above embodiments can be described as, but are not limited to, the following supplementary notes.
[0113] (Supplementary Note 1) A one-dimensionalization means for creating a plurality of types of one-dimensional data from a plurality of multidimensional data using each of a plurality of space-filling curves; a query data arrangement means for arranging query data on each of the plurality of space-filling curves on which the one-dimensional data is arranged; a candidate area determination means for determining a neighborhood range of query data on each of the plurality of space-filling curves and determining an area on each of a plurality of multidimensional planes corresponding to the neighborhood range as a candidate area; a search range determination means for determining, as a search area, the area that includes the smallest number of data items among the plurality of candidate areas; A range determination device comprising:
[0114] (Supplementary Note 2) The one-dimensionalization means creates a plurality of sets of a plurality of data by replacing the numerical values of each of the plurality of data on the multidimensional plane, and creates the plurality of types of one-dimensional data by mapping the plurality of data in each set onto a one-dimensional space using one type of space-filling curve (e.g., a Z-curve); The query data arrangement means creates a plurality of types of query data by swapping the numerical values of the query data on the multidimensional plane, and arranges each type of query data on the space-filling curve. 2. The range determination apparatus of claim 1.
[0115] (Supplementary Note 3) The space-filling curves are a plurality of types of space-filling curves (e.g., Z-curves and Hilbert curves). 2. The range determination apparatus of claim 1.
[0116] (Supplementary Note 4) A range determination device according to Supplementary Note 1; a distance calculation means for calculating a distance between each of a plurality of data included in the search area on the multidimensional plane and the query data, and selecting a predetermined data item corresponding to the smallest distance from the plurality of distances; A range search device comprising:
[0117] (Appendix 5) Creating multiple types of one-dimensional data from multiple multidimensional data using multiple space-filling curves, placing query data on each of the plurality of space-filling curves on which the one-dimensional data is placed; determining a neighborhood range of the query data on each of the plurality of space-filling curves, and determining regions on each of a plurality of multidimensional planes corresponding to the neighborhood range as candidate regions; Among the plurality of candidate regions, the region containing the smallest amount of data is set as the search region. Range determination method.
[0118] (Appendix 6) A plurality of sets of a plurality of data are created by replacing the numerical values of each of the plurality of data in the multidimensional plane, and the plurality of data in each set is mapped onto a one-dimensional space using one type of space-filling curve, thereby creating the plurality of types of one-dimensional data; A plurality of types of query data are generated by rearranging the numerical values of the query data on the multidimensional plane, and each type of query data is arranged on the space-filling curve. The range determination method described in Appendix 5.
[0119] (Supplementary Note 7) The space-filling curves are of multiple types. The range determination method described in Appendix 5.
[0120] (Appendix 8) Execute the range determination method described in Appendix 5, Calculating the distance between each of the plurality of data included in the search area on the multidimensional plane and the query data, and selecting a predetermined piece of data corresponding to the smallest distance from the plurality of distances. Range search method.
[0121] (Appendix 9) A computer-readable recording medium storing a range determination program, The range determination program is configured to: A plurality of types of one-dimensional data are generated from a plurality of multidimensional data using a plurality of space-filling curves, placing query data on each of the plurality of space-filling curves on which the one-dimensional data is placed; determining a neighborhood range of the query data on each of the plurality of space-filling curves, and determining regions on each of a plurality of multidimensional planes corresponding to the neighborhood range as candidate regions; Among the plurality of candidate regions, the region containing the smallest number of data is selected as the search region. A computer-readable recording medium.
[0122] (Supplementary Note 10) The range determination program is configured to: creating a plurality of sets of a plurality of data by replacing the numerical values of each of the plurality of data in the multidimensional plane, and creating the plurality of types of one-dimensional data by mapping the plurality of data in each set onto a one-dimensional space using one type of space-filling curve; A plurality of types of query data are generated by permuting the numerical values of the query data on the multidimensional plane, and each type of query data is arranged on the space-filling curve. 10. The computer-readable storage medium of claim 9.
[0123] (Appendix 11) The plurality of space-filling curves are a plurality of types of space-filling curves. 10. The computer-readable storage medium of claim 9.
[0124] (Appendix 12) To the computer, A plurality of types of one-dimensional data are generated from a plurality of multidimensional data using a plurality of space-filling curves, placing query data on each of the plurality of space-filling curves on which the one-dimensional data is placed; determining a neighborhood range of the query data on each of the plurality of space-filling curves, and determining regions on each of a plurality of multidimensional planes corresponding to the neighborhood range as candidate regions; Among the plurality of candidate regions, the region containing the smallest number of data is selected as the search region. Range determination program for.
[0125] (Appendix 13) To the computer, creating a plurality of sets of a plurality of data by replacing the numerical values of each of the plurality of data in a multidimensional plane, and creating the plurality of types of one-dimensional data by mapping the plurality of data in each set onto a one-dimensional space using one type of space-filling curve; A plurality of types of query data are generated by permuting the numerical values of the query data on the multidimensional plane, and each type of query data is arranged on the space-filling curve. 13. The range determination program of claim 12.
[0126] (Appendix 14) The plurality of space-filling curves are a plurality of types of space-filling curves. 13. The range determination program of claim 12.
[0127] Although the present invention has been described above with reference to the embodiments, the present invention is not limited to the above-described embodiments. Various modifications that can be understood by those skilled in the art can be made to the configuration and details of the present invention within the scope of the present invention. [Explanation of symbols]
[0128] 1,2 Range search device 10,20 Range determination section 11 Numerical value exchange section 12 Sorting section 13,13A Candidate area determination unit 14 Search range determination section 15 Distance calculation section 100 Range determination device 101 One-dimensionalization part 102 Query data placement part 103 Candidate area determination unit 104 Search range determination unit 1000 CPU 1001 Storage device 1002 memory
Claims
1. a one-dimensionalization means for generating a plurality of types of one-dimensional data from a plurality of multidimensional data by using each of a plurality of space-filling curves; a query data arrangement means for arranging query data on each of the plurality of space-filling curves on which the one-dimensional data is arranged; a candidate area determination means for determining a neighborhood range of query data on each of the plurality of space-filling curves and determining an area on each of a plurality of multidimensional planes corresponding to the neighborhood range as a candidate area; a search range determination means for determining, as a search area, the area that includes the smallest number of data items among the plurality of candidate areas; A range determination device comprising:
2. the one-dimensionalization means creates a plurality of sets of a plurality of data by swapping values of each of the plurality of data on the multidimensional plane, and creates the plurality of types of one-dimensional data by mapping the plurality of data in each set onto a one-dimensional space using one type of space-filling curve; The query data arrangement means creates a plurality of types of query data by swapping the numerical values of the query data on the multidimensional plane, and arranges each type of query data on the space-filling curve.
2. The range determination apparatus of claim 1.
3. The plurality of space-filling curves are a plurality of types of space-filling curves.
2. The range determination apparatus of claim 1.
4. a range determination device according to claim 1; a distance calculation means for calculating a distance between each of a plurality of data included in the search area on the multidimensional plane and the query data, and selecting a predetermined number of data corresponding to the smallest distance from the plurality of distances; A range search device comprising:
5. A computer operating as a range determination device or a range search device, creating a plurality of types of one-dimensional data from a plurality of multidimensional data using a plurality of space-filling curves, placing query data on each of the plurality of space-filling curves on which the one-dimensional data is placed; determining a neighborhood range of the query data on each of the plurality of space-filling curves, and determining regions on each of a plurality of multidimensional planes corresponding to the neighborhood range as candidate regions; Among the plurality of candidate regions, the region containing the smallest amount of data is set as the search region. Range determination method.
6. The computer creating a plurality of sets of a plurality of data by replacing the numerical values of each of the plurality of data in the multidimensional plane, and creating the plurality of types of one-dimensional data by mapping the plurality of data in each set onto a one-dimensional space using one type of space-filling curve; A plurality of types of query data are generated by rearranging the numerical values of the query data on the multidimensional plane, and each type of query data is arranged on the space-filling curve. The range determination method according to claim 5 .
7. The plurality of space-filling curves are a plurality of types of space-filling curves. The range determination method according to claim 5 .
8. The computer Execute the range determination method according to claim 5, Calculating the distance between each of a plurality of data included in the search area on the multidimensional plane and the query data, and selecting a predetermined number of data corresponding to the smallest distance from the plurality of distances. Range search method.
9. On the computer, creating a plurality of types of one-dimensional data from a plurality of multidimensional data using a plurality of space-filling curves, placing query data on each of the plurality of space-filling curves on which the one-dimensional data is placed; determining a neighborhood range of the query data on each of the plurality of space-filling curves, and determining regions on each of a plurality of multidimensional planes corresponding to the neighborhood range as candidate regions; Among the plurality of candidate regions, the region containing the smallest number of data is selected as the search region. Range determination program for.
10. The computer, creating a plurality of sets of a plurality of data by replacing the numerical values of each of the plurality of data in the multidimensional plane, and creating the plurality of types of one-dimensional data by mapping the plurality of data in each set onto a one-dimensional space using one type of space-filling curve; A plurality of types of query data are generated by permuting the numerical values of the query data on the multidimensional plane, and each type of query data is arranged on the space-filling curve. The range determination program according to claim 9.
Citation Information
Patent Citations
Multidimensional range retrieval device and multidimensional range retrieval method
JP2015018497A
Database access using a space-filling curve
US20170255682A1
Dynamic query hints in LDAP search operations
US20190334856A1