Skip to content

Conversation

@jackgerrits
Copy link
Member

@jackgerrits jackgerrits commented Feb 13, 2023

Requires #48

"\n",
"with open(\"example_cb.txt\") as dataset_file:\n",
" with vw.TextFormatReader(workspace, dataset_file) as reader:\n",
" for example in reader:\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"example" here vs "examples" in the next line (extract_label signature) is a bit confusing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Perhaps I should rename to event?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think it is better

" logged_action_0_based, logged_cost, logged_prob = logged_label\n",
"\n",
" # 4. Get the probability of choosing the logged action according to the target policy\n",
" prediction_prob = next(x for i, x in pmf if i == logged_action_0_based)\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] dict(pmf)[logged_action_0_based] (not sure which one is more readable)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting, I didn't know you could init a dictionary like that

@jackgerrits jackgerrits merged commit b5c01ae into main Feb 14, 2023
@jackgerrits jackgerrits deleted the cb_estimators branch February 23, 2023 15:59
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.

3 participants