Repository navigation
v1.0.0: PINN with one output and normalized loss terms, missing splits, no legacy code - #79
Merged
Conversation
…gacy code
- PINNModel(physics_targets={'pinn': w}): physics targets are loss columns (PreprocessingData
loss_columns, from model.required_loss_columns), the model has one output and is exportable;
loss mse/s + sum w_i mse_i/s with s = var(y_train), not averaged; per-term metrics and history;
early stopping on the validation data loss; MetricsPINN with a physics block
- fixes: swapped loss arguments, stateful RMSE inside the loss, halved data weight, rescaling over
physics columns, test_size=0 for single step data, px.Linear(bias=False) warning, nominal_range check
- removed 0.x compatibility: recursive_feature_elimination_pipeline/save_result (-> result.save),
flat metrics (-> by_output, kpi()), td.columns/td.output, pinn_weights/multi_y_loss, init_layer,
init_features, warmup_columns_*, batch_size of PreprocessingMultiStep; unknown arguments raise
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.
This was referenced Nov 6, 2026
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.
This PR is stacked on #78 (CI/Sphinx): until #78 is merged, the diff also contains its changes. It reworks the PINN, fixes training on data without a test split, and removes the 0.x compatibility code.
PINN: one output, normalized loss terms
The ideas come from branch 67-pinns (normalizing the terms, per-term metrics, early stopping on the data loss) and were implemented anew.
Physics targets are loss columns, not outputs.
PreprocessingData(loss_columns=...)holds columns that are used only in the loss:'y:name'is the value at the predicted time,'name'the value at the time of the inputs.required_loss_columns.Loss:
w_iis the relative importance of term i.Training and evaluation:
physXAI.models.ann.pinn.physics).data_loss,<target>_lossandrmse.val_data_lossby default (early_stopping_on='total'is the alternative).td.metrics.physicsholds the disagreement with each physics target per split.Alignment (documented and tested): physics targets are taken at the predicted time, like the output. For a step model with
Change(T), the column is shifted with.lag(1). On the simulated room, the exact physics then equals the target.P_hp_pinn.py(50 epochs): R² train/val/test = 0.84 / 0.83 / 0.80.Bugs fixed
multi_y_losscalledloss(y_pred, y_true), which is wrong for asymmetric losses.test_size=0(from branch 14):X_test/y_testwere empty arrays instead ofNone, and the evaluation predicted on an empty set. Now every model skips a missing split (single step, horizon, PINN, RNN, report,Run.save,ModelComparison), tested with(test, val) ∈ {(0, .2), (.2, 0), (0, 0)}.px.Linear(bias=False)with normalized inputs now warns: the centring acts as a bias.nominal_rangemust now be ordered (min, max).Legacy removed (major release)
recursive_feature_elimination_pipeline,save_resultFeatureSelection(...).run(path),result.save(run)train_kpis/val_kpis/test_kpis,get_metrics()by_output,td.metrics.kpi('test', 'rmse')td.columns,td.outputtd.inputs,td.outputsPINNModel(pinn_weights),multi_y_loss,output=['y', 'pinn']physics_targets,output='y'init_layer,init_features,warmup_columns_*,PreprocessingMultiStep(batch_size)TypeError)Kept on purpose:
.kerasfiles.ModelComparison(requested).split='random_rows'as a comparison option.The migration guide and the CHANGELOG are updated.
Tests
unittests/test_models/test_pinn.py:RecursiveTraining, PINN, RNN and the comparison.🤖 Generated with Claude Code