Model Explanations with Text Data

In this demo we will:

  • Launch a movie sentiment model which takes text input

  • Send a request to get a sentiment prediction

  • Create an explainer for the model

  • Send the same request and then get an explanation for it

The explainer uses the anchors technique to provide insight into why a particular classification was made by the model. We’ll see patterns in input text that are most relevant to the prediction outcome.

Create Model

  1. Click on Create. Click Create button

  2. Enter the deployment details as follows:

  • name: movie

  • namespace: seldon

  • Type: Seldon Deployment

  • Protocol: Seldon Deployment details

  1. Configure the default predictor as follows:

  • runtime: Scikit Learn

  • Model Project: default

  • uri:

  • Storage Secret: (leave blank/none) Default predictor spec

  1. Skip to the end and click Launch. Launch deployment

  2. If your deployment is launched successfully, it will have Available status. Deployment dashboard showing newly created deployment with available status

Get Predictions

  1. Click on the movie deployment created in the previous section to enter the deployment dashboard.

  2. Inside the deployment dashboard, click on the Predict button.

  3. On the Predict page, enter the following text:

      "data": {
        "names": [
          "Text review"
        "ndarray": [
          "this film has bad actors"
  4. Click the Predict button. A screenshot showing the Predict page with the textarea prepopulated

Add an Anchor Text Explainer

  1. From the movie deployment dashboard, click Create inside the Model Explanation card. The "Create" button inside the Model Explanation card being clicked

  2. For step 1 of the Explainer Configuration Wizard, select Text then click Next. Text radio option selected

  3. For step 2, click make sure Anchors is selected, then click Next. Anchors option selected

  4. For step 3, click Next (do not fill in any fields). Next button clicked

  5. For step 4, click Next (do not change any fields). Next button clicked

  6. For step 5, click Next (do not change any fields). You may wish to enter a comment here for a gitops enabled namespace. Next button clicked

  7. For step 6, click Launch. Next button clicked

After a short while, the explainer should become available.

Explainer status showing Available

Get Explanation for one Request

Resend a single request using the JSON below and then explain it:

  "data": {
    "names": [
      "Text review"
    "ndarray": [
      "this film has bad actors"

Resending the initial prediction

Navigate to the Requests page using the left navigation drawer.

navigating to the Requests page

Click on the magnifying glass icon to generate explanations for the request.

Explaining the request

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

Next Steps

Why not try our other demos? Ready do dive in? Read our operations guide to learn more about how to use Deploy.