I am training an LSTM in Keras:
model2 = Sequential(name="LSTM-Model") # Model
model2.add(Input(shape=(X_train_tensor.shape[1],X_train_tensor.shape[2]), name='Input-Layer')) # Input Layer - need to speicfy the shape of inputs\
model2.add(Masking(mask_value=-1000, input_shape=(timestep, 1)))
model2.add(Bidirectional(LSTM(units=64, activation='relu', recurrent_activation='sigmoid', stateful=False), name='Hidden-LSTM-Encoder-Layer')) # Encoder Layer
model2.add(RepeatVector(Y_train.shape[1], name='Repeat-Vector-Layer')) # Repeat Vector
model2.add(Bidirectional(LSTM(units=64, activation='relu', recurrent_activation='sigmoid', stateful=False, return_sequences=True), name='Hidden-LSTM-Decoder-Layer')) # Decoder Layer
model2.add(TimeDistributed(Dense(units=1, activation='linear'), name='Output-Layer')) # Output Layer, Linear(x) = x
However, it appears the -1000 values in the sequence are not being masked and as such inflating the metrics (loss,MSE). If I want to ignore either nan or -1000 values in the input data, how can I mask or deal with them being passed in?
The data would look like this:
[1,2,3,-1000,5,6,-1000,8]
I am trying to get the model to skip the -1000s.