Top Related Projects
Best Practices on Recommendation Systems
Easy-to-use,Modular and Extendible package of deep-learning based CTR models .
LibRec: A Leading Java Library for Recommender Systems, see
A unified, comprehensive and efficient recommendation library
A Python implementation of LightFM, a hybrid recommendation algorithm.
Fast Python Collaborative Filtering for Implicit Feedback Datasets
Quick Overview
DeepGraphLearning/RecommenderSystems is a GitHub repository that provides implementations of various recommender system algorithms using deep learning and graph-based approaches. It aims to offer a comprehensive collection of state-of-the-art recommendation models, focusing on graph neural networks and their applications in recommendation tasks.
Pros
- Offers a wide range of recommendation algorithms, including both traditional and cutting-edge approaches
- Implements graph-based recommendation models, which can capture complex user-item interactions
- Provides clear documentation and examples for each implemented algorithm
- Regularly updated with new models and improvements
Cons
- May require significant computational resources for training large-scale models
- Some implementations might be complex for beginners in the field of recommender systems
- Limited support for non-graph-based recommendation algorithms
- Dependency on specific deep learning frameworks may limit flexibility
Code Examples
- Loading and preprocessing data:
from recommender_systems import data_utils
# Load MovieLens dataset
data = data_utils.load_movielens()
# Preprocess the data
user_item_matrix = data_utils.create_user_item_matrix(data)
- Training a Graph Convolutional Matrix Completion (GCMC) model:
from recommender_systems.models import GCMC
# Initialize and train the GCMC model
model = GCMC(user_item_matrix)
model.train(epochs=100, batch_size=64)
# Make predictions
predictions = model.predict(user_ids, item_ids)
- Evaluating the model performance:
from recommender_systems.evaluation import evaluate_metrics
# Calculate evaluation metrics
metrics = evaluate_metrics(predictions, ground_truth)
print(f"NDCG: {metrics['ndcg']}, Precision@10: {metrics['precision@10']}")
Getting Started
To get started with the DeepGraphLearning/RecommenderSystems repository:
-
Clone the repository:
git clone https://github.com/DeepGraphLearning/RecommenderSystems.git cd RecommenderSystems
-
Install dependencies:
pip install -r requirements.txt
-
Run an example:
from recommender_systems import run_example run_example('gcmc', dataset='movielens')
This will train a GCMC model on the MovieLens dataset and display the results.
Competitor Comparisons
Best Practices on Recommendation Systems
Pros of recommenders
- More comprehensive and actively maintained, with regular updates and contributions
- Includes a wider range of algorithms and evaluation metrics
- Provides extensive documentation and examples for ease of use
Cons of recommenders
- Larger codebase may be overwhelming for beginners
- Requires more dependencies and setup time
- May have higher computational requirements for some algorithms
Code Comparison
RecommenderSystems:
class GCN(nn.Module):
def __init__(self, in_dim, out_dim):
super(GCN, self).__init__()
self.gc1 = GraphConvolution(in_dim, out_dim)
def forward(self, x, adj):
return F.relu(self.gc1(x, adj))
recommenders:
class NCF(tf.keras.Model):
def __init__(self, num_users, num_items, model_type="NeuMF", **kwargs):
super(NCF, self).__init__()
self.num_users = num_users
self.num_items = num_items
self.model_type = model_type
self._build()
RecommenderSystems focuses on graph-based models, while recommenders offers a broader range of algorithms, including neural collaborative filtering. The code snippets showcase the different approaches and frameworks used in each repository.
Easy-to-use,Modular and Extendible package of deep-learning based CTR models .
Pros of DeepCTR
- Comprehensive implementation of various CTR (Click-Through Rate) prediction models
- Well-documented with clear examples and tutorials
- Actively maintained with frequent updates and bug fixes
Cons of DeepCTR
- Focused primarily on CTR prediction, limiting its scope for other recommendation tasks
- May require more domain-specific knowledge to use effectively
- Less emphasis on graph-based recommendation approaches
Code Comparison
DeepCTR example:
from deepctr.models import DeepFM
from deepctr.feature_column import SparseFeat, DenseFeat, get_feature_names
model = DeepFM(linear_feature_columns, dnn_feature_columns, task='binary')
model.compile("adam", "binary_crossentropy", metrics=['binary_crossentropy'])
RecommenderSystems example:
from recommender_systems import GraphSAGE
from recommender_systems.utils import load_data
data = load_data('cora')
model = GraphSAGE(data.num_features, 16, data.num_classes)
model.fit(data.x, data.edge_index, data.y)
The code examples highlight the different focus areas of each repository. DeepCTR emphasizes CTR prediction models with feature engineering, while RecommenderSystems showcases graph-based approaches for recommendation tasks.
LibRec: A Leading Java Library for Recommender Systems, see
Pros of librec
- More comprehensive and mature library with a wider range of algorithms
- Better documentation and user guides
- Larger community and more frequent updates
Cons of librec
- Less focus on deep learning and graph-based approaches
- May be more complex to use for beginners
- Primarily Java-based, which may not be ideal for all users
Code Comparison
librec:
DataModel dataModel = new TextDataModel("data/filmtrust/rating/rating.txt");
RecommenderContext context = new RecommenderContext(dataModel);
Recommender recommender = new ItemKNNRecommender();
recommender.recommend(context);
RecommenderSystems:
from recommender_systems import GraphConvRecommender
model = GraphConvRecommender(num_users, num_items, embedding_dim)
model.fit(train_data)
predictions = model.predict(test_data)
The code snippets show that librec uses a more traditional Java-based approach with explicit data models and contexts, while RecommenderSystems employs a more modern Python-based implementation focusing on graph convolutional networks for recommendations.
A unified, comprehensive and efficient recommendation library
Pros of RecBole
- More comprehensive and up-to-date collection of recommender system algorithms
- Better documentation and user guides, making it easier for newcomers to get started
- Active development and maintenance, with frequent updates and bug fixes
Cons of RecBole
- Steeper learning curve due to its extensive features and configurations
- May be overkill for simple recommendation tasks or small-scale projects
- Requires more computational resources for some advanced models
Code Comparison
RecBole:
from recbole.quick_start import run_recbole
run_recbole(model='BPR', dataset='ml-100k')
RecommenderSystems:
from recommender_systems import BPR
model = BPR(n_factors=20, n_iterations=10, learning_rate=0.1, lambda_reg=0.01)
model.fit(train_data)
predictions = model.predict(user_ids, item_ids)
RecBole offers a more streamlined approach with its quick_start module, while RecommenderSystems requires more manual configuration. RecBole's implementation is more concise and easier to use out-of-the-box, but RecommenderSystems provides more granular control over model parameters.
A Python implementation of LightFM, a hybrid recommendation algorithm.
Pros of LightFM
- Efficient implementation with support for both implicit and explicit feedback
- Incorporates both collaborative and content-based filtering approaches
- Well-documented with clear examples and tutorials
Cons of LightFM
- Limited to matrix factorization-based models
- May not handle complex graph structures as effectively as RecommenderSystems
- Less flexibility for customizing deep learning architectures
Code Comparison
LightFM:
from lightfm import LightFM
model = LightFM(learning_rate=0.05, loss='warp')
model.fit(train, epochs=10)
RecommenderSystems:
from recommender_systems import GCN
model = GCN(hidden_channels=64, num_layers=3)
optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
model.train()
LightFM focuses on matrix factorization techniques, providing a simpler API for quick implementation. RecommenderSystems offers more flexibility for graph-based deep learning models, allowing for custom architectures and graph neural networks. LightFM is better suited for traditional recommendation tasks, while RecommenderSystems excels in leveraging complex graph structures and deep learning techniques for recommendations.
Fast Python Collaborative Filtering for Implicit Feedback Datasets
Pros of implicit
- Mature and well-maintained library with extensive documentation
- Efficient implementation of various implicit feedback algorithms
- Supports both CPU and GPU acceleration for faster computations
Cons of implicit
- Focused primarily on implicit feedback models, limiting its scope
- Less emphasis on deep learning and graph-based approaches
- May require more manual feature engineering compared to graph-based methods
Code comparison
implicit:
from implicit.als import AlternatingLeastSquares
model = AlternatingLeastSquares()
model.fit(user_item_matrix)
recommendations = model.recommend(user_id, user_item_matrix[user_id])
RecommenderSystems:
from recommender import GraphRecommender
model = GraphRecommender()
model.build_graph(user_item_interactions)
model.train()
recommendations = model.recommend(user_id)
Key differences
- implicit focuses on traditional collaborative filtering methods, while RecommenderSystems emphasizes graph-based approaches
- RecommenderSystems likely offers more flexibility in incorporating additional features and complex relationships
- implicit may be easier to use for simpler recommendation tasks, while RecommenderSystems could be more suitable for advanced, graph-based scenarios
Use cases
- Choose implicit for straightforward implicit feedback scenarios with large datasets requiring efficient processing
- Opt for RecommenderSystems when dealing with complex user-item relationships or when leveraging graph structures is beneficial
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
A library of Recommender Systems
This repository provides a summary of our research on Recommender Systems. It includes our code base on different recommendation topics, a comprehensive reading list and a set of bechmark data sets.
Code Base
Currently, we are interested in sequential recommendation, feature-based recommendation and social recommendation.
Sequential Recommedation
Since users' interests are naturally dynamic, modeling users' sequential behaviors can learn contextual representations of users' current interests and therefore provide more accurate recommendations. In this project, we include some state-of-the-art sequential recommenders that empoly advanced sequence modeling techniques, such as Markov Chains (MCs), Recurrent Neural Networks (RNNs), Temporal Convolutional Neural Networks (TCN) and Self-attentive Neural Networks (Transformer).
Feature-based Recommendation
A general method for recommendation is to predict the click probabilities given users' profiles and items' features, which is known as CTR prediction. For CTR prediction, a core task is to learn (high-order) feature interactions because feature combinations are usually powerful indicators for prediction. However, enumerating all the possible high-order features will exponentially increase the dimension of data, leading to a more serious problem of model overfitting. In this work, we propose to learn low-dimentional representations of combinatorial features with self-attention mechanism, by which feature interactions are automatically implemented. Quantitative results show that our model have good prediction performance as well as satisfactory efficiency.
Social recommendation
Online social communities are an essential part of today's online experience. What we do or what we choose may be explicitly or implicitly influenced by our friends. In this project, we study the social influences in session-based recommendations, which simultaneously model users' dynamic interests and context-dependent social influences. First, we model users' dynamic interests with recurrent neural networks. In order to model context-dependent social influences, we propose to employ attention-based graph convolutional neural networks to differentiate friends' dynamic infuences in different behavior sessions.
Reading List
We maintain a reading list of RecSys papers to keep track of up-to-date research.
Data List
We provide a summary of existing benchmark data sets for evaluating recommendation methods.
New Data
We contribute a new large-scale dataset, which is collected from a popular movie/music/book review website Douban (www.douban.com). The data set could be useful for researches on sequential recommendation, social recommendation and multi-domain recommendation. See details here.
Publications:
- Weiping Song, Zhijian Duan, Ziqing Yang, Hao Zhu, Ming Zhang and Jian Tang. Explainable Knowledge Graph-based Recommendation via Deep Reinforcement Learning. arXiv'2019.
- Weiping Song, Zhiping Xiao, Yifan Wang, Laurent Charlin, Ming Zhang and Jian Tang. Session-based Social Recommendation via Dynamic Graph Attention Networks. WSDM'19.
- Weiping Song, Chence Shi, Zhiping Xiao, Zhijian Duan, Yewen Xu, Ming Zhang and Jian Tang. AutoInt: Automatic Feature Interaction Learning via Self-Attentive Neural Networks. CIKM'2019.
Top Related Projects
Best Practices on Recommendation Systems
Easy-to-use,Modular and Extendible package of deep-learning based CTR models .
LibRec: A Leading Java Library for Recommender Systems, see
A unified, comprehensive and efficient recommendation library
A Python implementation of LightFM, a hybrid recommendation algorithm.
Fast Python Collaborative Filtering for Implicit Feedback Datasets
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot