Unverified Commit e2dfcd69 authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

Fix potential overflow in linear trees (#5395)



* Fix potential overflow in linear trees

* simplify
Co-authored-by: default avatarJames Lamb <jaylamb20@gmail.com>
parent ebd9e860
......@@ -281,7 +281,7 @@ void LinearTreeLearner::CalculateLinear(Tree* tree, bool is_refit, const score_t
float g = static_cast<float>(gradients[i]);
int j = 0;
for (int feat1 = 0; feat1 < num_feat + 1; ++feat1) {
float f1_val = curr_row[feat1];
double f1_val = static_cast<double>(curr_row[feat1]);
XTg_by_thread_[tid][leaf_num][feat1] += f1_val * g;
f1_val *= h;
for (int feat2 = feat1; feat2 < num_feat + 1; ++feat2) {
......
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