Train Model with multiple features

I’m trying to train LSTM model with multiple feature inputs and 1 output.
I get the following error
non-broadcastable output operand with shape (90,1) doesn’t match the broadcast shape (90,2)

model = Sequential()
    model.add(LSTM(units=50, return_sequences=True, input_shape=(sequence_length, num_features)))
    model.add(LSTM(units=50))
    model.add(Dense(units=1))
    model.compile(optimizer='adam', loss='mse')
    return model

How can i resolve this error.

Hi @Bharadwaj_D, Could you please make sure that final dense layer units are equal to the number of features in your y_train. For example if your y_train has a shape (100,5) then the dense layer units should be 5 . The model expects the final dense layer units to be equal to the number of output features. Thank You.

1 Like

Where can i learn more about LSTM models for free

Hi @Bharadwaj_D, You can refer to articles available online. like medium articles etc. Thank You.

1 Like