Unverified Commit 32fec820 authored by Christian Lorentzen's avatar Christian Lorentzen Committed by GitHub
Browse files

Replace division of exponential in Gamma loss (#4289)

parent 08c38efc
......@@ -689,14 +689,14 @@ class RegressionGammaLoss : public RegressionPoissonLoss {
if (weights_ == nullptr) {
#pragma omp parallel for schedule(static)
for (data_size_t i = 0; i < num_data_; ++i) {
gradients[i] = static_cast<score_t>(1.0 - label_[i] / std::exp(score[i]));
hessians[i] = static_cast<score_t>(label_[i] / std::exp(score[i]));
gradients[i] = static_cast<score_t>(1.0 - label_[i] * std::exp(-score[i]));
hessians[i] = static_cast<score_t>(label_[i] * std::exp(-score[i]));
}
} else {
#pragma omp parallel for schedule(static)
for (data_size_t i = 0; i < num_data_; ++i) {
gradients[i] = static_cast<score_t>(1.0 - label_[i] / std::exp(score[i]) * weights_[i]);
hessians[i] = static_cast<score_t>(label_[i] / std::exp(score[i]) * weights_[i]);
gradients[i] = static_cast<score_t>(1.0 - label_[i] * std::exp(-score[i]) * weights_[i]);
hessians[i] = static_cast<score_t>(label_[i] * std::exp(-score[i]) * weights_[i]);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment