Setting specific lags¶
Example created by Wilson Rocha Lacerda Junior
Different ways to set the maximum lag for input and output
In [ ]:
Copied!
pip install sysidentpy
pip install sysidentpy
In [2]:
Copied!
from sysidentpy.model_structure_selection import FROLS
from sysidentpy.basis_function._basis_function import Polynomial
from sysidentpy.model_structure_selection import FROLS from sysidentpy.basis_function._basis_function import Polynomial
Setting lags using a range of values¶
If you pass int values for ylag and xlag, the lags are defined as a range from 1-ylag and 1-xlag.
For example: if ylag=4 then the candidate regressors are $y_{k-1}, y_{k-2}, y_{k-3}, y_{k-4}$
In [3]:
Copied!
basis_function = Polynomial(degree=1)
model = FROLS(
order_selection=True,
ylag=4,
xlag=4,
info_criteria="aic",
basis_function=basis_function,
)
basis_function = Polynomial(degree=1) model = FROLS( order_selection=True, ylag=4, xlag=4, info_criteria="aic", basis_function=basis_function, )
Setting specific lags using lists¶
If you pass the ylag and xlag as a list, only the lags related to values in the list will be created. $y_{k-1}, y_{k-4}$, $x_{k-1}, x_{k-4}$
In [7]:
Copied!
model = FROLS(
order_selection=True,
ylag=[1, 4],
xlag=[1, 4],
info_criteria="aic",
basis_function=basis_function,
)
model = FROLS( order_selection=True, ylag=[1, 4], xlag=[1, 4], info_criteria="aic", basis_function=basis_function, )
Setting lags for Multiple Input Single Output (MISO) models¶
The following example shows how to define specific lags for each input. One should notice that we have to use a nested list in that case.
In [8]:
Copied!
# The example considers a model with 2 inputs, but you can use the same for any amount of inputs.
model = FROLS(
order_selection=True,
ylag=[1, 4],
xlag=[[1, 2, 3, 4], [1, 7]],
info_criteria="aic",
basis_function=basis_function,
)
# The lags defined are:
# x1(k-1), x1(k-2), x(k-3), x(k-4)
# x2(k-1), x1(k-7)
# The example considers a model with 2 inputs, but you can use the same for any amount of inputs. model = FROLS( order_selection=True, ylag=[1, 4], xlag=[[1, 2, 3, 4], [1, 7]], info_criteria="aic", basis_function=basis_function, ) # The lags defined are: # x1(k-1), x1(k-2), x(k-3), x(k-4) # x2(k-1), x1(k-7)
In [ ]:
Copied!