Making time series predictions based on a keras model

Hello KNIME community,
I have constructed a simple LSTM model in KNIME using the Keras extension and wish to make a prediction into the future based on this model. I have searched around the web to no avail and it doesn’t seem like its an easy fix (although that would be much appreciated). I, therefore, post here to see if I could get a possible solution to this problem. After all, what is the purpose of having a Keras model if you cant use it to make predictions?

Hi @Repletion and welcome to the forum.

Have you looked on the KNIME Hub yet? In particular, you may want to check the two Keras workflows listed in the link below - one for training, one for deployment.

In particular, these are making use of the Keras Network Writer, Keras Network Reader, and Keras Network Executor nodes.

Hope that helps!

Correct me if I am wrong, but this workflow utilizes build in predictor nodes such as the random forest. Keras does not have such a node, hence why I am asking about a possible solution.

Sorry, I should have been more clear when I linked the workflow group. Take a look at 03 and 04 in the group linked above - Those are the Keras specific workflows.

1 Like

Hi @Repletion,

to apply your trained network to new data you can use the Keras Network Executor node.

Are you planning to predict only the next value in your time series? Or do you want to use the next predicted value as input to predict also the next value and so on?

There are couple examples for how to deploy LSTM networks with KNIME Analytics Platform based on text. But in the end text is also a sequence of characters. Therefore they might be helpful.

A many-to-many example (training and deployment)

A many-to-one example (training and deployment)

Cheers
Kathrin

Thank you and @ScottF for the replies. I will have a look for sure, but I have one last question. Wouldnt it be possible to predict future values if you train only on lagged values? For example if all your training columns are lagged by 1 and the responsevariable is not lagged, wouldnt that mean you could predict future values by doing so?

The one problem I have with that approach is that it makes my Keras model accuracy constant 0 with the same parameters as before (where it worked without the lagged values). I have posted in more detail about it here: Keras model accuracy constant 0

Dear Kathrin,
I have posted a (similar) situation in the Forum, at:

I read (some of) your posts suggesting Keras integration for an RNN - LSTM applied to a Time Series prediction. I suppose that what I really need is some help to configure (at least) two predictive workflows with:

  • three input numerical variables, describing Covid regional data: NrCases; NrHosps; NrDeaths.
  • I want to classify my predictions into a small number of nominal classes. This number was defined after optimizing k-Means. In this task, I clustered financial data to search for (the most compact and mutually distinct) intervals of hospital expenses (before and during the COVID-19 sanitary crisis).
  • In the end, I wish to predict the most likely class for the interval of hospital expenses which could be associated with a particular set of values on the input variables.
    My preprocessed data are in this file:
    Covid data for TS Prediction with NN algorithms.csv (37.6 KB)
    Would you help me to select a particular TS predictive algorithm, and to configure it properly?
    I thank you for all the help you could give to solve my issue.
    B.R.,
    Rogério.