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. Open the deployment space containing the model.
  2. Click Add deployment and specify a name for the deployment.
  3. Select Web service as the Deployment type.
  4. Click Save.

Scoring a deployment

When you score a deployment, you submit new data and get back a prediction.

Testing an online deployment using the input form

The simplest way to test an online 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, enter test data, and click Predict to see the result.
Prediction from test data

Testing an online deployment using Python code

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.

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

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.

PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked
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.

{"input_data":[{
        "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]]]
  }]
}