wilsonrljr / sysidentpy

A Python Package For System Identification Using NARMAX Models
https://sysidentpy.org
BSD 3-Clause "New" or "Revised" License
380 stars 77 forks source link

steps_ahead not simulating next steps in SimulateNARMAX #88

Closed Lalith-Sagar-Devagudi closed 1 year ago

Lalith-Sagar-Devagudi commented 1 year ago

https://github.com/wilsonrljr/sysidentpy/blob/440bd926892b506506eaa37d3864cfed99e6a2b1/sysidentpy/simulation/_simulation.py#L333

bug When trying to simulate duffing equation

x_1 = 1.0 x_2
x_2 = -0.15 x_1 + 2.75 x_2 - 1.0 x_2^3

by giving steps_ahead = 2 or more, it is still predicting the one step forward for all the given test values. And it cannot simulate with out the steps_ahead parameter and also when steps_ahead = 50 or more. Please see the respective screenshots of the simulations.

ident_model = np.array([
      [1001, 1001, 1001],
      [1001,    0,    0],
      [2001,    0,    0],
       ])

s = SimulateNARMAX(basis_function=Polynomial(degree=3), calculate_err=True, estimate_parameter=True, extended_least_squares=True)
yhat_simulate = s.simulate(
    X_train=x_train,
    y_train=y_train,
    X_test=x_test,
    y_test=y_test,
    model_code=ident_model,
    steps_ahead=2)

without steps_ahead wostepahead steps_ahead = 1 wstepahead1 steps_ahead = 2 wstepahead2nmor steps_ahead = 50 wstepahead50 steps_ahead = 100 wstepahead100

Thank you very much for this very insightful and helpful project.

wilsonrljr commented 1 year ago

Hey Lalith! Thank you for creating the issue. The issue is only with the 1 step ahead prediction and fix will be on next update. You can use the solution we talked about on discord in the meantime!

wilsonrljr commented 1 year ago

fixed in v0.3.0