> ## Documentation Index
> Fetch the complete documentation index at: https://fpde-80-mintlify-48090872.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Use FPDE to explain classification results with prototype-contrast feature attribution

Feature Prototype Direction Explainer (FPDE) is a Python package for prototype-contrast feature attribution.
It explains a classification result by comparing an input with a prototype for the target class and a prototype for a rival class.
FPDE then decomposes that contrast into one contribution per feature.

Use FPDE when you need a lightweight, post-hoc explanation method for tabular feature vectors and classifiers that expose class probabilities.

<CardGroup cols={2}>
  <Card title="Install FPDE" icon="box-archive" href="/installation">
    Install the PyPI package and check that your environment meets the requirements.
  </Card>

  <Card title="Run the quickstart" icon="rocket" href="/quickstart">
    Train a scikit-learn classifier and explain your first sample.
  </Card>

  <Card title="Explain one sample" icon="magnifying-glass" href="/explain-one">
    Fit reusable prototype state and inspect a single target-versus-rival explanation.
  </Card>

  <Card title="Explain batches" icon="table" href="/explain-batches">
    Generate attribution matrices while keeping per-sample metadata.
  </Card>

  <Card title="Choose lambda_hyb" icon="sliders" href="/select-lambda">
    Select a Hyb-FPDE mixture weight with held-out deletion and insertion validation.
  </Card>

  <Card title="Look up APIs" icon="code" href="/api-reference">
    Review public classes, functions, parameters, result objects, and errors.
  </Card>
</CardGroup>

## What FPDE does

FPDE builds one class-mean prototype per class from training data.
For one input, it chooses a target class and a rival class.
With `FPDEEngine`, the target class is the model's highest-probability class and the rival class is the second-highest-probability class.

The output is an attribution vector with one value per feature.
Positive values support the target class.
Negative values support the rival class.

## What you need

* Python 3.12 or newer
* NumPy and scikit-learn
* Training data and labels in the same feature space used by the classifier
* A fitted classifier with `predict_proba` and `classes_` for model-driven workflows

```bash theme={null}
python -m pip install fpde
```

<Tip>
  Start with the <a href="/quickstart">quickstart</a> if you are new to FPDE.
  Use the <a href="/method-overview">method overview</a> when you need the details behind Diff-FPDE, Cos-FPDE, and Hyb-FPDE.
</Tip>

## Project links

* [Repository](https://github.com/fpde-xai/fpde)
* [PyPI package](https://pypi.org/project/fpde/)
* [Citation metadata](https://github.com/fpde-xai/fpde/blob/main/CITATION.cff)
* [License](https://github.com/fpde-xai/fpde/blob/main/LICENSE)
