Recommender Systems Tutorial
Learn Recommender Systems step by step: 38 lessons in 9 chapters with examples, quizzes, diagrams and projects.
Start learning →
of lessons completed
Getting Started
- What Is a Recommender System? Understand what recommender systems do, where you meet them every day, what problem they solve, and how a tiny recommender works in Python.
- Types of Recommender Systems Compare popularity, content-based, collaborative, knowledge-based, context-aware and hybrid recommenders, and learn when each one fits.
- The Recommender Pipeline: Candidates and Ranking See how real recommenders are built in stages: candidate generation, scoring, filtering, re-ranking and serving, with a runnable two-stage example in Python.
- Your First Recommender: A Popularity Baseline Build your first recommender in Python: count-based, average-rating and Bayesian-weighted popularity lists, trending with time decay, and why they set the baseline.
Concepts and Data
- Explicit and Implicit Feedback Learn the difference between ratings and behavioral signals such as clicks, plays and purchases, and how to turn raw events into usable preference scores in Python.
- The User-Item Matrix Turn interaction logs into a user-item matrix with pandas, store it efficiently as a SciPy sparse matrix, and mean-center ratings, with runnable examples.
- Sparsity and the Long Tail Measure matrix sparsity, see why interaction counts follow a long-tail power law, and learn how popularity bias and thin data shape recommender design.
- The Ratings Dataset and Time-Based Splits Build a MovieLens-style ratings dataset with timestamps and split it correctly: random, per-user, time-based and leave-one-out splits, and how leakage fools you.
- Similarity Measures for Recommenders Compare cosine, Pearson, adjusted cosine, Jaccard and Euclidean similarity on rating vectors in Python, see when each one works, and avoid common traps with missing values.
Content-based Filtering
- TF-IDF Features for Items Turn item descriptions, tags and genres into TF-IDF vectors with scikit-learn, see why IDF down-weights common words, and find similar items with cosine similarity.
- A Content-based Recommender Build a complete content-based recommender: item vectors, a user profile from liked items, cosine scoring, excluding seen items, and explaining each recommendation.
- User Profiles and Feature Weighting Combine several item fields with weights, decay old interactions in user profiles, and use genres, numeric features and one-hot encodings in a content-based recommender.
- Limits of Content-based Filtering See where content-based recommenders fail: overspecialization and filter bubbles. Measure diversity, re-rank with MMR, and add dense embeddings via SVD for meaning beyond words.
Collaborative Filtering
- User-based Collaborative Filtering Build user-based collaborative filtering from scratch: find similar users, predict ratings with a mean-centered weighted average, evaluate with RMSE and make top-N lists.
- Item-based Collaborative Filtering Implement item-based collaborative filtering: item-item similarity with adjusted cosine, rating prediction from a user's own ratings, top-N lists and 'because you liked' explanations.
- Bias Baselines and Rating Prediction Predict ratings with global mean plus user and item biases, fit them by regularized least squares, evaluate with RMSE, and use the baseline inside neighborhood models.
- Shrinkage and Neighborhood Tuning Fix noisy similarities with shrinkage, minimum overlap and significance weighting, then tune k, thresholds and the similarity measure on a validation split.
- Item-based CF for Implicit Feedback Build an item-item recommender for clicks and purchases: binary interaction matrix, cosine and conditional-probability similarity, popularity damping and hit-rate evaluation.
- Scaling Neighborhood Methods Make neighborhood recommenders fast: sparse matrices, keeping only the top-k neighbors per item, precomputed lists, batching and approximate nearest neighbors, with timings.
Matrix Factorization
- Latent Factors and SVD for Recommendations Understand why a ratings matrix has low rank, how latent factors describe users and items, and how truncated SVD builds a first matrix-factorization recommender.
- SGD and Biased Matrix Factorization Build the classic Netflix-Prize style recommender from scratch in NumPy: fit user and item factors with SGD, add bias terms, tune regularization and rank unseen items.
- ALS and Implicit Feedback Learn alternating least squares (ALS) for implicit data such as clicks and plays: preferences, confidence weights, the closed-form solves, and a working NumPy version.
- BPR and Pairwise Ranking Learn pairwise ranking for recommenders: the BPR loss, negative sampling, the SGD update, and a NumPy implementation compared with a popularity baseline.
Deep and Hybrid Models
- Neural Collaborative Filtering Replace the dot product with a neural network: embeddings, generalized matrix factorization, an MLP interaction function, negative sampling and a NumPy implementation.
- Autoencoders for Recommendation Treat each user's history as a vector, compress and reconstruct it: denoising autoencoders for recommendations, the closed-form linear model EASE, and runnable NumPy code.
- Two-Tower Models and Embeddings Build a two-tower retrieval model: a user tower and an item tower, in-batch softmax training, fast dot-product search, and item features that help brand-new items.
- Hybrid Recommenders Combine collaborative and content-based signals: weighted, switching, feature-augmentation and cascade hybrids, with a NumPy blend that rescues users who have little history.
Evaluation Metrics
- Rating Metrics: RMSE and MAE Measure rating-prediction accuracy with MAE and RMSE: formulas, worked examples, per-user breakdowns, baselines, and why a low RMSE does not guarantee good recommendations.
- Precision and Recall at K Evaluate top-N recommendation lists with precision@K, recall@K, F1@K and hit rate: definitions, worked numbers, averaging over users, and common evaluation mistakes.
- Ranking Metrics: MAP, MRR and NDCG Reward relevant items that appear early in the list: average precision, MAP, reciprocal rank, MRR, DCG and NDCG with graded relevance, worked examples and runnable code.
- Beyond Accuracy: Coverage, Diversity and Novelty Measure what accuracy misses: catalog coverage, the Gini index, intra-list diversity, novelty and serendipity, plus MMR re-ranking to trade accuracy for variety.
- Offline Evaluation and A/B Testing Avoid misleading offline results: random vs time splits, leakage, selection bias, then confirm with online A/B tests: metrics, sample size, significance and guardrails.
Cold Start and Production
- The Cold Start Problem Solve the cold start problem: new users, new items and new systems. Popularity fallbacks, onboarding, content features, exploration, with runnable learning-curve examples.
- ANN Search and Serving Serve recommendations at scale: exact top-k with argpartition, approximate nearest neighbor ideas (IVF, HNSW, quantization), recall versus speed, caching and a retrieve-then-rerank flow.
- Feedback Loops, Bias and Fairness Understand how recommenders shape their own training data: feedback loops, position and popularity bias, exploration with bandits (epsilon-greedy, UCB, Thompson sampling) and fairness checks.
Projects and Practice
- Project: A Movie Recommender End-to-end project: build a movie rating dataset, split it by time, set baselines, train biased matrix factorization, evaluate with RMSE and NDCG, and produce readable top-N lists.
- Project: An Implicit-Feedback Music Recommender Build a play-count recommender: log-scale the counts, compare popularity, item-kNN, ALS and EASE on recall, NDCG and coverage, then add similar-artist lists and explanations.
- Recommender Systems Practice Set Eight worked practice problems on similarity, prediction, matrix factorization updates, implicit confidence, ranking metrics, A/B sample size, MMR and cold start, with runnable solutions.