Your First Recommendation System: From Data Preparation to ML Debugging and Improvements Assessment

Alexander Chaptykov2 Feb 2023

Problem

A team building its first recommender must choose data cleaning, metrics and a model, and then debug low metrics. Without baselines and a debugging routine, people tune hyperparameters when the real fault is sparse data, a post-processing bug or a model that adds nothing over "most popular".

Example from the article: the author builds a movie recommender on MovieLens (100k ratings, 943 users, 1682 movies) and compares four models on four metrics.

Solution in brief

Filter inactive users and rare items to lower sparsity, then train two real models next to two reference models (most popular and random). Score all four on precision, MAP, coverage and genre diversity, so that one metric never decides alone. If metrics look wrong, rerun the same code on MovieLens and compare with the baselines to see whether the data, the model or the pipeline is at fault.

Questions this case answers
  • How to localize the cause of poor offline quality in a recommender when data, model and evaluation code are all suspects
  • How to choose between candidate recommenders when accuracy, catalog coverage and diversity pull in different directions
  • How to prepare interaction data so that a first recommender trains to sensible metrics?
  • How to choose a first model by comparing it with popularity and random baselines on precision, coverage and diversity?

Tools and methods

  • Sparsity filtering — drops users and items with too few interactions before training
  • ALS matrix factorization — fast first model, light on memory
  • BiVAE (Bilateral Variational Autoencoder) — higher-quality but slower model from the Cornac library, best in the Microsoft recommenders benchmark table
  • Most popular and random models — reference points for judging whether ML is needed
  • Precision@k, MAP, coverage, diversity — minimum metric set: accuracy, ranking quality, catalog use, variety
  • MovieLens — public dataset for sanity-checking the pipeline
Continue reading — it's free

Google or a one-time email code. No password.