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:
parent
95cbfad990
commit
2231940d1d
@ -291,6 +291,8 @@ struct EvalGammaNLogLik {
|
|||||||
}
|
}
|
||||||
|
|
||||||
XGBOOST_DEVICE bst_float EvalRow(bst_float y, bst_float py) const {
|
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 psi = 1.0;
|
||||||
bst_float theta = -1. / py;
|
bst_float theta = -1. / py;
|
||||||
bst_float a = psi;
|
bst_float a = psi;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user