How to make a regression that never underestimates but may overestimate?

Viewed 1847

Let's say I am making an AI that predicts how many police cars are needed for an emergency situation, using multiple regression. When using linear regression, it overestimates half of the time and underestimates for the other half. But I can't underestimate, but it is somewhat ok if it overestimates. Which method should I use to prevent that?

I'm using Python BTW.

2 Answers

You can't make a regression that never underestimates but may overestimate.

You would need to be able to define a lower bound for your target (needed cars). And that is simply not possible for what you ask.

What you can get is e.g. a model that tends to overestimate. You could for example based on the variance of your targets calculate a factor you add on your number of needed cars so that your model does not underestimate in X% of your cases. The higher you set that factor the closer to 0 percent your underestimation rate goes. Of course you need to take into account that this procedure will cause an overestimation trend in your predictions.

You also can set underestimating penalties - such that an underestimation error is taken into account n times worse than an overestimation error, that will also decrease your underestimation rate, but can't ensure that you never underestimate. But you either need to find a loss function that does that for you or create an own loss function.

There could allways be the case that you get a call about someting small (e.g small fire in someones yard) that turns into something way bigger (exploding gas pipe) after you made your prediction. And you won't be able to create an AI that takes such "impossible to predict"-scenarios into account.

You might want to look into Quantile Regression. Of course the limitations mentioned by @Florian H are still true for that approach. By selecting a higher Quantile (e.g. 75% quantile) you can train your model to favour overestimations.

enter image description here

The respective loss function is quantile loss.

Related