Model Explanations with Text Data¶
In this demo we will:
Launch a movie sentiment pipeline 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 anchor 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¶
Click on
Create new deployment.Enter the deployment details as follows:
- Name: movie - Namespace: seldon - Type: Seldon ML Pipeline
Configure the default predictor as follows:
- Runtime: Scikit Learn - Model Project: default - Model URI: gs://seldon-models/scv2/examples/moviesentiment/classifier - Storage Secret: (leave blank/none)

Skip to the end and click
Launch.If your deployment is launched successfully, it will have
Availablestatus.
Get Predictions¶
Click on the
moviedeployment created in the previous section to enter the deployment dashboard.Inside the deployment dashboard, click on the
Predictbutton.On the
Predictpage, enter the following text:{ "parameters": { "content_type": "str" }, "inputs": [{ "name": "text review", "shape": [1], "datatype": "BYTES", "data": ["this film has bad actors"] }] }
Click the
Predictbutton.
Add a Anchor Text Explainer¶
From the
moviedeployment dashboard, clickAddinside theModel Explanationcard.For step 1 of the Explainer Configuration Wizard, select
Textthen clickNext.For step 2, set the following details:
- Explainer Algorithm: Anchor
For step 3, set the following details
- Explainer URI: gs://seldon-models/scv2/examples/moviesentiment/explainer - Explainer Project: default

Skip step 4.
For step 5, set following details
- Memory: 1Gi
Skip the remaining steps without changing fields, and click
Launch.
After a short while, the explainer should become available.
Get Explanation for one Request¶
Resend a single request using the JSON below and then explain it:
{
"parameters": {
"content_type": "str"
},
"inputs": [{
"name": "text review",
"shape": [1],
"datatype": "BYTES",
"data": ["this film has bad actors"]
}]
}
Navigate to the Requests page using the left navigation drawer.

Click on the View explanation button to generate explanations for the request.

Congratulations, you’ve created an explanation for the request! 🥳
Next Steps¶
Why not try our other demos? Ready to dive in? Read our operations guide to learn more about how to use Enterprise Platform.