Skip to content

Commit

Permalink
Hiding threshold if equals to zero in tree representation
Browse files Browse the repository at this point in the history
  • Loading branch information
gAldeia committed Oct 29, 2024
1 parent 82995a2 commit 10a4caa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/program/tree_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ string TreeNode::get_tree_model(bool pretty, string offset) const
}

if (Is<NodeType::SplitBest>(data.node_type)){
if (data.W == 0.0) // likely it is a boolean (threshold is forced at zero)
return fmt::format("If({})", data.get_feature()) + child_outputs;

return fmt::format("If({}>{:.2f})", data.get_feature(), data.W) +
child_outputs;
}
Expand Down

0 comments on commit 10a4caa

Please sign in to comment.