MCPcopy
hub / github.com/recommenders-team/recommenders

github.com/recommenders-team/recommenders @1.2.1 sqlite

repository ↗ · DeepWiki ↗ · release 1.2.1 ↗
1,460 symbols 5,351 edges 240 files 765 documented · 52%
README

Documentation status License Black PyPI Version Python Versions

What's New (Dec, 2024)

We have a new release Recommenders 1.2.1!

We fixed a lot of bugs due to dependencies, improved security, reviewed the notebooks and the libraries.

Introduction

Recommenders objective is to assist researchers, developers and enthusiasts in prototyping, experimenting with and bringing to production a range of classic and state-of-the-art recommendation systems.

Recommenders is a project under the Linux Foundation of AI and Data.

This repository contains examples and best practices for building recommendation systems, provided as Jupyter notebooks. The examples detail our learnings on five key tasks:

  • Prepare Data: Preparing and loading data for each recommendation algorithm.
  • Model: Building models using various classical and deep learning recommendation algorithms such as Alternating Least Squares (ALS) or eXtreme Deep Factorization Machines (xDeepFM).
  • Evaluate: Evaluating algorithms with offline metrics.
  • Model Select and Optimize: Tuning and optimizing hyperparameters for recommendation models.
  • Operationalize: Operationalizing models in a production environment on Azure.

Several utilities are provided in recommenders to support common tasks such as loading datasets in the format expected by different algorithms, evaluating model outputs, and splitting training/test data. Implementations of several state-of-the-art algorithms are included for self-study and customization in your own applications. See the Recommenders documentation.

For a more detailed overview of the repository, please see the documents on the wiki page.

For some of the practical scenarios where recommendation systems have been applied, see scenarios.

Getting Started

We recommend conda for environment management, and VS Code for development. To install the recommenders package and run an example notebook on Linux/WSL:

# 1. Install gcc if it is not installed already. On Ubuntu, this could done by using the command
# sudo apt install gcc

# 2. Create and activate a new conda environment
conda create -n <environment_name> python=3.9
conda activate <environment_name>

# 3. Install the core recommenders package. It can run all the CPU notebooks.
pip install recommenders

# 4. create a Jupyter kernel
python -m ipykernel install --user --name <environment_name> --display-name <kernel_name>

# 5. Clone this repo within VSCode or using command line:
git clone https://github.com/recommenders-team/recommenders.git

# 6. Within VSCode:
#   a. Open a notebook, e.g., examples/00_quick_start/sar_movielens.ipynb;  
#   b. Select Jupyter kernel <kernel_name>;
#   c. Run the notebook.

For more information about setup on other platforms (e.g., Windows and macOS) and different configurations (e.g., GPU, Spark and experimental features), see the Setup Guide.

In addition to the core package, several extras are also provided, including: + [gpu]: Needed for running GPU models. + [spark]: Needed for running Spark models. + [dev]: Needed for development for the repo. + [all]: [gpu]|[spark]|[dev] + [experimental]: Models that are not thoroughly tested and/or may require additional steps in installation.

Algorithms

The table below lists the recommendation algorithms currently available in the repository. Notebooks are linked under the Example column as Quick start, showcasing an easy to run example of the algorithm, or as Deep dive, explaining in detail the math and implementation of the algorithm.

Algorithm Type Description Example
Alternating Least Squares (ALS) Collaborative Filtering Matrix factorization algorithm for explicit or implicit feedback in large datasets, optimized for scalability and distributed computing capability. It works in the PySpark environment. Quick start / Deep dive
Attentive Asynchronous Singular Value Decomposition (A2SVD)* Collaborative Filtering Sequential-based algorithm that aims to capture both long and short-term user preferences using attention mechanism. It works in the CPU/GPU environment. Quick start
Cornac/Bayesian Personalized Ranking (BPR) Collaborative Filtering Matrix factorization algorithm for predicting item ranking with implicit feedback. It works in the CPU environment. Deep dive
Cornac/Bilateral Variational Autoencoder (BiVAE) Collaborative Filtering Generative model for dyadic data (e.g., user-item interactions). It works in the CPU/GPU environment. Deep dive
Convolutional Sequence Embedding Recommendation (Caser) Collaborative Filtering Algorithm based on convolutions that aim to capture both user’s general preferences and sequential patterns. It works in the CPU/GPU environment. Quick start
Deep Knowledge-Aware Network (DKN)* Content-Based Filtering Deep learning algorithm incorporating a knowledge graph and article embeddings for providing news or article recommendations. It works in the CPU/GPU environment. Quick start / Deep dive
Extreme Deep Factorization Machine (xDeepFM)* Collaborative Filtering Deep learning based algorithm for implicit and explicit feedback with user/item features. It works in the CPU/GPU environment. Quick start
FastAI Embedding Dot Bias (FAST) Collaborative Filtering General purpose algorithm with embeddings and biases for users and items. It works in the CPU/GPU environment. Quick start
LightFM/Factorization Machine Collaborative Filtering Factorization Machine algorithm for both implicit and explicit feedbacks. It works in the CPU environment. Quick start
LightGBM/Gradient Boosting Tree* Content-Based Filtering Gradient Boosting Tree algorithm for fast training and low memory usage in content-based problems. It works in the CPU/GPU/PySpark environments. Quick start in CPU / Deep dive in PySpark
LightGCN Collaborative Filtering Deep learning algorithm which simplifies the design of GCN for predicting implicit feedback. It works in the CPU/GPU environment. Deep dive
GeoIMC* Collaborative Filtering Matrix completion algorithm that takes into account user and item features using Riemannian conjugate gradient optimization and follows a geometric approach. It works in the CPU environment. Quick start
GRU Collaborative Filtering Sequential-based algorithm that aims to capture both long and short-term user preferences using recurrent neural networks. It works in the CPU/GPU environment. Quick start
Multinomial VAE Collaborative Filtering Generative model for predicting user/item interactions. It works in the CPU/GPU environment. Deep dive
Neural Recommendation with Long- and Short-term User Representations (LSTUR)* Content-Based Filtering Neural recommendation algorithm for recommending news articles with long- and short-term user interest modeling. It works in the CPU/GPU environment. Quick start
Neural Recommendation with Attentive Multi-View Learning (NAML)* Content-Based Filtering Neural recommendation algorithm for recommending news articles with attentive multi-view learning. It works in the CPU/GPU environment. Quick start
Neural Collaborative Filtering (NCF) Collaborative Filtering Deep learning algorithm with enhanced performance for user/item implicit feedback. It works in the CPU/GPU environment. Quick start / Deep dive
Neural Recommendation with Personalized Attention (NPA)* Content-Based Filtering Neural recommendation algorithm for recommending news articles with personalized attention network. It works in the CPU/GPU environment. Quick start
Neural Recommendation with Multi-Head Self-Attention (NRMS)* Content-Based Filtering Neural recommendation algorithm for recommending news articles with multi-head self-attention. It works in the CPU/GPU environment. Quick start
Next Item Recommendation (NextItNet) Collaborative Filtering Algorithm based on dilated convolutions and residual network that aims to capture sequential patterns. It considers both user/item interactions and features. It works in the CPU/GPU environment. Quick start
Restricted Boltzmann Machines (RBM) Collaborative Filtering Neural network based algorithm for learning the underlying probability distribution for explicit or implicit user/item feedback. It works in the CPU/GPU environment. Quick start / Deep dive
Riemannian Low-rank Matrix Completion (RLRMC)* Collaborative Filtering Matrix factorization algorithm using Riemannian conjugate gradients optimization with small memory consumption to predict user/item interactions. It works in the CPU environment. Quick start
Simple Algorithm for Recommendation (SAR)* Collaborative Filtering Similarity-based algorithm for implicit user/item feedback. It works in the CPU environment. Quick start / Deep dive
Self-Attentive Sequential Recommendation (SASRec) Collaborative Filtering Transformer based algorithm for sequential recommendation. It works in the CPU/GPU environment. Quick start
Short-term and Long-term Preference Integrated Recommender (SLi-Rec)* Collaborative Filtering Sequential-based algorithm that aims to capture both long and short-term user preferences using attention mechanism, a time-aware controller and a content-aware controller. It works in the CPU/GPU environment. Quick start
Multi-Interest-Aware Sequential User Modeling (SUM)* Collaborative Filtering An enhanced memory network-based sequential user model which aims to capture users' multiple interests. It works in the CPU/GPU environment. Quick start
Sequential Recommendation Via Personalized Transformer (SSEPT) Collaborative Filtering Transformer based algorithm for sequential recommendation with User embedding. It works in the CPU/GPU environment. Quick start
Standard VAE Collaborative Filtering Generative Model for predicting user/item interactions. It works in the CPU/GPU environment. [Deep dive](examples/02_model_collaborative_filtering

Core symbols most depended-on inside this repo

split
called by 139
recommenders/models/sasrec/util.py
execute_notebook
called by 78
recommenders/utils/notebook_utils.py
items
called by 55
recommenders/models/ncf/dataset.py
read_notebook
called by 52
recommenders/utils/notebook_utils.py
placeholder
called by 49
recommenders/models/rbm/rbm.py
fit
called by 42
recommenders/models/rbm/rbm.py
_format
called by 32
contrib/sarplus/python/pysarplus/SARPlus.py
download_deeprec_resources
called by 32
recommenders/models/deeprec/deeprec_utils.py

Shape

Function 806
Method 553
Class 99
Route 2

Languages

Python100%

Modules by API surface

recommenders/evaluation/python_evaluation.py38 symbols
tests/unit/recommenders/evaluation/test_python_evaluation.py34 symbols
recommenders/models/ncf/dataset.py34 symbols
recommenders/evaluation/spark_evaluation.py34 symbols
examples/06_benchmarks/benchmark_utils.py31 symbols
examples/07_tutorials/KDD2020-tutorial/utils/task_helper.py30 symbols
tests/unit/recommenders/evaluation/test_spark_evaluation.py28 symbols
tests/conftest.py28 symbols
recommenders/models/sasrec/model.py28 symbols
recommenders/models/deeprec/models/base_model.py27 symbols
recommenders/models/vae/standard_vae.py26 symbols
recommenders/models/vae/multinomial_vae.py26 symbols

Dependencies from manifests, versioned

jupyter-book1.0.0 · 1×
setuptools52 · 1×
wheel0.36 · 1×

For agents

$ claude mcp add recommenders \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact