Recommenders

repository·main·Indexed 12 days ago

https://github.com/recommenders-team/recommenders

A comprehensive repository of recommendation algorithms ranging from classical matrix factorization to modern deep learning and transformer-based models. It includes implementations of ALS, NCF, RBM, and SAR, as well as specialized tools like SARplus for Apache Spark. The library provides quick-start examples, data preparation utilities for splitting and transforming data, and integration modules for AzureML Designer.

Tokens
83K
Snippets
200
Records
307
Agent score
98%

What's inside Recommenders

  1. Overview of SARplus

    main

    SARplus is an efficient implementation of the Simple Algorithm for Recommendation (SAR) designed for Spark. SAR is a neighborhood-based algorithm that provides personalized recommendations by finding items similar to those a user has already interacted with (affinity).

    Key features include:

    • Scalable PySpark-based implementation.
    • Fast C++ based predictions.
    • Reduced memory consumption: the similarity matrix is cached in-memory once per worker and shared across Python executors.
  2. Overview of Recommenders capabilities

    main

    Recommenders is designed to assist in the full lifecycle of building recommendation systems through Jupyter notebook examples and library utilities. The project focuses on five key tasks:

    1. Prepare Data: Preparing and loading data for specific recommendation algorithms.
    2. Model: Building models using classical and deep learning algorithms (e.g., ALS, xDeepFM).
    3. Evaluate: Evaluating algorithms using offline metrics.
    4. Model Select and Optimize: Tuning and optimizing hyperparameters.
    5. Operationalize: Moving models into production environments.
  3. Overview of Data Preparation notebooks

    main

    The examples/01_prepare_data/ directory contains notebooks demonstrating utility functions for common recommendation system data operations, including import/export, transformation, and splitting.

    Available notebooks include:

    • data_split.ipynb: Demonstrates various data splitting strategies.
    • data_transform.ipynb: Provides guidance on transforming implicit or explicit data for collaborative filtering recommenders.
    • wikidata_knowledge_graph.ipynb: Details the creation of a knowledge graph using Wikidata.
  4. What is SARplus?

    main

    SARplus (Simple Algorithm for Recommendation) is a neighborhood-based algorithm designed for personalized recommendations using user transaction history. It is an efficient implementation of the SAR algorithm optimized for Apache Spark.

    Core Concepts:

    • Affinity: A user has an affinity for an item if they have interacted with it in the past.
    • Similarity: Two items are considered similar if users who interacted with one item are also likely to have interacted with the other.

    The algorithm works by recommending items that are most similar to the items a user already has an affinity for.

  5. Overview of Recommendation Systems for News

    main

    News recommendation systems aim to predict which news articles a user is likely to read to mitigate information overload. When developing these systems, two primary challenges must be addressed:

    1. Cold-start Problem: New articles emerge continuously and expire quickly. Systems must effectively represent and recommend new articles that lack historical interaction data.
    2. Content Representation: Unlike other domains where item IDs might suffice, news recommendation relies heavily on the rich text within articles. Natural Language Processing (NLP) methods are critical for learning effective news content representations from text.

    For theoretical foundations, refer to the ACL paper on MIND.

  6. Overview of Recommender notebook directories

    main

    The examples/ directory contains Jupyter notebooks organized by the recommendation system development workflow. The directories are categorized as follows:

    DirectoryRuns LocalDescription
    00_quick_startYesQuick start notebooks demonstrating local algorithm development workflows.
    01_prepare_dataYesData preparation notebooks for specific recommender algorithms.
    02_model_collaborative_filteringYesDeep dive into training and evaluating collaborative filtering models.
    02_model_content_based_filteringYesDeep dive into training and evaluating content-based filtering models.
    03_evaluateYesNotebooks introducing various evaluation methods for recommenders.
    04_model_select_and_optimizeSome local, some on AzureNotebooks for model tuning and selection using Azure ML or open source tools.
    05_operationalizeNo (Azure only)End-to-end pipeline illustrations for real-world use cases.
    06_benchmarksYesBenchmark comparisons of several recommender algorithms.
    07_tutorialsYesTutorials for using the Recommenders library.
  7. Introduction to Recommenders

    main

    Recommenders is a project under the Linux Foundation of AI and Data designed to help researchers, developers, and enthusiasts prototype, experiment with, and deploy classic and state-of-the-art recommendation systems.

    The project provides Jupyter notebooks covering five key stages of the recommendation lifecycle:

    • Prepare Data: Loading and preparing data for specific algorithms.
    • Model: Building models using classical and deep learning algorithms (e.g., ALS, xDeepFM).
    • Evaluate: Using offline metrics to evaluate algorithm performance.
    • Model Select and Optimize: Hyperparameter tuning and optimization.
    • Operationalize: Deploying models in production environments (e.g., on Azure).

    The recommenders package includes utilities for dataset loading, model evaluation, and data splitting, along with implementations of several state-of-the-art algorithms.

  8. Overview of Recommender Models and Utilities

    main

    The recommenders package is organized into several functional submodules:

    • datasets: Data loading (e.g., MovieLens) and splitting techniques (Random, Chronological, Stratified).
    • evaluation: Metric calculation (RMSE, Precision@K, etc.) for Python and Spark.
    • models: Implementations of various algorithms including DeepRec (CASER, DKN, xDeepFM, etc.), LightFM, NCF, SASRec, and more.
    • tuning: Hyperparameter tuning utilities.
    • utils: High-level utilities for managing constants and framework-specific aspects (GPU, Spark, Jupyter).
  9. Use SASRec and SSE-PT models

    main

    The recommenders.models.sasrec module provides implementations for Sequential Self-Attention based recommendation.

    • SASRec: The core model is located in recommenders.models.sasrec.model.
    • SSE-PT: An implementation found in recommenders.models.sasrec.ssept.
    • Supporting components: Use recommenders.models.sasrec.sampler for data sampling and recommenders.models.sasrec.util for utility functions.
  10. Retail Recommendation Scenarios

    main

    This guide outlines common retail use cases for recommendation systems and suggests appropriate modeling approaches available in the repository.

    Personalized Recommendation

    Goal: Predict products a user is likely to engage with based on their history (e.g., for home pages, feeds, or newsletters). Models to use:

    You might also like

    Goal: Recommend products relevant to the specific item a user is currently viewing. Approach: While personalization techniques apply, item similarity is particularly effective for 'cold' items or users with sparse interaction data.

    Frequently bought together

    Goal: Predict complementary products to encourage cross-selling, typically displayed near the shopping cart or checkout. Approach: Often achieved through simple association rules without requiring complex machine learning.

    Similar alternatives

    Goal: Provide down-selling options or alternatives for out-of-stock items to prevent lost sales. Approach: Predict products with similar features such as price, type, brand, or visual appearance.

  11. Explore DeepRec recommender models and utilities

    main

    The recommenders.models.deeprec module provides a collection of deep learning-based recommendation models, including sequential models, graph-based models, and data processing utilities.

    Key components include:

    • Base Models: recommenders.models.deeprec.models.base_model.BaseModel and recommenders.models.deeprec.models.sequential.sequential_base_model.SequentialBaseModel for defining custom architectures.
    • Sequential Models: Implementations like DKN, A2SVD, Caser, GRU, NextItNet, SLIRec, and SASRec (via ssept).
    • Graph/Interaction Models: LightGCN and xDeepFM.
    • Iterators: Specialized data loaders for sequential training, such as dkn_iterator, nextitnet_iterator, and sequential_iterator.
    • Data Processing: recommenders.models.deeprec.DataModel.ImplicitCF for implicit collaborative filtering data handling.
  12. Recommendation scenarios for Travel

    main

    The travel recommendation domain covers several distinct user journeys, each requiring different modeling approaches:

    • Destination discovery: Matching travelers with destinations using preferences, budget, and seasonality. Suitable models include Collaborative Filtering (e.g., ALS) and content-based methods.
    • Accommodation recommendations: Recommending hotels or rentals based on price, amenities, and location. Models like NCF (Neural Collaborative Filtering) and SAR (Self-Attentive Sequential Recommendation) can be adapted for this.
    • Activity and experience suggestions: Recommending tours and attractions based on interests and duration of stay. Content-based and hybrid approaches are most effective.
    • Trip planning assistance: Building coherent itineraries by suggesting complementary items (flights, hotels, activities). Sequential recommendation approaches are recommended for this scenario.