Fix NaNs in plot_error_map for zero-error rows#576
Open
vkverma9534 wants to merge 1 commit intomllam:mainfrom
Open
Fix NaNs in plot_error_map for zero-error rows#576vkverma9534 wants to merge 1 commit intomllam:mainfrom
vkverma9534 wants to merge 1 commit intomllam:mainfrom
Conversation
| ) | ||
|
|
||
| ax = fig.axes[0] | ||
| plotted = np.asarray(ax.images[0].get_array()) |
Collaborator
There was a problem hiding this comment.
Does this really get back the normalized errors? I think this code would need some explanations as it is pretty much unpacking the produced figure. Hard to understand without knowing matplotlib internals.
Author
|
@joeloskarsson , Thanks for your attention and yeah that’s fair. Right now the test is just guarding against NaNs in the final heatmap for the zero-error case, so I’m pulling the array from ax.images[0] to check that. Do you think that’s acceptable here, or would you rather we restructure things so the normalized values can be tested more directly? |
Collaborator
|
on a higher level: did you check whether this error is alread solved in #376? |
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.
Describe your changes
plot_error_map normalizes each variable by its maximum error before plotting. If a variable has zero error across all prediction horizons, this leads to a division by zero and introduces NaNs in the heatmap.
This change replaces the normalization with a safe division approach to avoid NaNs in this case. A regression test is also added to cover this scenario.
No additional dependencies are required.
Type of change
Checklist before requesting a review
pullwith--rebaseoption if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
reflecting type of change (add section where missing):
Checklist for assignee