In the previous chapter, we generated recommendations by analyzing the intrinsic properties of items. We now shift our focus from item attributes to user behavior with collaborative filtering. This technique operates on a simple, intuitive principle: users who agreed in the past are likely to agree in the future. Instead of asking "what is this item like?", we ask "who else liked this item?".
This chapter introduces neighborhood-based methods, which form the foundation of many collaborative filtering systems. We will begin by structuring our data into a user-item interaction matrix, a grid where each cell can represent the interaction between a user and an item .
From there, you will learn to:
By the end of this chapter, you will build a functional item-based collaborative filter, giving you a practical understanding of how to generate recommendations based purely on user interaction patterns.
3.1 The Rationale Behind Collaborative Filtering
3.2 The User-Item Interaction Matrix
3.3 User-Based vs. Item-Based Approaches
3.4 Finding Similar Users and Items with k-Nearest Neighbors
3.5 Calculating Similarity Metrics
3.6 Making Predictions with Weighted Averages
3.7 Addressing Sparsity in the Interaction Matrix
3.8 Hands-on Practical: Implementing an Item-Based Filter
© 2026 ApX Machine LearningEngineered with