# LSTM Sequential Model question re: ValueError: non-broadcastable output operand with shape doesn't match broadcast shape

This is probably a very simplistic question but I have not been able to find resources that directly address this. I know I must be understanding this incorrectly; I'm not quite sure how.

I've noticed that if the number of units in the last Dense output layer of my LSTM sequential model does not equal the number of features (columns), I get an error.

If you wanted to output 1 feature in the output (Dense) layer, and you had several input features, how would you:

1. Do that without errors
2. identify which feature is being outputted, or does Keras provide outputs for each feature and you have to identify which one you want?

I want to train the model with multiple features, but I'm only interested in one feature's prediction.

Example: I have data with 'open', 'low', 'high' and 'close' and 'volume columns (5 features). If I set the number of units in the last Dense layer to anything other than 5, I get a broadcast error telling me I have inconsistent shapes in the model. If I put 5 units in the last Dense output layer, I get no errors.

Example:

def create_model(self, epochs, batch_size):

model = Sequential()

# Adding the first LSTM layer and some Dropout regularisation
batch_size=batch_size, input_shape=(TIME_STEP, self.X_train.shape[2])))

# Adding a second LSTM layer and some Dropout regularisation

# Adding a third LSTM layer and some Dropout regularisation

# Adding a fourth LSTM layer and some Dropout regularisation

# Adding the output layer
model.summary()

# compile model