I am trying to create a ML model for salary classification into 5 categories (0-90k, 90-120k, 120-180k and so on).

The problem is that in my dataset almost all salary data is presented in intervals. What I have tried is to calculate the average value of each interval, and using that average value divide data into bins.

However, there are values with very large intervals, for example given 100k-200k salary range, its average would be 150k, and hence it would be assigned to 3rd category (120-180k). But given its lower bound it would also qualify for 2nd category (90-120k). I am a bit lost here, is there a better way to divide interval data into classes?


1 Answer 1



This is a regression problem, not a classification problem. So model it with a regressor.

Your loss function can choose to discretize each prediction before scoring it, if that's what you really want.

Given your unequal bin sizes, it appears you wish to work with logarithm of salary rather than the raw observations. Turning "range 100 .. 200" into 150 seems reasonable in a linear setting, but you may want to modify that if you go the log transform route. Plot your raw data so you'll know the shape of the salary distribution.

If for some reason you insist on sticking with your current approach, you can cope with interval uncertainty by re-sampling. Pick an expansion factor $k$. For each example in a given fold, draw $k$ random numbers, and use a copy of that example as if the salary was known to be exactly equal to that random number. Then many of the draws would correspond to your "120 .. 180" bucket, but some of them would fall into adjacent buckets.


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.