2
$\begingroup$

I have a model that has to classify inputs into one of 45 categories but those categories actually represent bins (e.g. bins 1, 2 and 3 are between 1 and 10, 11 and 20, 21 and 30 respectively). What I would like is my model to classify properly values into bins but I am not too upset if it puts 19 into bin #3 even in bin #1. What is the loss function that would measure distance from the correct category and will score the classification in neighbouring bins with weight of say 1/n where n is the distance to the correct bin.

mind you that what I am looking for is different from the top_k metric that keras has.

$\endgroup$

1 Answer 1

1
$\begingroup$

It looks like you should redefine your task as a regression problem instead of a classification problem, because your target variable is numerical.

The performance will be much better and it will avoid the need for a questionable pseudo-regression-like measure. Mean absolute error and mean squared error are standard regression evaluation measures.

$\endgroup$
2
  • $\begingroup$ thanks. this is exactly how I started solving my problem but my model wouldn't converge. also considering that one of my outputs is "none of the rest" it felt like this might be a classification problem. perhaps I should be building two models $\endgroup$ Commented Sep 21, 2019 at 5:47
  • $\begingroup$ @ГеоргиКременлиев depending on the problem I can see two options: either using only regression and automatically assign any value not within the predefined range as in the "none of the rest" category; or indeed using first a binary classification model to distinguish regular cases from "none of the rest", then doing regression on the regular cases. $\endgroup$
    – Erwan
    Commented Sep 21, 2019 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.