Adaptor from LGBM dictionary to tree
Definition at line 48 of file convertLGBMToRootTree.py.
◆ __init__()
| util.convertLGBMToRootTree.LGBMTextNode.__init__ |
( |
| self, |
|
|
| structure, |
|
|
| invert_as_tmva = False ) |
Definition at line 53 of file convertLGBMToRootTree.py.
53 def __init__(self, structure, invert_as_tmva=False):
54 super(LGBMTextNode, self).__init__(structure)
55 self.invert_as_tmva = invert_as_tmva
56
◆ _get_left()
| util.convertLGBMToRootTree.LGBMTextNode._get_left |
( |
| self | ) |
|
|
protected |
Definition at line 69 of file convertLGBMToRootTree.py.
69 def _get_left(self):
70 if "left_child" not in self:
71 return None
72 if self["decision_type"] == "<=":
73 return LGBMTextNode(self["left_child"])
74 else:
75 return LGBMTextNode(self["right_child"])
76
◆ _get_right()
| util.convertLGBMToRootTree.LGBMTextNode._get_right |
( |
| self | ) |
|
|
protected |
Definition at line 77 of file convertLGBMToRootTree.py.
77 def _get_right(self):
78 if "right_child" not in self:
79 return None
80 if self["decision_type"] == "<=":
81 return LGBMTextNode(self["right_child"])
82 else:
83 return LGBMTextNode(self["left_child"])
84
◆ get_default_left()
| util.convertLGBMToRootTree.LGBMTextNode.get_default_left |
( |
| self | ) |
|
Definition at line 97 of file convertLGBMToRootTree.py.
97 def get_default_left(self):
98 return self.get("default_left", True)
99
100
◆ get_left()
| util.convertLGBMToRootTree.LGBMTextNode.get_left |
( |
| self | ) |
|
Definition at line 85 of file convertLGBMToRootTree.py.
85 def get_left(self):
86 if not self.invert_as_tmva:
87 return self._get_left()
88 else:
89 return self._get_right()
90
◆ get_right()
| util.convertLGBMToRootTree.LGBMTextNode.get_right |
( |
| self | ) |
|
Definition at line 91 of file convertLGBMToRootTree.py.
91 def get_right(self):
92 if not self.invert_as_tmva:
93 return self._get_right()
94 else:
95 return self._get_left()
96
◆ get_split_feature()
| util.convertLGBMToRootTree.LGBMTextNode.get_split_feature |
( |
| self | ) |
|
Definition at line 57 of file convertLGBMToRootTree.py.
57 def get_split_feature(self):
58 if "split_feature" in self:
59 return self["split_feature"]
60 else:
61 return -1
62
◆ get_value()
| util.convertLGBMToRootTree.LGBMTextNode.get_value |
( |
| self | ) |
|
Definition at line 63 of file convertLGBMToRootTree.py.
63 def get_value(self):
64 if "threshold" in self:
65 return self["threshold"]
66 else:
67 return self["leaf_value"]
68
◆ invert_as_tmva
| util.convertLGBMToRootTree.LGBMTextNode.invert_as_tmva = invert_as_tmva |
The documentation for this class was generated from the following file: