Building Recommender Systems
This is a utility package for the course SMEMI315: Building Recommender systems taught at the Université Côte d’Azure in autumns of 2021 and 2022. See the course description for more info about its content.
How to Install
In a Docker container
First, install Docker on your system. Then:
docker build -t recommender-systems-course https://github.com/inpefess/recommender-systems-course.git
docker run -it --rm -p 8888:8888 recommender-systems-course jupyter-lab --ip=0.0.0.0 --port=8888
You can also try it on MyBinder (it’s a free system, so resources are not always available).
On Linux
This includes Google Colab, Kaggle, and VertexAI Workbench.
pip install git+https://github.com/inpefess/recommender-systems-course.git
Depending on your environment (this is a known issue on VertexAI Workbench, for example), you should add other parameters to this command.
PATH=/home/jupyter/.local/bin:$PATH; pip install --user git+https://github.com/inpefess/recommender-systems-course.git
On Windows
There are two options:
Use Windows Subsystem for Linux (WSL)
On WSL, proceed as on any Linux.
Use Anaconda
# get the source git clone git+https://github.com/inpefess/recommender-systems-course.git cd recommender-systems-course # use a provided environment configuration conda env create -n recommender-systems-course -f environment.yml python=3.8 conda activate recommender-systems-course # test that all installed correctly pytest # add ``rs_course`` package pip install . # start working jupyter lab
On macOS
Should be in principle installable in a similar way as on Linux, but not tested.
How to Use
This package is supposed to be used together with rs_datasets
:
from rs_datasets import MovieLens
ratings = MovieLens("small").ratings
The package contains pre-packed examples of different recommenders.
For example, this function computes hit-rate@1
of a PureSVD
trained with default parameteres from scikit-learn
on randomly
selected 80% of ratings:
from rs_course.cf_svd import pure_svd_recommender
pure_svd_recommender(
ratings=ratings,
split_test_users_into=1,
model_config={},
top_k=1,
train_percentage=0.8
)
More Detailed Documentation
More detailed documentation is available here.
Similar packages
This package is not supposed to be used as a recommender systems library. It’s only purpose is to help a complete beginner to get the taste of the recommenders’ world. For a proper library, try something from this list.
How to Cite
If you want to cite this package in your research paper, please use the following DOI.
- Description
- Topics
- Package Documentation
- Popular (not Personalised) Recommender
popular_recommender()
- Content-based item2item KNN Recommender
get_content_based_recommender()
- Collaborative Filtering KNN Recommender
collaborative_filtering_knn()
- Collaborative Filtering ALS Recommender
als_recommendations()
- Pure SVD Recommender
get_svd_recs()
pure_svd_recommender()
- DNN Recommender Example
dnn_recommender()
get_dnn_predictions()
get_recbole_trained_recommender()
prepare_recbole_data()
- Cold Start Recommender Example
cold_start()
compute_cold_factors()
get_cold_items()
- Factorisation Machines with Vowpal Wabbit
factorisation_machines()
- Useful Function for the Whole Course
enumerate_users_and_items()
evaluate_implicit_recommender()
filter_users_and_items()
get_sparse_item_features()
movielens_split()
pandas_to_scipy()