Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradient calculation in Hamming loss for multi-label classification

I am doing a multilabel classification using some recurrent neural network structure. My question is about the loss function: my output will be vectors of true/false (1/0) values to indicate each label's class. Many resources said the Hamming loss is the appropriate objective. However, the Hamming loss has a problem in the gradient calculation: H = average (y_true XOR y_pred),the XOR cannot derive the gradient of the loss. So is there other loss functions for training multilabel classification? I've tried MSE and binary cross-entropy with individual sigmoid input.

like image 365
William Chou Avatar asked Feb 08 '17 23:02

William Chou


People also ask

Which loss function is used for multi-label classification?

You can use softmax as your loss function and then use probabilities to multilabel your data.

How is hamming loss calculated?

Hamming loss is the fraction of wrong labels to the total number of labels. In multi-class classification, hamming loss is calculated as the hamming distance between y_true and y_pred . In multi-label classification, hamming loss penalizes only the individual labels.

How do you calculate accuracy for multi-label classification?

We can sum up the values across classes to obtain global FP, FN, TP, and TN counts for the classifier as a whole. This would allow us to compute a global accuracy score using the formula for accuracy. Accuracy = (4 + 3) / (4 + 3 + 2 + 3) = 7 / 12 = 0.583 = 58%.

Which loss function is well suited for multi-class classification problem?

Binary, multi-class and multi-label classificationCross-entropy is a commonly used loss function for classification tasks.


1 Answers

H = average(y_true*(1-y_pred)+(1-y_true)*y_pred)

is a continuous approximation of the hamming loss.

like image 137
Juan Wang Avatar answered Oct 10 '22 18:10

Juan Wang