Over a million developers have joined DZone.

An Online Recommendation Engine with MongoDB and Mahout

DZone 's Guide to

An Online Recommendation Engine with MongoDB and Mahout

· Database Zone ·
Free Resource

This is the second entry of the series of blog posts about building an online recommendation system based on MongoDB and Mahout. We presented you Mario’s fictional online shop in the previous and first blog post of this series (“Pivot your idea”). There we also explained how Mario came up with the idea of extending his product line and building a recommendation system for his shop. Today it is time to show you, how Mario plans to integrate the recommendations into his current online shop.

Now let’s take a look which pages exist in the current online shop and where Mario could place panels with recommendations. So far Mario’s online shop has two pages: the start page and the checkout. The start page displays all pizzas and the shopping cart. Here a customer can add any pizza to the basket and proceed to the checkout. On the checkout page the customer can review the basket and submit the order.


Initial start page of Mario’s online shop


Initial checkout page of Mario’s online shop

Mario browses through the web to get inspiration of how to integrate recommendations into his shop. He stumbled upon the big online shop Bähmazon. Bähmazon presents the most ordered products to its customers on their start page if they are not logged in. Mario likes this idea and decides to change his current start page and to present the most ordered products of all his product categories as well.

Start Page Mockup

Mario’s new start page including recommendations of the most popular products

In addition Mario recognizes that Bähmazon has not only a product category page, but it presents details of each product on an additional product detail page. These two pages include recommendations as well: the category’s top seller on the category page and products other users also viewed on the detail page.


New category page including the recommendation of this category’s top-selling product


New product detail page including recommendations of products that other users also viewed

There is a second kind of recommendation on Bähmazon’s detail page, which is called “Frequently Bought Together”, but Mario decides that this kind of recommendation is better presented in the checkout of his shop. Mario’s underlying assumption is that when a customer buys a pizza on the start page and then proceeds to the checkout (and thus leaving out the detail page), she will also purchase a beverage when brought to her attention on the checkout page.


New checkout page including recommendations of products that have been bought together with the products currently contained in the basket

Finally Mario creates an account on Bähmazon to see what kind of recommendations are presented to a customer that is logged in. They get information about the products they viewed the last time. In Mario’s case, where customers mostly buy the same products, it is better to present to the users their individual top sellers on their personal start page, i.e. when they are logged in.


New personalised start page including the display of the customer’s favorite products and recommendations based on Mahout

Mario is also interested in an approach by which he can recommend existing but so far unknown products to the customer. He is especially curious for strategies of collaborative filtering, that is user- and item-based recommendation. When looking for an appropriate open source framework he discovers Apache Mahout. Mahout produces recommendations based on the knowledge of the users’ relationships to items. Mario plans to integrate this kind of recommendations in the “You my also like” panels on the personal start page for users that are logged in.

Now Mario has a clear vision on what to change in his current online shop in order to integrate the new products and the recommendation system. Stay tuned for the continuation of this blog post series about building an online recommendation system based on MongoDB and Mahout. In the next post we will explain the implementation and evaluation of the aforementioned recommendation system based on MongoDB and Mahout in Mario’s shop.

Please attend the MongoDB Usergroup Meeting at the CeBIT in Hannover, March 6, 2013 to get a live and comprehensive presentation of the subject. See Meetup or Xing for event details (room directions can be found here).



Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}