Introducing tf-explain, Interpretability for TensorFlow 2.0

A Tensorflow 2.0 library for deep learning model interpretability

Raphaël Meudec
Sicara's blog
2 min readJul 31, 2019

--

Grad CAM Method (Original Photo by Kelly Lund on Unsplash)

Understanding deep networks is crucial for AI adoption. tf-explain offers interpretability methods to gain insight on your network.

The library is adapted to the Tensorflow 2.0 workflow, using tf.keras API as possible. It provides:

  • Heatmaps Visualizations & Gradients Analysis
  • Both off-training and tf.keras.Callback Usages
  • Tensorboard Integration

Disclaimer: This library is not an official Google product, although it is built for Tensorflow 2.0 models.

Why interpretability

The main challenge when working with deep neural networks is to understand the behavior of trained networks. It is crucial both to the scientist to debug and improve current model, and to the users to help them to trust the method. As a human, it is difficult to get feedback from a neural network. Interpretability has emerged in research to help tackling this:

  • Analysis of decisions over a validation set helps identify issues with the network (for instance bias in dataset, mislabeled data)
  • Heatmap visualizations are often appreciated by non-initiated users

However, those methods are not well-integrated in deep learning workflow as of today.

The solution: off the shelf analysis tools for your tf.keras models

tf-explain implements interpretability methods as Tensorflow 2.0 callbacks to ease neural networks’ understanding.

The library was built to offer a comprehensive list of interpretability methods, directly usable in your Tensorflow workflow:

  • Tensorflow 2.0 compatibility
  • Unified interface between methods
  • Support for Training Integration (callbacks, Tensorboard)

Built for Tensorflow 2.0

tf-explain respects the new TF2.0 API, and is primarily based on tf.keras when possible. It benefits from the @tf.function decorator which helps to keep support for both eager and graph mode. This allows keeping most algorithms computation time negligible compared to full training.

Read the full article here.

--

--