wilsonrljr / sysidentpy

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

Need to add extra feature in Narx model. #110

Closed himanshupant24 closed 1 year ago

himanshupant24 commented 1 year ago
1. The data looks like this. The "Need to forecast" line represents data to be forecasted by the Narx model.

Time_Stamp | Water_level | Rainfall | x1 | X2 | Met_office_Rain_forecast -- | -- | -- | -- | -- | -- 29/09/2020 13:45 | 10.2 | 0.5 | 2020 | 9 | NA 29/09/2020 14:00 | 7.8 | 0 | 2020 | 9 | NA 29/09/2020 14:15 | 8.3 | 1.3 | 2020 | 9 | NA 29/09/2020 14:30 | 23 | 2.6 | 2020 | 9 | NA 29/09/2020 14:45 | 11.4 | 0.35 | 2020 | 9 | NA 29/09/2020 15:00 | Need to forecast |   | 2020 | 9 | 1.25 29/09/2020 15:15 | Need to forecast |   | 2020 | 9 | 1.3 29/09/2020 15:30 | Need to forecast |   | 2020 | 9 | 1.4 29/09/2020 15:45 | Need to forecast |   | 2020 | 9 | 1.2 29/09/2020 16:00 | Need to forecast |   | 2020 | 9 | 0.89
Met_office_Rain_forecast is the rain forecast data from the Met office. I want to forecast "Water_level" from the next time stamp (29/09/2020 15:00)  to the next 20.
 
Let's say, If I have to forecast for the date "29/09/2020 15:00",  I am using y_lag =3 which is 8.3,23 and 11.4X_lag=2 which is 2.6, 0.35.
I also want to use X1, X2 and rain forecast data (from the Met office) for that particular time stamp i.e "29/09/2020 15:00".

The code you share with me: 
narx_net = NARXNN(
    ylag=2,
    xlag=[[1, 2], [1, 2]], # defining lags for multiple inputs
    basis_function=basis_function,

Here: xlag=[[1, 2], [1, 2]], I am not sure what 1 and 2 are representing. Can you please suggest what would be the values of xlag for my case? And do you have any comment on the presentation of data in the table.
wilsonrljr commented 1 year ago

Hey @himanshupant24 , as I sent you by mail, the lag definition "[[1, 2], [1, 2]]" is the list of lags of each input. The first list, [1, 2], represents the lags of the first input x1 like x1(k-1) and x1(k-2). The second list is the same for the second input x2(k-1) and x2(k-2). If you have another input, x3 for example, the xlag should be something like this [[1, 2], [1, 2], [1, 2]].

You can check more details on the docs:

http://sysidentpy.org/examples/defining_lags/ http://sysidentpy.org/examples/multiple_inputs_example/

I'll close this issue because I think this issue has been addressed I'll focusing on #111 to help you out.

If you have any questions, just let me know.