Prevent multiclass Hessian approaching 0 (#3304)

* Prevent Hessian in multiclass objective becoming zero

* Set default learning rate to 0.5 for "coord_descent" linear updater
This commit is contained in:
Rory Mitchell
2018-05-09 20:25:51 +12:00
committed by GitHub
parent b8a0d66fe6
commit 088bb4b27c
3 changed files with 4 additions and 3 deletions

View File

@@ -65,7 +65,8 @@ class SoftmaxMultiClassObj : public ObjFunction {
const bst_float wt = info.GetWeight(i);
for (int k = 0; k < nclass; ++k) {
bst_float p = rec[k];
const bst_float h = 2.0f * p * (1.0f - p) * wt;
const float eps = 1e-16f;
const bst_float h = fmax(2.0f * p * (1.0f - p) * wt, eps);
if (label == k) {
gpair[i * nclass + k] = GradientPair((p - 1.0f) * wt, h);
} else {