Model Explanations with Anchor Text

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

Use the model uri:

gs://seldon-models/sklearn/moviesentiment

load

Get Predictions

Run a single prediction using the JSON below.

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

load

Add an Anchor Text Explainer

Create an Anchor Text explainer using the default settings.

load

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"
    ]
  }
}

explain