When to use FPDE
Use FPDE when you have:- A feature matrix where each column has a consistent meaning
- Class labels for training samples
- A classifier that exposes
predict_probaandclasses_ - A need to explain target-versus-rival evidence at the feature level
Core terms
Prototype construction
class_mean_prototypes(X, y) computes one prototype per class by averaging all training rows with that class label.
FPDEEngine.fit(X_train, y_train, model) builds the same prototype state and stores it for repeated explanations.
For repeated workflows, prefer FPDEEngine because it reuses:
- Class-mean prototypes
- Prototype labels
- Mean and zero anchors
- The baseline vector
- Label-to-prototype lookup state
Target and rival selection
When you useFPDEEngine with a model, FPDE chooses the local contrast from predict_proba.
1
Select the target class
The target class is the highest-probability class.
2
Select the rival class
The rival class is the second-highest-probability class.
3
Map labels to prototypes
FPDE maps both labels to their fitted class-mean prototypes.
positive_label and negative_label.
If you omit negative_label, FPDE selects a non-target prototype according to the selected mode.
Diff-FPDE
Diff-FPDE decomposes the difference in squared distances from the input to the rival and target prototypes.Cos-FPDE
Cos-FPDE decomposes a regularized cosine-similarity contrast.Hyb-FPDE
Hyb-FPDE mixes Diff-FPDE and Cos-FPDE attribution vectors.lambda_hyb must be in [0, 1].
lambda_hyb=1.0uses the Diff-FPDE endpoint.lambda_hyb=0.0uses the Cos-FPDE endpoint.- Intermediate values blend both attribution vectors.
normalize="none" when you want to mix the raw component scales.
Where to go next
- Use Explain one sample for a practical local explanation.
- Use Select lambda_hyb to choose a fixed mixture weight.
- Use Interpreting results to read signs and evidence values correctly.