Creating an AutoAI experiment from sample data

When you create an AutoAI experiment, you can work with sample data to see how AutoAI works. The Bank data is a data set collected from a Portugese bank with customer information collected to measure response to a promotional campaign. The guided experience with the sample data illustrates how to build an experiment designed to predict whether a customer is likely to enroll in the promotion.

This topic describes how you can save a pipeline as a Watson Machine Learning model, deploy the model, and score it to view a prediction.


  • Create a project in Watson Studio with an associated Machine Learning Service instance
  • Download the UCI: Bank marketing data set from the Gallery to your file system.

Sample data

The sample data used in the guided experience is Bank marketing data used to predict whether a customer will enroll in a marketing promotions. The data is automatically uploaded and available for your use when you select Gallery sample as the basis for your experiment.

Steps overview

This tutorial works in concert with the guided experience in the AutoAI tool and describes how to take the sample model built in the AutoAI Experiment builder and deploy and score the resulting model to see how a prediction is generated. Follow these steps in Watson Studio:

  1. Build and train the model
  2. Deploy the trained model
  3. Test the deployed model

Watch this short video to see how to create and run an AutoAI experiment based on the bank marketing sample.

Step 1: Build and train the model

1.1 Specify basic model details

  1. From the Assets page of your project in Watson Studio, click Add to project and choose AUTOAI EXPERIMENT.
  2. In the page that opens, fill in the basic fields:
    • Specify a name and optional description for your new model.
    • Choose Gallery Sample to load the Bank marketing sample data.
      Building from sample data
    • Confirm that the IBM Watson Machine Learning service instance that you associated with your project is selected in the Machine Learning Service section.
  3. Click Create.

1.2 Add training data

Following the prompts for the guided experience, you will see that the Bank marketing sample data is already selected for your experiment.
Bank sample data uploaded

1.3 Train the model

  1. In the guided experience, the column labeled “Y” is automatically selected for the model. This column will be used to predict whether a customer is likely to enroll in a marketing promotion. AutoAI analyzes your data and determines that the Y column contains True/False information, making this data suitable for a binary classification model. The default metric for a binary classification is ROC/AUC.
    Choosing a prediction column
  2. Click Run experiment. As the model trains, you will see an infographic that shows the process of building the pipelines.
    Building model pipelines

For a list of algorithms, or estimators, available with each machine learning technique in AutoAI, see: AutoAI implementation detail

1.4 Choose a pipeline

Once the pipeline creation is complete, you can view and compare the ranked pipelines in a leaderboard.
Pipeline leaderboard

Choose Save model from the action menu for the pipeline with a rank of 1. This saves the pipeline as a Machine Learning asset in your project. A notification gives you the link to view the saved model in your project.

Step 2: Deploy the trained model

Before you can use your trained model to make predictions on new data, you must deploy the model.

You can deploy the model from the model details page. You can access the model details page in one of these ways:

  • Click on the model name in the notification displayed when you save the model.
  • Open the Assets page for the project containing the model and click the model name in the Machine Learning Model section.

From the model details page:

  • Click the Promote to deployment space.
  • Choose an existing deployment space or create a new one.
  • Click Add Deployment.
  • In the page that opens, fill in the fields:
    • Specify a name for the deployment.
    • Select “Web service” as the Deployment type.
    • Click Save.

After you save the deployment, click on the deployment name to view the deployment details page.

Step 3: Test the deployed model

You can test the deployed model from the deployment details page in two ways:

Test with a form

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

Test with JSON code

  1. On the Test tab of the deployment details page, click the icon to Provide input data as JSON and enter the following test data:
        "fields": ["age","job","marital","education","default","balance","housing","loan","contact","day", "month","duration","campaign","pdays","previous","poutcome"],
        "values": [[27,"unemployed", "married", "primary", "no",1787,"no", "no","cellular",19,"oct", 79, 1, -1, 0, "unknown" ]]

Note that the test data replicates the data fields for the model with the exception of the prediction field.

  1. Click Predict to predict whether a customer with the entered attributes is likely to sign up for a particular kind of account. The resulting prediction indicates that a customer with the attributes entered has a very high probability of not enrolling in the marketing promotion.
    Sample banking model prediction

Step 4: Create a batch deployment

To process a batch of inputs and have the output written to a file instead of displayed in real time, create a batch deployment job.

Step 1: Upload the input data

For a batch deployment, you provide input data, also known as the model payload, in a CSV file. The data should be structured like the training data, with the same column headers. The batch job will process each row of data and create a corresponding prediction.

For this tutorial, you will use the payload data bank-payload.csv that you downloaded as part of the tutorial setup. When you deploy a model, you can add the payload data to a project, upload it directly to a space, or link to the data in a storage repository such as a Cloud Object Storage bucket. In this case, you will upload the file directly to the deployment space.

From the Assets page of the deployment space:

  1. Click Add to space then choose Data
  2. Upload the file bank.csv file that you saved locally.

Step 2: Create the batch deployment

Now you can define the batch deployment.

  1. Click the deployment icon next to the model name.
  2. In the page that opens, fill in the fields:
    • Specify a name for the deployment.
    • Select “Batch” as the Deployment type.
    • Choose the smallest hardware specification.
    • Click Create.

Step 3: Create the batch job:

The batch job executes the deployment. To create the job you specify the input data and the name for the output file. You can set up a job to run on a schedule, or run immediately.

  1. Click Create job.
  2. Specify the input file: bank.csv.
  3. Name the output file: bank-tutorial-output
  4. Click Create and run to run the job immediately.

Step 4: View the output

When the deployment status changes to Deployed, return to the Assets page for the deployment space. You will see that the file bank-tutorial-output.csv was created and added to your assets list.

Click the download icon next to the output file and open the file in an editor. You can review the prediction results for the customer information submitted for batch processing.

View the batch predictions

For each case, the prediction returned indicates these customers are unlikely to subscribe to the bank promotion.