PlasmaControl / PyRCN

A Python 3 framework for Reservoir Computing with a scikit-learn-compatible API.
BSD 3-Clause "New" or "Revised" License
89 stars 19 forks source link

how to predict multiple steps ahead #56

Open wilbertmatthew opened 4 months ago

wilbertmatthew commented 4 months ago

I am using PyRCN version PyRCN-0.0.17 and the mackeyglass example. I would like to know how to modify the example to predict multiple steps ahead instead of 1 step ahead as it currently does.

Thanks

Wilbert Jackson

renierts commented 4 months ago

Hi Wilbert,

Thank you for this question. Currently, this is not supported natively. However, I am working on a better implementation based on PyTorch, which makes it easier to do tasks like this.

For now, the easiest way would be to predict one step, append the output to the input and then predict the next step with this modified input. This can be done in a simple loop. Does this help you for now?

wilbertmatthew commented 4 months ago

Thanks Peter for your quick response. Is there any code available for your new design? I tried your suggestion for multi step prediction as follows:

stepsahead = 10 for i in range(stepsahead): y_test_pred = esn.predict(X_test)

append the last prediction value to the X_test array

X_test = np.concatenate((X_test., y_test_pred[-1:]) y_test_pred = esn.predict(X_test)

Is this the right idea? The multiple calls to the incremental_regression function makes for an very slow prediction process.