Skip to content
Snippets Groups Projects

end Decision tree

Merged Caroline de Pourtalès requested to merge decision-tree-type-file into main
15 files
+ 1813
197
Compare changes
  • Side-by-side
  • Inline
Files
15
@@ -393,14 +393,18 @@ class DecisionTree():
done.append(target)
return done
list_contrastive_expls = []
to_hit = [set(s) for s in to_hit]
to_hit.sort(key=lambda s: len(s))
expls = list(reduce(process_set, to_hit, []))
list_expls_str = []
explanation = {}
for expl in expls:
list_contrastive_expls.append([self.fvmap[(p[0],1-p[1])] for p in sorted(expl, key=lambda p: p[0])])
list_expls_str.append('Contrastive: IF {0} THEN class!={1}'.format(' OR '.join(['!{0}'.format(self.fvmap[p]) for p in sorted(expl, key=lambda p: p[0])]), term))
explanation["List of path contrastive explanation(s)"] = list_contrastive_expls
explanation["List of contrastive explanation(s)"] = list_expls_str
explanation["Number of contrastive explanation(s) : "]=str(len(expls))
explanation["Minimal contrastive explanation : "]= str( min([len(e) for e in expls]))
Loading