Getting "LSTM expected shape (None,1) but instead got array with shape (100,3)" while trying to switch to categorical input


#1

Hello, I’m trying to switch my output from numeric to 3-categorical without much success. I have been training by choosing my output type as “numeric” with no issue. But whenever I tried to switch to categoricals I get a “LSTM expected shape (None,1) but instead got array with shape (100,3)” error. Is the problem with my reshape layer? I have a dataset of 60000 char of array data divided into 3 columns with batches of 100 records each. In my model I have a reshape layer with an input of (250,240) (sometimes I choose (500,120)). The loss function I chose was sparse_categorical_crossentropy.

Thanks.

EDIT: It turned out I got the wrong information about sparse_categorical_crossentropy and wrongly chose it instead of categorical_crossentropy.


#2

Hi since you are changing output data type from numeric to categorical then the shape of the output layer should change but your error sounds like you are changing shape of inputport.
Please check the port selected with column and
Please share a snapshop of the data and configuration of the model used.

Regards
Rajat


#3

It’s running fine now. It turned out I chose the wrong loss function.

Thanks.