Skip to main content
Glama
florenciakabas

xai-toolkit

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
NameRequiredDescriptionDefault
model_idYes
sample_indexYes
include_plotNo

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/florenciakabas/xai-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server