Tabular Data Classification on Income Dataset

In this demo we will:

  • Create a pipeline which can be used to classify tabular data

  • Send a request to get a prediction

  • Create an explainer - either an anchor or kernel SHAP explainer

  • Send a request to a prediction pipeline

  • View the explanation

Create a Pipeline

  1. Click on Create new deployment. Create new deployment

  2. Enter the deployment details as follows:

    • Name: income

    • Namespace: seldon

    • Type: Seldon ML Pipeline

    Expand to see deploy pipeline

    Deployment Details

  3. Configure the default predictor as follows:

    • Runtime: Scikit Learn

    • Model URI:

       gs://seldon-models/scv2/samples/mlserver_1.3.2/income-sklearn/classifier/
      
    • Model Project: default

    • Storage Secret: (leave blank/none)

    Expand to see default predictor details

    Default Predictor

  4. Skip Next for the remaining steps, then click Launch.

Get Predictions

  1. Click on the income 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:

{
  "inputs": [
    {
      "name": "income",
      "datatype": "INT64",
      "shape": [1, 12],
      "data": [53, 4, 0, 2, 8, 4, 2, 0, 0, 0, 60, 9]
    }
  ]
}
  1. Click the Predict button. A screenshot showing the Predict page with the text area pre-populated

Add an Explainer

There are currently 2 explainers available for tabular data classification:

  • Anchor Explainer

  • Kernel SHAP Explainer

  1. From the income deployment dashboard, click Add inside the Model Explanation card.

  2. For step 1 of the Explainer Configuration Wizard, select Tabular then click Next.

  3. For step 2, set the following details:

       - Explainer Algorithm: Anchor
    

    In step 3, set the following details:

       - Explainer URI: gs://seldon-models/scv2/samples/mlserver_1.3.2/income-sklearn/anchor-explainer
       - Explainer Project: default
    
  4. Skip step 4

  5. For step 5, set following details

    - Memory: 1Gi
    
  6. Skip the remaining steps without changing fields, and click Launch.

After a short while, the explainer should become available.

Get Explanation for 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.

    Anchor Explanation Part 1 Anchor Explanation Part 2 Anchor Explanation Part 3

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