Predicting Marketing Campaign Response Using Amazon Machine Learning

Today, marketers are challenged with higher expectations and thinner budgets.

So figuring out where to invest your advertising dollars to drive the highest ROI is critical. Fortunately, artificial intelligence (A.I.) tools are making that decision easier and easier every day.

Imagine if you had a crystal ball that allowed you to peer into the future and see exactly who is going to respond to your offer.

How profitable would your marketing campaigns be if you knew exactly who is going to convert and who isn’t before you even launch the campaign?

But the formula for a successful marketing campaign can’t be pinned down to a single factor. In fact, it could take a mountain of data to figure out the best strategy.

That’s where A.I. — or more specifically, machine learning — comes in.

Predicting the Future

We can use a machine learning system to predict who is going to convert based on their past actions.

And for this guide we’re going to use Amazon Machine Learning to make those predictions. Amazon provides a nice graphical interface for setup and for visualization of the data and results — everything is point-and-click, no coding necessary.

So let’s get right to it…

Looking for an on ramp?

This is a how-to guide intended for developers or tech-savvy business leaders looking for a proven entry point into A.I.-powered business systems.

What You’ll Need

Right off the bat, let’s get the initial requirements knocked out.

Create an AWS account.

If you don’t already have an AWS account, go ahead and set one up.

Verify user permissions.

And if you aren’t using an administrator-level user account for AWS, you’ll need to make sure your account has full control over the following services:

  • Machine Learning, and
  • S3

Step 1: Launch the Setup Wizard

Go to your Machine Learning Dashboard.

Once you’re signed in, hit “Get started.”

Then click on the “Launch” button to start the setup wizard.

Step 2: Upload the Training Data

Next we need to give the system some data to learn from. And for the purposes of this demo, we’re just going to use a sample dataset Amazon provides (s3://aml-sample-data/banking.csv).

Select S3 as the data location. Then enter aml-sample-data/banking.csv for the “S3 location” and s3://aml-sample-data/banking.schema for the “Datasource name.” And hit “Verify.”

If you’d like to review what’s in the pre-labeled training data, here’s a spreadsheet of it.

Once the data is uploaded and verified, you’ll get a validation message and a “Continue” button — click it.

Step 3: Define the Training Schema

On the next screen you’ll get a breakdown of the columns in the dataset file.

Make sure the “Data type” for the last row (“y”) is set to “Binary.” Otherwise the default settings should be fine, so click on “Continue.”

Step 4: Set the Prediction Target

On the “Target” screen, you’ll see a list of all the columns with some respective sample data.

This is the screen where you’ll define the variable you want the system to predict. In our case, it will be a 1 or a 0. 1 if the system predicts the prospect will respond and 0 if they won’t.

In the search field, enter “y” which will filter down the list. And the last row should be y — make sure it’s selected. This will set the API response as a binary classification (1 or 0).

Then hit “Continue.”

Step 5: Confirm the Row Identifier

The next screen asks if the dataset includes a unique ID for each row.

And the sample data file doesn’t include one, so click on “Review.”

Step 6: Validate the Training

Next, you’ll get a summary of your training settings.

Give them a quick once-over, then hit “Continue.”

Step 7: Configure the Model Settings

That should take you to a “ML model settings” screen.

Enter a name for your model if you like. Then select “Default” for the evaluation settings and hit “Review.”

Step 8: Validate the Model Settings

On the next screen, you’ll get a summary of your model settings.

Give them a quick once-over and hit “Create ML model.”

And that will take you the summary page for the model. After a few minutes, the “Status” will change to “Completed.”

Step 9: Set the Score Threshold

When the evaluation is complete, you’ll see an “AUC” score — click it.

AUC (Area Under the Curve) is a numerical representation of the model’s accuracy — the model’s ability to predict a higher score for positive examples as compared to negative examples.

That will open a screen that details the model evaluation.

Click on “Adjust score threshold” to adjust the setting.

Adjusting the “Score Threshold” allows you to fine-tune the trade off between false positives and true positives.

On the “ML model performance” screen, you can change the score threshold and view how it affects performance in the graph.

Once you’re happy with the settings, click on the “Save score threshold at 0.xx” button.

Step 10: Test a Prediction

Jump back to your model summary page and click on the “Try real-time predictions” button.

On the “Try real-time predictions” page, select “20” items per page and enter values for the features. Then hit “Create prediction.”

Note: You can hit the “Paste a record” button to insert a row from the original dataset.

The system will respond with a JSON-formatted response in the right-side column. The predictedLabel field is the primary answer, in this particular case it will be a 1 or a 0 depending on the values you inputted.

The response will also include a confidence score, which will be listed in the predictedScores value. This field provides the original predictedLabel and its respective confidence score.

The confidence score is a value from 0 to 1 — the higher the number, the higher the system’s confidence in its response.


You’ve built a machine learning model that you can use as a prediction API in batch mode or real-time.

What’s Next

Now all that’s left is for you to tie this API into your existing marketing planner or automation platform.

Welcome to the wonderful world of predictive marketing.

You can dig deeper into Amazon’s Machine Learning API — including additional tutorials — in the developer documentation.


This post is part of our How to Apply A.I. in Your Business blog series. Be sure to check out our past issues:

And be on the lookout for future issues, they come out every other Monday.