cdpierse / transformers-interpret

Model explainability that works seamlessly with 🤗 transformers. Explain your transformers model in just 2 lines of code.
Apache License 2.0
1.29k stars 97 forks source link

MultiLabel Classification Explainer #79

Closed cdpierse closed 2 years ago

cdpierse commented 2 years ago

PR Description

Extends the existing sequence classification explainer into a new explainer that independently produces attributions for each label in the model regardless of what the predicted class is. This allows users to better inspect and interpret model predictions across all classes, particularly in situations where classifiers might be used in a multilabel fashion.

The MultiLabelClassificationExplainer returns a dictionary mapping labels/classes to a list of word attributions, additionally the visualize() method will display the entire table of attributions for each label.

This has been a very requested feature for a number of months so we're very happy to get it released (finally)

CC: @MichalMalyska @rhettdsouza13 @fraserprice @JensVN98 @dheerajiiitv

Motivation and Context

References issue: #39

Tests and Coverage

Types of changes

Final Checklist: