explain_prediction
Explains a borrower default-risk score by showing which applicant factors increase or decrease risk, returning ranked SHAP contributions with human-readable names.
Instructions
Explain a default-risk prediction: which factors push risk up or down.
Use this when the user wants the "why" behind a score, not just the number. Runs SHAP on the single applicant and returns the strongest contributing features with human-readable names.
Args: profile: the applicant to explain. top_n: how many contributing factors to return (default 8).
Returns a dict with default_probability, risk_tier, and top_factors — a list of {feature, friendly_name, value, shap_contribution, direction} ordered by impact, where direction is "increases risk" or "decreases risk".
Educational model — not real lending advice.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top_n | No | ||
| profile | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||