All Projects → truera → trulens

truera / trulens

Licence: AGPL-3.0 license
Library containing attribution and interpretation methods for deep nets.

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to trulens

mllp
The code of AAAI 2020 paper "Transparent Classification with Multilayer Logical Perceptrons and Random Binarization".
Stars: ✭ 15 (-89.73%)
Mutual labels:  explainable-ml
responsible-ai-toolbox
This project provides responsible AI user interfaces for Fairlearn, interpret-community, and Error Analysis, as well as foundational building blocks that they rely on.
Stars: ✭ 615 (+321.23%)
Mutual labels:  explainable-ml
Deep XF
Package towards building Explainable Forecasting and Nowcasting Models with State-of-the-art Deep Neural Networks and Dynamic Factor Model on Time Series data sets with single line of code. Also, provides utilify facility for time-series signal similarities matching, and removing noise from timeseries signals.
Stars: ✭ 83 (-43.15%)
Mutual labels:  explainable-ml
dlime experiments
In this work, we propose a deterministic version of Local Interpretable Model Agnostic Explanations (LIME) and the experimental results on three different medical datasets shows the superiority for Deterministic Local Interpretable Model-Agnostic Explanations (DLIME).
Stars: ✭ 21 (-85.62%)
Mutual labels:  explainable-ml
DataScience ArtificialIntelligence Utils
Examples of Data Science projects and Artificial Intelligence use cases
Stars: ✭ 302 (+106.85%)
Mutual labels:  explainable-ml
xai-iml-sota
Interesting resources related to Explainable Artificial Intelligence, Interpretable Machine Learning, Interactive Machine Learning, Human in Loop and Visual Analytics.
Stars: ✭ 51 (-65.07%)
Mutual labels:  explainable-ml
Awesome Machine Learning Interpretability
A curated list of awesome machine learning interpretability resources.
Stars: ✭ 2,404 (+1546.58%)
Mutual labels:  explainable-ml
Mindsdb
Predictive AI layer for existing databases.
Stars: ✭ 4,199 (+2776.03%)
Mutual labels:  explainable-ml
Interpret
Fit interpretable models. Explain blackbox machine learning.
Stars: ✭ 4,352 (+2880.82%)
Mutual labels:  explainable-ml
Tensorwatch
Debugging, monitoring and visualization for Python Machine Learning and Data Science
Stars: ✭ 3,191 (+2085.62%)
Mutual labels:  explainable-ml
diabetes use case
Sample use case for Xavier AI in Healthcare conference: https://www.xavierhealth.org/ai-summit-day2/
Stars: ✭ 22 (-84.93%)
Mutual labels:  explainable-ml
ml-fairness-framework
FairPut - Machine Learning Fairness Framework with LightGBM — Explainability, Robustness, Fairness (by @firmai)
Stars: ✭ 59 (-59.59%)
Mutual labels:  explainable-ml
global-attribution-mapping
GAM (Global Attribution Mapping) explains the landscape of neural network predictions across subpopulations
Stars: ✭ 18 (-87.67%)
Mutual labels:  explainable-ml
SHAP FOLD
(Explainable AI) - Learning Non-Monotonic Logic Programs From Statistical Models Using High-Utility Itemset Mining
Stars: ✭ 35 (-76.03%)
Mutual labels:  explainable-ml
fastshap
Fast approximate Shapley values in R
Stars: ✭ 79 (-45.89%)
Mutual labels:  explainable-ml
DIG
A library for graph deep learning research
Stars: ✭ 1,078 (+638.36%)
Mutual labels:  explainable-ml
shapr
Explaining the output of machine learning models with more accurately estimated Shapley values
Stars: ✭ 95 (-34.93%)
Mutual labels:  explainable-ml
CARLA
CARLA: A Python Library to Benchmark Algorithmic Recourse and Counterfactual Explanation Algorithms
Stars: ✭ 166 (+13.7%)
Mutual labels:  explainable-ml
cnn-raccoon
Create interactive dashboards for your Convolutional Neural Networks with a single line of code!
Stars: ✭ 31 (-78.77%)
Mutual labels:  explainable-ml
ProtoTree
ProtoTrees: Neural Prototype Trees for Interpretable Fine-grained Image Recognition, published at CVPR2021
Stars: ✭ 47 (-67.81%)
Mutual labels:  explainable-ml

Welcome to TruLens!

TruLens

TruLens is a cross-framework library for deep learning explainability. It provides a uniform abstraction over a number of different frameworks. It provides a uniform abstraction layer over TensorFlow, Pytorch, and Keras and allows input and internal explanations.

This paper is an introduction to the theoretical foundations of the library. We’ve been using TruLens at TruEra across a wide range of real-world use cases to explain deep learning models ranging from time-series RNNs to image and NLP models, and wanted to share the awesomeness with the world.

Documentation

Quick Usage

To quickly play around with the TruLens library, check out the following CoLab notebooks:

  • PyTorch: Open In Colab
  • Tensorflow 2 / Keras: Open In Colab
  • NLP with PyTorch: Open In Colab
  • NLP with Tensorflow 2 / Keras: Open In Colab

Installation

These installation instructions assume that you have conda installed and added to your path.

  1. Create a virtual environment (or modify an existing one).
conda create -n "<my_name>" python=3.7  # Skip if using existing environment.
conda activate <my_name>
  1. Install dependencies.
conda install tensorflow-gpu=1  # Or whatever backend you're using.
conda install keras             # Or whatever backend you're using.
conda install matplotlib        # For visualizations.
  1. Install the trulens package
pip install trulens

Overview

Attributions

Model Wrappers

In order to support a wide variety of backends with different interfaces for their respective models, TruLens uses its own ModelWrapper class which provides a general model interface to simplify the implementation of the API functions. To get the model wrapper, use the get_model_wrapper method in trulens.nn.models. A model wrapper class exists for each backend that converts a model in the respective backend's format to the general TruLens ModelWrapper interface. The wrappers are found in the models module, and any model defined using Keras, Pytorch, or Tensorflow should be wrapped before being used with the other API functions that require a model -- all other TruLens functionalities expect models to be an instance of trulens.nn.models.ModelWrapper.

For example,

from trulens.nn.models import get_model_wrapper
wrapped_model = get_model_wrapper(model_defined_via_keras)

Attribution Methods

Attribution methods, in the most general sense, allow us to quantify the contribution of particular variables in a model towards a particular behavior of the model. In many cases, for example, this may simply measure the effect each input variable has on the output of the network.

Attribution methods extend the AttributionMethod class, and many concrete instances are found in the trulens.nn.attribution module.

Once an attribution method has been instantiated, its main function is its attributions method, which returns an np.Array of batched items, where each item matches the shape of the input to the model the attribution method was instantiated with.

See the method comparison demo for further information on the different types of attribution methods, their uses, and their relationships with one another.

Slices, Quantities, and Distributions

In order to obtain a high degree of flexibility in the types of attributions that can be produced, we implement Internal Influence, which is parameterized by a slice, quantity of interest, and distribution of interest, explained below.

The slice essentially defines a layer to use for internal attributions. The slice for the InternalInfluence method can be specified by an instance of the Slice class in the trulens.nn.slices module. A Slice object specifies two layers: (1) the layer of the variables that we are calculating attribution for (e.g., the input layer), and (2) the layer whose output defines our quantity of interest (e.g., the output layer, see below for more on quantities of interest).

The quantity of interest (QoI) essentially defines the model behavior we would like to explain using attributions. The QoI is a function of the model's output at some layer. For example, it may select the confidence score for a particular class. In its most general form, the QoI can be pecified by an implementation of the QoI class in the trulens.nn.quantities module. Several common default implementations are provided in this module as well.

The distribution of interest (DoI) essentially specifies for which points surrounding each record the calculated attribution should be valid. The distribution can be specified via an implementation of the DoI class in the trulens.nn.distributions module, which is a function taking an input record and producing a list of sample input points to aggregate attribution over. A few common default distributions implementing the DoI class can be found in the trulens.nn.distributions module.

See Attributions for Different Use Cases for further explanations of the purpose of these parameters and examples of their usage.

Visualizations

In order to interpret the attributions produced by an AttributionMethod, a few useful visualizers are provided in the trulens.visualizations module. While the interface of each visualizer varies slightly, in general, the visualizers are a function taking an np.Array representing the attributions returned from an AttributionMethod and producing an image that can be used to interpret the attributions.

Contact Us

To communicate with other trulens developers, join our Slack!

Citation

DOI

To cite this repository: curl -LH "Accept: application/x-bibtex" https://doi.org/10.5281/zenodo.4495856

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].