XAI in Python with dalex

[This article was first published on Stories by Przemyslaw Biecek on Medium, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The dalex is the Python library developed by Wojciech Kretowicz and Hubert Baniecki for Explanatory Model Analysis / eXplainable Artificial Intelligence.

In MI2DataLab we have built many tools for the exploration, explanation and visualization of machine learning models. The latest product is the dalex package for Python developed by Wojciech Kretowicz and Hubert Baniecki.

It is written from scratch reimplementation of the DALEX package for R with identical functionalities and underlying philosophy. All algorithms have been rewritten to the Python and interactive plots are available through the plotly module.

Installation of the package

The latest version of the dalex package can be installed from a pip. The installation is very simple.

pip install dalex

Example use

We are still working on documentation and examples, so any feedback and suggestion will be welcome. For now we have:

An example Variable Importance plot. See more examples here
An example Partial Dependence and Accumulated Local Effect plot. See more examples here
An example Break Down plot. See more examples here

All available functions are described in the open ebook Explanatory Model Analysis.


The R environment has a fantastic data visualization system. Once the pioneer of statistical graphics was its package graphics, then package lattice and now its ggplot2. No wonder that for R there are many great tools for visualizing machine learning models, like pdp, ALEplot, condvis, lime, DALEX, iml, ROCR, modelStudio, regtools, vip, auditor, arena, modelDown and many others.

But what if we have a model built in Python, for example in scikit-learn?
In MI2DataLab we have made several tools to visualize in R models built in Python like DALEXtra and pyDALEX. Each of them required installation of both R and Python, which pose a challenge when it comes to maintaining both environments. In order to make it easier to explain the models built in scikit-learn or other Python libraries, a DALEX clone for Python was created.

There are already many great tools for XAI in Python, such as ELI4, LIME, SHAP, XAI360, tf-explain or interpretml. The advantage of the dalex package is that it is based on the expandable grammar of Explanatory Model Analysis process.

If you have an idea for an extension or find an error, let us know. Post an issue on https://github.com/ModelOriented/DALEX/.

To leave a comment for the author, please follow the link and comment on their blog: Stories by Przemyslaw Biecek on Medium.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)