Clip small positive values in gamma-nloglik (#6537)

For the `gamma-nloglik` eval metric, small positive values in the labels are causing `NaN`'s in the outputs, as reported here: https://github.com/dmlc/xgboost/issues/5349. This will add clipping on them, similar to what is done in other metrics like `poisson-nloglik` and `logloss`.
This commit is contained in:
Gorkem Ozkaya
2020-12-21 11:11:40 -08:00
committed by GitHub
parent 95cbfad990
commit 2231940d1d

View File

@@ -291,6 +291,8 @@ struct EvalGammaNLogLik {
}
XGBOOST_DEVICE bst_float EvalRow(bst_float y, bst_float py) const {
const bst_float eps = 1e-16f;
if (y < eps) y = eps;
bst_float psi = 1.0;
bst_float theta = -1. / py;
bst_float a = psi;