I am working on an email-classifier (using Tensorflow and keras) for whom I created a dataset myself. It has 3 classes - spam
, feedback/advice
and complaint
. It is giving an error: ValueError: Shapes (None, 1) and (None, 3) are incompatible
when I fit the model. I read a few answers on it which said that I need to use to_categorical()
on my training and validation data (X_train, X_val, Y_train, Y_val)
. But that also gives a new errors like axis error and more commonly my session on colab crashes. I am totally confused please help:
My code: https://colab.research.google.com/drive/1GWMx1p9XhQjbC-CD5CQsVpVIn4jvxG6m?usp=sharing
My dataset: https://www.kaggle.com/ayaanmustafa/email-classification
See my answer here. In short, convert your target variable to one hot. It's shape is (batch_size, 1)
and it should be (batch_size, 3)