Fix monotone constraints on CPU. (#9122)
This commit is contained in:
@@ -412,6 +412,7 @@ class HistEvaluator {
|
||||
tree_evaluator_.AddSplit(candidate.nid, left_child, right_child,
|
||||
tree[candidate.nid].SplitIndex(), left_weight,
|
||||
right_weight);
|
||||
evaluator = tree_evaluator_.GetEvaluator();
|
||||
|
||||
snode_.resize(tree.GetNodes().size());
|
||||
snode_.at(left_child).stats = candidate.split.left_sum;
|
||||
|
||||
@@ -49,6 +49,8 @@ class TreeEvaluator {
|
||||
monotone_.HostVector().resize(n_features, 0);
|
||||
has_constraint_ = false;
|
||||
} else {
|
||||
CHECK_LE(p.monotone_constraints.size(), n_features)
|
||||
<< "The size of monotone constraint should be less or equal to the number of features.";
|
||||
monotone_.HostVector() = p.monotone_constraints;
|
||||
monotone_.HostVector().resize(n_features, 0);
|
||||
// Initialised to some small size, can grow if needed
|
||||
|
||||
Reference in New Issue
Block a user