Fix nodes_leaves for base_estimator

This commit is contained in:
Ricardo Montañana Gómez 2021-11-24 10:50:19 +01:00
parent 3558c946a8
commit 74343a15e1
Signed by: rmontanana
GPG Key ID: 46064262FD9A7ADE

View File

@ -88,8 +88,9 @@ class Odte(BaseEnsemble, ClassifierMixin):
return self
def _compute_metrics(self) -> None:
tdepth = tnodes = tleaves = 0
tdepth = tnodes = tleaves = 0.0
for estimator in self.estimators_:
if hasattr(estimator, "nodes_leaves"):
nodes, leaves = estimator.nodes_leaves()
depth = estimator.depth_
tdepth += depth