Skip to content

1125: Test w and w_vs arguments of the variogram score - #1245

Open
nikosbosse wants to merge 4 commits into
mainfrom
issue-1125-test-variogram-weights
Open

nikosbosse wants to merge 4 commits into
mainfrom
issue-1125-test-variogram-weights

Conversation

@nikosbosse

@nikosbosse nikosbosse commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

CLAUDE:

Description

This PR closes #1125.

The w and w_vs arguments of the variogram score were not exercised by any test (raised in review of #1114). This PR adds tests only; no code in R/ changes.

  • tests/testthat/test-class-forecast-multivariate-sample.R: the existing test variogram_score_multivariate() matches scoringRules::vs_sample() (which already checks p this way) is extended to call variogram_score_multivariate() with w alone, w_vs alone, and both together. Each result is compared per group against scoringRules::vs_sample() with the same weights, and the single-weight results are checked to differ from the unweighted score.
  • tests/testthat/test-class-forecast-multivariate-point.R: new test calling variogram_score_multivariate_point() with w_vs, compared against scoringRules::vs_sample() per group and checked to differ from the unweighted score. (The point version has no w argument; it always uses w = NULL.)
  • NEWS.md: bullet under a new ## Internal changes heading in the development section.

Mutation check: replacing w/w_vs with NULL in the vs_sample() call in R/metrics-multivariate-sample.R and w_vs with NULL in R/metrics-multivariate-point.R makes the multivariate test files fail (FAIL 7); with the real code they pass. Re-run after the review changes, same result.

Implementation: two independent drafts were compared by a judge agent; draft A was chosen as base.

Review

An independent adversarial agent reviewed the PR (verdict: approve, including its own mutation check that reproduced the 7 failures).

Changed in response:

  • The sample-score tests duplicated the setup of the existing matches scoringRules::vs_sample() test line for line. They are now folded into that test as extra expectations, reusing its data and unweighted score (diff shrank from 57 to 43 added lines in that file).
  • This description now states that the adversarial review was done and how it was handled.

Kept / rebutted:

  • Combined w + w_vs case (reviewer called it redundant but harmless): kept as a cheap check that passing both at once is forwarded correctly, which the single-argument cases do not rule out by themselves.
  • NEWS item for a tests-only change (reviewer: possible noise): kept because the project rule asks for a news item on every PR; easy to drop if a maintainer prefers.
  • CI checklist item: left unticked until CI on the latest push finishes.

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. Full suite: [ FAIL 0 | WARN 4 | SKIP 0 | PASS 1049 ].
  • I have added or updated unit tests where necessary. "Fails before / passes after" is N/A: this PR only adds tests for existing behaviour, so there is no pre-change code for them to fail against. The mutation check above shows instead that the tests catch the arguments being dropped.
  • I have updated the documentation if required. N/A: no user-facing change.
  • I have built the package locally and run rebuilt docs using roxygen2. N/A: no roxygen changes.
  • My code follows the established coding standards and I have run lintr::lint_package() to check for style issues introduced by my changes. lintr::lint() on both changed test files: no lints.
  • 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. CI pending on the latest push.

🤖 Generated with Claude Code

nikosbosse and others added 3 commits November 8, 2026 13:10
Compare variogram_score_multivariate() with w, w_vs and both against
scoringRules::vs_sample(), and variogram_score_multivariate_point() with
w_vs, and check that the weighted scores differ from the unweighted ones
so a dropped argument is caught.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reuses the setup of the existing 'matches scoringRules::vs_sample()'
test instead of duplicating it in a separate test block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.18%. Comparing base (779d7d6) to head (959fedf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1245   +/-   ##
=======================================
  Coverage   99.18%   99.18%           
=======================================
  Files          41       41           
  Lines        2331     2331           
=======================================
  Hits         2312     2312           
  Misses         19       19           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nikosbosse

Copy link
Copy Markdown
Collaborator Author

LGTM. @sbfnk, any objections?

@nikosbosse
nikosbosse marked this pull request as ready for review November 8, 2026 13:39
@nikosbosse
nikosbosse requested a review from sbfnk November 8, 2026 13:39

This branch has not been deployed

No deployments
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.

Add a test for variogram w and w_vs parameters.

1 participant