This chapter developed a recommendation system with a wide range of use cases. We looked at content-based filtering to find similar items based on the items' titles and descriptions, and more extensively at collaborative filtering, which considers users' interests in the items rather than the items' content. Since we focused on implicit feedback, our collaborative filtering recommendation system does not need user ratings or other numeric scores to represent user preferences. Only passive data collection suffices to generate enough knowledge to make recommendations. Such passive data may include purchases, listens, clicks, and so on.
After collecting data for some users, along with their purchase/listen/click patterns, we used matrix factorization to represent how users and items relate and to reduce the size of the data. The implicit
and faiss
libraries are used to make an effective recommendation system, and the Flask
library is used to create a simple HTTP API that is general purpose...