/usr/include/vowpalwabbit/action_score.h is in libvw-dev 8.5.0.dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #pragma once
namespace ACTION_SCORE
{
struct action_score
{ uint32_t action;
float score;
};
typedef v_array<action_score> action_scores;
inline int cmp(size_t a, size_t b)
{ if (a == b) return 0;
if (a > b) return 1;
return -1;
}
inline int score_comp(const void* p1, const void* p2)
{ action_score* s1 = (action_score*)p1;
action_score* s2 = (action_score*)p2;
// Most sorting algos do not guarantee the output order of elements that compare equal.
// Tie-breaking on the index ensures that the result is deterministic across platforms.
// However, this forces a strict ordering, rather than a weak ordering, which carries a performance cost.
if(s2->score == s1->score) return cmp(s1->action, s2->action);
else if(s2->score >= s1->score) return -1;
else return 1;
}
inline int reverse_order(const void* p1, const void* p2)
{ return score_comp(p2,p1);
}
void print_action_score(int f, v_array<action_score>& a_s, v_array<char>&);
void delete_action_scores(void* v);
}
|