MetricKnn API
Fast Similarity Search using the Metric Space Approach
mevaluation_eval.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_EVAL_HPP
10 #define MKNN_EVALUATION_EVAL_HPP
11 
12 #include <map>
13 #include <string>
14 #include <set>
15 #include <vector>
16 #include <algorithm>
17 #include <iostream>
18 #include "../metricknn_impl.hpp"
19 
20 namespace mknn {
21 class MknnQueryEvaluation;
22 class MknnCategoryEvaluation;
23 
24 template<typename TypeQuery, typename TypeCategory, typename TypeObject>
26 public:
28  void evaluate(MknnAnswers<TypeQuery, TypeObject> &ans, bool with_details);
29  void print(std::string filename_output, std::string file_header_text);
30  double getMAP();
31 private:
32  void evaluate_query(MknnQueryEvaluation &res,
33  MknnAnswers<TypeQuery, TypeObject> &ans, TypeQuery id_query,
34  bool with_details);
35  void evaluate_category(MknnCategoryEvaluation &res,
36  TypeCategory id_category);
37 
39  long long max_rank;
40  long long expected_corrects;
41  std::vector<long long> corrects_at_rank;
42  std::vector<double> precision_at_rank;
43  double mean_average_precision, mean_average_rank;
44  double average_precision_first, average_rank_first;
45  std::map<TypeQuery, MknnQueryEvaluation> evaluationByQuery;
46  std::map<TypeCategory, MknnCategoryEvaluation> evaluationByCategory;
47 };
48 
50 public:
52 private:
53  long long num_categories_expected;
54  long long num_categories_found;
55  long long num_categories_missed;
56  long long num_objects_expected;
57  long long num_objects_found;
58  long long num_objects_missed;
59  double average_precision, average_rank;
60  double precision_first, rank_first;
61  std::string summary;
62 
63  template<typename A, typename B, typename C>
64  friend class MknnEvaluation;
65 };
67 public:
69 private:
70  long long num_queries;
71  long long num_objects_expected;
72  double queries_mean_average_precision, queries_mean_average_rank;
73  double queries_average_precision_first, queries_average_rank_first;
74 
75  template<typename A, typename B, typename C>
76  friend class MknnEvaluation;
77 };
78 
80 
81 }
82 #endif
Definition: mevaluation_eval.hpp:66
Definition: mevaluation_eval.hpp:25
Definition: mevaluation_answers.hpp:47
Definition: mevaluation_answers.hpp:18
Definition: mevaluation_eval.hpp:49
Definition: mevaluation_groundtruth.hpp:19
Powered by Download MetricKnn