A Sea of Words: An In-Depth Analysis of Anchors for Text Data

Gianluigi Lopardo, Frederic Precioso, Damien Garreau
5/27/2022
stat.MLcs.AIcs.CL

Official code: gianluigilopardo/anchors_text_theory (14 stars, Python, last commit 2024-10-26).

Abstract

Anchors (Ribeiro et al., 2018) is a post-hoc, rule-based interpretability method. For text data, it proposes to explain a decision by highlighting a small set of words (an anchor) such that the model to explain has similar outputs when they are present in a document.

Show full abstract

In this paper, we present the first theoretical analysis of Anchors, considering that the search for the best anchor is exhaustive. After formalizing the algorithm for text classification, we present explicit results on different classes of models when the vectorization step is TF-IDF, and words are replaced by a fixed out-of-dictionary token when removed. Our inquiry covers models such as elementary if-then rules and linear classifiers. We then leverage this analysis to gain insights on the behavior of Anchors for any differentiable classifiers. For neural networks, we empirically show that the words corresponding to the highest partial derivatives of the model with respect to the input, reweighted by the inverse document frequencies, are selected by Anchors.

View on arXivView PDF

Code Implementations(1)

Code for the paper "A Sea of Words: An In-Depth Analysis of Anchors for Text Data", AISTATS 2023

141PythonMay 12, 20222 years ago
anchorsexplainable-aiinterpretabilitynatural-language-processingstatistics

Similar Papers

Cite this paper

@article{lopardo2022words,
  title  = {A Sea of Words: An In-Depth Analysis of Anchors for Text Data},
  author = {Gianluigi Lopardo and Frederic Precioso and Damien Garreau},
  year   = {2022},
  eprint = {2205.13789},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2205.13789}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2205.13789.svg)](https://codeofpaper.com/paper/2205.13789)

Discussion