Skip to content

Read the fitted models' objective with xgb.config() - #34

Merged
eliotmcintire merged 1 commit into
developmentfrom
fix/xgboost-objective
Oct 17, 2026
Merged

eliotmcintire merged 1 commit into
developmentfrom
fix/xgboost-objective

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

Every prediction run (hindcasts and NRV) stopped at the ignition step, because the fitted models' objective was read the old way and the current xgboost no longer stores it there. The objective is now read with xgboost's own function.

Affects: prediction runs with xgboost 3.x fitted models now run; results are unchanged.

Technical details

Defect: fitObjective() (fireSense_ignitionPredict.R:275) read model$params$objective; a reloaded xgboost 3.x booster is a pointer object with no $params, so it stopped with "cannot read the objective". It now uses xgboost::xgb.config(model)$learner$objective$name, falling back to attr(model, "params")$objective, and keeps the error (message now names both). xgboost (>= 3.0.0) added to reqdPkgs. No other xgboost internals are read in this module or in fireSense_burn development.

Tests: new test-xgboost-objective.R trains real boosters, round-trips them through saveRDS/readRDS, and checks the objective and the mixed-objective error; it fails on development and passes here. The toy fold stand-ins now keep the objective in attr(, "params"), as real models do. Module tests via convertToPackage() + test_local(): development plus the new test 35 pass / 2 fail; this branch 37 pass / 0 fail.

🤖 Generated with Claude Code

https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6

@eliotmcintire eliotmcintire added bug Something isn't working backwards compatible Existing code and results keep working unchanged labels Oct 17, 2026
@eliotmcintire
eliotmcintire merged commit 74fb5e9 into development Oct 17, 2026
9 checks passed
@eliotmcintire
eliotmcintire deleted the fix/xgboost-objective branch October 17, 2026 04:18
eliotmcintire added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards compatible Existing code and results keep working unchanged bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant