SysIdentPy electromechanical generator: parallel NARX/NARMAX identification audit
On real measurements from a coupled DC motor–generator bench, how accurately do distinct nonlinear system-identification paradigms (FROLS, MetaMSS, Entropic Regression, Bayesian NARX-ARD and tree/neighbour NARX baselines) predict multi-step free-run (infinite-horizon) dynamics without teacher forcing, and do their residuals pass nonlinear whiteness and input–residual independence tests?
Nine AkôFlow activities identify six model families in parallel from the same leakage-free split and compare them. Tracked in community-explorer #804. Every figure below is produced by the workflow's gallery activity from the real run.

Animation: free-run rollout stepping along the 495-sample validation horizon. The parametric polynomial models (MetaMSS, FROLS) stay on the measured generator output, while the tree-based NARX rollouts accumulate error.
Free-run simulation on the validation data

Top: parametric models (MetaMSS, FROLS, Entropic Regression, NARX-ARD). Bottom: tree/neighbour NARX baselines. All are free-run, i.e. without teacher forcing, converted back to physical units.
Error by model family

| Model | Free-run RRSE | 1-step RRSE | Terms | Reference free-run RRSE (SysIdentPy v0.9.1 notebook) |
|---|---|---|---|---|
| Entropic Regression (ER) | 0.031087 | 0.019309 | 17 | not in the MetaMSS notebook |
| MetaMSS (RLS λ=0.95, scaled) | 0.031354 | 0.022595 | 32 | 0.031354 (1-step 0.022595) |
| MetaMSS (RLS λ=0.98, scaled) | 0.035944 | 0.021008 | 32 | 0.035944 (1-step 0.021008) |
| MetaMSS (RLS λ=0.98, unscaled) | 0.049762 | 0.036028 | 33 | 2.184406 (not reproduced) |
| NARX-ARD | 0.073927 | 0.027896 | – | 0.073927 |
| FROLS-Polynomial_NARX (BIC) | 0.080256 | 0.042191 | 9 | 0.080256 |
| NARX-KNeighborsRegressor | 0.165875 | 0.174823 | – | 0.165875 |
| NARX-RandomForestRegressor | 0.264727 | 0.140768 | – | 0.262959 |
| NARX-DecisionTreeRegressor | 0.413217 | 0.231870 | – | 0.413217 |
Six of the eight rows that have a notebook reference match it to six decimals. The RandomForest is 0.7% above the notebook value, and the notebook's unscaled MetaMSS row (free-run RRSE 2.18, unstable) was not reproduced: in this environment the unscaled model reached 0.0498. The issue anticipated platform floating-point sensitivity in MetaMSS; the audit reports the difference instead of hiding it.
Structure selection and residual diagnostics

Top: FROLS selects 9 terms by BIC; MetaMSS reaches its best loss in the first iterations. Bottom: share of correlation lags outside the 95% bound (±0.0623) for each model.
Do the residuals satisfy the whiteness tests? No, for no model. Share of lags outside the 95% bound, residual autocorrelation: MetaMSS 21%, Entropic Regression 42%, NARX-ARD 55%, FROLS 72% (RandomForest 6%, DecisionTree 12%, but with much larger errors). Input–residual cross-correlation: 20–27% of lags for every model. Low free-run error therefore does not imply white residuals on this bench.
Acceptance checks (fixed by the issue before execution)
| Check | Result |
|---|---|
500/500 split after ::500 decimation; 495 evaluated points | passed |
| MetaMSS free-run RRSE < 0.045, within 0.005 of 0.03135 | passed (0.031354) |
| MetaMSS one-step RRSE < 0.030 | passed (0.022595) |
| FROLS and NARX-ARD free-run RRSE < 0.10 and below the DecisionTree | passed |
| DecisionTree free-run RRSE > 0.25 | passed (0.413217) |
| Identical outputs across 1-slot and 6-slot runs | passed: all 23 output hashes match |
| Unscaled MetaMSS (λ=0.98) RRSE > 0.5 or divergence | not met (0.0498), see above |
Workflow (9 activities)
stage-inputs verifies the SHA-256 of the two CSVs, decimates by 500, splits 500/500 and fits the scalers on the training split only → six independent identify-* activities (metamss, frols, er, ard, rf, knn-dt) → audit ranks the models and checks the acceptance criteria → gallery renders the figures and the animation.
Polynomial NARX models of degree 2 with xlag = ylag = 5, random_state = 42 wherever the library takes a seed. Output files (SHA-256 in provenance.json): benchmark_comparison.csv, validation_report.json, identify_*.json, pred_*.csv, prepared_generator_split.npz, staged-manifest.json, the three figures and the animation.
Adaptations to the reference notebooks: the Entropic Regression branch uses lags 5 (its notebook uses 6) and the train-only scaled data (the notebook uses unscaled data); the optional CatBoost branch was omitted to keep the image small.
Measured AkôFlow execution
Profile executed: Local environment (Docker, local daemon on a home server), 6 single-vCPU slots of 2 GiB. No cloud (GCP or other) profile was executed or configured.
| Run | Slots | Status | Makespan |
|---|---|---|---|
community-sysident-narx-6slot-r2 (reference) | 6 | completed, 9/9 activities | 67.28 s |
community-sysident-narx-1slot-r2 | 1 | completed, 9/9 activities | 108.17 s |
Measured timeline of the six-slot run (seconds from the first activity start): stage-inputs 0.00–2.34; identify-ard 4.15–7.97; identify-er 4.39–55.24; identify-frols 4.67–9.84; identify-knn-dt 5.13–8.94; identify-rf 5.35–17.97; identify-metamss 5.91–18.19; audit 58.67–58.80; gallery 60.43–67.28. All six identification branches ran at the same time from 5.91 s to 7.97 s.
The speedup is about 1.6× (108.17 s to 67.28 s) from a single repetition of each run, so it is indicative only. It is bounded by the Entropic Regression branch (about 51 s), which sits on the critical path. The issue's estimate of under 45 s was not met for this reason.
Data and sources
- Experimental bench data:
wilsonrljr/sysidentpy-data, commit4085901293ba5ed5674bb2911ef4d1fa20f3438d(MIT):datasets/generator/x_cc.csv(SHA-256673e1550f82f83f73d7370fba29d2fdf117740dea27832567efa80bd86417fae) andy_cc.csv(SHA-25645f87a54ccb1a478a5f813e9adf80240844ce5a23a9e5a983850fbbcdceaafb5). Both hashes were verified at image build and again instage-inputs. - Software: SysIdentPy 0.9.1 (BSD-3-Clause), following
electromechanical-system-identification-metamss.ipynb,-overview.ipynband-entropic-regression.ipynb. - Protocol: decimate by 500 (1,000 samples from ~500,000), split 500 identification / 500 free-run validation samples, scalers fitted on the training split only, evaluation from index
max_lag = 5. Other protocols of the overview notebook use a different slice and must not be mixed with these numbers.
Resources and reproducibility
- Per activity: 1 vCPU, 2 GiB RAM limit, no GPU. Linux amd64.
OMP_NUM_THREADS=OPENBLAS_NUM_THREADS=MKL_NUM_THREADS=1. - Python 3.12.16, sysidentpy 0.9.1, scikit-learn 1.9.1, numpy 2.3.5, scipy 1.18.1, pandas 3.1.2, matplotlib 3.11.2, pillow 13.0.0 (pinned versions, not hash-locked).
- Base image
python:3.12-slim-bookworm@sha256:44cf1793efa7c7a476bb0f2cff81443f4a072c90c1cb127e2924933daa3e8c64. - Portable AkôFlow build recipe
recipe-build-cc20eac1fe8b2f08550754135f337567f4d1270ea05aa20c4feec256a69a2717; context digestsha256:a91b794ff0e75c4c4d78e0265ad7eb5ca9e2644834a8353bcf6bb2f4ba47f55a; Dockerfile digestsha256:a74869fae5d8638e70f0d3c341057588c943e4a7521f19fa3df0fe992f824795. The built-image digest was not exposed by the API. - The AkôFlow daemon version was not exposed by the API, so it is not recorded.
- Workflow source and Dockerfile: akoflow-examples / system-identification / sysidentpy-electromechanical-narx.
- Evidence (figures, animation, output hashes, raw run records): evidence/reference.
Papers and authors
- Wilson Rocha Lacerda Junior, Luan Pascoal Costa da Andrade, Samuel Carlos Pessoa Oliveira and Samir Angelo Milani Martins (2020). SysIdentPy: A Python package for System Identification using NARMAX models. Journal of Open Source Software, 5(54), 2384. doi:10.21105/joss.02384.
- Wilson R. Lacerda Junior, Samir A. M. Martins, Erivelton G. Nepomuceno and Márcio J. Lacerda (2019). Control of Hysteretic Systems Through an Analytical Inverse Compensation Based on a NARX Model. IEEE Access, 7, 98228–98237. doi:10.1109/ACCESS.2019.2926057. Experimental bench from GCOM, Universidade Federal de São João del-Rei (UFSJ), Brazil.
- Companion book: Wilson Rocha Lacerda Junior et al., Nonlinear System Identification and Forecasting: Theory and Practice With SysIdentPy.
The authors' notebooks and figures are linked, not redistributed; every figure above was generated by this workflow.