How To #11: Hybrid Recommendation System-Online Platform

Adam Davis
3 min readOct 17, 2024

--

Factories Painting — Ginie Ruitenbeek

“It is not the employer who pays the wages. Employers only handle the money. It is the customer who pays the wages.” — Henry Ford

Collaborative Filtering

Collaborative filtering is a technique used in recommendation systems that predicts a user’s preferences based on the preferences of similar users or items. It operates on the principle that if two users agree on one issue, they are likely to agree on others as well. There are two main approaches: user-based filtering, which identifies users with similar tastes and recommends items they liked, and item-based filtering, which focuses on finding items that are similar to those a user has previously liked. This method leverages vast amounts of user interaction data to uncover hidden patterns and preferences, making it widely used in platforms like Netflix and Amazon to enhance user experience by providing personalized recommendations.

Content Based Filtering

Content-based filtering is a recommendation technique that suggests items to users based on the attributes of the items and the user’s past preferences. It analyzes the features of items — such as genre, director, or cast in movies, or keywords in articles — and matches them with the characteristics of items that the user has previously liked or engaged with. By focusing on the intrinsic properties of items rather than relying on the behavior of other users, content-based filtering helps create personalized recommendations tailored to an individual’s tastes. This method is particularly effective in scenarios where user data is sparse or when new items are introduced, as it relies solely on the content itself.

Hybrid Filtering

Hybrid filtering combines multiple recommendation techniques, typically integrating both collaborative and content-based filtering, to enhance the accuracy and effectiveness of recommendations. By leveraging the strengths of each method, hybrid filtering can mitigate the limitations inherent in using a single approach. For instance, it can address issues like the cold start problem, where new users or items lack sufficient data for reliable recommendations. By synthesizing user behavior data with item attributes, hybrid systems provide more personalized and relevant suggestions, leading to improved user satisfaction and engagement. This approach is widely used in various platforms, such as streaming services and e-commerce sites, to create a richer and more tailored user experience.

For our purposes we will combine collaborative and content based filtering into a hybrid model.

Preprocessing

The amazon data contains multiple entries (user ids) for each review. To be able to index a single user we’ll need to flatten these ids and also repeat the same purchases that they made.

This will be the data frame that we’ll index for our hybrid model. Let’s take a look at the distribution of ratings:

Wow. Most rated the products above 4. A lot of satisfied customers.

Functions

Collaborative Filtering:

Content Based:

Hybrid Filtering:

Now to call our function to get a recommendation for our user. The amount of recommendations is kept at 10 for now.

One thing that could be added in here is the recommendation based off of the last purchase. We have an overall recommendation here based off of all content and all users. Most users viewed computers and accessories and that is where most recommendations are coming from.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Adam Davis
Adam Davis

No responses yet

Write a response