0
$\begingroup$

I am looking at LSTM example here

However, I am not sure how to modify the setup if I have forecast available (assuming perfect forecast) for TEMP: Temperature and PRES: Pressure at time t.

i.e. pollution_t = fn(TEMP_t, PRES_t, TEMP_t_1, PRES_t_1, ..., othervariables and lagged values)

_t represents the perfect forecast available

_t_1 represents the variable values at previous time steps

Basically I am looking for something of the following setup:

enter image description here

$\endgroup$
1
$\begingroup$

You need a bidirectional LSTM. The temporal direction on the original LSTM and on GRU type cell connectivity is forward in time. Fortunately, the bidirectional class is available in Keras.

from keras.models import Sequential
from keras.layers import LSTM
from keras.layers import TimeDistributed
from keras.layers import Bidirectional
...
model = Sequential()
model.add(Embedding(max_features, 128, input_length=maxlen))
model.add(Bidirectional(LSTM(64)))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))

Now the network has causality from both history and forecast. This is only useful if the forecasts reduce entropy, which means they have to be known effective forecasts that when fed to earlier cells (in the time domain) will enhance accuracy and confidence metrics.

When the loss function (for its derivative) is provided, it must return the error at $t = t(i)$, where $i$ is the index of the last sample in the sequence before the values become forecasts. This is the main distinction when the sequence includes both history and forecast.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.