Skip to content

Commit 89eb7d0

Browse files
Fixed AnchorTabular length discrepancy between feature and names field. (#902)
Fixed AnchorTabular length discrepancy between feature and names field.
1 parent 90541a2 commit 89eb7d0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

alibi/explainers/anchors/anchor_tabular.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,9 +912,10 @@ def add_names_to_exp(self, explanation: dict) -> None:
912912
"""
913913

914914
anchor_idxs = explanation['feature']
915-
explanation['names'] = []
916-
explanation['feature'] = [self.enc2feat_idx[idx] for idx in anchor_idxs]
917915
ordinal_ranges = {self.enc2feat_idx[idx]: [float('-inf'), float('inf')] for idx in anchor_idxs}
916+
explanation['feature'] = list(ordinal_ranges.keys())
917+
explanation['names'] = []
918+
918919
for idx in set(anchor_idxs) - self.cat_lookup.keys():
919920
feat_id = self.enc2feat_idx[idx] # feature col. id
920921
if 0 in self.ord_lookup[idx]: # tells if the feature in X falls in a higher or lower bin

0 commit comments

Comments
 (0)