Skip to content

Comments

feat: add forecast_multivariate_point class#1115

Open
seabbs-bot wants to merge 4 commits intomainfrom
issue-1112-multivariate-point
Open

feat: add forecast_multivariate_point class#1115
seabbs-bot wants to merge 4 commits intomainfrom
issue-1112-multivariate-point

Conversation

@seabbs-bot
Copy link
Collaborator

Summary

  • Adds forecast_multivariate_point class with constructor, assertion, scoring, and metric methods following the forecast_multivariate_sample pattern
  • Adds variogram_score_multivariate_point() metric that wraps scoringRules::vs_sample() treating point forecasts as single-sample ensembles
  • Updates transform_forecasts() to correctly dispatch multivariate point types when recomputing .mv_group_id

Closes #1112

Test plan

  • Constructor tests with renamed columns and expected structure snapshots
  • is_forecast_multivariate_point() positive/negative checks
  • get_metrics() returns expected metric list
  • score() produces numeric variogram scores with snapshot output
  • Error cases for missing joint_across and invalid columns
  • Full test suite passes (720 tests, 0 failures)
  • All changed files lint clean

This was opened by a bot. Please ping @seabbs for any questions.

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.95%. Comparing base (42904b0) to head (fd26084).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1115      +/-   ##
==========================================
+ Coverage   97.87%   97.95%   +0.07%     
==========================================
  Files          35       37       +2     
  Lines        1881     1953      +72     
==========================================
+ Hits         1841     1913      +72     
  Misses         40       40              

☔ View full report in Codecov by Sentry.
📢 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.

@seabbs-bot
Copy link
Collaborator Author

Review of PR #1115

Overall this is a clean implementation that follows existing patterns well. A few items to consider:

Unnecessary nolint comments

  1. R/class-forecast-multivariate-point.R:202# nolint: line_length_linter on score.forecast_multivariate_point. The line is 95 chars without the nolint comment, well under the 120-char limit in .lintr. The nolint is self-defeating (adds length). The equivalent score.forecast_multivariate_sample line has no nolint.

  2. R/metrics-multivariate-point.R:18# nolint: object_name_linter line_length_linter on the variogram_score_multivariate_point function signature. The line is ~104 chars without the nolint (under the 120-char limit). And object_name_linter is set to NULL in .lintr, so it is disabled project-wide. The equivalent energy_score_multivariate function has no nolint at all.

Inherited docs mismatch

variogram_score_multivariate_point uses @inheritParams ae_median_sample and @inheritParams assert_input_multivariate_sample. This inherits a predicted parameter description that says "nxN matrix of predictive samples, n (number of rows) being the number of data points and N (number of columns) the number of Monte Carlo samples". For a point forecast wrapper where N is always 1, this is misleading. Consider writing a custom @param predicted that describes the actual input (a numeric vector or single-column matrix of point predictions).

transform-forecasts.R change

The generalisation from hardcoded as_forecast_multivariate_sample to dynamic dispatch via paste0("as_forecast_", forecast_type) is a good fix — it mirrors the pattern already used in the else branch and is necessary for the new class to work with transform_forecasts(). Looks correct.

Everything else looks good

  • The "single-sample ensemble" approach for variogram scoring of point forecasts is sound
  • Correct to omit the w (sample weights) parameter since it's meaningless with a single sample
  • w_vs correctly maps to the variogram weight matrix in scoringRules::vs_sample()
  • Test coverage is solid: creation, structure, type checking, metrics, scoring, error cases, snapshots
  • Score method correctly simplifies the sample version by dropping the split-by-sample-length logic

- Remove unnecessary line_length_linter nolint
- Replace inherited param docs with point-forecast-specific descriptions
- Add test for check_input_point failure path (coverage)
- Add NEWS.md entry
- Extract ensure_mv_grouping() for shared constructor logic
- Extract score_multivariate_apply() for shared scoring logic
- Use @inheritParams for joint_across and forecast_unit docs
- Simplify transform_forecasts.R to single constructor call path
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.

This looks good to me. Note a few related issues.

@seabbs seabbs requested review from nikosbosse and sbfnk February 16, 2026 18:07
@seabbs
Copy link
Contributor

seabbs commented Feb 16, 2026

@nickreich for awareness

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 forecast_multivariate_point class for multivariate point forecasts

2 participants