liveBook · Manning

Chapter 2: Implementing a simple recommender model

What you will learn in chapter 2 of AI Recommender Systems

The chapter introduces simple recommender models as reference points for later evaluation and explains why personalized predictions need a user or session context.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduces simple recommender models as reference points for later evaluation and explains why personalized predictions need a user or session context.

Key terms: simple recommender models, reference point, evaluation, personalized predictions, user, session, consumed together

2.1 Start with the simplest recommender system

This section argues for starting with a simple, understandable recommender before attempting more complex solutions.

Key terms: start simple, understand and monitor

2.1.1 Popularity: The Fallback Recommender

This section explains why a simple popularity-based fallback keeps recommendations available, provides a comparison baseline, and reveals useful patterns in the data.

Key terms: fallback, robustness, baseline for evaluation, popular, consumption, popular items, pre-computed list, fast cache, single lookup

2.2 Building a Collaborative Filtering Recommender

The section introduces MovieLens ratings as evidence of user interactions and explains why the dataset is useful but imperfect for a recommender example.

Key terms: rating, interaction, user behavior, MovieLens 25M dataset, benchmark, production data

2.2.1 The Data: User-Item Interactions

This section explains how sparse movie-rating data shapes collaborative filtering.

Key terms: sparsity, user-item matrix, sparse matrix representations, collaborative filtering

2.2.2 Stage 1: Retrieval - Finding Similar Items

This section builds a behavior-based item similarity matrix and uses it to retrieve a small set of candidate movies from a large catalog.

Key terms: user-item matrix, sparse matrix, item-item similarity, cosine similarity, item similarity matrix, retrieval stage, candidates, precomputed similarities, approximate nearest neighbor methods

2.2.3 Stage 2: Filtering - Removing Consumed Items

This section explains filtering recommendation candidates to avoid showing users movies they have already watched.

Key terms: filtering stage, candidates, business rules

2.2.4 Stage 3: Scoring - Adding Multiple Signals

The scoring stage adds popularity to retrieved candidates’ similarity scores so later ranking can use more than one signal.

Key terms: scoring stage, candidates, similarity scores, popularity signal

2.2.5 Stage 4: Ranking - Combining Multiple Scores

This section explains how weighted scores set the final recommendation order and why ranking needs more candidates than the final list contains.

Key terms: ranking stage, weighted combination, similarity, popularity, candidates, filtering, ranker, diversity

2.2.6 The four-stage recommender in action

This section brings the four stages together into a working personalized recommender and describes what each stage does.

Key terms: retrieval, filtering, scoring, ranking, similarity, popularity

2.2.7 "Popular for You" - Personalized Popularity

This section shows how to personalize a popularity-based recommendation list by reordering popular items according to their similarity to a user’s watch history.

Key terms: popular items, similarity score, watch history, Popular for You, retrieval stage, popular action movies, subset of the content, number of candidates, top 10, average similarity

2.2.8 Creating the Framework

The section turns the four-stage recommender into a reusable framework and explains why separating its stages makes the system easier to change, test, and operate.

Key terms: four-stage pattern, retrieval, scoring, filtering, ranking, separates concerns, swap implementations, pipeline, mock the inputs, reusable framework

2.2.9 The Cold Start Problem

Explains why collaborative filtering gives unreliable recommendations for new, sparsely rated movies and how item metadata offers an alternative.

Key terms: cold start problem, collaborative filtering, behavioral data, similarity matrix, metadata, content-based recommendations

2.3 Content-Based Recommendations

Introduces content-based recommendations as finding items similar to a user’s liked or viewed item through their attributes.

Key terms: content-based recommendations, item metadata, similar items

2.3.1 Using Item Metadata

The section turns movie titles and genres into TF-IDF vectors, compares movies with cosine similarity, and explains both the immediate usefulness and metadata limitations of content-based recommendations.

Key terms: item metadata, TF-IDF, Term Frequency, Inverse Document Frequency, content vectors, cosine similarity, content similarity, sparse metadata, content-based recommendations, behavioral data

2.3.2 Fitting Into the Four-Stage Framework

The section shows how content-based retrieval fits into the existing four-stage recommender and compares its results with collaborative filtering.

Key terms: four-stage framework, retrieval stage, retrieve_similar_by_content, collaborative filtering, co-consumption patterns, content-based methods, genre and title similarity, metadata

2.3.3 Combining Behavioral and Content Signals

This section combines content and behavioral retrieval, ranks candidates using three signals, and uses the results to show both the value and limits of genre-based content similarity.

Key terms: content similarity, behavioral similarity, popularity, retrieval, ranker, genre-only vectors, content representation, descriptions, cast, learned embeddings

2.4 Wrapping up

The section sums up the tradeoffs among collaborative, content-based, and hybrid recommenders and draws practical lessons from building them in a shared four-stage framework.

Key terms: collaborative filtering, content-based, hybrid, interaction data, metadata, popularity, ItemKNN, metadata features, fallback strategy, four-stage framework

2.5 Further Reading

2.6 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 1: Recommendations, recommender systems, and components Chapter 3: Embedding-based recommender systems →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.