Skip to content

Commit

Permalink
fix bug 1784: return probabilities for actions in the correct order (V…
Browse files Browse the repository at this point in the history
  • Loading branch information
pavithraks authored and jackgerrits committed May 15, 2019
1 parent 1fe4e6f commit fd6b0d0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions python/pylibvw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,16 @@ py::list ex_get_scalars(example_ptr ec)
py::list ex_get_action_scores(example_ptr ec)
{ py::list values;
v_array<ACTION_SCORE::action_score> scores = ec->pred.a_s;
std::vector<float> ordered_scores(scores.size());
for (auto action_score: scores)
{
ordered_scores[action_score.action] = action_score.score;
}

for (ACTION_SCORE::action_score s : scores)
{ values.append(s.score);
for (auto action_score: ordered_scores)
{ values.append(action_score);
}

return values;
}

Expand Down

0 comments on commit fd6b0d0

Please sign in to comment.