Welcome to ContrXT’s documentation!

ContrXT is a Python library that provides global, model-agnostic, contrastive explainer for any text classifier.

ContrXT is about explaining how a classifier changed its predictions through time. Also, it can be used to explain the differences in the classification behaviours of two distinct classifiers at a time.

ContrXT takes as input the predictions of two distinct classifiers M1 and M2. Then, it traces the decision criteria of both classifiers by encoding the changes in the decision logic through Binary Decision Diagrams. Then (ii) it provides “global, model-agnostic, time-contrastive (T-contrast) “explanations in natural language, estimating why -and to what extent- the model has modified its behaviour over time.

Check out the Usage section for further information, including how to Installation the project.

Note

This project is under active development.

Contents

Usage

Installation

To use ContrXT, first install it using pip:

(.venv) $ pip install contrxt

The PyEDA package is required but has not been added to the dependencies. This is due to installation errors on Windows. If you are on Linux or Mac, you should be able to install it by running:

(.venv) $ pip install pyeda

However, if you are on Windows, we found that the best way to install is through Christophe Gohlke’s pythonlibs page.

For further information, please consult the official PyEDA installation documentation.

To produce the PDF files, a Graphviz installation is also required. Full documentation on how to install Graphviz on any platform is available here.

Using ContrXT

TO-DO documentation. […]you can use the exp.run_trace() function[…]

For example:

>>> from contrxt.contrxt import ContrXT
>>> exp = ContrXT(X_t1, predicted_labels_t1,
>>>               X_t2, predicted_labels_t2)
>>> exp.run_trace()
>>> exp.run_explain()
>>> exp.explain.BDD2Text()

API