Skip to content

Conversation

@nikosbosse
Copy link
Collaborator

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

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

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.

2 participants