# Top 3 Python Packages to Learn the Recommendation System **Published by:** [wang0766](https://paragraph.com/@wang0766/) **Published on:** 2021-12-12 **URL:** https://paragraph.com/@wang0766/top-3-python-packages-to-learn-the-recommendation-system ## Content 从这些包中学习以提高您的推荐系统知识Cornellius Yudha Wijaya照片由维多利亚诺·伊斯基耶多在Unsplash 推荐系统是一个数据科学问题,它根据历史数据预测用户或客户想要什么。推荐系统有两种常见的工作方式——协同过滤和基于内容的过滤。 上面的条款你觉得熟悉吗?可能是可能不是。无论如何,本文旨在更好地理解使用这三大 Python 包的推荐系统。这些包是什么?让我们开始吧!1. 惊喜Surprise is an open-source Python package for building a recommendation system based on the rating data. The name SurPRISE is an abbreviation for the Simple Python RecommendatIon System Engine. The package provides all the necessary tools for building the recommendation system — from loading the dataset, choosing the prediction algorithm, and evaluating the model. Let’s install the package to learn more about the recommendation system.pip install scikit-surprise After installing the package, let’s try to build a recommendation system based on the tutorial package. We did this to see if the package had been properly installed or not.from surprise import SVD from surprise import Dataset from surprise.model_selection import cross_validate# Load the movielens-100k dataset (download it if needed). data = Dataset.load_builtin('ml-100k')# Use the famous SVD algorithm. algo = SVD()# Run 5-fold cross-validation and print results. cross_validate(algo, data, measures=['RMSE', 'MAE'], cv=5, verbose=True) Image by Author If you can see the output above, you are good to go. The code above analyzes the dataset by rating, and using the SVD algorithm; we create the recommendation system. The metrics we evaluated are RMSE and MAE with 5-fold as an evaluation method. If we want to understand further how the algorithm and evaluation work, we could visit the Surprise documentation. The developer has stated that they strongly emphasized the documentation to explain every detail of the algorithm. That is why we would explore documentation for our material learning.GIF by Author If we look at the Getting Started part, the documentation is full of learning material on developing machine learning prediction for recommendation systems and evaluating it. If we look at the prediction algorithm section, we will get a more detailed part about the estimation using baseline estimates and similarity measures. This part is pretty well written and lets you understand the basic algorithm used in the recommendation system.Image by Author The documentation also gives you an excellent selection for learning material; I suggest you could start from the following section to learn more about the model and the evaluation:prediction_algorithms packageThe model_selection packagesimilarities moduleaccuracy moduledataset moduleWhat I love from this documentation is all the calculations and equitation written in detail so you can understand what happened under the hood. For example, the calculation is written clearly in the image below for the cosine similarities.Image by Author2. TensorFlow RecommendersThe TensorFlow framework contains a library to build the recommendation system called TensorFlow Recommenders. Like the other package, the TensorFlow Recommenders contains dataset examples, recommender algorithms, model evaluations, and deployment. To Install the package, you need to run the following code.pip install tensorflow-recommenders TensorFlow Recommenders would allow us to build a recommendation system based only on the TensorFlow framework. However, the documentation is complete for beginners as it is written for beginners and professionals alike. Let’s take a look at the documentation page for learning.GIF by Author The documentation is structured from how you load the data, select the algorithm, and evaluate it. Not only does the documentation contain the how-to-work for the beginner, but it also gives you tips on related content such as Feature Preprocessing.Image by Author If you want to look at a more advanced use case, you could check out the Documentation for Intermediate cases. It shows you content such as Multitask recommenders, Cross networks, etc.Image by Author If you want to have the source code or contribute to the open-source, you could visit the GitHub page.3. RecmetricsLearning about the recommendation system algorithm would not be complete without the evaluation metrics. The previous article I mentioned has taught us some basic recommendation evaluation metrics, but a Python package focuses on the metrics — Recmetrics. To install the package, you only need to run the following code.该包包含许多推荐系统的评估指标,例如:长尾图覆盖范围新奇个性化列表内相似度还有很多。GitHub 页面上提供了对指标的所有解释。作者的 GIF 如果要使用示例数据集探索包,可以探索包中提供的示例笔记本。结论推荐系统是一个数据科学问题,它根据历史数据预测用户或客户想要什么。学习推荐系统可以更好地与 Python Package 一起陪伴你的学习。我推荐的包是:惊喜TensorFlow 推荐计量学我希望它有帮助! 在我的**LinkedIn** ** ** 或**Twitter**上访问我。*如果您喜欢我的内容并希望获得有关数据或作为数据科学家的日常生活的更深入的知识,请考虑在此处订阅我的 *时事通讯。如果您不是以 Medium 会员身份订阅的,请考虑通过我的推荐订阅。 ## Publication Information - [wang0766](https://paragraph.com/@wang0766/): Publication homepage - [All Posts](https://paragraph.com/@wang0766/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@wang0766): Subscribe to updates - [Twitter](https://twitter.com/0xluod): Follow on Twitter