From 10a4caa2ba5def89b35ced85fe0113f39c3cb862 Mon Sep 17 00:00:00 2001 From: gAldeia Date: Tue, 29 Oct 2024 14:08:01 -0300 Subject: [PATCH] Hiding threshold if equals to zero in tree representation --- src/program/tree_node.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/program/tree_node.cpp b/src/program/tree_node.cpp index bee16d63..aad1e43e 100644 --- a/src/program/tree_node.cpp +++ b/src/program/tree_node.cpp @@ -39,6 +39,9 @@ string TreeNode::get_tree_model(bool pretty, string offset) const } if (Is(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; }