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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues 520 and 484: expose function to get names of scores used in score() #588

Merged
merged 2 commits into from
Jan 8, 2024

Conversation

nikosbosse
Copy link
Contributor

@nikosbosse nikosbosse commented Jan 8, 2024

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

  • renames the current function get_metrics() to get_score_names()
  • adds a new argument error = FALSE to the function, controlling whether or not the function should error if no stored attributes are found
  • renames the metric_names attribute to score_names and replaces it everywhere
  • slightly adapts the error message
  • fixes an unrelated test warning in plot_ranges() by wrapping a call to score() in suppressWarnings(). This is more of a hotfix, and the future of plot_ranges() is discussed in Discussion: Future of function plot_ranges()?聽#462.

Further thoughts:
There is probably an argument to be had about whether score_names is 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 attribute rule_names
  • get_names_rules()
  • get_rule_names()

Any thoughts?

Checklist

  • My PR is based on a package issue and I have explicitly linked it.
  • I have included the target issue or issues in the PR title as follows: issue-number: PR title
  • I have tested my changes locally.
  • I have added or updated unit tests where necessary.
  • I have updated the documentation if required.
  • I have built the package locally and run rebuilt docs using roxygen2.
  • My code follows the established coding standards and I have run lintr::lint_package() to check for style issues introduced by my changes.
  • I have added a news item linked to this PR.
  • I have reviewed CI checks for this PR and addressed them as far as I am able.

Copy link
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

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

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.

@@ -21,7 +21,7 @@
correlation <- function(scores,
metrics = NULL,
digits = NULL) {
metrics <- get_metrics(scores)
metrics <- get_score_names(scores)
Copy link
Contributor

Choose a reason for hiding this comment

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

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).

Copy link
Contributor

Choose a reason for hiding this comment

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

also this arg needs renaming (already an issue to address this?) but not as part of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Excellent point. It might be mentioned somewhere, but I'll make it a separate issue (#589) so it doesn't get buried somewhere.

Copy link
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

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

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.

@nikosbosse nikosbosse merged commit 18bbb8f into main Jan 8, 2024
9 checks passed
@nikosbosse nikosbosse deleted the export-get_metrics() branch January 8, 2024 14:44
nikosbosse added a commit that referenced this pull request Jan 9, 2024
PR #588 (issues #520 and #484): Update documentation for `get_score_names()`
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.

None yet

2 participants