GreenBox

Polynomial system identification with a low-complexity (Green) criterion

Starting Python runtime…
System identification · Green computing

Models that are accurate
and cheap to run.

GreenBox learns dynamic models of a system from measured input and output data and, besides the most accurate model, finds Green models that need far fewer arithmetic operations at every sample, saving computation, energy and CO₂e.

01Identify

NARX, NARMAX, ARX, FIR and Volterra models. Candidate terms are ranked by how much of the output they explain; structure and size are chosen by free-run simulation.

02Weigh the cost

Every term costs additions and multiplications. Decision methods on the Pareto front of accuracy and complexity each pick one model.

03Compare

All models are validated on unseen data and placed on the complexity–error plane, with execution time and CO₂e per sample.

Interactive example

Choose a decision method and weight

A nonlinear system with known equation, excited by random steps and measured with noise (σ = 0.02). 600 samples identify the models, 400 unseen samples validate them.

cost accuracy

Pareto front on the test part

Free-run simulation on validation data

True system

Identified Green model

Learn more · model families

Polynomial model families

All families in GreenBox write the output as a sum of candidate terms (regressors) φi, each a product of lagged signals, multiplied by an unknown coefficient θi:

y(k) = Σi θi φi(k) + e(k),   e.g. φ = y(k−1), u(k−2), y(k−1)·u(k−1), u(k−1)², …

The model is nonlinear in the signals but linear in the parameters, so θ is estimated by least squares, and the structure (which terms to keep) is chosen with the forward orthogonal least squares algorithm and the Error Reduction Ratio (ERR), the fraction of output variance explained by each term [Kor88] [Bil89] [Che89]. General references are the books by Ljung [Lju99] and Billings [Bil13]. The families differ only in which signals and powers may appear.

FamilyPast outputs yNonlinear termsNoise model eTypical use
FIRnononolinear, stable systems with short memory
ARXyesnonolinear dynamics, compact models
ARMAXyesnoyeslinear dynamics with coloured noise
Volterranoyesnononlinear systems with fading memory, no feedback
NARXyesyesnogeneral nonlinear dynamics
NARMAXyesyesyesnonlinear dynamics with coloured or nonlinear noise

FIR: finite impulse response

y(k) = θ0 + Σj=0..nu bj u(k−j)

The output is a weighted window of past inputs: the truncated impulse response of a linear system. FIR models are always stable and easy to estimate, but need many lags when the system responds slowly, because they have no output feedback [Lju99].

ARX and ARMAX: linear models with output feedback

y(k) = Σi ai y(k−i) + Σj bj u(k−j) + e(k)  [+ Σl cl e(k−l) for ARMAX]

Feeding back past outputs captures slow or oscillatory dynamics with a few coefficients. ARMAX adds a moving-average model of the noise, which avoids biased parameters when the disturbance is coloured [Lju99].

Volterra series (truncated)

y(k) = h0 + Σj h1(j) u(k−j) + Σj₁≤j₂ h2(j₁,j₂) u(k−j₁) u(k−j₂) + …

The nonlinear extension of the impulse response: kernels of increasing order multiply products of past inputs. It represents systems with fading memory without output feedback [Sch80], but the number of terms grows quickly with degree and memory, which is exactly where a complexity criterion matters.

NARX and NARMAX

y(k) = F[ y(k−1), …, y(k−ny), u(k−1), …, u(k−nu), e(k−1), …, e(k−ne) ] + e(k)

The Nonlinear AutoRegressive Moving Average model with eXogenous inputs represents a wide class of discrete-time nonlinear systems [Leo85] [Bil13]. With F a polynomial of degree ℓ, it contains all the families above as special cases. NARX drops the noise terms. In NARMAX the e(k) terms form a noise model, estimated iteratively from the residuals (extended least squares); it removes bias from the process parameters, but e(k) is set to zero in free-run simulation.

Choosing the structure

Keeping too many terms gives over-parametrised models that fit the data but can show spurious dynamics or diverge in simulation [Agu95]. The classical procedure ranks terms by ERR and chooses the size with an information criterion such as AIC [Aka74], computed on one-step-ahead residuals. Because a good one-step predictor is not necessarily a good simulator, GreenBox by default selects the size and structure by free-run simulation error on test part of the estimation data, in the spirit of simulation-error-based selection [Pir03]. Residual correlation tests check the final model [Bil83], and the same reference proposes the ry′y′² test GreenBox uses to detect nonlinearity.

GreenBox identifies only Green models, one per decision method on the Pareto front of test error and complexity [Cha83]. With the structure search on, the Green search visits structures (degree and lags) on the estimation data; for every structure, candidate models from several term orders are simulated on the test part of the estimation data, and all of them form the Green candidate set. A candidate is admissible when it does not diverge and reaches a minimum test R² (0.75 by default, the "very good" level NSE > 0.75 of [Mor07]; free-run R² is the NSE). With the simulation error E and the complexity C scaled to 0–1 over the admissible candidates, each method picks one of them: the cheapest (min C); the ε-constraint (the cheapest with E ≤ ε, ε = 0.5 by default); compromise programming, the candidate closest to the ideal point (E, C) = (0, 0) with the distance (wEpEp + wCpCp)1/p for p = 1 (weighted sum), p = 2 (Euclidean) and p = ∞ (Tchebycheff, max(wEE, wCC)), with equal weights by default; and the most accurate (min E). Ties go to the cheaper candidate. Every method returns a Pareto-optimal candidate: when several methods agree, the choice does not depend on the decision rule. The classical Green procedure, which ranks terms and chooses the size from the one-step error reduction, remains available as an option.

The reference model. The most accurate Green model ignores cost. The results report the change in complexity and in validation error of every Green model relative to it.

Example systems

All examples are measured data from real systems. The DC motor comes from the SysIdentPy package [Lac20]; the others are benchmarks of the nonlinear system identification community, distributed at nonlinearbenchmark.org [NLB]. Please cite the original reference when you use them. The source of the loaded example is also shown under the data plot and under the results. Because these data belong to their authors, GreenBox does not export the measured signals of the examples: the Data button of those figures opens the original source instead, where the data can be obtained under their own terms. Figures, models and results can be exported as usual.

DC motor

Angular velocity of a DC motor driven by a two-level (0/5 V) input, the case study distributed with the SysIdentPy package [Lac20]. The data are decimated by 500 (500 samples); the first 250 are used for estimation and the rest for validation, as in the original Green-Box study [Naz23]. Because the input takes only two values, u² = u after scaling, so such terms are redundant. The response is clearly nonlinear: the best polynomial model simulates with about 90% less error than the best linear one.

Silverbox

An electronic circuit that emulates a mass–spring–damper with a cubic hardening spring (a Duffing oscillator), measured at about 610 Hz [Wig13]. GreenBox uses 10 000 samples of the filtered Gaussian excitation for estimation and 20 000 samples of the multisine experiments for validation. The nonlinearity is mild but essential: linear models reach R² ≈ 0.90, cubic NARX models above 0.99. The estimation signal is small and barely excites the nonlinearity (on the test part even linear models reach R² ≈ 0.999), so a structure chosen on estimation data alone can be less accurate on the larger validation signals: the example therefore starts from the structure listed below. Source: nonlinearbenchmark.org [NLB].

EMPS (electro-mechanical positioning system)

A prismatic joint of an industrial robot, driven by a DC motor through a ball screw, with nonlinear friction. The input is the motor force and the output is the position of the carriage. GreenBox uses the estimation and test records of the benchmark, decimated from 1 kHz to 100 Hz (2485 samples each) [Jan19]. Because the position integrates the velocity, long output lags are needed. Source: nonlinearbenchmark.org [NLB].

Three-story structure (LANL)

An aluminium frame of three floors on rails, excited at the base by an electrodynamic shaker, built at Los Alamos National Laboratory for structural health monitoring [Fig09]. The input is the shaker force and the output is the acceleration of the third floor, sampled at 320 Hz (8192 samples). GreenBox uses the undamaged state: test 1 for estimation and test 2 for validation. Autoregressive models of such responses are the standard damage-sensitive features of this data set; a cheap and accurate reference model is what a monitoring system evaluates continuously.

Wiener–Hammerstein

An electronic circuit made of a linear filter, a static diode-based nonlinearity and a second linear filter (a Wiener–Hammerstein block structure), excited by filtered Gaussian noise and sampled at 51.2 kHz [Sch09]. GreenBox uses the first 10 000 samples of the estimation record for estimation and the first 20 000 samples of the test record for validation. Source: nonlinearbenchmark.org [NLB].

Recommended structure of each model family

For every example and family, tools/tune_examples.py tried a grid of degrees and lags and kept the smallest structure whose classical model (terms ranked by ERR, size by free-run simulation) is within 0.005 of the best validation R². Loading an example sets the NARX structure below (with Use the structure from step 2); choosing another family in step 2 sets that family's structure. Values: degree d, output lags ny, input lags nu, noise lags ne, and the validation R² and number of terms of that model.

References

  1. [Agu95] L. A. Aguirre, S. A. Billings. Dynamical effects of overparametrization in nonlinear models. Physica D, 80, 1995. doi:10.1016/0167-2789(94)00166-N
  2. [Aka74] H. Akaike. A new look at the statistical model identification. IEEE Trans. Automatic Control, 19(6), 1974. doi:10.1109/TAC.1974.1100705
  3. [Bil83] S. A. Billings, W. S. F. Voon. Structure detection and model validity tests in the identification of nonlinear systems. IEE Proc. D, 130(4), 1983. doi:10.1049/ip-d.1983.0034
  4. [Bil89] S. A. Billings, S. Chen, M. J. Korenberg. Identification of MIMO non-linear systems using a forward-regression orthogonal estimator. Int. J. Control, 49(6), 1989. doi:10.1080/00207178908559767
  5. [Bil13] S. A. Billings. Nonlinear System Identification: NARMAX Methods in the Time, Frequency, and Spatio-Temporal Domains. Wiley, 2013. doi:10.1002/9781118535561
  6. [Cha83] V. Chankong, Y. Y. Haimes. Multiobjective Decision Making: Theory and Methodology. North-Holland, New York, 1983.
  7. [Che89] S. Chen, S. A. Billings, W. Luo. Orthogonal least squares methods and their application to non-linear system identification. Int. J. Control, 50(5), 1989. doi:10.1080/00207178908953472
  8. [Kor88] M. Korenberg, S. A. Billings, Y. P. Liu, P. J. McIlroy. Orthogonal parameter estimation algorithm for non-linear stochastic systems. Int. J. Control, 48(1), 1988. doi:10.1080/00207178808906169
  9. [Lac20] W. R. Lacerda, L. P. C. Andrade, S. C. P. Oliveira, S. A. M. Martins. SysIdentPy: a Python package for system identification using NARMAX models. J. Open Source Software, 5(54), 2020. doi:10.21105/joss.02384
  10. [Leo85] I. J. Leontaritis, S. A. Billings. Input-output parametric models for non-linear systems, Part II: stochastic non-linear systems. Int. J. Control, 41(2), 1985. doi:10.1080/0020718508961130
  11. [Lju99] L. Ljung. System Identification: Theory for the User, 2nd ed. Prentice Hall, 1999.
  12. [Naz23] T. Nazaré, K. Mahmoodi, E. Nepomuceno. Green-Box system identification and carbon footprint analysis for sustainable computing. OCEANS 2023 – Limerick, IEEE, 2023. doi:10.1109/OCEANSLimerick52467.2023.10244352
  13. [NLB] Nonlinear system identification benchmarks. www.nonlinearbenchmark.org
  14. [Mor07] D. N. Moriasi, J. G. Arnold, M. W. Van Liew, R. L. Bingner, R. D. Harmel, T. L. Veith. Model evaluation guidelines for systematic quantification of accuracy in watershed simulations. Trans. ASABE, 50(3):885–900, 2007. doi:10.13031/2013.23153
  15. [Pir03] L. Piroddi, W. Spinelli. An identification algorithm for polynomial NARX models based on simulation error minimization. Int. J. Control, 76(17), 2003. doi:10.1080/00207170310001635419
  16. [Sch80] M. Schetzen. The Volterra and Wiener Theories of Nonlinear Systems. Wiley, 1980.
  17. [Sch09] J. Schoukens, J. Suykens, L. Ljung. Wiener-Hammerstein benchmark. 15th IFAC Symposium on System Identification (SYSID), Saint-Malo, France, 2009.
  18. [Wig13] T. Wigren, J. Schoukens. Three free data sets for development and benchmarking in nonlinear system identification. European Control Conference, 2013. doi:10.23919/ECC.2013.6669201
  19. [Fig09] E. Figueiredo, G. Park, J. Figueiras, C. Farrar, K. Worden. Structural health monitoring algorithm comparisons using standard data sets. Report LA-14393, Los Alamos National Laboratory, 2009.
  20. [Jan19] A. Janot, M. Gautier, M. Brunot. Data set and reference models of EMPS. Nonlinear System Identification Benchmarks Workshop, Eindhoven, 2019.
Learn more · complexity criteria

Why count arithmetic?

Computing has an energy and carbon cost that grows with the amount of work done [Lan20], and there is a growing call to report efficiency alongside accuracy [Sch20]. An identified model is evaluated at every sample, often for years on embedded hardware, so a model with fewer and cheaper operations saves energy every time it runs. GreenBox follows the Green-Box approach [Naz23]: the cost of a model is measured by the arithmetic it needs per sample.

Operation count

A polynomial model with p terms (constant included), where term i has di signal factors, needs per sample

a = p − 1 additions,   b = Σi di multiplications

because each coefficient multiplies its di factors one by one. For example, θ0 + θ1y(k−1) + θ2u(k−1)y(k−1) has a = 2 and b = 3. The complexity weights the two operations:

C = a·c+ + b·c×  ∝  a + ρ b,   ρ = c× / c+

The Green criterion min-max normalises C among the options it compares, so only ρ, the cost of a multiplication measured in additions, changes which model is selected. Noise terms of NARMAX models are not counted, because they are not evaluated when the model is used.

Theoretical criteria: bit-level cost of B-bit operands

Adding two B-bit numbers takes on the order of B bit operations. Multiplication algorithms differ [Knu97]:

ModelMultiplication cost M(B)ρ = M(B)/B at B = 64Idea
SchoolbookB²64long multiplication: every digit times every digit
KaratsubaBlog₂3 ≈ B1.58511.4three half-size products instead of four [Kar63]
Toom–Cook 3-wayBlog₃5 ≈ B1.4656.9splits operands in three parts, five products [Coo69]
Schönhage–StrassenB·log₂B·log₂log₂B15.5fast Fourier transform over rings [Sch71]
UniformB1every operation costs the same (operation count)

These are asymptotic models: FFT-based methods only win for very large B, and integer multiplication in O(B log B) was reached only recently [Har21]. Real processors multiply 64-bit floating-point numbers in dedicated hardware, so the theoretical ρ describes the intrinsic difficulty of the operation rather than the time on a given machine. On current floating-point hardware an addition and a multiplication take about the same time (ρ ≈ 1). GreenBox therefore uses the calibration of your own computer as default (it runs once at the first start, see below); the uniform count and the theoretical models remain available for comparison. The original study [Naz23] used the Karatsuba model, which remains available.

Explore: ρ as a function of the word length

Computational criterion: calibration on your computer

The default calibration, processor arithmetic, measures the cost of the operations themselves on the processor of the computer running GreenBox: a small program runs long chains of dependent 64-bit floating-point additions (x = x + k, then again, …) and of multiplications. Each operation waits for the previous result, so the time per operation is the latency of one addition t+ and of one multiplication t×; loop, loads and stores run in parallel with the chain and do not add to it. Eight independent chains give the throughput (cost when many operations run in parallel). Then ρ = t×/t+, and C = a·t+ + b·t× is the arithmetic time of one model evaluation in nanoseconds. The result describes the processor, not the browser: Edge and Safari give the same values on the same machine (on an Apple M2, t+ ≈ 0.86 ns and t× ≈ 1.15 ns, ρ ≈ 1.33). In the browser the program is WebAssembly, translated by the browser into native instructions; the desktop application runs the same chains as native machine code compiled in C and shipped with it, so it needs no internet connection and no compiler.

The model evaluation engines time whole polynomials with known (a, b) in Python or JavaScript and fit

t = t0 + t+·a + t×·b

by least squares. Their t+ and t× are the cost per term and per factor in that language, including the interpreter's work, so they describe how fast that implementation runs a model rather than the arithmetic (interpreted Python gives ρ between about 0.4 and 1, depending on the runtime). Use them only if the model will run in that same implementation; to describe another target (embedded C, another machine), measure there and enter t+ and t× manually.

From complexity to carbon

GreenBox converts complexity into time (directly for calibrated costs; for theoretical costs by anchoring one 64-bit multiplication to a reference time) and multiplies by an emission rate in mgCO₂e per second of computing, in the spirit of the Green Algorithms calculator [Lan20]. These are estimates for comparing models, not measured energy.

References

  1. [Coo69] S. A. Cook, S. O. Aanderaa. On the minimum computation time of functions. Trans. American Mathematical Society, 142, 1969. doi:10.1090/S0002-9947-1969-0249212-8
  2. [Har21] D. Harvey, J. van der Hoeven. Integer multiplication in time O(n log n). Annals of Mathematics, 193(2), 2021. doi:10.4007/annals.2021.193.2.4
  3. [Kar63] A. Karatsuba, Yu. Ofman. Multiplication of multidigit numbers on automata. Soviet Physics Doklady, 7, 1963.
  4. [Knu97] D. E. Knuth. The Art of Computer Programming, Vol. 2: Seminumerical Algorithms, 3rd ed. Addison-Wesley, 1997.
  5. [Lan20] L. Lannelongue, J. Grealey, M. Inouye. Green Algorithms: quantifying the carbon footprint of computation. Advanced Science, 8(12), 2021. doi:10.1002/advs.202100707
  6. [Naz23] T. Nazaré, K. Mahmoodi, E. Nepomuceno. Green-Box system identification and carbon footprint analysis for sustainable computing. OCEANS 2023 – Limerick, IEEE, 2023. doi:10.1109/OCEANSLimerick52467.2023.10244352
  7. [Sch71] A. Schönhage, V. Strassen. Schnelle Multiplikation großer Zahlen. Computing, 7, 1971. doi:10.1007/BF02242355
  8. [Sch20] R. Schwartz, J. Dodge, N. A. Smith, O. Etzioni. Green AI. Communications of the ACM, 63(12), 2020.

Data source

CSV, TXT, DAT (comma, semicolon, tab or space separated, optional header) or .mat. Files never leave this computer.

The examples are published data sets of other authors. Their source is shown under the plot, and the measured signals are not exported: use the link to the original data, and cite it.

How should my data file look?

One signal per column, one sample per row, sampled at a constant rate. A file needs at least two columns: the input u(k) and the output y(k). Other columns (time, other sensors) may be present; you choose which column is the input and which is the output under Signals.

u,y
0.00,-0.013
1.00,-0.011
1.00, 0.042
…
  • Header (recommended): a first line with the column names, e.g. u,y or voltage,speed. The names are yours; without a header the columns are called col1, col2, …
  • Separator: comma, semicolon, tab or spaces. With a semicolon or tab the decimal mark can be a comma (1,5;2,25, as saved by Excel in Portuguese or other European languages).
  • Files: .csv, .txt, .dat, .tsv (UTF-8, UTF-16 or Latin-1) or MATLAB .mat (each vector or matrix column becomes a signal). Excel files (.xlsx) are not read: use File → Save as → CSV.
  • Ignored lines: lines starting with # or %, and text lines such as a units line under the header. Empty cells and NaN are treated as missing; samples where u or y is missing are dropped.
  • Validation: either one record that GreenBox splits in two (One record, split in two), or separate estimation and validation records, in the same file (e.g. columns uEst,yEst,uVal,yVal, which may have different lengths) or in two files.
  • Only single-input, single-output (SISO) models are identified. If the signals are stored in rows instead of columns, GreenBox transposes them.

    Signals

    Preprocessing

    Load a file or an example to begin.

    Is the system linear?

    Compares the best linear model with the best nonlinear polynomial model (free-run simulation on the test part of the estimation data) and runs the Billings–Voon correlation test ry′y′². Also done automatically when you run the identification.

    Model family

    Candidate terms

    Candidate library

    –

    Show candidate terms

    How the cost of a model is measured

    A model with a additions and b multiplications per sample costs C = a·c+ + b·c× (equivalently C ∝ a + ρ b, with ρ = c×/c+). The Green criterion min-max normalises C, so only ρ changes which model is selected.

    Calibrate on this computer

    Processor arithmetic measures how long one addition and one multiplication of 64-bit floating-point numbers take on this computer's processor, with no reading, storing or loop costs: a chain of dependent operations (each waits for the previous result) runs as native instructions (WebAssembly in the browser, compiled C in the desktop application). The model evaluation engines instead time whole polynomials with known (a, b) and fit t = t0 + t+a + t×b; their t+ and t× also contain the interpreter's per-term and per-factor work.

    Enter timings manually

    Carbon estimate

    Carbon per sample = estimated execution time × emission rate. Calibrated costs are already times; theoretical costs are converted by anchoring one multiplication to a reference time.

    Defaults: 121.81 mgCO₂e/min from the Green Algorithms calculator and a 64-bit multiplication measured at 1.07 ns. These are estimates, not measured energy.

    Identification settings

    Model structure

    Uses only the estimation data. A first scan of linear models (lags 1, 2, 4, 8, 15, … up to the max. lag) locates the memory of the system; then, for every degree up to the limit, the search climbs the lags (1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, … up to the max. lag) while the score improves, scoring each structure by its best Green candidate. Libraries above 400 terms are skipped. A warning is shown if the target R² is not reached.

    Test part = the last part of the estimation data (30 % by default), not used to estimate the parameters. A model is scored by free-run simulation over the test part and over the whole estimation record (the lower R² counts). The validation data are never used for any choice.

    Number of terms

    The last part of the estimation data is held out: terms are ranked on the rest, and candidate models are compared by how well they simulate the held-out part. Validation data are never used for any choice.

    Noise model (extended least squares)

    Noise terms remove bias from the process parameters; they are not used in free-run simulation and are not counted in the complexity.

    Green models

    The admissible candidate models form a Pareto front of test error E and complexity C. Each decision method below picks one of them as a Green model.

    Accuracy weights wE (weighted sum, Euclidean, Tchebycheff)

    wC = 1 − wE. A range gives one model per weight for each of these methods.

    How the decision methods are used

    For every structure its search visits, the Green identification builds candidate models from several term orders (error reduction, error reduction per unit of cost, the classical Green order, and the most accurate of these with terms removed one by one) and simulates each on the test part and over the whole estimation record. A candidate is admissible when it simulates without diverging and reaches the minimum test R². The test error E = √(1 − R²) is scaled to 0–1 between the best admissible candidate and the limit set by the minimum R², the complexity C between the cheapest and the most costly admissible candidate, so (E, C) = (0, 0) is the ideal point. Each method then picks one candidate; ties go to the cheaper one, so every Green model is on the Pareto front. Validation data are never used for any choice.

    Most accurate Green model. It is the reference the other Green models are compared with. A large model that is only slightly better on the test part can generalise worse; a compromise method is usually the safer choice.

    Terms are added one at a time, each minimising wE·(1 − ERR) + wC·C, and each decision method chooses the number of terms with E the unexplained output variance, where ERR, E and the complexity C are scaled to 0–1 among the options compared. The one-step error can look almost perfect for models that drift or diverge in simulation, so check the validation results.

    System linearity

    Summary

    Click a row to inspect that model. All methods lists every distinct Green model once, with the decision methods (and weights) that picked it; choose a method to see its models only. ★ marks models on the Pareto front (complexity vs validation NRMSE). NRMSE = ‖y − ŷ‖ / ‖y − ȳ‖ and R² = 1 − NRMSE², both in free run on the validation data.

    Structure search

    Free-run validation

    Complexity vs error

    Pareto front and decision methods

    Model

    Process model · simulated in free run and counted in the complexity

    Noise model · e(k) terms, used only to estimate unbiased parameters; e(k) = 0 in free run, not counted in the complexity

    Residual correlation tests (training, one-step-ahead)

    Model size selection

    Starting…