Skip to content

hts fixes with weight values - #279

Merged
Mike Tokic (mitokic) merged 2 commits into
mainfrom
mitokic/09142026/hts-recon-bug-fix
Sep 14, 2026
Merged

Mike Tokic (mitokic) merged 2 commits into
mainfrom
mitokic/09142026/hts-recon-bug-fix

Conversation

@mitokic

@mitokic Mike Tokic (mitokic) commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces an important improvement to hierarchical forecast reconciliation by bounding the ratio between the largest and smallest inverse-error weights, which enhances numerical stability and reduces reconciliation failures. It also updates package documentation to clarify the development version policy and ensures consistency between DESCRIPTION and NEWS.md. The most significant changes are summarized below:

Forecast Reconciliation Improvements:

  • Added a new reconciliation_weights function in R/hierarchy.R to compute inverse-MSE weights for hierarchical reconciliation, enforcing a maximum weight ratio of 1e15 when nonnegative forecasts are required. This prevents numerical issues caused by extreme weight disparities and produces actionable errors for invalid residuals.
  • Updated all reconciliation logic in R/hierarchy.R and R/agent_update_forecast.R to use the new reconciliation_weights function instead of directly computing weights inline, ensuring consistent application of the new bounds and error handling. [1] [2] [3]

Documentation and Policy Updates:

  • Updated NEWS.md to document the reconciliation weight bounding change and advanced the development version section from 0.7.0.9006 to 0.7.0.9007.
  • Bumped the package version in DESCRIPTION to 0.7.0.9006 to match the new development cycle.
  • Clarified the policy for development versioning and release notes in .claude/rules/r-package.md, AGENTS.md, and CLAUDE.md, specifying that only one development-version section should exist in NEWS.md and aligning documentation practices. [1] [2] [3]

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The shared implementation is consistently integrated and comprehensively covers numerical, routing, and failure scenarios.

Pull request overview

Stabilizes nonnegative hierarchical reconciliation by centralizing inverse-MSE weight calculation and capping extreme weight ratios.

Changes:

  • Adds bounded, validated reconciliation weights across standard, grouped, and Agent paths.
  • Adds comprehensive numerical and integration coverage.
  • Aligns package versioning and development-release guidance.
File summaries
File Description
R/hierarchy.R Adds shared bounded-weight logic.
R/agent_update_forecast.R Uses shared weights for Agent reconciliation.
tests/testthat/test-hierarchical.R Covers weighting, errors, topologies, and routes.
NEWS.md Documents the behavioral change.
DESCRIPTION Advances the development version.
.claude/rules/r-package.md Defines development-version policy.
AGENTS.md References the policy.
CLAUDE.md Directs versioning work to canonical guidance.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mitokic
Mike Tokic (mitokic) merged commit 88ce8b4 into main Sep 14, 2026
8 of 12 checks passed
@mitokic
Mike Tokic (mitokic) deleted the mitokic/09142026/hts-recon-bug-fix branch September 14, 2026 20:44
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.

3 participants