#include <eval.h>
Public Member Functions | |
| void | resize (unsigned Q, unsigned K=0) |
| void | init (unsigned Q, unsigned maxID) |
| void | load (std::istream &is) |
| void | save (std::ostream &os) const |
| void | load (const std::string &path) |
| void | save (const std::string &path) const |
| unsigned | getQ () const |
| unsigned | getQuery (unsigned n) const |
| Get the ID of the nth query. | |
| const Topk< KEY > & | getAnswer (unsigned n) const |
| Get the nearest neighbors of the nth query. | |
| Topk< KEY > & | getAnswer (unsigned n) |
| Get the KNNs for modification. | |
We assume the feature vectors in the benchmark database are numbered from 0 to N. We sample Q queries as test examples and run K-NN search against the database with linear scan. The results are saved in a benchmark file for evaluation purpose. A benchmark file is made up of Q lines, each line represents a test query and is of the following format:
<query id>=""> <K> <1st NN's ID> <distance> <2nd NN's ID> <distance> ... <Kth NN's ID> <distance>
For all queries in the benchmark file, the K value should be the same.
Because the query points are also sampled from the database, they should be excluded from scanning when running this particular query.