Skip to content

Commit

Permalink
Replace division of exponential in Gamma loss (#4289)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorentzenchr authored May 18, 2021
1 parent 08c38ef commit 32fec82
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/objective/regression_objective.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
}
Expand Down

0 comments on commit 32fec82

Please sign in to comment.