From 2c14cc60d5f10bfdd8670a7409d3f83f2531c230 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 17 Mar 2022 09:15:37 +0100 Subject: LMT: Fix max_depth and number_of_leaves getters --- lib/functions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/functions.py b/lib/functions.py index 5aa773b..bfe0b00 100644 --- a/lib/functions.py +++ b/lib/functions.py @@ -538,9 +538,11 @@ class LMTFunction(SKLearnRegressionFunction): def get_number_of_nodes(self): return self.regressor.node_count + def get_number_of_leaves(self): + return len(self.regressor._leaves.keys()) + def get_max_depth(self): - # FIXME this returns the configured maximum depth, not the actual tree depth. - return self.regressor.max_depth + return max(map(len, self.regressor._leaves.keys())) + 1 class XGBoostFunction(SKLearnRegressionFunction): -- cgit v1.2.3