Why interpretability matters
What it is
Three distinct reasons, which want different tools: debugging (is the model right for the right reasons?), trust (will a domain expert act on this output?), and compliance (in credit, insurance, hiring and healthcare, an adverse decision often must come with a stated reason).
Why it matters
Conflating the three produces the wrong artifact. A regulator wants a per-decision reason code; a data scientist chasing a bug wants a global ranking to sort features by suspicion; a clinician wants to know whether this particular prediction rests on something clinically plausible.
In the real world: Lenders must tell customers why a loan was declined, and regulators ask how a model makes decisions.
# Debugging: does the global ranking contain anything absurd?
from sklearn.inspection import permutation_importance
r = permutation_importance(pipe, X_val, y_val, n_repeats=10, random_state=0, scoring='roc_auc')
for i in r.importances_mean.argsort()[::-1][:5]:
print(f'{X_val.columns[i]:<24} {r.importances_mean[i]:+.4f}')
# Compliance: the same model, one row, ranked reasons for THIS decision.
# top_reasons(explain_row(pipe, X_val.iloc[[7]]), k=3)An accurate model that is right for the wrong reason passes every metric you have. A pneumonia model that learnt the hospital's portable-X-ray marker, or a churn model that learnt a support ticket opened *because* the cancellation was already decided, both score beautifully offline and are useless in the decision they were built for.