Repository navigation
fix: fit rows in time order to avoid an INLA crash, and release 0.1.7 - #12
Merged
Merged
Conversation
…fect Release 0.1.5.
mortenoh
force-pushed
the
fix/sort-rows-before-fit
branch
from
October 15, 2026 15:02
01b4194 to
d1185ac
Compare
Contributor
|
Rebased onto main (1a7f8e4), which now has #10 (MLproject, chapkit 2.4.0, 0.1.5) and #13 (
After the rebase, all local targets pass: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With the s2 fix in 0.1.4, the model gets past the adjacency graph on the Vietnam benchmark dataset, but one backtest window (training to 2010-06, forecasting 2010-07 to 2010-09) then crashes inside INLA:
The crash is an INLA problem (25.10.19), triggered by the iid year effect and dependent on row order and thread count.
disease_cases ~ 1 + f(year_id, model = "iid")alone crashes on those rows in the orderpredict.Rbuilds them (by location, forecast rows appended), with 1 or 4 threads; the same rows sorted by year, shuffled, or fitted with 16 threads work. Investigation, reproduction script and data: https://dhis2.atlassian.net/browse/CLIM-1444The rows are independent observations in the likelihood, so their order does not change the model.
predict.Rnow puts them in time, then location order just before the fit, with the forecast flag carried along, so the forecast rows are still the ones sampled and written out.scripts/lib.R:order_for_fit().scripts/predict.R: calls it right beforefit_models(), after the lags and rolling windows are derived per location.tools/test_lib.R: checks the order and that the forecast flag follows its rows.main.py: version 0.1.5. Draft PR feat: add an MLproject generated from main.py and bump the version to 0.1.5 #10 will need 0.1.6.This sidesteps the INLA bug rather than fixing it; a newer INLA or an upstream report is followed up in the Jira issue above.
Test plan
tools/test_lib.Rpasses.monthly_climateoptions in the 0.1.4 image with this branch'sscripts/mounted: all six train and predict. Before, the 2010-06 window crashed. The output rows match the forecast input.make test-localinputs) still trains and predicts.