September 6th, 2019

Driverless AI can help you choose what you consume next

RSS icon RSS Category: Driverless AI, Machine Learning, Recipes, Recommendations, Technical, Tutorials

Last updated: 09/06/19

Steve Jobs once said, “A lot of times, people don’t know what they want until you show it to them’. This makes sense, especially in this era of constant choice overload. Consumers today have access to a plethora of products just at the click of their mouse. These innumerable choices can sometimes turn out to be confusing and hampering and do more harm than good. For instance, a company may offer millions of products on its website, but how does a consumer find a new and appealing product from amongst those? Also, wouldn’t it be great if the company could provide choices to every consumer based on their past shopping history? This would not only save a lot of time but also provide them with highly personalized experiences. Such a customized filter relying on modern machine learning techniques constitutes a Recommendation System, and we shall see how Driverless AI can be used to create one.

Recommender Systems

Please note that in this article, the terms recommendation engine, recommender system and recommendation system will be used interchangeably and signify the same underlying idea.

Benefits of using Recommendation systems

Some of the businesses that stand to gain from Recommendation Systems:

Types of Recommender Systems

  • What we want to identify and,
  • What kind of relationship is specified in our data?

Some of the common approaches used for recommendations include:

Approaches used for Recommendation systems

Let’s have a brief overview of each one of them:

1. Content-Based Filtering

The diagram above(source) shows that if a user likes a book in the ‘Literature’ category, it makes sense to recommend books in the same category to the user. Also, recommending books released in the same year and by the same Author would also be a great idea.

2. Collaborative Filtering

3. Hybrid Filtering

Both Content-based and Collaborative approaches have their strengths and weaknesses, and one can end up with a better system by combining many algorithms in what we call a hybrid approach. Hybrid systems leverage both item data and transaction data to give recommendations.

For instance, in the figure below, recommendations are not only based on what people’s reading and searching habits(collaborative systems)but books sharing similar characteristics(content-based) are also recommended.

Creating a Recommender system using Driverless AI

Driverless AI(1.7.0 and above) implements a key feature called BYOR, which stands for Bring Your Own Recipes. Recipes are customizations and extensions to the Driverless AI platform. One can create their own recipes, or select from several recipes available in the repository. We shall use one of the available recipes to develop a Recommender system with Driverless AI.


It is important to note here that this is a regression problem. However, where we would want to predict if the user will buy a particular item or not, it will be a classification problem.


The original data contains over 20 million ratings from 138,000 thousand randomly-chosen, anonymous users. However, for this article, we shall only be using a portion of the original data so that others can quickly reproduce the experiment. The sampled dataset data can be accessed from here. Here are the first few rows of the training data:

First few rows of the training data
  • userId: Customer IDs
  • movieId: Unique ID for every movie
  • rating: On a scale from 1 to 5. This is also the Target variable.
  • timestamp: Date and time on which the ratings were given.
  • releaseYear: The year in which the movie was released.

Driverless AI Recommender System recipes can be used to create Collaborative, Content-based as well as Hybrid Recommender systems.

Collaborative Filtering Methodology

1. Uploading data into Driverless AI

Columns selected for Collaborative Filtering

2. Uploading Custom recipes

Recommender recipe

Edit these values in the code file, save it and then upload the recipe to the Driverless AI experiment as follows:

Uploading Custom recipe

Next, select only the RecH2OMFTransformer and deselect all the other transformers by navigating to Expert Settings>Recipes>include specific Transformers.

Selecting RecH2OMF Transformer

Select Regression as experiment type and RMSE as the scorer and launch the experiment.

Collaborative Filtering Experiment in Driverless AI

Let’s try and understand very briefly, what the Matrix Factorization transformer does under the hood.

  • It first converts the movie rating dataframe into an user-item matrix, also called a utility matrix as follows:

Every cell of the matrix is populated by the ratings that the user has given for the movie. It factors a sparse rating matrix X (m by n, with N_z non-zero elements) into an m-by-kand a k-by-f matrix, where Latent factors are represented by K. This reconstructed matrix populates the empty cells in the original user-item matrix, and so the unknown ratings in the sparse matrix are now known.

  • Implementing the MF technique through H2O4GPU

Matrix Factorization is a commonly used technique in collaborative filtering for decomposing the user-item interaction matrix into the product of two lower dimensionality rectangular matrices. The idea behind matrix factorization is to represent users and items in a lower-dimensional latent space.

In Driverless AI, the Matrix Factorization technique is implemented through h2o4gpu.solvers.factorization module. H2O4GPU is an open-source project consisting of a collection of GPU solvers by H2Oai with APIs in Python and R. The Python API builds upon the easy-to-use scikit-learn API and its well-tested CPU-based algorithms.h2o4gpu.solvers.FactorizationH2O implements Matrix Factorization on GPU with Alternating Least Square (ALS) algorithm.

Content-Based Filtering Methodology

Next, we shall deselect the RecH2OMFTransformer while keeping all the default ones intact. Keeping all the other parameters, the same as the previous experiment hit the launch button.

Hybrid Filtering Methodology

Make sure the RecH2OMFTransformer is reflected along with other selected transformers on the experiment page. Go ahead and launch the experiment. Driverless AI will build multiple features using the various transformers and try multiple models to optimize the weights between the content-features and collaborative-features.

Experiment Results Summary

The pure collaborative approach has an RMSE of 0.96 while the content-based approach has an RMSE of 0.94. The hybrid approach combines both and clearly outperforms each with an RMSE of 0.92.

It is also interesting to note that XGBoost scores 0.98 on the raw features while LightGBM scores 0.99 on the same MovieLens dataset. Therefore, it is safe to conclude that Driverless AI’s recommendation recipes combined with its feature engineering and model-optimization perform better as compared to using plain open-sourced algorithms.

Top N recommendations

Once the experiment is done, users can download the predictions, just like any other Driverless AI experiment.

We can then sort all of the predicted ratings and get the top N recommendations for the user. We would also want to exclude or filter out items that a user has already interacted with before. In the case of movies, there is no point in recommending a movie that a user has previously watched.



About the Author

Parul Pandey

Parul is a Data Science Evangelist here at She combines Data Science , evangelism and community in her work. Her emphasis is to spread the information about H2O and Driverless AI to as many people as possible, She is also an active writer and has contributed towards various national and international publications.

Leave a Reply

Exploring the Next Frontier of Automatic Machine Learning with H2O Driverless AI

At, it is our goal to democratize AI by bridging the gap between the

July 28, 2020 - by Jo-Fai Chow
In a World Where… AI is an Everyday Part of Business

Imagine a dramatically deep voice-over saying “In a world where…” This phrase from old movie

July 22, 2020 - by Ellen Friedman, PhD
Running Sparkling Water in Kubernetes

Sparkling Water can now be executed inside the Kubernetes cluster. Sparkling Water provides a Beta

July 10, 2020 - by Jakub Hava
From GLM to GBM – Part 2

How an Economics Nobel Prize could revolutionize insurance and lending Part 2: The Business Value of

July 9, 2020 - by Patrick Hall and Michael Proksch
A Inteligência Artificial está transformando e alavancando negócios. Entenda como e por quê

Você sabia que inteligência artificial e machine learning não são conceitos novos? Pois eles surgiram

June 26, 2020 - by Daniel Garbuglio
On-Ramp to AI

The path to democratize AI starts with one class Artificial Intelligence (AI) is like a superhighway,

June 11, 2020 - by Rafael Coss

Join the AI Revolution

Subscribe, read the documentation, download or contact us.

Subscribe to the Newsletter

Start Your 21-Day Free Trial Today

Get It Now
Desktop img