Home > OS >  LightGBM predicts negative values
LightGBM predicts negative values

Time:12-14

My LightGBM regressor model returns negative values.

For XGBoost there is objective='count:poisson' hyperparameter in order to prevent returning negative predicitons.

Is there any chance to do this ?

Github issue => enter image description here

However... I don't recommend using Poisson regression just to achieve "no negative predictions". The Poisson loss function is intended to be used for cases where you believe your target is Poisson-distributed, e.g. it looks like counts of events observed over some regular interval like time or space.

Other options you might consider to try to achieve the behavior "never predict a negative number from LightGBM regression":

  • write a custom objective function in one of the interfaces that support it, like the R or Python package
  • post-process LightGBM's predictions, recoding negative values to 0
  • pre-process the target variable such that there are no negative values (e.g. dropping such observations, re-scaling, taking the absolute value)
  • Related