DEV Community

Cover image for Building a Recommender System with Flask and Amazon Personalize. (Part 1): Introduction
Joshua Oladokun
Joshua Oladokun

Posted on

Building a Recommender System with Flask and Amazon Personalize. (Part 1): Introduction

Have you ever used a website, and gotten a recommendation for similar videos or items when viewing an item? Have you ever visited a site homepage, and gotten item recommendations based on your search history. What is responsible for this is a recommendation system.

A recommender system is a system designed to recommend items to users based on different factors. These factors vary from user's interactions (behavior and preferences) to user's metadata (age, location, gender) to item's metadata. Companies like YouTube, Netflix, Spotify, and Amazon use recommender systems to improve users' experience on their websites.

Common use cases of recommender systems include:

  • recommendation of similar products on the product detail page.
  • personalized re-ranking of products for users.
  • personalized push notifications and marketing email.
  • recommend products based on user's interaction history on user's home page.
  • recommend relevant new products to users.

In this tutorial series, you would be using Amazon Personalize and Flask to create a recommender system. Amazon Personalize is a machine learning service managed by Amazon, that makes it easy for developers to deliver personalized experiences to users.
Flask is a Python microframework used for creating web applications.

How does Amazon Personalize Work

In Amazon Personalize, you start by creating a dataset group. A dataset group is a container for storing Amazon Personalize components such as datasets, event trackers, solutions, filters, and campaigns. A dataset group helps organize resources into an independent collection, to prevent resources from one dataset group from interfering with another dataset group. There are two types of dataset groups:

  • Domain dataset group
  • Custom dataset group

A Domain dataset group is a dataset group consisting of pre-configured resources for different business use cases. There are 2 pre-configured business domain groups in Amazon Personalize:

  • ECOMMERCE domain: for getting recommendations for best-selling products on an e-commerce application.
  • VIDEO_ON_DEMAND domain: for getting similar video recommendations.

With Domain dataset groups, Amazon Personalize manages the life cycle of training models and deployment. When you create a Domain dataset group, you choose your business domain, import your data, and create recommenders for each of your use cases. You use your recommender in your application to get recommendations with the GetRecommendations operation. If you start with a Domain dataset group, you can add custom resources later during the lifecycle of the model. Use a Domain dataset group if you have a video on demand or e-commerce application and want Amazon Personalize to find the best configurations for your use cases.

A Custom dataset group is a dataset group containing custom resources such as solutions, solution versions, filters, and campaigns. When creating a Custom dataset group, you determine your use case, import data, train a model and deploy a campaign. You use the campaign in your application to get recommendations with the GetRecommendation operation. A Custom dataset group is used if you want to configure and manage only custom resources or want to get recommendations in a batch workflow. The developer is responsible for managing the lifecycle of training models and deployment. If you start with a Custom dataset group, you cannot add a domain resource later.

After choosing the dataset group, we would import data into a dataset. A dataset is a container for storing data imported into Amazon Personalize. There is 3 type of datasets in Amazon Personalize: Users, Interactions, and Items. The Items dataset is the only required dataset to create the recommender, with the other two datasets being optional.

Amazon Personalize creates a recommender or a solution depending on the dataset group you are using. It creates and deploys a customized API for getting recommendations in real-time and a batch workflow for getting recommendations in batch.
In the next series, we will be going through steps to set up Amazon Personalize.

Top comments (0)