-
Notifications
You must be signed in to change notification settings - Fork 1.9k
refactor: migrate active to builder and fix warnings #3243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| reduction_builder.set_learn_returns_prediction(learn_returns_prediction); | ||
| if (!simulation) { reduction_builder.set_finish_example(return_active_example); } | ||
|
|
||
| return make_base(*reduction_builder.build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could stick to the usual style with something like:
auto* finish_ptr = simulation ? reinterpret_cast<void (*)(vw&, active&, example&)>(return_simple_example) : return_active_example
Then chaining the .sets with .set_finish_example(finish_ptr)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditionally setting this allows the default to change without having to update this code. It's a little uglier but I'd prefer to not leak the return_simple_example implementation detail
vowpalwabbit/active.cc
Outdated
| std::sqrt((1.f + 0.5f * std::log(k)) / (weighted_queries + 0.0001f)); | ||
| bias = get_active_coin_bias(k, avg_loss, ec_revert_weight / k, a.active_c0); | ||
| } | ||
| if (a._random_state->get_and_update_random() < bias) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could add this change as well:
return (a._random_state->get_and_update_random() < bias) ? 1.f / bias : -1.f;
No description provided.