I am doing Covid-19 cases prediction using SVR, and getting negative values, while there should be no number of Covid-9 cases negative. Feature input that I was used is mobility factor (where have negative data) and daily cases of Covid-19. Kernel that I used is RBF kernel. Can anyone explain why I am getting negative values? are the independent variable (mobility) that I used influence that?
It's frequent in regression tasks that for some instances, the predicted value is out of bounds of the theoretical range, sometimes in a way which is semantically meaningless for the task.
This is due to the regression method. For example in linear regression, some of the features may have a negative coefficient, and if this feature happens to have a very high value in the test data, this could result in a negative target value. Generally this happens with instances which strongly differ from the instances in the training set. If this happens with a lot of instances, it's likely that the training set is not representative enough, i.e. the model is overfit. It can especially happen if there are many features with high variations and/or bad predictors for the target (i.e. low correlation).
Assuming that only a few instances get predicted with an meaningless value this way, it's common to simply post-process the values, for example change every negative prediction to zero. This depends on the task of course.
$\begingroup$ Thank you so much for your explanations. But I wondering, are there any regression model that will always result a positive target value, even there are many features with high variance? $\endgroup$– ArdyMay 14, 2022 at 15:31
$\begingroup$ @LutfiArdiningTyas I don't think so. And I don't think it would make sense, because that would mean that the model would not follow the actual data but some external constraints. $\endgroup$– ErwanMay 14, 2022 at 15:52
1$\begingroup$ It's fairly common to incorporate such a limit with a link function. That has more implications to the model fitting and interpretation than just setting limits on the outputs, but often is meaningfully helpful in those fronts too; see e.g. the log-link used in Poisson regression. $\endgroup$– Ben Reiniger ♦Jun 20, 2022 at 13:44