Repository navigation
Conversation
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.
Closes #633.
brier_ind()normalizedcase_weightswith a softmax (exp(w - max(w)) / sum(exp(w - max(w)))) before computing the weighted mean. This is only equivalent to a plain weighted mean when all the weights are equal; once weights are spread out,exp()distorts their relative sizes and can underflow small weights to zero, silently dropping those observations. The fix removes the softmax and normalizes by the plain sum of weights instead, matching how other weighted metrics likemn_log_loss()handlecase_weights.Since
ranked_prob_score()calls the samebrier_ind()helper, its weighted calculations were affected too and are fixed by the same change; I updated its case-weight test's expected value, which had been generated from the buggy output rather than the statedorf::rps()reference.Added a test comparing
brier_class()with widely spreadcase_weightsagainst the same data expanded withtidyr::uncount().