Skip to main content
This tutorial trains a scikit-learn classifier, fits FPDE prototypes from the training data, and explains one test sample. The example uses the breast cancer dataset bundled with scikit-learn.

Prerequisites

  • Python 3.12 or newer
  • fpde
  • A classifier that exposes predict_proba and classes_
1

Install FPDE

Install the stable package from PyPI.
2

Train a classifier

Train the model on the same feature space you will explain.
3

Fit FPDE

Fit reusable class-mean prototypes from the training data.
4

Explain one sample

Compute a Hyb-FPDE explanation with a fixed lambda_hyb.

Complete example

Interpret the output

details["target_label"] is the model’s highest-probability class. details["rival_label"] is the second-highest-probability class. details["evidence"] is the target-versus-rival contrast decomposed by FPDE.
Positive attribution values support the target class. Negative attribution values support the rival class.

Next steps