fuzzyclust.preprocessing.make_regressors#
- fuzzyclust.preprocessing.make_regressors(y, u=None, n_a=1, n_b=0, n_k=1)[source]#
Regression matrix and target of a NARX model
\[y_k = f\big(y_{k-1},\dots,y_{k-n_a},\; u_{k-n_k},\dots,u_{k-n_k-n_b+1}\big)\]- Parameters:
- yarray_like
ofshape(T,)or(T,n_outputs) Output sequence.
- uarray_like
ofshape(T,)or(T,n_inputs),optional Input sequence (
Nonefor an autonomous / time-series model).- n_a
int, default=1 Number of lagged outputs.
- n_b
int, default=0 Number of lagged inputs (
0ifuisNone).- n_k
int, default=1 Input delay (dead time) in samples.
- yarray_like
- Returns:
- Phi
ndarrayofshape(T-max_lag,n_regressors) Rows \(\boldsymbol{\varphi}_k\); lagged outputs first (all outputs at lag 1, then lag 2, …), then lagged inputs.
- target
ndarrayofshape(T- max_lag,)or(T-max_lag,n_outputs) \(y_k\) aligned with the rows of
Phi.- names
listofstr Human readable regressor names, e.g.
"y1(k-1)","u1(k-2)".
- Phi
Examples
>>> import numpy as np >>> from fuzzyclust.preprocessing import make_regressors >>> y = np.arange(6.0); u = np.arange(6.0) * 10 >>> Phi, target, names = make_regressors(y, u, n_a=2, n_b=1, n_k=1) >>> names ['y(k-1)', 'y(k-2)', 'u(k-1)'] >>> Phi[0], float(target[0]) (array([ 1., 0., 10.]), 2.0)
Examples using fuzzyclust.preprocessing.make_regressors#
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
Model-order selection by false nearest neighbors with a cluster-based threshold
Model-order selection by false nearest neighbors with a cluster-based threshold