> For the complete documentation index, see [llms.txt](https://docs.seldon.ai/seldon-enterprise-platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.seldon.ai/seldon-enterprise-platform/demos/seldon-core-v2/explainer-tabular.md).

# Tabular Explanations

In this demo we will:

* Create a pipeline which can be used to classify tabular data
* Create an explainer that will offer insight into why a particular prediction was made for a given input
* Send a prediction request to the pipeline
* View the explanation

{% hint style="info" %}
**Note**: This demo uses a model trained to predict high or low income based on [demographic features from a 1996 US census](https://archive.ics.uci.edu/dataset/20/census+income).
{% endhint %}

## Register an income classifier model

Register a pre-trained income classifier SKLearn model. See the ["Register an income classifier model"](/seldon-enterprise-platform/demos/seldon-core-v2/drift-detection.md#register-an-income-classifier-model) section in the Drift Detection demo for detailed instructions.

## Configure predictions schema for classifier

Edit the model metadata to update the prediction schema for the model. See the ["Configure predictions schema for classifier"](/seldon-enterprise-platform/demos/seldon-core-v2/drift-detection.md#configure-predictions-schema-for-classifier) section in the Drift Detection demo for detailed instructions.

## Launch a Seldon ML Pipeline

1. Navigate to the `Model Catalog` page where the model was registered.
2. Find the model and under the `Action` dropdown list, select `Deploy`.

<details>

<summary>Deploy model</summary>

<img src="https://1921172648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvLlcdnP8YnaIFsv8EiMA%2Fuploads%2Fgit-blob-79f3068101955b1d281edcc651277a1a37d31e04%2Fdeploy-model.png?alt=media" alt="" data-size="original">

</details>

3. Enter the deployment details in the deployment creation wizard and click `Next`:
   * Name: *income-classifier*
   * Namespace: *seldon*
   * Type: *Seldon ML Pipeline*

<details>

<summary>Deploy pipeline</summary>

<img src="https://1921172648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvLlcdnP8YnaIFsv8EiMA%2Fuploads%2Fgit-blob-165db65a94bbe3006a4f728ad5d2a88eed5daffe%2Fname_your_pipeline.webp?alt=media" alt="" data-size="original">

</details>

4. The default predictor should already be filled in from the model catalog. Click `Next`.
5. Click `Next` for the remaining steps, then click `Launch`.
6. If your deployment is launched successfully, it will show an `Available` status in the `Overview` page.

## Get Predictions

1. Click on the `income-classifier` pipeline created in the previous section to enter the deployment dashboard.
2. Inside the deployment dashboard, on the left navigation drawer, click on the `Predict` button.
3. On the `Predict` page, enter the following text:

```json
{
  "inputs": [
    {
      "name": "income",
      "datatype": "INT64",
      "shape": [1, 12],
      "data": [53, 4, 0, 2, 8, 4, 2, 0, 0, 0, 60, 9]
    }
  ]
}
```

4. Click the `Predict` button.

![A screenshot showing the Predict page with the text area pre-populated](https://1921172648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvLlcdnP8YnaIFsv8EiMA%2Fuploads%2Fgit-blob-3d2036f20ac167812385bbd0dcb0f57ab0a93193%2Fview_the_response.webp?alt=media)

## Add an Explainer

There are currently 2 explainers available for tabular data classification:

* Anchor Explainer
* Kernel SHAP Explainer

1. From the `income-classifier` deployment dashboard, click `Add` inside the `Model Explanation` card.
2. For step 1 of the Explainer Configuration Wizard, select `Tabular` then click `Next`.
3.

{% tabs %}
{% tab title="Anchor Explainer" %}
For step 2, set the following details:

```
   - Explainer Algorithm: Anchor
```

For step 3, set the following details:

```
   - Explainer URI: gs://seldon-models/scv2/samples/mlserver_1.6.0/income-sklearn/anchor-explainer
   - Explainer Project: default
```

{% endtab %}

{% tab title="Kernel SHAP Explainer" %}
For step 2, set the following details:

```
   - Explainer Algorithm: KernelShap
```

For step 3, set the following details:

```
   - Explainer URI: gs://seldon-models/scv2/samples/mlserver_1.6.0/income-sklearn/kernel-shap-explainer
   - Explainer Project: default
```

{% endtab %}
{% endtabs %}

4. Skip step 4
5. For step 5, set following details

   ```
   - Memory: 1Gi
   ```
6. Click `Next` for the remaining steps, then click `Launch`.
7. If your explainer is launched successfully, both the pipeline and the explainer will show an `Available` status.

## Explain a Prediction

1. Navigate to the `Requests` page using the left navigation drawer.
2. Click on the `View explanation` button to generate explanations for the request.

{% tabs %}
{% tab title="Anchor Explainer" %}
![Anchor Explanation Part 1](https://1921172648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvLlcdnP8YnaIFsv8EiMA%2Fuploads%2Fgit-blob-bc834a5b08f1aa5c8eeec15331e1618803ace1d2%2Fanchor-explanation-1.webp?alt=media) ![Anchor Explanation Part 2](https://1921172648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvLlcdnP8YnaIFsv8EiMA%2Fuploads%2Fgit-blob-a10a1cad249bfdfc13b0fb69308ff2a8e8c5ab53%2Fanchor-explanation-2.webp?alt=media) ![Anchor Explanation Part 3](https://1921172648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvLlcdnP8YnaIFsv8EiMA%2Fuploads%2Fgit-blob-dde52d1430fce271848d96fbee234a219b2bbb63%2Fanchor-explanation-3.webp?alt=media)
{% endtab %}

{% tab title="Kernel SHAP Explainer" %}
![Shap Explanation Part 1](https://1921172648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvLlcdnP8YnaIFsv8EiMA%2Fuploads%2Fgit-blob-f9cc0d8699328167f285d828e7659e30ec1cdd26%2Fshap-explanation-1.webp?alt=media) ![Shap Explanation Part 2](https://1921172648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvLlcdnP8YnaIFsv8EiMA%2Fuploads%2Fgit-blob-0e30557ff75bb9e6f5ce72fc3e87aaea1af75f5b%2Fshap-explanation-2.webp?alt=media)
{% endtab %}
{% endtabs %}

Congratulations, you've created an explanation for the request! 🥳

## Next Steps

Why not try our other [demos](/seldon-enterprise-platform/demos.md)? Ready to dive in? Read our [operations guide](/seldon-enterprise-platform/operations.md) to learn more about how to use Enterprise Platform.
