Skip to content

Pre-release fixes: AgentLib export of isolated lags, online training, CMNN layers; ruff format - #91

Merged
PatrickHenkel1 merged 3 commits into
refactoring_v1.0.0from
v1/pre-release-fixes
Nov 8, 2026
Merged

PatrickHenkel1 merged 3 commits into
refactoring_v1.0.0from
v1/pre-release-fixes

Conversation

@PatrickHenkel1

Copy link
Copy Markdown
Collaborator

Fixes from the review of the release candidate (after #90), plus a one-time formatting of the whole code.

Fixes (466eee7)

  1. AgentLib-MPC export of isolated lags. check_agentlib_compatibility now rejects lag groups that do not start at lag 0 (e.g. ['u', 'T_lag1']). AgentLib-MPC accepts such configs without an error, but only counts the inputs of a feature and passes its values from lag 0 on: for T_lag1 the MPC would feed T(k) instead of T(k-1), and for u_lag1 it would pass u, u_1 (shape mismatch at runtime). physXAI itself still trains with isolated lags (e.g. a dead time u_lag3); only the export needs the complete group. A contract test documents how AgentLib-MPC translates these configs.
  2. ModularANN.online_pipeline with warm start. With a normalized px.Linear holding data-only terms (warm start on by default), the online pipeline crashed (AttributeError, no build context). If it had run, the warm start would have overwritten the loaded weights. A loaded model is now trained further from its own weights.
  3. PCNN parameters after online training. The trained rates, consistency_margin and td.physics['initial_rates'] were computed with initial rates estimated again from the current data, not with the ones built into the loaded model. Reproduced: 3.72 K/h reported, 1.24 K/h in the model. They are now read from the model's constant_pcnn_scale_<j> layers.
  4. Monotone networks need a hidden layer. With n_layers=0, CMNNModel, PINNModel and px.MonotoneMLP only had the non-negative weights of the output layer, so the prediction was increasing in every input, also with monotonicity -1. n_layers >= 1 is required now (also checked in the constructor, before the preprocessing).

CHANGELOG entries for 1 and 4; 2 and 3 concern features that are new in 1.0.

Formatting (dca1edb, 48249ef)

  • ruff format (0.17.4) on the package, tests, examples and the code block in the README. Only formatting, ruff check is still clean.
  • quality.yml also runs ruff format --check .. The ruff version is pinned there and in .pre-commit-config.yaml (v0.17.4), since the formatting can change between ruff versions. dev extra: ruff>=0.17.4.
  • .git-blame-ignore-revs lists the formatting commit; GitHub skips it in blame automatically (locally: git config blame.ignoreRevsFile .git-blame-ignore-revs).

The formatting commit touches 50 files: open PRs based on refactoring_v1.0.0 will conflict and are easiest to reformat before merging.

Checks (local, Windows, Python 3.12)

  • pytest: 272 passed, 1 skipped (RNN contract test, AgentLib-MPC main without RNN support)
  • tests/smoke_examples.py: 13/13 examples OK
  • ruff check physXAI tests examples, ruff format --check .: clean
  • Sphinx (sphinx-apidoc + sphinx-build -W, Sphinx 6.2.1): no warnings

🤖 Generated with Claude Code

PatrickHenkel1 and others added 3 commits November 8, 2026 16:15
…ing of ModularANN and PCNN, CMNN layers

- check_agentlib_compatibility rejects lag groups without lag 0 (e.g. ['u', 'T_lag1']): AgentLib-MPC accepts them
  but passes the values from lag 0 on (T(k) instead of T(k-1)). physXAI itself keeps isolated lags.
- ModularANN.online_pipeline: no warm start for a loaded model (crashed without build context, would overwrite the
  loaded weights).
- PCNN: trained parameters, consistency margin and initial rates are read from the model (constants built into it),
  not from rates re-estimated on the current data (wrong after online_pipeline on other data).
- CMNNModel, PINNModel and px.MonotoneMLP need n_layers >= 1: without a hidden layer the prediction was increasing
  in every input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ality.yml

Only formatting, no change of the code. The ruff version is pinned in quality.yml and .pre-commit-config.yaml,
since the formatting can change between ruff versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 8, 2026 15:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@PatrickHenkel1
PatrickHenkel1 merged commit 633e091 into refactoring_v1.0.0 Nov 8, 2026
28 checks passed
@PatrickHenkel1
PatrickHenkel1 deleted the v1/pre-release-fixes branch November 8, 2026 16:01
@PatrickHenkel1 PatrickHenkel1 mentioned this pull request Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants