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).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model_id": "<model_id>",
"sample_index": "<sample_index>"
},
"name": "explain_prediction"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model_id | Yes | ||
| sample_index | Yes | ||
| include_plot | No |