MetricKnn API
Fast Similarity Search using the Metric Space Approach
mevaluation_answers.hpp
1 /*
2  * Copyright (C) 2012-2015, Juan Manuel Barrios <juanmanuel@barrios.cl>
3  * All rights reserved.
4  *
5  * This file is part of P-VCD. https://github.com/juanbarrios/p-vcd
6  * P-VCD is made available under the terms of the BSD 2-Clause License.
7  */
8 
9 #ifndef MKNN_EVALUATION_ANSWERS_HPP
10 #define MKNN_EVALUATION_ANSWERS_HPP
11 
12 #include <map>
13 #include <string>
14 #include <set>
15 #include <vector>
16 #include "../metricknn_impl.hpp"
17 
18 namespace mknn {
19 template<typename TypeObject> class MknnRankedAnswer {
20 public:
27  MknnRankedAnswer(TypeObject id_object, long long rank_position);
29  const TypeObject& getIdObject() const;
33  long long getRank() const;
39  bool operator <(const MknnRankedAnswer& other) const;
40 
41 private:
42  TypeObject id_object;
43  //rank starting from 0
44  long long rank_position;
45 };
46 
47 template<typename TypeQuery, typename TypeObject> class MknnAnswers {
48 public:
49  MknnAnswers();
50  ~MknnAnswers();
51  void addAnswer(TypeQuery id_query, TypeObject id_object,
52  long long rank_position);
53  long long getNumRanks();
54  std::set<TypeQuery> getQueryNames();
55  std::vector<MknnRankedAnswer<TypeObject>> &getQueryAnswers(
56  TypeQuery id_query);
57 private:
58  std::map<TypeQuery, std::vector<MknnRankedAnswer<TypeObject>>>answers;
59 };
60 
63 
64 }
65 #endif
Definition: mevaluation_answers.hpp:19
bool operator<(const MknnRankedAnswer &other) const
comparator by rank.
Definition: mevaluation_answers.cpp:42
Definition: mevaluation_answers.hpp:47
Definition: mevaluation_answers.hpp:18
long long getRank() const
the rank, 0 is the first.
Definition: mevaluation_answers.cpp:38
Powered by Download MetricKnn