Introducing Suggestionbox: Personalization and recommendation machine learning in a Docker container

Mat Ryer
Machine Box
Published in
7 min readJan 31, 2018
How can you find the best options to suggest to users? With Suggestionbox, that’s how
Suggestionbox has been released for Developer Preview

Today we are very proud to announce the Developer Preview release of Suggestionbox, the latest ML-in-a-Docker-container from Machine Box. This is truly staggering technology, so if you’ve got a standing desk, I recommend you find somewhere to sit down now.

Suggestionbox learns about your users, so that it can predict which items they are more likely to interact with

What is Suggestionbox?

Suggestionbox is a Docker container that you can run anywhere (in the public cloud, or in your own private datacenter) that contains state-of-the-art machine learning technology with artificial intelligence that can learn things about your users that are otherwise difficult to discover.

The API documentation for Suggestionbox are available when you run the box on your local development machine.

You can use this learning to automatically personalize the experience of your application, or make confident recommendations that your users are likely to be interested in to drive engagement. In an e-commerce world, this means that you can, for example, copy the way Amazon recommends products to users based on their browsing history to drive sales.

Unlike cloud APIs, all Machine Box products have sensible, fixed prices and are ready to run at gigantic scale. You can learn more about Machine Box in this blog post.

Suggestionbox can address a pretty wide range of problems, and there is almost certainly a use case for it in your project. This article will examine some real-world examples, and explain how you would use Suggestionbox to solve them.

Use case 1: Suggest news articles to readers

News and blog sites might want to show a list of recommended stories to users to increase engagement, and make sure the user doesn’t miss something that they might find important.

There are three steps to integrating Suggestionbox with your own application.

Step 1: Create a model

In this case, you would create a model inside Suggestionbox — where the choices are twenty of the most recent news stories — by making a request like this:

POST /suggestionbox/models
{
"id": "model1",
"name": "Story recommendations",
"choices": [
{
"id": "article1",
"features": [
{
"key": "title",
"type": "text",
"value": "Machine Box releases new box"
}
]
},
{
"id": "article2",
"features": [
{
"key": "title",
"type": "text",
"value": "Elon Musk actually an AI"
}
]
},
...
]
}

Each choice has a selection of features which describe it. In this case, we have a text title — but we might include a range of other details, like author, publish date, number of views, or even the main image from the article.

Step 2: Make a prediction

Once the model is created, we can ask it to make a prediction by telling it something about the user via more features in the inputs array:

POST /suggestionbox/models/model1/predict
{
"inputs": [
{
"key": "user_age",
"type": "number",
"value": "25"
},
{
"key": "user_interests",
"type": "list",
"value": "ml,golang,music,cats"
}
]
}

Suggestionbox will look at the details about that user, like their age and interests — It’s up to you to pick sensible features based on your use case — and try and figure out which of the articles above they are more likely to enjoy.

We’ll get a response that looks like this:

{
"choices": [
{
"id": "article3",
"score": 0.60,
"reward_id": "5a71d78495864f25c02089e154bc2e30"
},
{
"id": "article1",
"score": 0.30,
"reward_id": "5a71d7845587d4b715aa3a0e95842dc8"
},
{
"id": "article2",
"score": 0.10,
"reward_id": "d789586445587d89e154cbc2e34b715a"
}
]
}

Suggestionbox is saying that article3 should be presented to the user, or we could show all of them following the order of the array.

Step 3: Reward the model

Assuming we do this and the user clicks the news item, we should reward the model by making the following request — using the reward_id from the successfully predicted choice:

POST /suggestionbox/models/model1/rewards
{
"reward_id": "5a71d78495864f25c02089e154bc2e30",
"value": 1
}

This will let Suggestionbox know that it got something right, and that it should learn from that.

The value field can be used to weight the rewards, but in most cases 1 is appropriate.

Initially, Suggestionbox isn’t going to know anything. But surprisingly quickly, it will start to evolve and learn so that predictions become more and more accurate and reliable.

Use case 2: Best image selection

If we had a food delivery app, we probably show an image of one of the dishes in the main listings page where users choose which menus to look at. How cool would it be if those images were automatically selected to present the most interesting dish to each specific user. Not just the best picture for everybody, but the best picture for you!

We could do this by creating a model where the choices were the photos of the food:

Suggestionbox uses the same technology as Tagbox for understanding images, so you can use images (via URL or Base64 encoded) as features too. Yes, I know, David Hernandez deserves a big kiss for this feature!

We would create such a model by making the following request:

POST /suggestionbox/models
{
"id": "model2",
"name": "Sushi pics",
"choices": [
{
"id": "california-roll",
"features": [
{
"key": "pic",
"type": "image_url",
"value": "https://url.com/to/pic1.jpg"
}
]
},
{
"id": "sashimi",
"features": [
{
"key": "pic",
"type": "image_url",
"value": "https://url.com/to/pic2.jpg"
}
]
},
...
]
}

Then we could ask the model to make predictions based on things we know about the user.

We could give Suggestionbox the following information:

  • Where the user lives — maybe people in New York City eat more sashimi?
  • Their age — perhaps curry dishes are prefered by the young?
  • Their previous order history — past behaviour probably helps predict future behaviour
  • Dietary requirements — it’s likely vegans won’t tap on a fat juicy steak
  • The time they are ordering — probably breakfast dishes will attract more attention in the morning versus dinner dishes later

Suggestionbox might not need all of this information, but it’s smart enough to find the patterns that matter.

Use case 3: New music recommendations

Music streaming sites spend a lot of time trying to help users discover new music. Suggestionbox makes this trivial provided we pick sensible choices and user features.

One way to address this would be to create a model with all the genres of music as choices:

POST /suggestionbox/models
{
"id": "model3",
"name": "Music genres",
"choices": [
{
"id": "pop"
},
{
"id": "rock"
},
{
"id": "metal"
},
{
"id": "indie"
},
...
]
}

And then we would ask Suggestionbox to predict which genre of music a user is more likely to enjoy based on songs they have previously listened to.

Notice that we don’t need to provide which genres those songs are in, Suggestionbox will figure it out based on real user history.

Your use case?

By now, you’ve probably already thought of a way this technology could be applied in your own projects, and we’d love to hear about them. Please get in touch and let us know if we can help.

What will Suggestionbox cost?

For development, integration, and test, you can run Suggestionbox for free (see below for details on how to do this).

In production, for commercial use, you can run Suggestionbox for $99/month with up to ten models, and $499/month you can use them in an unlimited way with premium support.

How can I join the Developer Preview?

You can join the Developer Preview for free by running Suggestionbox with the following command:

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

You’ll need to make sure you’ve set your MB_KEY variable, which you can get for free from the Account page on the Machine Box website.

When will Suggestionbox be released in production?

The box is ready for production, but we might fiddle with the API based on developer feedback, so we’re reserving the right to make breaking changes for the next 30 days — although it is unlikely.

Please don’t let this stop you integrating Suggestionbox into your product. Any changes are likely to be small (like field names) and will most likely be additions, rather than subtractions from the API.

What is Machine Box?

Machine Box puts state of the art machine learning capabilities into Docker containers so developers like you can easily incorporate natural language processing, facial detection, object recognition, etc. into your own apps very quickly.

The boxes are built for scale, so when your app really takes off just add more boxes horizontally, to infinity and beyond. Oh, and it’s way cheaper than any of the cloud services (and they might be better)… and your data doesn’t leave your infrastructure.

Have a play and let us know what you think.

--

--

Mat Ryer
Machine Box

Founder at MachineBox.io — Gopher, developer, speaker, author — BitBar app https://getbitbar.com — Author of Go Programming Blueprints