From 6e2fa5f36deb9882e5bddb212695434c219c3d94 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 5 Jan 2022 15:56:24 +0100 Subject: store decision tree attributes of xv models in dataref export --- lib/functions.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/functions.py') diff --git a/lib/functions.py b/lib/functions.py index 320e8ed..5358d8e 100644 --- a/lib/functions.py +++ b/lib/functions.py @@ -339,6 +339,13 @@ class SplitFunction(ModelFunction): ret += 1 return ret + def get_max_depth(self): + ret = [0] + for v in self.child.values(): + if type(v) is SplitFunction: + ret.append(v.get_max_depth()) + return 1 + max(ret) + @classmethod def from_json(cls, data): assert data["type"] == "split" -- cgit v1.2.3