Text Explanations
This demo helps you learn about:
Launching a movie sentiment pipeline which takes text input
Sending a request to get a sentiment prediction
Creating an explainer for the model
Sending the same request and then get an explanation
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 a Seldon Deployment
In the Overview page, click Create new deployment.
Type the following deployment details and click Next:
ParameterValueName
movie
Namespace
seldon
Type
Seldon ML Pipeline
Configure the default predictor as follows:
ParameterValueRuntime
Scikit Learn
Model Project
default
Model URI
gs://seldon-models/scv2/examples/moviesentiment/classifier
Storage Secret
(leave blank/none)
Click Next for the remaining steps in the Deployment Creation Wizard and then click Launch.

Get Predictions
Click the movie deployment that you created.
In the Deployment Dashboard, click Predict in the left pane.
In the Predict page, click Enter JSON and paste the following text:
{ "parameters": { "content_type": "str" }, "inputs": [{ "name": "text review", "shape": [1], "datatype": "BYTES", "data": ["this film has bad actors"] }] }
Click Predict.

Add an Anchor Text Explainer
In the Deployment Dashboard page for the deployment
movie
, click Add inside the MODEL EXPLANATION card.In the Explainer Configuration Wizard, choose Text and click Next.
In the Explainer Types step, choose the Anchor option for Explainer Algorithms supported: and click Next.
In the Explainer URI step, set the following details:
- Explainer URI: gs://seldon-models/scv2/examples/moviesentiment/explainer - Explainer Project: default
Next button clicked Click Next in Additional Parameters step of the wizard.
In the Memory step of the wizard, set following details
- Memory: 1Gi
Click Next for the remaining steps without changing any fields, and click Launch.
After sometime, the explainer should become available.
Get Explanation for one Request
In the Deployment Dashboard for the deployment named
movie
, click Predict in the left pane.In the Predict page, click Enter JSON and once again paste the following text and click Predict:
{ "parameters": { "content_type": "str" }, "inputs": [{ "name": "text review", "shape": [1], "datatype": "BYTES", "data": ["this film has bad actors"] }] }
Click Explain to generate explanations for the request.


Next Steps
Try the other demos or read our operations guide to learn more about how to use Seldon Enterprise Platform.
Last updated
Was this helpful?