Skip to content

Commit

Permalink
OW*TreeViewer: Use correct attribute for value formatting
Browse files Browse the repository at this point in the history
Before, self.attribute() returned TREE_UNDEFINED (-2) for leaf nodes
which failed with domains of a single feature and worked incorrectly
with all other domains (it took the second to last feature).
Now, use self.parent.attribute() to format the value of the split.
  • Loading branch information
kernc committed Jul 7, 2016
1 parent 815a8fc commit a54f810
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Orange/widgets/classify/owclassificationtreegraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ def split_condition(self):
:return: split condition to reach a particular node.
"""
if self.i > 0:
attribute = self.domain.attributes[self.attribute()]
parent_attr = self.domain.attributes[self.parent.attribute()]
parent_attr_cv = parent_attr.compute_value
is_left_child = self.tree.children_left[self.parent.i] == self.i
Expand All @@ -292,7 +291,7 @@ def split_condition(self):
else:
thresh = self.tree.threshold[self.parent.i]
return "%s %s" % ([">", "≤"][is_left_child],
attribute.str_val(thresh))
parent_attr.str_val(thresh))
else:
return ""

Expand Down

0 comments on commit a54f810

Please sign in to comment.