Skip to main content
Use FPDEEngine.select_lambda to choose a fixed lambda_hyb before you explain final evaluation or test samples. The method evaluates candidates with deletion and insertion perturbation curves on held-out data.

Prerequisites

  • A fitted FPDEEngine
  • Held-out validation samples X_val
  • A classifier with predict_proba and classes_
  • A candidate grid for lambda_hyb
Keep validation data separate from the final reporting split.

Run selection

1

Choose a candidate grid

Start with a small grid.
2

Evaluate validation samples

Score each candidate on held-out samples.
3

Reuse the selected value

Explain final samples with the selected lambda_hyb.

Inspect the result

selection.rows contains the candidate scores. Save it with your experiment artifacts.

How selection is scored

For each candidate, FPDE computes deletion and insertion curves. Deletion replaces top-ranked features with the baseline. Insertion starts from the baseline and restores top-ranked features. The combined score is:
The selected lambda is the candidate with the best validation score.
Use the same normalize, anchor_strategy, and eps values during selection and final explanation.

Bayesian selection

Use FPDEEngine.select_bayesian_lambda when you want a posterior over lambda_hyb candidates instead of a single fixed value. The method scores each unique candidate with the same deletion and insertion validation as select_lambda, combines the scores with a Beta prior, and normalizes the result into a finite-grid posterior. The posterior is limited to the lambda_hyb grid. It does not sample class prototypes, estimate feature-level prototype uncertainty, or model classifier uncertainty.

Build the posterior

  • alpha and beta set the Beta prior over lambda_hyb. The defaults alpha=1.0, beta=1.0 give a uniform prior.
  • temperature scales how sharply validation scores concentrate posterior mass. Lower values produce a more peaked posterior.
  • credible_mass sets the coverage of the reported credible interval. The default is 0.95.

Inspect the posterior

selection.posterior_rows holds the posterior mass and validation score for each candidate. The credible interval is an interval over lambda_hyb candidates, not a per-feature attribution interval.

Explain with the posterior mean

Pass the selection result to explain_one_bayesian or explain_batch_bayesian. Both use selection.posterior_mean_lambda and reuse the normalize, anchor_strategy, and eps values from selection.
The result is a Bayesian model-averaged Hyb-FPDE explanation over the finite lambda grid. details["posterior_mean_lambda"] records the lambda that produced the attributions. For a runnable end-to-end walkthrough, including posterior plots and credible-interval attribution ranges, see examples/bayesian_fpde_example.ipynb.