3

According to my knowledge(please correct me if I'm wrong),

Multi-label classification(mutually inclusive) i.e., samples might have more than 1 correct values (for example movie genre, disease detection, etc).

Multi-Class classification(mutually exclusive) i.e., samples will always have 1 correct value (for example Cat or Dog, object detection, etc) this includes Binary Classification.

Assuming output is one-hot encoding.

What are the Loss function and metrics on has to use for these 2 types?

                     loss func.          metrics
1. multi-label:  (binary, categorical)  (binary_accuracy, TopKCategorical accuracy, categorical_accuracy, AUC)
2. multi-class:      (binary)           (binary_accuracy,f1, recall, precision)

Please tell me from the above table which of them is/are more suitable, which of them is/are wrong & Why?

Bhuvan S
  • 213
  • 1
  • 4
  • 10
  • how are you going to use one-hot encoding for multi-label classification ? – Andrey Nov 02 '20 at 19:41
  • 1
    Does [this](https://stats.stackexchange.com/questions/207794/what-loss-function-for-multi-class-multi-label-classification-tasks-in-neural-n) answer your question? –  Nov 04 '20 at 11:31
  • If there are 5 classes, then it's (None,5) output shape. If say Class 0, Class 1, and Class 4 are correct then output is array([1. 1. 0. 1. 0.] ) – Bhuvan S Nov 04 '20 at 16:43
  • @Bhuvan S, yes. –  Nov 24 '20 at 15:02

1 Answers1

1

If you are trying to use multi-class classification provided that the labels (y) is one hot encoded, use the loss function as categorical crossentropy and use adam optimizer (It is suitable for most cases). Also, while using multi-class classification, the number of output nodes should be the same as the number of classes (or) labels. Say if your model is going to classify the input into 4 classes, You can configure the output layer as follows..

model.add(4, activation = "softmax")

Also, forgot to mention that softmax activation should be used in the output layer for multiclass classification problems.

Incase if your y is not one hot encoded, I would advise you to choose the loss function as sparse categorical crossentropy. No other changes will be necessary.

Also, I usually split the data into test data and train data and feed them to the model like this to get the accuracy in each epoch..

history = model.fit(train_data, validation_data = test_data, epochs = 10)

Hope it solved your problem.