Issues 520 and 484: expose function to get names of scores used in score()#588
Issues 520 and 484: expose function to get names of scores used in score()#588nikosbosse merged 2 commits intomainfrom
score()#588Conversation
seabbs
left a comment
There was a problem hiding this comment.
LGTM. See note about correlation metric arg. We need to very clearly and repeatedly document what a scoring rule is and what a score is in order to avoid confusing people.
| metrics = NULL, | ||
| digits = NULL) { | ||
| metrics <- get_metrics(scores) | ||
| metrics <- get_score_names(scores) |
There was a problem hiding this comment.
why is metrics an argument if it immediately gets overwritten? Shouldn't this (i.e. get_score_names be the default arg for metrics instead).
There was a problem hiding this comment.
also this arg needs renaming (already an issue to address this?) but not as part of this PR.
There was a problem hiding this comment.
Excellent point. It might be mentioned somewhere, but I'll make it a separate issue (#589) so it doesn't get buried somewhere.
seabbs
left a comment
There was a problem hiding this comment.
LGTM. See note about correlation metric arg. We need to very clearly and repeatedly document what a scoring rule is and what a score is in order to avoid confusing people.
Description
This PR partially addresses #520 and #484.
In the spirit of exposing diagnostic functions to the user, this PR exports a function that users can call to obtain the names of the scoring rules used during scoring.
Specifically, the PR
get_metrics()toget_score_names()error = FALSEto the function, controlling whether or not the function should error if no stored attributes are foundmetric_namesattribute toscore_namesand replaces it everywhereplot_ranges()by wrapping a call toscore()insuppressWarnings(). This is more of a hotfix, and the future ofplot_ranges()is discussed in Discussion: Future of functionplot_ranges()? #462.Further thoughts:
There is probably an argument to be had about whether
score_namesis the best name. According to #520, "scores are computed by scoring rules". So the score is the output of a scoring rule. In some sense, the function gives you the names of the columns that hold the scores. Is that the name of the score? The name of the scoring rule? 🤷The current name felt sufficiently concise and clear to me, but I don't have a strong opinion. Other naming options that I thought about:
get_rules()with attributerule_namesget_names_rules()get_rule_names()Any thoughts?
Checklist
lintr::lint_package()to check for style issues introduced by my changes.I have added a news item linked to this PR.