Skip to content

Commit

Permalink
Set missing node to parent, if there are no missing records
Browse files Browse the repository at this point in the history
  • Loading branch information
jinlow committed Sep 19, 2023
1 parent 7cb2951 commit 9f3532f
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/splitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,22 @@ impl Splitter for MissingBranchSplitter {
(right_weight * right_hessian + left_weight * left_hessian)
/ (right_hessian + left_hessian)
}
MissingNodeTreatment::None => constrained_weight(
&self.get_l2(),
missing_gradient,
missing_hessian,
lower_bound,
upper_bound,
constraint,
),
MissingNodeTreatment::None => {
// If there are no missing records, just default
// to the parent weight.
if missing_hessian == 0. || missing_gradient == 0. {
parent_weight
} else {
constrained_weight(
&self.get_l2(),
missing_gradient,
missing_hessian,
lower_bound,
upper_bound,
constraint,
)
}
}
};
let missing_gain = gain_given_weight(
&self.get_l2(),
Expand Down

0 comments on commit 9f3532f

Please sign in to comment.