All pages
Powered by GitBook
1 of 1

Loading...

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 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

  1. In the Overview page, click Create new deployment.

  2. Type the following deployment details and click Next:

    Parameter
    Value
  1. Click Next for the remaining steps in the Deployment Creation Wizard and then click Launch.

Get Predictions

  1. Click the movie deployment that you created.

  2. In the Deployment Dashboard, click Predict in the left pane.

  3. In the Predict page, click Enter JSON and paste the following text:

Add an Anchor Text Explainer

  1. In the Deployment Dashboard page for the deployment movie, click Add inside the MODEL EXPLANATION card.

  2. In the Explainer Configuration Wizard, choose Text and click Next.

  3. In the Explainer Types step, choose the Anchor

After sometime, the explainer should become available.

Get Explanation for one Request

  1. In the Deployment Dashboard for the deployment named movie, click Predict in the left pane.

  2. In the Predict page, click Enter JSON and once again paste the following text and click Predict:

  3. Click Explain to generate explanations for the request.

Next Steps

Try the other or read our to learn more about how to use Seldon Enterprise Platform.

movie

Namespace

seldon

Type

Seldon Deployment

  • Configure the default predictor as follows:

    Parameter
    Value

    Runtime

    Scikit Learn

    Model Project

    default

  • Click Predict.
    option and click
    Next
    .
  • In the Explainer URI step, set the following details:

    - Explainer URI: gs://seldon-models/scv2/examples/moviesentiment/explainer
    - Explainer Project: default
  • Click Next for the remaining steps without changing any fields, and click Launch.

  • {
      "parameters": {
        "content_type": "str"
      },
      "inputs": [{
        "name": "text review",
        "shape": [1],
        "datatype": "BYTES",
        "data": ["this film has bad actors"]
      }]
    }
    {
      "parameters": {
        "content_type": "str"
      },
      "inputs": [{
        "name": "text review",
        "shape": [1],
        "datatype": "BYTES",
        "data": ["this film has bad actors"]
      }]
    }

    The Model Name is linked to the name described in the model-settings.json file, located in the Google Cloud Storage location. Changing the name in the JSON file would also require changing the Model Name, and vice versa.

    • The seldon and seldon-gitops namespaces are installed by default, which may not always be available. Select a namespace which best describes your environment.

    • A secret may be required for private buckets.

    • Additional steps may be required for your specific model.

    • It is only possible to create one explainer for each deployment.

    • You can also enter a comment here for a gitops enabled namespace.

    Note: If the explainer is making use of parameters.content_type field, View explanation button from the Requests dashboard then it leads to the server error. The /explain API works as expected if parameters.content_type is included in the request input.

    anchor technique
    demos
    operations guide
    Default predictor details
    the Predict page with the textarea prepopulated
    Explainer URI details
    Resending the prediction
    Explaining the request

    Name

    Model URI

    gs://seldon-models/scv2/examples/moviesentiment/classifier

    Storage Secret

    (leave blank/none)

    Model Name

    movies