Welcome to RecStudy, an introductory journey for beginners in recommender systems. This project covers various techniques, from basic collaborative filtering to deep learning algorithms and advanced graph-based and knowledge graph methods.
The primary reference for this project is Professor Yu Fangren's book, "Hands-on Learning of Recommender Systems: Algorithm Implementation Based on PyTorch". A significant portion of the code is inspired by the content of the book and the author's code repository. Special thanks to Professor Yu Fangren for his invaluable contributions!
To facilitate learning for beginners, all code is thoroughly commented, well-organized, and ready to run without any adjustments. You can directly execute the code and see the final results. If you encounter any issues, feel free to raise them in the Issues section!
Below is the directory structure and a detailed description of each chapter.
RecStudy/
├─ dataset/ # Datasets used in the project
│ ├─ ml-100k # MovieLens 100K dataset
│ ├─ ml-100k-original # Original MovieLens 100K dataset
│ └─ ml-latest-small # MovieLens Latest Small dataset
├─ Part1.BasicRecAlgorithms/ # Basic recommender system algorithms
├─ Part2.AdvancedRecAlgorithms/ # Advanced deep learning-based algorithms
├─ Part3.GraphRecAlgorithms/ # Graph-based recommender algorithms
├─ Part4.KGRecAlgorithms/ # Knowledge graph recommender algorithms
├─ Part5.ConstructRecSys/ # Recommender system construction techniques
├─ Part6.EvaRecSys/ # Evaluation methods for recommender systems
└─ utils/ # Utility scripts
This chapter introduces foundational algorithms and techniques for recommender systems, including matrix factorization, collaborative filtering, and similarity-based methods.
File | Description |
---|---|
ALS_PyTorch.py |
Alternating Least Squares (ALS) implemented in PyTorch. |
ALS_tradition.py |
ALS implemented in NumPy. |
basicSim.py |
Basic similarity computation for user-item pairs. |
evaluate.py |
Evaluation metrics for recommender systems. |
FM.py |
Factorization Machines (FM) implementation. |
FM_embbeding_style.py |
FM with embedding style implementation. |
furtherSim.py |
Extensions of similarity computation. |
itemCF_01label.py |
Item-based collaborative filtering with binary labels. |
LR.py |
Logistic Regression-based recommendation. |
POLY2.py |
Polynomial-based recommendation model. |
SVD.ipynb |
Singular Value Decomposition (SVD) for recommendations. |
userCF_01label.py |
User-based collaborative filtering with binary labels. |
userItemCF_15label.ipynb |
Hybrid user-item collaborative filtering with detailed labels. |
This chapter explores deep learning-based approaches, such as neural collaborative filtering, embedding methods, and sequence-based models.
File | Description |
---|---|
ALS_MLP.ipynb |
Neural Collaborative Filtering (NCF) with MLP. |
Embedding_CNN.ipynb |
Embedding-based recommendation using CNNs. |
Embedding_MLP.ipynb |
Embedding-based recommendation using MLP. |
FNN_plus.ipynb |
Feedforward Neural Networks with additional features. |
RNN_rec.ipynb |
Sequential recommendation using RNNs. |
RNN_rec_ALS.ipynb |
Combining RNNs with ALS for hybrid recommendations. |
In this chapter, we introduce graph neural networks (GNNs) and other graph-based techniques for recommendations. (Files in this directory to be updated.)
File | Description |
---|
This chapter focuses on leveraging knowledge graphs to enhance recommendation quality. (Files in this directory to be updated.)
File | Description |
---|
This section delves into building end-to-end recommender systems, including system design and implementation. (Files in this directory to be updated.)
File | Description |
---|
This chapter discusses evaluation techniques and metrics for recommender systems, including accuracy and diversity measures. (Files in this directory to be updated.)
File | Description |
---|
The project uses several datasets, primarily the MovieLens dataset, with different versions organized as follows:
ml-100k
: Preprocessed MovieLens 100K dataset.ml-100k-original
: Original MovieLens 100K dataset.ml-latest-small
: Latest small version of MovieLens.
Additional scripts and helper functions are stored in the utils/
directory. These include data preprocessing and utility scripts to facilitate the project.
File | Description |
---|---|
dataloader.py |
General data loader for recommender systems. |
dataloader4ml100kIndexs.py |
Data loader for MovieLens 100K with indexed features. |
dataloader4ml100kOneHot.py |
Data loader for MovieLens 100K with one-hot encoding. |
To start exploring the code and running experiments:
-
Clone the repository:
git clone https://github.com/Embraccce/RecStudy.git cd RecStudy
-
Install dependencies:
pip install -r requirements.txt
-
Run examples or experiment scripts from respective directories.
We welcome contributions to improve and expand this repository. Feel free to submit issues or pull requests.
This project is licensed under the MIT License.