Git Product home page Git Product logo

visualime's Introduction

VisuaLIME

Unit Test Status Coverage Status Documentation Status License PyPI version PyPI - Status

VisuaLIME is an implementation of LIME (Local Interpretable Model-Agnostic Explanations) [1] focused on producing visual local explanations for image classifiers.

In contrast to the reference implementation, VisuaLIME exclusively supports image classification and gives its users full control over the properties of the generated explanations. It was written to produce stable, reliable, and expressive explanations at scale.

VisuaLIME was created as part of the XAI Demonstrator project.

A full documentation is available on visualime.readthedocs.io.

Getting Started

๐Ÿ’ก If you're new to LIME, you might want to check out the Grokking LIME talk/tutorial for a general introduction prior to diving into VisuaLIME.

To install VisuaLIME, run:

pip install visualime

VisuaLIME provides two functions that package its building blocks into a reference explanation pipeline:

import numpy as np
from visualime.explain import explain_classification, render_explanation

image = ...  # a numpy array of shape (width, height, 3) representing an RGB image

def predict_fn(images: np.ndarray) -> np.ndarray:
    # a function that takes a numpy array of shape (num_of_samples, width, height, 3)
    # representing num_of_samples RGB images and returns a numpy array of
    # shape (num_of_samples, num_of_classes) where each entry corresponds to the
    # classifiers output for the respective image
    predictions = ...
    return predictions

segment_mask, segment_weights = explain_classification(image, predict_fn)

explanation = render_explanation(
        image,
        segment_mask,
        segment_weights,
        positive="green",
        negative="red",
        coverage=0.2,
    )

For a full example, see the example notebook on GitHub.

Roadmap

  • Verify that the algorithm matches the original LIME and document differences
  • Add performance benchmarks and optimize implementation of the algorithm
  • Include utilities to assess and tune explanations for stability and faithfulness
  • Create a user guide that walks through a best practice example of implementing a fully configurable LIME explainer

References

[1] Ribeiro et al.: "Why Should I Trust You?": Explaining the Predictions of Any Classifier (arXiv:1602.04938, 2016)

visualime's People

Contributors

bergschaf avatar ddennyd avatar dependabot[bot] avatar ionicsolutions avatar matthias271828 avatar theresa323 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

bergschaf

visualime's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.