Loss function for ordinal multiclass classification problem

355 views
Skip to first unread message

a.dand...@gmail.com

unread,
Jun 7, 2017, 7:06:39 AM6/7/17
to Keras-users
Hi all.

Let's say I have a multiclass classification problem with input X and some labels Y that I am trying to learn to predict.

Without knowing anything more about the problem I would build a model where the last layer uses a softmax activation and I would use the categorical crossentropy loss function when compiling the model.


However, lets assume that more information about the problem is provided. The input is actually pictures, or some representation, of facial expressions and the task is to classify the emotional mood of the person depicted into the classes [very sad, sad, neutral, happy, very happy].

To my understanding this is an ordinal multiclass classification problem and the categorical crossentropy loss does not seem optimal for this category of classification problems, since it would penalize all errors equally.

It would make more sense to use a loss function that gives higher loss the further away from the correct label the prediction is, i.e. for a given sample were the correct label is "happy", "very sad" would give higher loss than "very happy".

This is discussed in the article "A simple squared-error reformulation for ordinal classification" (link: https://arxiv.org/pdf/1612.00775.pdf) but how would I accomplish this in Keras?


Thanks
Reply all
Reply to author
Forward
0 new messages