Machine Learning can learn about your users

The first thing we need to do is learn about our users.

We can start by randomly changing the order of the choices and tracking engagement (clicks probably) just like A/B testing does.

The difference is we will also capture some measurable data about the user too, which can start to form a model of their interests. For example, we might know their age, or location, or previous purchasing history. The goal here is to think about what properties might be important when tailoring the experience.

Things don’t have to get creepy — use data that the user knows you have and doesn’t mind you using. And always let them at least opt-out, if not having everyone opt-in.

We might also decide to give the model other inputs, such as the time of day, or even the current weather, if they are likely to influence our users’ decisions.

The learning applies to other users too

The insights we get from our users can be applied to other users, and even to brand new users who have never used our app before.

For example, given the following simple table of data about some users:

Name City AgeGroup Loved

--------------------------------------------------------------------

Mat London 30-40 The Matrix + 28 Days Later

David London 30-40 The Matrix + 28 Days Later

Piotr Warsaw 20-30 The Matrix + Jack Strong

Paweł Warsaw 20-30 The Matrix + Jack Strong

Bill London 60-70 Jack Strong + Das Boot

What films would you suggest to Piotr and Paweł?

Given their age group, and the fact that they liked The Matrix, it is probably sensible to recommend 28 Days Later to them.

If a new user comes along with the following properties, which films would you suggest?

Name City AgeGroup Loved

--------------------------------------------------------------------

Peter London 60-70 ?

Since he lives in London and is in the same age group as Bill, we might decide to recommend Jack Strong and Das Boot.

Of course, in the real world it’s nowhere near this simple and the patterns are likely to be much more nuanced — never mind when you introduce any kind of big data scale.

This is where Machine Learning can do a better job than humans.

Reward the model

Once we can make predictions, we need to track whether they’re successful or not.

Whenever we get something right (like a user clicks a choice, or watches a movie, or buys a product) we will reward the model to reinforce the learning.

Our model will then notice patterns, and make better predictions in the future.

Meet Suggestionbox

Suggestionbox is a tool from Machine Box that provides a Machine Learning model for this very use case. You use a simple JSON API to interact with the box.

Typing this single line into a terminal will download and run Suggestionbox for you (assuming you have installed Docker):

docker run -p 8080:8080 -e "MB_KEY=$MB_KEY" machinebox/suggestionbox

If you don’t have an MB_KEY — which you need to unlock the box — you can grab one from the Machine Box website.

We will use it to build a little demo to show personalization working.

Create a model

While you can create models via the API, it’s much easier to head to http://localhost:8080 and create the model using the Console.

Suggestionbox ships with a built-in UI that lets you create models and run simulations.

I am going to create a model called Genres, with five choices.

Make predictions

Our model is now ready to start making predictions.

Of course, they’re not going to be very well informed initially, but very quickly Suggestionbox will notice patterns in the rewards, and we’ll start to see the predictions get better and better.

Try the free simulator