fuzzyclust.models.simulate_free_run#

fuzzyclust.models.simulate_free_run(model, u, y_init, n_a, n_b=0, n_k=1)[source]#

Free-run (parallel) simulation of a NARX model.

The regressors follow the layout of make_regressors(). The predicted outputs are fed back as regressors instead of the measured ones, \(\hat y_k = f(\hat y_{k-1},\dots,\hat y_{k-n_a}, u_{k-n_k},\dots)\), which is the demanding test of a dynamic model (errors can accumulate).

Parameters:
modelfitted regressor with predict

Takes rows ordered as the regressors of make_regressors: lagged outputs first (lag 1 for all outputs, then lag 2, …), then lagged inputs.

uarray_like of shape (T,) or (T, n_inputs) or None

Input sequence (None for an autonomous model).

y_initarray_like of shape (max_lag,) or (max_lag, n_outputs)

Initial outputs (the first max_lag measured values).

n_a, n_b, n_kint

Model orders and dead time, as used for make_regressors.

Returns:
y_simndarray of shape (T,) or (T, n_outputs)

Simulated output; the first max_lag entries are y_init.

Examples

>>> import numpy as np
>>> from fuzzyclust.preprocessing import make_regressors
>>> from fuzzyclust.models import TakagiSugeno, simulate_free_run, make_second_order_plant
>>> u, y = make_second_order_plant(n_samples=150, random_state=0)
>>> Phi, target, _ = make_regressors(y, u, n_a=2, n_b=1, n_k=0)
>>> ts = TakagiSugeno(n_clusters=4, random_state=0).fit(Phi, target)
>>> y_sim = simulate_free_run(ts, u, y[:2], n_a=2, n_b=1, n_k=0)
>>> y_sim.shape
(150,)

Examples using fuzzyclust.models.simulate_free_run#

Identification of a nonlinear dynamic system with free-run validation

Identification of a nonlinear dynamic system with free-run validation

MIMO Takagi–Sugeno model with local MIMO ARX consequents

MIMO Takagi–Sugeno model with local MIMO ARX consequents