explain_prediction
Understand why a machine learning model made a specific prediction by revealing which features influenced the classification, supported by SHAP values and optional visualizations.
Instructions
Explain why a single sample received its classification.
Returns a plain-English narrative explaining which features drove
the model's prediction for the given sample, backed by SHAP values.
Optionally includes a SHAP bar chart (tornado plot) visualization.
Checks the result store first for precomputed explanations.
Falls back to on-the-fly SHAP computation if not found.
Args:
model_id: ID of a registered model (e.g., "gbc_lubricant_quality").
sample_index: Row index in the test dataset to explain (0-based).
include_plot: If True, include a SHAP bar chart as base64 PNG (default: True).Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model_id | Yes | ||
| sample_index | Yes | ||
| include_plot | No |