Repository navigation
physXAI 1.0.0 – Phase 3: recursive multi step evaluation and training - #73
Merged
Merged
Conversation
…models - physXAI.evaluation.rollout: recursion derived from the names (Change(X) / X and lags), RecursiveCell (keras RNN cell around the step model) with recomputation of derived columns depending on the recursive feature, RMSE / MAE / bias per step of the horizon for every split - Single step models evaluate the horizon automatically with PreprocessingSingleStep(eval_horizon='24h'); horizon plot - physXAI.training.RecursiveTraining: training on the multi step error with weighted first step, modes single_then_multi / multi_step, also as fine tuning of OLS solutions; the saved model stays a single step model - Fixes: in-place writes of the legacy multi step evaluation, BuildContext id reuse, early stopping without validation data, seeding at creation - Example TAir_recursive.py, tests for exact rollouts, recomputed columns, bias, lags, absolute outputs and the recursive training Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Open
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.
Phase 3 of the physXAI 1.0.0 refactoring, the core feature: single step models are evaluated and trained over a horizon, as in an MPC. Stacked on #72 (base
v1/phase-2-expr).Summary
physXAI.evaluation.rollout):PreprocessingSingleStep(..., eval_horizon='24h')applies every single step model recursively on windows of the val/test/train data.Change(T)orTwith inputTand its lags.td.horizon_metricsand{name}_training_data.json, and plotted over the horizon in hours.vTfrom their expressions. This was impossible with constructed features.RecursiveCellis a keras RNN cell around the step model and is differentiable. scikit-learn linear regressions are wrapped as a frozen dense layer.recursive_training=RecursiveTraining(horizon='24h', first_step_weight=0.25, mode='single_then_multi').ModularANN(solver='ols')can serve as the initialization.executables/bestest_hydronic_heat_pump/TAir_recursive.py(physics terms plus a residual MLP).Results on the BOPTEST data (test split, 12 h horizon)
The single step RMSE is nearly identical for both (0.038 / 0.037). Only 14 days of data, i.e. 4 test windows, so the numbers are indicative.
Fixes
BuildContextcached tensors byid()of temporary expressions, which Python reuses (wrong tensors).val_losswithout validation data; seeds were set at object creation.Test plan
pytest: 102 passed. New tests cover exact rollouts (error < 1e-3 over the horizon), comparison with a hand-written recursion including the recomputedvT, an offset showing up as an accumulating bias, lags and absolute outputs, step weights and both training modes.🤖 Generated with Claude Code