Label dimension for Multi-class classification

Hello Sridhar,

There are few issues with your models

  1. The embedding layer needs correction.
    Please follow this link, to make correction
    tf.keras.layers.Embedding  |  TensorFlow v2.13.0

in the link, you will come across input_dim, output_dim and input_length, defining your embedding layer and the values for these are already mentioned at the beginning of the assignment.

  1. The next major issue with your model is your activation choice. This is multi class classification, do you feel you are using the right activation for the last dense layer??
    There is a clear mention about this in the instructions
  • The last layer should be a Dense layer with 5 units (since there are 5 categories) with a softmax activation.
  1. while you are using a dense unit too higher can create problem in your model training as you see epoch is only 30, so you wouldn’t get desired accuracy. which would be preferred first dense layer according to the epoch??

  2. Your loss choice is incorrect. The instructions mentions

  • You should also compile your model using an appropiate loss function and optimizer. Please choose these without needing to edit the following code cell that contains model.fit()

Categorical_crossentropy produces a one-hot array containing the probable match for each category, where as
sparse_categorical_crossentropy produces a category index of the most likely matching category.

So which one would be ideal.

Do these corrections. Let me know if you clear the test and choose appropriate comment in your post thread to close that thread.

You can ask me if you still have issue.
Regards
DP