* Address windows compilation error * Do not allow divide by zero in weight calculation * Update tests
This commit is contained in:
@@ -101,7 +101,8 @@ class SoftmaxMultiClassObj : public ObjFunction {
|
||||
for (int k = 0; k < nclass; ++k) {
|
||||
// Computation duplicated to avoid creating a cache.
|
||||
bst_float p = expf(point[k] - wmax) / static_cast<float>(wsum);
|
||||
const bst_float h = fmax(2.0f * p * (1.0f - p) * wt, kRtEps);
|
||||
const float eps = 1e-16f;
|
||||
const bst_float h = fmax(2.0f * p * (1.0f - p) * wt, eps);
|
||||
p = label == k ? p - 1.0f : p;
|
||||
gpair[idx * nclass + k] = GradientPair(p * wt, h);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user