Deploying an AutoAI model

After you train and save a model, create a deployment so you can use the model to make predictions. One way to do this is to find your saved model in the Machine Learning Models section of your project assets and choose Deploy from the action menu. Alternatively, click the model name to view model details and click the Deployments tab.

To create a deployment:

  1. Click Add deployment and specify a name for the deployment.
  2. Select Web service as the Deployment type.
  3. Click Save.

Note: You can navigate to your deployment details page from your project at any time:

  1. From your project in Watson Studio, click the Deployments tab
  2. Click on the name of the deployment to open the deployment details page

View the deployment details

Click the Implementation tab to view details about your deployment, including information you will need to create your test data and payload files.

For example, click the Python tab for information on how to format input data in Python code.

Test the deployment in Watson Studio

From the deployment details page, click the Test tab.

Testing the deployment using the input form

The simplest way to test a deployment is to use the form to enter data you held back for testing purposes, or enter new data, then view the prediction. On the Test tab of the deployment details page, click the icon to Provide input data using form, enter test data, and click Predict to see the result.
Prediction from test data

Testing the deployment using Python code

Alternatively, you can test a larger set of data by entering it as JSON-formatted payload data in the the input data box. Click Predict to view predictions for each entry.

Note: AutoAI is built using the Watson Machine Learning Python client library reference, version 4, which has a different syntax than the version 3 APIs used for Model Builder and other Watson Machine Learning models. To interact programmatically with an AutoAI deployment, refer to the deployment syntax in Watson Machine Learning Python client library external link.

The payload data must include the data schema, that is, the list of features generated by the model pipeline. AutoAI uses the data schema to structure the resulting predictions.

For example, in this sample data for testing a model that predicts whether individuals on the Titanic survived or perished, the data schema is reflected with the column names.

1,0,3,"Braund, Mr. Owen Harris",0,22,1,0,A/5 21171,7.25,,S
2,1,1,"Cumings, Mrs. John Bradley (Florence Briggs Thayer)",1,38,1,0,PC 17599,71.2833,C85,C
3,1,3,"Heikkinen, Miss. Laina",1,26,0,0,STON/O2. 3101282,7.925,,S
4,1,1,"Futrelle, Mrs. Jacques Heath (Lily May Peel)",1,35,1,0,113803,53.1,C123,S
5,0,3,"Allen, Mr. William Henry",0,35,0,0,373450,8.05,,S

The scoring payload would be structured like this, where fields is a one-dimensional array, and values is a 2-dimensional array, with each row representing a single scoring point.

        "fields": ["PassengerId","Pclass","Name","Sex","Age","SibSp","Parch","Ticket","Fare","Cabin","Embarked"],
        "values": [[1,3,"Braund, Mr. Owen Harris",0,22,1,0,"A/5 21171",7.25,null,"S"]]

The resulting prediction indicates a very high likelihood that passenger Owen Harris did not survive.

  "predictions": [{
    "fields": ["prediction", "probability"],
    "values": [[0.0, [0.9710078835487366, 0.028992116451263428]]]