DATA
- The type of dataDISTANCES
- The type of distances measured (usually an array type)PAIR_TYPE
- The type of distance-index pair returned by the search methodspublic interface NearestNeighbours<DATA,DISTANCES,PAIR_TYPE>
Modifier and Type | Method and Description |
---|---|
void |
searchKNN(DATA[] qus,
int K,
int[][] indices,
DISTANCES[] distances)
Search for the K nearest neighbours to each of the N queries, and return
the indices of each nearest neighbour and their respective distances.
|
List<PAIR_TYPE> |
searchKNN(DATA query,
int K)
Search for the K nearest neighbours to the given query and return an
ordered list of pairs containing the distance and index of each
neighbour.
|
void |
searchKNN(List<DATA> qus,
int K,
int[][] indices,
DISTANCES[] distances)
Search for the K nearest neighbours to each of the N queries, and return
the indices of each nearest neighbour and their respective distances.
|
PAIR_TYPE |
searchNN(DATA query)
Search for the nearest neighbour to the given query and return a pair
containing the distance and index of that neighbour.
|
void |
searchNN(DATA[] qus,
int[] indices,
DISTANCES distances)
Search for the nearest neighbour to each of the N queries, and return the
index of each nearest neighbour and the respective distance.
|
void |
searchNN(List<DATA> qus,
int[] indices,
DISTANCES distances)
Search for the nearest neighbour to each of the N queries, and return the
index of each nearest neighbour and the respective distance.
|
int |
size()
Get the size of the dataset
|
void searchNN(DATA[] qus, int[] indices, DISTANCES distances)
For efficiency, to use this method, you need to pre-construct the arrays for storing the results outside of the method and pass them in as arguments.
If a nearest-neighbour cannot be determined, it will have an index value of -1
qus
- An array of N query vectorsindices
- The return N-dimensional array for holding the indices of the
nearest neighbour of each respective query.distances
- The return N-dimensional array for holding the distances of
the nearest neighbour to each respective query.void searchKNN(DATA[] qus, int K, int[][] indices, DISTANCES[] distances)
For efficiency, to use this method, you need to pre-construct the arrays for storing the results outside of the method and pass them in as arguments.
If a k-th nearest-neighbour cannot be determined, it will have an index value of -1
qus
- An array of N query vectorsK
- the number of neighbours to findindices
- The return N*K-dimensional array for holding the indices of
the K nearest neighbours of each respective query.distances
- The return N*K-dimensional array for holding the distances of
the nearest neighbours of each respective query.void searchNN(List<DATA> qus, int[] indices, DISTANCES distances)
For efficiency, to use this method, you need to pre-construct the arrays for storing the results outside of the method and pass them in as arguments.
If a nearest-neighbour cannot be determined, it will have an index value of -1
qus
- An array of N query vectorsindices
- The return N-dimensional array for holding the indices of the
nearest neighbour of each respective query.distances
- The return N-dimensional array for holding the distances of
the nearest neighbour to each respective query.void searchKNN(List<DATA> qus, int K, int[][] indices, DISTANCES[] distances)
For efficiency, to use this method, you need to pre-construct the arrays for storing the results outside of the method and pass them in as arguments.
If a k-th nearest-neighbour cannot be determined, it will have an index value of -1
qus
- An array of N query vectorsK
- the number of neighbours to findindices
- The return N*K-dimensional array for holding the indices of
the K nearest neighbours of each respective query.distances
- The return N*K-dimensional array for holding the distances of
the nearest neighbours of each respective query.List<PAIR_TYPE> searchKNN(DATA query, int K)
If k neighbours cannot be determined, then the resultant list might have fewer than k elements.
query
- the query vectorK
- the number of neighbours to search forPAIR_TYPE searchNN(DATA query)
If the nearest-neighbour cannot be determined null
will be
returned.
query
- the query vectorint size()