Repository navigation
Conversation
fit_partial_models(), fit_full_models() and trans_pred_data_v() take id_period_anterior, create_alloc_params_t() takes id_period_post, so the last observed transition can be held out of calibration and used for a backcast. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FGUMMMQKK6iCRSBxmhR3xo
…allant-dijkstra-93w9qx
MERGE had a 'when matched then update set' with an empty assignment list, which DuckDB rejects; such a table now only inserts the unmatched rows. trans_preds_t is one such table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FGUMMMQKK6iCRSBxmhR3xo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FGUMMMQKK6iCRSBxmhR3xo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FGUMMMQKK6iCRSBxmhR3xo
This branch has not been deployed
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.
Two changes, both needed by the evoland-experiments
2026-05-ssp-chrework: its backcast now holds the last observed transition out of calibration.Period filters
Model fitting and allocation-parameter estimation can now be restricted to a subset of the observed periods, so the last observed transition can be held out and backcast out of sample.
trans_pred_data_v(id_trans, id_pred, id_period_anterior = NULL)restricts the training rows to these anterior periods. The filter is applied ininst/trans_pred_data.sql, after the existing "drop the last period" window.fit_partial_models(..., id_period_anterior = NULL)andfit_full_models(..., id_period_anterior = NULL)pass it through, in direct-learner and score-select mode. In score-select mode it should match what was passed tofit_partial_models().create_alloc_params_t(id_period_post = NULL)estimates only from the period pairs that end in these periods.NULLkeeps the current behaviour everywhere. The new arguments are checked with theis_integerish()predicate from #82.commit_upserton tables whose columns are all keysFor a table with no non-key columns,
MERGEwas generated withwhen matched then update setand an empty assignment list, which DuckDB rejects. Such a table now only inserts the unmatched rows.trans_preds_tis one: upserting a second run's predictor selection failed. Separately,trans_preds_t's active binding uses"overwrite", unlike the other per-run tables, sodb$trans_preds_t <- xreplaces every run's rows. That is left as is here; it may be worth a follow-up.Tests
test_db_evoland.R:trans_pred_data_v()withid_period_anteriorreturns only those anterior periods;create_alloc_params_t()with an empty period selection errors.test_integ_trans_models_t.R:fit_partial_models()with a hold-out scores fewer rows than without one.test_db_ducklake.R: upserting into a key-only table inserts the new rows and keeps the matched ones.tinytest::test_package("evoland", at_home = TRUE): all ok, 662 results. The branch hasdevelopmerged in, so the diff is just these two changes.Generated by Claude Code