Skip to content

Example-based

Latest
Compare
Choose a tag to compare
@AntoninPoche AntoninPoche released this 08 Oct 12:36
· 1 commit to master since this release

Release v1.4.0 Introduce the Example-based module

This module introduces example-based methods from four families of methods. Namely:

  • Similar Examples
  • Semi-factuals
  • Counterfactuals
  • Prototypes

The API

The API is common for the four families, and it has three steps:

  • Construct a projection function with the model.
  • Initialize the method with a dataset, projection, and other parameters.
  • Explain given samples with a local explanation.
projection = ProjectionMethod(model)

explainer = ExampleMethod(
    cases_dataset=cases_dataset, 
    k=k,
    projection=projection,
    case_returns=case_returns,
    distance=distance,
)

examples = explainer.explain(inputs, targets)

It works for TensorFlow and PyTorch without additional code. To have more information, please look at the documentation or to the tutorial.

Other modifications

  • Xplique is limited to TensorFlow < 2.16 as this version of tf introduces many modifications.
  • The features visualization module now supports grey-scale images.