Skip to content

Commit eb4551c

Browse files
committed
CN2RuleViewer: Output sample of training data when separate data is not available
1 parent 07dafdf commit eb4551c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Orange/widgets/visualize/owruleviewer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,19 @@ def commit(self):
137137
data_output = None
138138
self._save_selected(actual=True)
139139

140+
data = self.data or self.classifier and self.classifier.instances
140141
if (self.selected is not None and
141-
self.data is not None and
142+
data is not None and
142143
self.classifier is not None and
143-
self.data.domain.attributes ==
144+
data.domain.attributes ==
144145
self.classifier.original_domain.attributes):
145146

146-
status = np.ones(self.data.X.shape[0], dtype=bool)
147+
status = np.ones(data.X.shape[0], dtype=bool)
147148
for i in self.selected:
148149
rule = self.classifier.rule_list[i]
149-
status &= rule.evaluate_data(self.data.X)
150+
status &= rule.evaluate_data(data.X)
150151

151-
data_output = self.data.from_table_rows(
152-
self.data, status.nonzero()[0])
152+
data_output = data.from_table_rows(data, status.nonzero()[0])
153153

154154
self.send(OWRuleViewer.data_output_identifier, data_output)
155155

0 commit comments

Comments
 (0)