Machine Learning Based Recommendation Systems

Module 18 - Machine Learning Based Recommendation Systems - Featured Image

Module 18 – Machine Learning Based Recommendation Systems

In this module, we will learn how to implement machine learning based recommendation systems. So far, we have learned many supervised and unsupervised machine learning algorithm and now this is the time to see their practical implementation.

1- Introduction to Recommendation System

The basic purpose of a recommendation system is to find and recommend items that a user is most likely to be interested in. When we visit e-commerce sites such as Amazon, Apple Music, or Netflix, your host recommends you some products. These recommendations are based on your past purchases or the products you might be interested in. The system or application behind calculating these endorsements is called recommendation system. It saves users’ time by giving them the best of their choice and increases the potential sale of the business.

Formally, we define a recommendation system as:

The Recommendation System is a computer program that filters and recommends product or content to users by analyzing their behavior of rating or preference they had given in the past.


  • Recommendation of Movies and shows by Netflix.
  • Recommendation of music by Apple music store.
  • Social connection recommendations by Facebook, LinkedIn, or Instagram.
  • Recommendation of dates by dating applications.
  • Banking and insurance products recommendation.


2- Types of Recommendation System

There are typically two ways to produce a list of recommendation:

a- Collaborative Filtering: Use knowledge of user’s past purchase/selection or similar decisions by other users to recommend products (User-based recommendation).

  • Advantage – Product knowledge not required.
  • Disadvantage – Can’t recommend products if no user reviews available so difficult to make recommendations for new users. It may be biased towards products with high reviews than the product with low reviews.

b- Content-Based Recommender: Use knowledge of each product to recommend a similar product (Product based recommendation).

  • Advantage – Even works without user reviews.
  • Disadvantage – Need descriptive data for every product so difficult to implement for large inventory products.


3- Classification-based collaborative filtering

Classification-based recommenders are very good at making personalized recommendations because they consider user attributes, as well as purchase history and other contextual data. 
The dataset must-have features such as key characteristics of users that purchased or did not purchase, what purchases users have made or have not made and contextual data (hour, season, browser history…etc.). The more data you have, the good recommender system you can made.

3.1- Project Goal:

A bank is running a special short-term deposit offer for existing customers. The sales manager wants to identify the potential good candidates to reach out and make them the offer.

3.2- Data set Description:

The data is related with direct marketing campaigns of a Portuguese banking institution. The marketing campaigns were based on phone calls. Often, more than one contact to the same client was required, in order to access if the product (bank term deposit) would be (‘yes’) or not (‘no’) subscribed. The data available from UCI has some categorical text variables so they are already converted to binary categorical dummy variables.

It was originally created by [Moro et al., 2014] S. Moro, P. Cortez and P. Rita. A Data-Driven Approach to Predict the Success of Bank Telemarketing. Decision Support Systems, Elsevier, 62:22-31, June 2014

3.3- Model Selection:

Our model requires both transaction history and user attributes dataset. The transaction history data provides simple attributes of users who have converted or not converted to past marketing efforts. A user attribute dataset that provides a rich description of users who have converted or did not convert in the past. Our dataset contains all required information so we will use logistic regression model as a recommender to decide whether to recommend the client for the marketing outreach call or not