Skip to content
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

Handle the empty input case in ReactionModelBasedEvaluator #27

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

kmaziarz
Copy link
Contributor

@kmaziarz kmaziarz commented Sep 7, 2023

Node evaluators based on ReactionModelBasedEvaluator can perform normalization; if done in log space, this can fail if the input list is empty (due to taking max of an empty array). Whether empty lists are actually passed in for evaluation depends on the exact algorithm (it does not seem to happen in MCTS, but does happen in Retro*), so it's best to guard against that in the evaluator itself as done in this PR.

Copy link
Collaborator

@AustinT AustinT left a comment

Choose a reason for hiding this comment

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

Looks good to me.

However, I've seen the "empty list" edge case come up a few times myself. Perhaps a better long-term fix would be to implement this behaviour directly in the __call__ method of the NoCacheNodeEvaluator base class?

@kmaziarz kmaziarz merged commit ca6c2ab into main Sep 8, 2023
3 checks passed
@kmaziarz kmaziarz deleted the kmaziarz/node-evaluators-fix branch September 8, 2023 13:45
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