Skip to content

Conversation

@jackgerrits
Copy link
Member

No description provided.

@jackgerrits jackgerrits changed the title refactor: migrate to active builder and fix warnings refactor: migrate active to builder and fix warnings Aug 20, 2021
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());
Copy link
Member

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)

Copy link
Member Author

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

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)
Copy link
Member

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants