Repository navigation
fix(metrics): rank a NaN combined_score as the worst score - #603
Open
Bhaveshmeghwal21 wants to merge 2 commits into
Open
Bhaveshmeghwal21 wants to merge 2 commits into
Bhaveshmeghwal21 wants to merge 2 commits into
Conversation
get_fitness_score returned a NaN combined_score as it was. NaN loses every comparison, so a program with that fitness could never be beaten and stayed the best program. Fall back to the other metrics, as for any other unusable combined_score.
|
|
… other metrics Averaging the other metrics for a NaN combined_score let a program with a NaN score outrank valid programs when it reported another metric such as eval_time. Return -inf so it ranks below every other program, and test that a valid program is not replaced by one.
This branch has not been deployed
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.
get_fitness_scorereturnscombined_scoreas it is, so a NaN score (a numpy0/0, the mean of an empty array) gives the program a NaN fitness. Every comparison with NaN is False, so_is_betteris never true against it. If that program is the first one in the database, a cell or an island, nothing can replace it and it stays the best program:A NaN
combined_scorenow gives-inf, so that program ranks below every other one, negative scores included. Valid scores,infand-infare unchanged.I first fell back to averaging the other metrics, as for a
combined_scorethat cannot be converted to a float. That let a NaN program that also reportedeval_timeor similar outrank valid programs, so I dropped it.Not changed:
process_parallel.pysorts the programs shown in the prompt by the rawcombined_score, so a NaN still sorts oddly there. Usingget_fitness_scorefor that sort would be a small follow-up.tests/test_nan_combined_score.pyhas four tests. Two fail without the change; the other two check that valid scores are unchanged and that a NaN program does not replace a valid one. The fullunittestrun has the same 33 failing tests with and without the change (all environment-related on my Windows checkout).