| title | Select lambda_hyb |
|---|---|
| description | Choose a Hyb-FPDE mixture weight with held-out validation data |
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.
- A fitted
FPDEEngine - Held-out validation samples
X_val - A classifier with
predict_probaandclasses_ - A candidate grid for
lambda_hyb
Keep validation data separate from the final reporting split.
Start with a small grid.```python
lambda_grid = (0.0, 0.25, 0.5, 0.75, 1.0)
```
```python
selection = engine.select_lambda(
X_val,
lambda_hyb_grid=lambda_grid,
fractions=(0.0, 0.1, 0.3, 0.5, 0.7, 1.0),
normalize="l1",
)
```
```python
attributions, details = engine.explain_batch(
X_test,
lambda_hyb=selection.best_lambda,
normalize="l1",
)
```
print(selection.best_lambda)
print(selection.best_config)
print(selection.rows)selection.rows contains the candidate scores.
Save it with your experiment artifacts.
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:
combined_score = 0.5 * (deletion_drop_auc + insertion_auc)
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.