Simplify bound checking in feature interaction constraints (#4428)
This commit is contained in:
parent
4c74336384
commit
17df5fd296
@ -515,12 +515,8 @@ class InteractionConstraint final : public SplitEvaluator {
|
||||
// permissible in a given node; returns false otherwise
|
||||
inline bool CheckInteractionConstraint(bst_uint featureid, bst_uint nodeid) const {
|
||||
// short-circuit if no constraint is specified
|
||||
if (params_.interaction_constraints.empty()) {
|
||||
return true;
|
||||
}
|
||||
CHECK_LT(nodeid, int_cont_.size()) << "Invariant violated: nodeid = "
|
||||
<< nodeid << ", int_cont_.size() = " << int_cont_.size();
|
||||
return (int_cont_[nodeid].count(featureid) > 0);
|
||||
return (params_.interaction_constraints.empty()
|
||||
|| int_cont_.at(nodeid).count(featureid) > 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user