fix: correct ground_truth comparison in BanditEnv#190
Open
bigsawman wants to merge 1 commit into
Open
Conversation
`ground_truth` is a dict mapping button names to probabilities, but the final-turn check compared a button string directly against this dict (`button == self.state.game_state['ground_truth']`), which always evaluates to False. This means the player can never win. Fix: find the button with the highest probability first, then compare.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ground_truthinBanditEnvis a dict mapping button names to probabilities (e.g.{"red": 0.6, "blue": 0.3, ...}), but the final-turn winner check compares a button string directly against this dict (button == self.state.game_state['ground_truth']), which always evaluates toFalse.max(..., key=...), then compare the player's choice against that.Reproduction
Test plan
_regret()already correctly usesground_truthas a dict (calls.values()and indexes by button name), confirming this is a dict, not a string.