OPEN SOURCE · ALPHA · MIT

XAI — an eXplainability toolbox for machine learning

"XAI is a Machine Learning library that is designed with AI explainability in its core." It implements the three steps of explainable machine learning: data analysis, model evaluation and production monitoring, tools and process together.

01 — THE PROCESS, BY CHECKPOINT

The process, by checkpoint

XAI converts the Responsible AI Principles into a practical tool + process approach. The process carries explainability and bias mitigation through the full responsible-ML workflow, rather than treating them as a one-off report after training.

responsible-ml.process

TOOL + PROCESS

Responsible ML is a continuous workflow

Inspect the data before training

01CHECKPOINT

Data analysis

Surface imbalance across data and protected attributes, then correct it before training.

EXPLAINSURFACE BIASMITIGATE
CHECKED ✓
02CHECKPOINT

Model evaluation

Explain model behaviour and compare outcomes across protected groups.

EXPLAINSURFACE BIASMITIGATE
CHECKED ✓
03CHECKPOINT

Production monitoring

Monitor predictions, surface bias and feed findings back into mitigation.

EXPLAINSURFACE BIASMITIGATE
CHECKED ✓

02 — THE TOOLBOX, BY STAGE

The toolbox, by stage

The library ships with a census dataset for experimentation (xai.data.load_census()), and installs from PyPI. The protected-attribute lens runs through every stage: the same gender or ethnicity split that shapes the train/test split reappears in the metric and ROC comparisons.

STAGE 01 — PUBLIC API

Data analysis

imbalance_plot+

Plot class imbalances across one or more columns.

XAI class-imbalance plots split by gender and loan outcome
balance+

Correct class imbalances with up-sampling or down-sampling.

correlations+

Visualise correlations as a matrix or hierarchical dendogram.

group_by_columns+

Group a dataset by one or more categorical columns for custom operations.

balanced_train_test_split+

Create train and test splits balanced across protected attributes.

STAGE 02 — PUBLIC API

Model evaluation

feature_importance+

Calculate permutation-based feature importance.

metrics_plot+

Compare metric imbalances overall and across protected columns.

XAI model metrics compared across gender and ethnicity groups
roc_plot+

Plot ROC curves overall or per group, such as gender, ethnicity, or age.

confusion_matrix_plot+

Render a confusion matrix for model predictions.

STAGE 03 — PUBLIC API

Production monitoring

smile_imbalance+

Bucket accuracy and statistical metrics by prediction probability to visualise benefits of adding manual review on probability thresholds.

XAI probability buckets showing a manual review threshold

03 — TALK AND WORKED EXAMPLE

Talk and worked example

The approach was presented at PyData London, covering how to identify and mitigate undesired bias with the toolbox.

PyData London 2019 XAI talkPYDATA LONDON 2019 · VIDEOExplainable AI and bias mitigation with the XAI LibraryWatch the talk