9 #ifndef META_IR_EVAL_H_
10 #define META_IR_EVAL_H_
16 #include <unordered_map>
33 using result_type = std::vector<std::pair<doc_id, double>>;
38 ir_eval(
const std::string& config_file);
47 double precision(
const result_type& results, query_id q_id,
48 uint64_t num_docs = std::numeric_limits<uint64_t>::max())
const;
57 double recall(
const result_type& results, query_id q_id,
58 uint64_t num_docs = std::numeric_limits<uint64_t>::max())
const;
69 double f1(
const result_type& results, query_id q_id,
70 uint64_t num_docs = std::numeric_limits<uint64_t>::max(),
71 double beta = 1.0)
const;
82 double ndcg(
const result_type& results, query_id q_id,
83 uint64_t num_docs = std::numeric_limits<uint64_t>::max())
const;
88 double avg_p(
const result_type& results, query_id q_id,
89 uint64_t num_docs = std::numeric_limits<uint64_t>::max());
114 void print_stats(
const result_type& results, query_id q_id,
115 std::ostream& out = std::cout);
127 std::unordered_map<query_id, std::unordered_map<doc_id, uint8_t>>
qrels_;
144 uint64_t num_docs)
const;
153 using std::runtime_error::runtime_error;