Skip to content

Repository files navigation

logo

GitHub last commit

Introduction

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented. QRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.
Founder and principal contributor: @Coder-Yu
Other contributors: @DouTong@Niki666@HuXiLiFeng@BigPowerZ@flyxu
Supported by: @AIhongzhi (A/Prof. Hongzhi Yin, UQ), @mingaoo (A/Prof. Min Gao, CQU)

We also provide Pytorch implementations of some models in another library. Please click here

What's New

31/03/2022 - SimGCL proposed in our SIGIR'22 paper has been added.
12/10/2021 - BUIR proposed in SIGIR'21 paper has been added.
30/07/2021 - We have transplanted QRec from py2 to py3.
07/06/2021 - SEPT proposed in our KDD'21 paper has been added.
16/05/2021 - SGL proposed in SIGIR'21 paper has been added.
16/01/2021 - MHCN proposed in our WWW'21 paper has been added.
22/09/2020 - DiffNet proposed in SIGIR'19 has been added.
19/09/2020 - DHCF proposed in KDD'20 has been added.
29/07/2020 - ESRF proposed in my TKDE paper has been added.
23/07/2020 - LightGCN proposed in SIGIR'20 has been added.
17/09/2019 - NGCF proposed in SIGIR'19 has been added.
13/08/2019 - RSGAN proposed in ICDM'19 has been added.
09/08/2019 - Our paper is accepted as full research paper by ICDM'19.
20/02/2019 - IRGAN proposed in SIGIR'17 has been added.
12/02/2019 - CFGAN proposed in CIKM'18 has been added.

Architecture

QRec Architecture

Workflow

QRec Architecture

Features

  • Cross-platform: QRec can be easily deployed and executed in any platforms, including MS Windows, Linux and Mac OS.
  • Fast execution: QRec is based on Numpy, Tensorflow and some lightweight structures, which make it run fast.
  • Easy configuration: QRec configs recommenders with a configuration file and provides multiple evaluation protocols.
  • Easy expansion: QRec provides a set of well-designed recommendation interfaces by which new algorithms can be easily implemented.

Requirements

  • gensim==4.1.2
  • joblib==1.1.0
  • mkl==2022.0.0
  • mkl_service==2.4.0
  • networkx==2.6.2
  • numba==0.53.1
  • numpy==1.20.3
  • scipy==1.6.2
  • tensorflow==1.14.0

Usage

There are two ways to run the recommendation models in QRec:

  • 1.Configure the xx.conf file in the directory named config. (xx is the name of the model you want to run)
  • 2.Run main.py.

Or

  • Follow the codes in snippet.py.

For more details, we refer you to the handbook of QRec.

Configuration

Essential Options

EntryExampleDescription
ratingsD:/MovieLens/100K.txtSet the file path of the dataset. Format: each row separated by empty, tab or comma symbol.
socialD:/MovieLens/trusts.txtSet the file path of the social dataset. Format: each row separated by empty, tab or comma symbol.
ratings.setup-columns 0 1 2-columns: (user, item, rating) columns of rating data are used.
social.setup-columns 0 1 2-columns: (trustor, trustee, weight) columns of social data are used.
mode.nameUserKNNname of the recommendation model.
evaluation.setup-testSet ./dataset/test.txt Main option: -testSet, -ap, -cv (choose one of them)
-testSet path/to/test/file (need to specify the test set manually)
-ap ratio (ap means that the ratings are automatically partitioned into training set and test set, the number is the ratio of the test set. e.g. -ap 0.2)
-cv k (-cv means cross validation, k is the number of the fold. e.g. -cv 5)
-predict path/to/user list/file (predict for a given list of users without evaluation; need to mannually specify the user list file (each line presents a user))
Secondary option:-b, -p, -cold, -tf, -val (multiple choices)
-val ratio (model test would be conducted on the validation set which is generated by randomly sampling the training dataset with the given ratio.)
-b thres (binarizing the rating values. Ratings equal or greater than thres will be changed into 1, and ratings lower than thres will be left out. e.g. -b 3.0)
-p (if this option is added, the cross validation wll be executed parallelly, otherwise executed one by one)
-tf (model training will be conducted on TensorFlow (only applicable and needed for shallow models))
-cold thres (evaluation on cold-start users; users in the training set with rated items more than thres will be removed from the test set)
item.rankingoff -topN -1 Main option: whether to do item ranking
-topN N1,N2,N3...: the length of the recommendation list. *QRec can generate multiple evaluation results for different N at the same time
output.setupon -dir ./Results/Main option: whether to output recommendation results
-dir path: the directory path of output results.

Memory-based Options

similaritypcc/cosSet the similarity method to use. Options: PCC, COS;
num.neighbors30Set the number of neighbors used for KNN-based algorithms such as UserKNN, ItemKNN.

Model-based Options

num.factors5/10/20/numberSet the number of latent factors
num.max.epoch100/200/numberSet the maximum number of epoch for iterative recommendation algorithms.
learnRate-init 0.01 -max 1-init initial learning rate for iterative recommendation algorithms;
-max: maximum learning rate (default 1);
reg.lambda-u 0.05 -i 0.05 -b 0.1 -s 0.1 -u: user regularizaiton; -i: item regularization; -b: bias regularizaiton; -s: social regularization

Implement Your Model

  • 1.Make your new algorithm generalize the proper base class.
  • 2.Reimplement some of the following functions as needed.
- readConfiguration()
- printAlgorConfig()
- initModel()
- trainModel()
- saveModel()
- loadModel()
- predictForRanking()
- predict()

For more details, we refer you to the handbook of QRec.

Implemented Algorithms

Rating predictionPaper
SlopeOneLemire and Maclachlan, Slope One Predictors for Online Rating-Based Collaborative Filtering, SDM'05.
PMFSalakhutdinov and Mnih, Probabilistic Matrix Factorization, NIPS'08.
SoRecMa et al., SoRec: Social Recommendation Using Probabilistic Matrix Factorization, SIGIR'08.
SVD++Koren, Factorization meets the neighborhood: a multifaceted collaborative filtering model, SIGKDD'08.
RSTEMa et al., Learning to Recommend with Social Trust Ensemble, SIGIR'09.
SVDY. Koren, Collaborative Filtering with Temporal Dynamics, SIGKDD'09.
SocialMFJamali and Ester, A Matrix Factorization Technique with Trust Propagation for Recommendation in Social Networks, RecSys'10.
EEKhoshneshin et al., Collaborative Filtering via Euclidean Embedding, RecSys'10.
SoRegMa et al., Recommender systems with social regularization, WSDM'11.
LOCABALTang, Jiliang, et al. Exploiting local and global social context for recommendation, AAAI'13.
SREELi et al., Social Recommendation Using Euclidean embedding, IJCNN'17.
CUNE-MFZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17.

Item RankingPaper
BPRRendle et al., BPR: Bayesian Personalized Ranking from Implicit Feedback, UAI'09.
WRMFYifan Hu et al.Collaborative Filtering for Implicit Feedback Datasets, KDD'09.
SBPRZhao et al., Leveraing Social Connections to Improve Personalized Ranking for Collaborative Filtering, CIKM'14
ExpoMFLiang et al., Modeling User Exposure in Recommendation, WWW''16.
CoFactorLiang et al., Factorization Meets the Item Embedding: Regularizing Matrix Factorization with Item Co-occurrence, RecSys'16.
TBPRWang et al. Social Recommendation with Strong and Weak Ties, CIKM'16'.
CDAEWu et al., Collaborative Denoising Auto-Encoders for Top-N Recommender Systems, WSDM'16'.
DMFXue et al., Deep Matrix Factorization Models for Recommender Systems, IJCAI'17'.
NeuMFHe et al. Neural Collaborative Filtering, WWW'17.
CUNE-BPRZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17'.
IRGANWang et al., IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval Models, SIGIR'17'.
SERecWang et al., Collaborative Filtering with Social Exposure: A Modular Approach to Social Recommendation, AAAI'18'.
APRHe et al., Adversarial Personalized Ranking for Recommendation, SIGIR'18'.
IF-BPRYu et al. Adaptive Implicit Friends Identification over Heterogeneous Network for Social Recommendation, CIKM'18'.
CFGANChae et al. CFGAN: A Generic Collaborative Filtering Framework based on Generative Adversarial Networks, CIKM'18.
NGCFWang et al. Neural Graph Collaborative Filtering, SIGIR'19'.
DiffNetWu et al. A Neural Influence Diffusion Model for Social Recommendation, SIGIR'19'.
RSGANYu et al. Generating Reliable Friends via Adversarial Learning to Improve Social Recommendation, ICDM'19'.
LightGCNHe et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.
DHCFJi et al. Dual Channel Hypergraph Collaborative Filtering, KDD'20.
ESRFYu et al. Enhancing Social Recommendation with Adversarial Graph Convlutional Networks, TKDE'20.
MHCNYu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.
SGLWu et al. Self-supervised Graph Learning for Recommendation, SIGIR'21.
SEPTYu et al. Socially-Aware Self-supervised Tri-Training for Recommendation, KDD'21.
BUIRLee et al. Bootstrapping User and Item Representations for One-Class Collaborative Filtering, SIGIR'21.
SimGCLYu et al. Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for Recommendation, SIGIR'22.

Related Datasets

Data SetBasic MetaUser Context
UsersItemsRatings (Scale)DensityUsersLinks (Type)
Ciao [1]7,375105,114284,086[1, 5]0.0365%7,375111,781Trust
Epinions [2]40,163139,738664,824[1, 5]0.0118%49,289487,183Trust
Douban [3]2,84839,586894,887[1, 5]0.794%2,84835,770Trust
LastFM [4]1,89217,63292,834implicit0.27%1,89225,434Trust
Yelp [5]19,53921,266450,884implicit0.11%19,539864,157Trust
Amazon-Book [6]52,46391,5992,984,108implicit0.11%---

Reference

[1]. Tang, J., Gao, H., Liu, H.: mtrust:discerning multi-faceted trust in a connected world. In: International Conference on Web Search and Web Data Mining, WSDM 2012, Seattle, Wa, Usa, February. pp. 93–102 (2012)

[2]. Massa, P., Avesani, P.: Trust-aware recommender systems. In: Proceedings of the 2007 ACM conference on Recommender systems. pp. 17–24. ACM (2007)

[3]. G. Zhao, X. Qian, and X. Xie, “User-service rating prediction by exploring social users’ rating behaviors,” IEEE Transactions on Multimedia, vol. 18, no. 3, pp. 496–506, 2016.

[4]. Iván Cantador, Peter Brusilovsky, and Tsvi Kuflik. 2011. 2nd Workshop on Information Heterogeneity and Fusion in Recom- mender Systems (HetRec 2011). In Proceedings of the 5th ACM conference on Recommender systems (RecSys 2011). ACM, New York, NY, USA

[5]. Yu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.

[6]. He et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.

Acknowledgment

This project is supported by the Responsible Big Data Intelligence Lab (RBDI) at the school of ITEE, University of Queensland, and Chongqing University.

If our project is helpful to you, please cite one of these papers.

@inproceedings{yu2021socially,
title={Socially-aware self-supervised tri-training for recommendation},
author={Yu, Junliang and Yin, Hongzhi and Gao, Min and Xia, Xin and Zhang, Xiangliang and Viet Hung, Nguyen Quoc},
booktitle={Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining},
pages={2084--2092},
year={2021}
}

@inproceedings{yu2021self,
title={Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation},
author={Yu, Junliang and Yin, Hongzhi and Li, Jundong and Wang, Qinyong and Hung, Nguyen Quoc Viet and Zhang, Xiangliang},
booktitle={Proceedings of the Web Conference 2021},
pages={413--424},
year={2021}
}

About

QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

Topics

Resources

Stars

1.6k stars

Watchers

65 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
GitHub - Coder-Yu/QRec: QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based) · GitHub
Skip to content

Repository files navigation

logo

GitHub last commit

Introduction

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented. QRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.
Founder and principal contributor: @Coder-Yu
Other contributors: @DouTong@Niki666@HuXiLiFeng@BigPowerZ@flyxu
Supported by: @AIhongzhi (A/Prof. Hongzhi Yin, UQ), @mingaoo (A/Prof. Min Gao, CQU)

We also provide Pytorch implementations of some models in another library. Please click here

What's New

31/03/2022 - SimGCL proposed in our SIGIR'22 paper has been added.
12/10/2021 - BUIR proposed in SIGIR'21 paper has been added.
30/07/2021 - We have transplanted QRec from py2 to py3.
07/06/2021 - SEPT proposed in our KDD'21 paper has been added.
16/05/2021 - SGL proposed in SIGIR'21 paper has been added.
16/01/2021 - MHCN proposed in our WWW'21 paper has been added.
22/09/2020 - DiffNet proposed in SIGIR'19 has been added.
19/09/2020 - DHCF proposed in KDD'20 has been added.
29/07/2020 - ESRF proposed in my TKDE paper has been added.
23/07/2020 - LightGCN proposed in SIGIR'20 has been added.
17/09/2019 - NGCF proposed in SIGIR'19 has been added.
13/08/2019 - RSGAN proposed in ICDM'19 has been added.
09/08/2019 - Our paper is accepted as full research paper by ICDM'19.
20/02/2019 - IRGAN proposed in SIGIR'17 has been added.
12/02/2019 - CFGAN proposed in CIKM'18 has been added.

Architecture

QRec Architecture

Workflow

QRec Architecture

Features

  • Cross-platform: QRec can be easily deployed and executed in any platforms, including MS Windows, Linux and Mac OS.
  • Fast execution: QRec is based on Numpy, Tensorflow and some lightweight structures, which make it run fast.
  • Easy configuration: QRec configs recommenders with a configuration file and provides multiple evaluation protocols.
  • Easy expansion: QRec provides a set of well-designed recommendation interfaces by which new algorithms can be easily implemented.

Requirements

  • gensim==4.1.2
  • joblib==1.1.0
  • mkl==2022.0.0
  • mkl_service==2.4.0
  • networkx==2.6.2
  • numba==0.53.1
  • numpy==1.20.3
  • scipy==1.6.2
  • tensorflow==1.14.0

Usage

There are two ways to run the recommendation models in QRec:

  • 1.Configure the xx.conf file in the directory named config. (xx is the name of the model you want to run)
  • 2.Run main.py.

Or

  • Follow the codes in snippet.py.

For more details, we refer you to the handbook of QRec.

Configuration

Essential Options

EntryExampleDescription
ratingsD:/MovieLens/100K.txtSet the file path of the dataset. Format: each row separated by empty, tab or comma symbol.
socialD:/MovieLens/trusts.txtSet the file path of the social dataset. Format: each row separated by empty, tab or comma symbol.
ratings.setup-columns 0 1 2-columns: (user, item, rating) columns of rating data are used.
social.setup-columns 0 1 2-columns: (trustor, trustee, weight) columns of social data are used.
mode.nameUserKNNname of the recommendation model.
evaluation.setup-testSet ./dataset/test.txt Main option: -testSet, -ap, -cv (choose one of them)
-testSet path/to/test/file (need to specify the test set manually)
-ap ratio (ap means that the ratings are automatically partitioned into training set and test set, the number is the ratio of the test set. e.g. -ap 0.2)
-cv k (-cv means cross validation, k is the number of the fold. e.g. -cv 5)
-predict path/to/user list/file (predict for a given list of users without evaluation; need to mannually specify the user list file (each line presents a user))
Secondary option:-b, -p, -cold, -tf, -val (multiple choices)
-val ratio (model test would be conducted on the validation set which is generated by randomly sampling the training dataset with the given ratio.)
-b thres (binarizing the rating values. Ratings equal or greater than thres will be changed into 1, and ratings lower than thres will be left out. e.g. -b 3.0)
-p (if this option is added, the cross validation wll be executed parallelly, otherwise executed one by one)
-tf (model training will be conducted on TensorFlow (only applicable and needed for shallow models))
-cold thres (evaluation on cold-start users; users in the training set with rated items more than thres will be removed from the test set)
item.rankingoff -topN -1 Main option: whether to do item ranking
-topN N1,N2,N3...: the length of the recommendation list. *QRec can generate multiple evaluation results for different N at the same time
output.setupon -dir ./Results/Main option: whether to output recommendation results
-dir path: the directory path of output results.

Memory-based Options

similaritypcc/cosSet the similarity method to use. Options: PCC, COS;
num.neighbors30Set the number of neighbors used for KNN-based algorithms such as UserKNN, ItemKNN.

Model-based Options

num.factors5/10/20/numberSet the number of latent factors
num.max.epoch100/200/numberSet the maximum number of epoch for iterative recommendation algorithms.
learnRate-init 0.01 -max 1-init initial learning rate for iterative recommendation algorithms;
-max: maximum learning rate (default 1);
reg.lambda-u 0.05 -i 0.05 -b 0.1 -s 0.1 -u: user regularizaiton; -i: item regularization; -b: bias regularizaiton; -s: social regularization

Implement Your Model

  • 1.Make your new algorithm generalize the proper base class.
  • 2.Reimplement some of the following functions as needed.
- readConfiguration()
- printAlgorConfig()
- initModel()
- trainModel()
- saveModel()
- loadModel()
- predictForRanking()
- predict()

For more details, we refer you to the handbook of QRec.

Implemented Algorithms

Rating predictionPaper
SlopeOneLemire and Maclachlan, Slope One Predictors for Online Rating-Based Collaborative Filtering, SDM'05.
PMFSalakhutdinov and Mnih, Probabilistic Matrix Factorization, NIPS'08.
SoRecMa et al., SoRec: Social Recommendation Using Probabilistic Matrix Factorization, SIGIR'08.
SVD++Koren, Factorization meets the neighborhood: a multifaceted collaborative filtering model, SIGKDD'08.
RSTEMa et al., Learning to Recommend with Social Trust Ensemble, SIGIR'09.
SVDY. Koren, Collaborative Filtering with Temporal Dynamics, SIGKDD'09.
SocialMFJamali and Ester, A Matrix Factorization Technique with Trust Propagation for Recommendation in Social Networks, RecSys'10.
EEKhoshneshin et al., Collaborative Filtering via Euclidean Embedding, RecSys'10.
SoRegMa et al., Recommender systems with social regularization, WSDM'11.
LOCABALTang, Jiliang, et al. Exploiting local and global social context for recommendation, AAAI'13.
SREELi et al., Social Recommendation Using Euclidean embedding, IJCNN'17.
CUNE-MFZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17.

Item RankingPaper
BPRRendle et al., BPR: Bayesian Personalized Ranking from Implicit Feedback, UAI'09.
WRMFYifan Hu et al.Collaborative Filtering for Implicit Feedback Datasets, KDD'09.
SBPRZhao et al., Leveraing Social Connections to Improve Personalized Ranking for Collaborative Filtering, CIKM'14
ExpoMFLiang et al., Modeling User Exposure in Recommendation, WWW''16.
CoFactorLiang et al., Factorization Meets the Item Embedding: Regularizing Matrix Factorization with Item Co-occurrence, RecSys'16.
TBPRWang et al. Social Recommendation with Strong and Weak Ties, CIKM'16'.
CDAEWu et al., Collaborative Denoising Auto-Encoders for Top-N Recommender Systems, WSDM'16'.
DMFXue et al., Deep Matrix Factorization Models for Recommender Systems, IJCAI'17'.
NeuMFHe et al. Neural Collaborative Filtering, WWW'17.
CUNE-BPRZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17'.
IRGANWang et al., IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval Models, SIGIR'17'.
SERecWang et al., Collaborative Filtering with Social Exposure: A Modular Approach to Social Recommendation, AAAI'18'.
APRHe et al., Adversarial Personalized Ranking for Recommendation, SIGIR'18'.
IF-BPRYu et al. Adaptive Implicit Friends Identification over Heterogeneous Network for Social Recommendation, CIKM'18'.
CFGANChae et al. CFGAN: A Generic Collaborative Filtering Framework based on Generative Adversarial Networks, CIKM'18.
NGCFWang et al. Neural Graph Collaborative Filtering, SIGIR'19'.
DiffNetWu et al. A Neural Influence Diffusion Model for Social Recommendation, SIGIR'19'.
RSGANYu et al. Generating Reliable Friends via Adversarial Learning to Improve Social Recommendation, ICDM'19'.
LightGCNHe et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.
DHCFJi et al. Dual Channel Hypergraph Collaborative Filtering, KDD'20.
ESRFYu et al. Enhancing Social Recommendation with Adversarial Graph Convlutional Networks, TKDE'20.
MHCNYu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.
SGLWu et al. Self-supervised Graph Learning for Recommendation, SIGIR'21.
SEPTYu et al. Socially-Aware Self-supervised Tri-Training for Recommendation, KDD'21.
BUIRLee et al. Bootstrapping User and Item Representations for One-Class Collaborative Filtering, SIGIR'21.
SimGCLYu et al. Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for Recommendation, SIGIR'22.

Related Datasets

Data SetBasic MetaUser Context
UsersItemsRatings (Scale)DensityUsersLinks (Type)
Ciao [1]7,375105,114284,086[1, 5]0.0365%7,375111,781Trust
Epinions [2]40,163139,738664,824[1, 5]0.0118%49,289487,183Trust
Douban [3]2,84839,586894,887[1, 5]0.794%2,84835,770Trust
LastFM [4]1,89217,63292,834implicit0.27%1,89225,434Trust
Yelp [5]19,53921,266450,884implicit0.11%19,539864,157Trust
Amazon-Book [6]52,46391,5992,984,108implicit0.11%---

Reference

[1]. Tang, J., Gao, H., Liu, H.: mtrust:discerning multi-faceted trust in a connected world. In: International Conference on Web Search and Web Data Mining, WSDM 2012, Seattle, Wa, Usa, February. pp. 93–102 (2012)

[2]. Massa, P., Avesani, P.: Trust-aware recommender systems. In: Proceedings of the 2007 ACM conference on Recommender systems. pp. 17–24. ACM (2007)

[3]. G. Zhao, X. Qian, and X. Xie, “User-service rating prediction by exploring social users’ rating behaviors,” IEEE Transactions on Multimedia, vol. 18, no. 3, pp. 496–506, 2016.

[4]. Iván Cantador, Peter Brusilovsky, and Tsvi Kuflik. 2011. 2nd Workshop on Information Heterogeneity and Fusion in Recom- mender Systems (HetRec 2011). In Proceedings of the 5th ACM conference on Recommender systems (RecSys 2011). ACM, New York, NY, USA

[5]. Yu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.

[6]. He et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.

Acknowledgment

This project is supported by the Responsible Big Data Intelligence Lab (RBDI) at the school of ITEE, University of Queensland, and Chongqing University.

If our project is helpful to you, please cite one of these papers.

@inproceedings{yu2021socially,
title={Socially-aware self-supervised tri-training for recommendation},
author={Yu, Junliang and Yin, Hongzhi and Gao, Min and Xia, Xin and Zhang, Xiangliang and Viet Hung, Nguyen Quoc},
booktitle={Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining},
pages={2084--2092},
year={2021}
}

@inproceedings{yu2021self,
title={Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation},
author={Yu, Junliang and Yin, Hongzhi and Li, Jundong and Wang, Qinyong and Hung, Nguyen Quoc Viet and Zhang, Xiangliang},
booktitle={Proceedings of the Web Conference 2021},
pages={413--424},
year={2021}
}

About

QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

Topics

Resources

Stars

1.6k stars

Watchers

65 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - Coder-Yu/QRec: QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based) · GitHub
Skip to content

Repository files navigation

logo

GitHub last commit

Introduction

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented. QRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.
Founder and principal contributor: @Coder-Yu
Other contributors: @DouTong@Niki666@HuXiLiFeng@BigPowerZ@flyxu
Supported by: @AIhongzhi (A/Prof. Hongzhi Yin, UQ), @mingaoo (A/Prof. Min Gao, CQU)

We also provide Pytorch implementations of some models in another library. Please click here

What's New

31/03/2022 - SimGCL proposed in our SIGIR'22 paper has been added.
12/10/2021 - BUIR proposed in SIGIR'21 paper has been added.
30/07/2021 - We have transplanted QRec from py2 to py3.
07/06/2021 - SEPT proposed in our KDD'21 paper has been added.
16/05/2021 - SGL proposed in SIGIR'21 paper has been added.
16/01/2021 - MHCN proposed in our WWW'21 paper has been added.
22/09/2020 - DiffNet proposed in SIGIR'19 has been added.
19/09/2020 - DHCF proposed in KDD'20 has been added.
29/07/2020 - ESRF proposed in my TKDE paper has been added.
23/07/2020 - LightGCN proposed in SIGIR'20 has been added.
17/09/2019 - NGCF proposed in SIGIR'19 has been added.
13/08/2019 - RSGAN proposed in ICDM'19 has been added.
09/08/2019 - Our paper is accepted as full research paper by ICDM'19.
20/02/2019 - IRGAN proposed in SIGIR'17 has been added.
12/02/2019 - CFGAN proposed in CIKM'18 has been added.

Architecture

QRec Architecture

Workflow

QRec Architecture

Features

  • Cross-platform: QRec can be easily deployed and executed in any platforms, including MS Windows, Linux and Mac OS.
  • Fast execution: QRec is based on Numpy, Tensorflow and some lightweight structures, which make it run fast.
  • Easy configuration: QRec configs recommenders with a configuration file and provides multiple evaluation protocols.
  • Easy expansion: QRec provides a set of well-designed recommendation interfaces by which new algorithms can be easily implemented.

Requirements

  • gensim==4.1.2
  • joblib==1.1.0
  • mkl==2022.0.0
  • mkl_service==2.4.0
  • networkx==2.6.2
  • numba==0.53.1
  • numpy==1.20.3
  • scipy==1.6.2
  • tensorflow==1.14.0

Usage

There are two ways to run the recommendation models in QRec:

  • 1.Configure the xx.conf file in the directory named config. (xx is the name of the model you want to run)
  • 2.Run main.py.

Or

  • Follow the codes in snippet.py.

For more details, we refer you to the handbook of QRec.

Configuration

Essential Options

EntryExampleDescription
ratingsD:/MovieLens/100K.txtSet the file path of the dataset. Format: each row separated by empty, tab or comma symbol.
socialD:/MovieLens/trusts.txtSet the file path of the social dataset. Format: each row separated by empty, tab or comma symbol.
ratings.setup-columns 0 1 2-columns: (user, item, rating) columns of rating data are used.
social.setup-columns 0 1 2-columns: (trustor, trustee, weight) columns of social data are used.
mode.nameUserKNNname of the recommendation model.
evaluation.setup-testSet ./dataset/test.txt Main option: -testSet, -ap, -cv (choose one of them)
-testSet path/to/test/file (need to specify the test set manually)
-ap ratio (ap means that the ratings are automatically partitioned into training set and test set, the number is the ratio of the test set. e.g. -ap 0.2)
-cv k (-cv means cross validation, k is the number of the fold. e.g. -cv 5)
-predict path/to/user list/file (predict for a given list of users without evaluation; need to mannually specify the user list file (each line presents a user))
Secondary option:-b, -p, -cold, -tf, -val (multiple choices)
-val ratio (model test would be conducted on the validation set which is generated by randomly sampling the training dataset with the given ratio.)
-b thres (binarizing the rating values. Ratings equal or greater than thres will be changed into 1, and ratings lower than thres will be left out. e.g. -b 3.0)
-p (if this option is added, the cross validation wll be executed parallelly, otherwise executed one by one)
-tf (model training will be conducted on TensorFlow (only applicable and needed for shallow models))
-cold thres (evaluation on cold-start users; users in the training set with rated items more than thres will be removed from the test set)
item.rankingoff -topN -1 Main option: whether to do item ranking
-topN N1,N2,N3...: the length of the recommendation list. *QRec can generate multiple evaluation results for different N at the same time
output.setupon -dir ./Results/Main option: whether to output recommendation results
-dir path: the directory path of output results.

Memory-based Options

similaritypcc/cosSet the similarity method to use. Options: PCC, COS;
num.neighbors30Set the number of neighbors used for KNN-based algorithms such as UserKNN, ItemKNN.

Model-based Options

num.factors5/10/20/numberSet the number of latent factors
num.max.epoch100/200/numberSet the maximum number of epoch for iterative recommendation algorithms.
learnRate-init 0.01 -max 1-init initial learning rate for iterative recommendation algorithms;
-max: maximum learning rate (default 1);
reg.lambda-u 0.05 -i 0.05 -b 0.1 -s 0.1 -u: user regularizaiton; -i: item regularization; -b: bias regularizaiton; -s: social regularization

Implement Your Model

  • 1.Make your new algorithm generalize the proper base class.
  • 2.Reimplement some of the following functions as needed.
- readConfiguration()
- printAlgorConfig()
- initModel()
- trainModel()
- saveModel()
- loadModel()
- predictForRanking()
- predict()

For more details, we refer you to the handbook of QRec.

Implemented Algorithms

Rating predictionPaper
SlopeOneLemire and Maclachlan, Slope One Predictors for Online Rating-Based Collaborative Filtering, SDM'05.
PMFSalakhutdinov and Mnih, Probabilistic Matrix Factorization, NIPS'08.
SoRecMa et al., SoRec: Social Recommendation Using Probabilistic Matrix Factorization, SIGIR'08.
SVD++Koren, Factorization meets the neighborhood: a multifaceted collaborative filtering model, SIGKDD'08.
RSTEMa et al., Learning to Recommend with Social Trust Ensemble, SIGIR'09.
SVDY. Koren, Collaborative Filtering with Temporal Dynamics, SIGKDD'09.
SocialMFJamali and Ester, A Matrix Factorization Technique with Trust Propagation for Recommendation in Social Networks, RecSys'10.
EEKhoshneshin et al., Collaborative Filtering via Euclidean Embedding, RecSys'10.
SoRegMa et al., Recommender systems with social regularization, WSDM'11.
LOCABALTang, Jiliang, et al. Exploiting local and global social context for recommendation, AAAI'13.
SREELi et al., Social Recommendation Using Euclidean embedding, IJCNN'17.
CUNE-MFZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17.

Item RankingPaper
BPRRendle et al., BPR: Bayesian Personalized Ranking from Implicit Feedback, UAI'09.
WRMFYifan Hu et al.Collaborative Filtering for Implicit Feedback Datasets, KDD'09.
SBPRZhao et al., Leveraing Social Connections to Improve Personalized Ranking for Collaborative Filtering, CIKM'14
ExpoMFLiang et al., Modeling User Exposure in Recommendation, WWW''16.
CoFactorLiang et al., Factorization Meets the Item Embedding: Regularizing Matrix Factorization with Item Co-occurrence, RecSys'16.
TBPRWang et al. Social Recommendation with Strong and Weak Ties, CIKM'16'.
CDAEWu et al., Collaborative Denoising Auto-Encoders for Top-N Recommender Systems, WSDM'16'.
DMFXue et al., Deep Matrix Factorization Models for Recommender Systems, IJCAI'17'.
NeuMFHe et al. Neural Collaborative Filtering, WWW'17.
CUNE-BPRZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17'.
IRGANWang et al., IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval Models, SIGIR'17'.
SERecWang et al., Collaborative Filtering with Social Exposure: A Modular Approach to Social Recommendation, AAAI'18'.
APRHe et al., Adversarial Personalized Ranking for Recommendation, SIGIR'18'.
IF-BPRYu et al. Adaptive Implicit Friends Identification over Heterogeneous Network for Social Recommendation, CIKM'18'.
CFGANChae et al. CFGAN: A Generic Collaborative Filtering Framework based on Generative Adversarial Networks, CIKM'18.
NGCFWang et al. Neural Graph Collaborative Filtering, SIGIR'19'.
DiffNetWu et al. A Neural Influence Diffusion Model for Social Recommendation, SIGIR'19'.
RSGANYu et al. Generating Reliable Friends via Adversarial Learning to Improve Social Recommendation, ICDM'19'.
LightGCNHe et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.
DHCFJi et al. Dual Channel Hypergraph Collaborative Filtering, KDD'20.
ESRFYu et al. Enhancing Social Recommendation with Adversarial Graph Convlutional Networks, TKDE'20.
MHCNYu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.
SGLWu et al. Self-supervised Graph Learning for Recommendation, SIGIR'21.
SEPTYu et al. Socially-Aware Self-supervised Tri-Training for Recommendation, KDD'21.
BUIRLee et al. Bootstrapping User and Item Representations for One-Class Collaborative Filtering, SIGIR'21.
SimGCLYu et al. Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for Recommendation, SIGIR'22.

Related Datasets

Data SetBasic MetaUser Context
UsersItemsRatings (Scale)DensityUsersLinks (Type)
Ciao [1]7,375105,114284,086[1, 5]0.0365%7,375111,781Trust
Epinions [2]40,163139,738664,824[1, 5]0.0118%49,289487,183Trust
Douban [3]2,84839,586894,887[1, 5]0.794%2,84835,770Trust
LastFM [4]1,89217,63292,834implicit0.27%1,89225,434Trust
Yelp [5]19,53921,266450,884implicit0.11%19,539864,157Trust
Amazon-Book [6]52,46391,5992,984,108implicit0.11%---

Reference

[1]. Tang, J., Gao, H., Liu, H.: mtrust:discerning multi-faceted trust in a connected world. In: International Conference on Web Search and Web Data Mining, WSDM 2012, Seattle, Wa, Usa, February. pp. 93–102 (2012)

[2]. Massa, P., Avesani, P.: Trust-aware recommender systems. In: Proceedings of the 2007 ACM conference on Recommender systems. pp. 17–24. ACM (2007)

[3]. G. Zhao, X. Qian, and X. Xie, “User-service rating prediction by exploring social users’ rating behaviors,” IEEE Transactions on Multimedia, vol. 18, no. 3, pp. 496–506, 2016.

[4]. Iván Cantador, Peter Brusilovsky, and Tsvi Kuflik. 2011. 2nd Workshop on Information Heterogeneity and Fusion in Recom- mender Systems (HetRec 2011). In Proceedings of the 5th ACM conference on Recommender systems (RecSys 2011). ACM, New York, NY, USA

[5]. Yu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.

[6]. He et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.

Acknowledgment

This project is supported by the Responsible Big Data Intelligence Lab (RBDI) at the school of ITEE, University of Queensland, and Chongqing University.

If our project is helpful to you, please cite one of these papers.

@inproceedings{yu2021socially,
title={Socially-aware self-supervised tri-training for recommendation},
author={Yu, Junliang and Yin, Hongzhi and Gao, Min and Xia, Xin and Zhang, Xiangliang and Viet Hung, Nguyen Quoc},
booktitle={Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining},
pages={2084--2092},
year={2021}
}

@inproceedings{yu2021self,
title={Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation},
author={Yu, Junliang and Yin, Hongzhi and Li, Jundong and Wang, Qinyong and Hung, Nguyen Quoc Viet and Zhang, Xiangliang},
booktitle={Proceedings of the Web Conference 2021},
pages={413--424},
year={2021}
}

About

QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

Topics

Resources

Stars

1.6k stars

Watchers

65 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - Coder-Yu/QRec: QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based) · GitHub
Skip to content

Repository files navigation

logo

GitHub last commit

Introduction

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented. QRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.
Founder and principal contributor: @Coder-Yu
Other contributors: @DouTong@Niki666@HuXiLiFeng@BigPowerZ@flyxu
Supported by: @AIhongzhi (A/Prof. Hongzhi Yin, UQ), @mingaoo (A/Prof. Min Gao, CQU)

We also provide Pytorch implementations of some models in another library. Please click here

What's New

31/03/2022 - SimGCL proposed in our SIGIR'22 paper has been added.
12/10/2021 - BUIR proposed in SIGIR'21 paper has been added.
30/07/2021 - We have transplanted QRec from py2 to py3.
07/06/2021 - SEPT proposed in our KDD'21 paper has been added.
16/05/2021 - SGL proposed in SIGIR'21 paper has been added.
16/01/2021 - MHCN proposed in our WWW'21 paper has been added.
22/09/2020 - DiffNet proposed in SIGIR'19 has been added.
19/09/2020 - DHCF proposed in KDD'20 has been added.
29/07/2020 - ESRF proposed in my TKDE paper has been added.
23/07/2020 - LightGCN proposed in SIGIR'20 has been added.
17/09/2019 - NGCF proposed in SIGIR'19 has been added.
13/08/2019 - RSGAN proposed in ICDM'19 has been added.
09/08/2019 - Our paper is accepted as full research paper by ICDM'19.
20/02/2019 - IRGAN proposed in SIGIR'17 has been added.
12/02/2019 - CFGAN proposed in CIKM'18 has been added.

Architecture

QRec Architecture

Workflow

QRec Architecture

Features

  • Cross-platform: QRec can be easily deployed and executed in any platforms, including MS Windows, Linux and Mac OS.
  • Fast execution: QRec is based on Numpy, Tensorflow and some lightweight structures, which make it run fast.
  • Easy configuration: QRec configs recommenders with a configuration file and provides multiple evaluation protocols.
  • Easy expansion: QRec provides a set of well-designed recommendation interfaces by which new algorithms can be easily implemented.

Requirements

  • gensim==4.1.2
  • joblib==1.1.0
  • mkl==2022.0.0
  • mkl_service==2.4.0
  • networkx==2.6.2
  • numba==0.53.1
  • numpy==1.20.3
  • scipy==1.6.2
  • tensorflow==1.14.0

Usage

There are two ways to run the recommendation models in QRec:

  • 1.Configure the xx.conf file in the directory named config. (xx is the name of the model you want to run)
  • 2.Run main.py.

Or

  • Follow the codes in snippet.py.

For more details, we refer you to the handbook of QRec.

Configuration

Essential Options

EntryExampleDescription
ratingsD:/MovieLens/100K.txtSet the file path of the dataset. Format: each row separated by empty, tab or comma symbol.
socialD:/MovieLens/trusts.txtSet the file path of the social dataset. Format: each row separated by empty, tab or comma symbol.
ratings.setup-columns 0 1 2-columns: (user, item, rating) columns of rating data are used.
social.setup-columns 0 1 2-columns: (trustor, trustee, weight) columns of social data are used.
mode.nameUserKNNname of the recommendation model.
evaluation.setup-testSet ./dataset/test.txt Main option: -testSet, -ap, -cv (choose one of them)
-testSet path/to/test/file (need to specify the test set manually)
-ap ratio (ap means that the ratings are automatically partitioned into training set and test set, the number is the ratio of the test set. e.g. -ap 0.2)
-cv k (-cv means cross validation, k is the number of the fold. e.g. -cv 5)
-predict path/to/user list/file (predict for a given list of users without evaluation; need to mannually specify the user list file (each line presents a user))
Secondary option:-b, -p, -cold, -tf, -val (multiple choices)
-val ratio (model test would be conducted on the validation set which is generated by randomly sampling the training dataset with the given ratio.)
-b thres (binarizing the rating values. Ratings equal or greater than thres will be changed into 1, and ratings lower than thres will be left out. e.g. -b 3.0)
-p (if this option is added, the cross validation wll be executed parallelly, otherwise executed one by one)
-tf (model training will be conducted on TensorFlow (only applicable and needed for shallow models))
-cold thres (evaluation on cold-start users; users in the training set with rated items more than thres will be removed from the test set)
item.rankingoff -topN -1 Main option: whether to do item ranking
-topN N1,N2,N3...: the length of the recommendation list. *QRec can generate multiple evaluation results for different N at the same time
output.setupon -dir ./Results/Main option: whether to output recommendation results
-dir path: the directory path of output results.

Memory-based Options

similaritypcc/cosSet the similarity method to use. Options: PCC, COS;
num.neighbors30Set the number of neighbors used for KNN-based algorithms such as UserKNN, ItemKNN.

Model-based Options

num.factors5/10/20/numberSet the number of latent factors
num.max.epoch100/200/numberSet the maximum number of epoch for iterative recommendation algorithms.
learnRate-init 0.01 -max 1-init initial learning rate for iterative recommendation algorithms;
-max: maximum learning rate (default 1);
reg.lambda-u 0.05 -i 0.05 -b 0.1 -s 0.1 -u: user regularizaiton; -i: item regularization; -b: bias regularizaiton; -s: social regularization

Implement Your Model

  • 1.Make your new algorithm generalize the proper base class.
  • 2.Reimplement some of the following functions as needed.
- readConfiguration()
- printAlgorConfig()
- initModel()
- trainModel()
- saveModel()
- loadModel()
- predictForRanking()
- predict()

For more details, we refer you to the handbook of QRec.

Implemented Algorithms

Rating predictionPaper
SlopeOneLemire and Maclachlan, Slope One Predictors for Online Rating-Based Collaborative Filtering, SDM'05.
PMFSalakhutdinov and Mnih, Probabilistic Matrix Factorization, NIPS'08.
SoRecMa et al., SoRec: Social Recommendation Using Probabilistic Matrix Factorization, SIGIR'08.
SVD++Koren, Factorization meets the neighborhood: a multifaceted collaborative filtering model, SIGKDD'08.
RSTEMa et al., Learning to Recommend with Social Trust Ensemble, SIGIR'09.
SVDY. Koren, Collaborative Filtering with Temporal Dynamics, SIGKDD'09.
SocialMFJamali and Ester, A Matrix Factorization Technique with Trust Propagation for Recommendation in Social Networks, RecSys'10.
EEKhoshneshin et al., Collaborative Filtering via Euclidean Embedding, RecSys'10.
SoRegMa et al., Recommender systems with social regularization, WSDM'11.
LOCABALTang, Jiliang, et al. Exploiting local and global social context for recommendation, AAAI'13.
SREELi et al., Social Recommendation Using Euclidean embedding, IJCNN'17.
CUNE-MFZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17.

Item RankingPaper
BPRRendle et al., BPR: Bayesian Personalized Ranking from Implicit Feedback, UAI'09.
WRMFYifan Hu et al.Collaborative Filtering for Implicit Feedback Datasets, KDD'09.
SBPRZhao et al., Leveraing Social Connections to Improve Personalized Ranking for Collaborative Filtering, CIKM'14
ExpoMFLiang et al., Modeling User Exposure in Recommendation, WWW''16.
CoFactorLiang et al., Factorization Meets the Item Embedding: Regularizing Matrix Factorization with Item Co-occurrence, RecSys'16.
TBPRWang et al. Social Recommendation with Strong and Weak Ties, CIKM'16'.
CDAEWu et al., Collaborative Denoising Auto-Encoders for Top-N Recommender Systems, WSDM'16'.
DMFXue et al., Deep Matrix Factorization Models for Recommender Systems, IJCAI'17'.
NeuMFHe et al. Neural Collaborative Filtering, WWW'17.
CUNE-BPRZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17'.
IRGANWang et al., IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval Models, SIGIR'17'.
SERecWang et al., Collaborative Filtering with Social Exposure: A Modular Approach to Social Recommendation, AAAI'18'.
APRHe et al., Adversarial Personalized Ranking for Recommendation, SIGIR'18'.
IF-BPRYu et al. Adaptive Implicit Friends Identification over Heterogeneous Network for Social Recommendation, CIKM'18'.
CFGANChae et al. CFGAN: A Generic Collaborative Filtering Framework based on Generative Adversarial Networks, CIKM'18.
NGCFWang et al. Neural Graph Collaborative Filtering, SIGIR'19'.
DiffNetWu et al. A Neural Influence Diffusion Model for Social Recommendation, SIGIR'19'.
RSGANYu et al. Generating Reliable Friends via Adversarial Learning to Improve Social Recommendation, ICDM'19'.
LightGCNHe et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.
DHCFJi et al. Dual Channel Hypergraph Collaborative Filtering, KDD'20.
ESRFYu et al. Enhancing Social Recommendation with Adversarial Graph Convlutional Networks, TKDE'20.
MHCNYu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.
SGLWu et al. Self-supervised Graph Learning for Recommendation, SIGIR'21.
SEPTYu et al. Socially-Aware Self-supervised Tri-Training for Recommendation, KDD'21.
BUIRLee et al. Bootstrapping User and Item Representations for One-Class Collaborative Filtering, SIGIR'21.
SimGCLYu et al. Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for Recommendation, SIGIR'22.

Related Datasets

Data SetBasic MetaUser Context
UsersItemsRatings (Scale)DensityUsersLinks (Type)
Ciao [1]7,375105,114284,086[1, 5]0.0365%7,375111,781Trust
Epinions [2]40,163139,738664,824[1, 5]0.0118%49,289487,183Trust
Douban [3]2,84839,586894,887[1, 5]0.794%2,84835,770Trust
LastFM [4]1,89217,63292,834implicit0.27%1,89225,434Trust
Yelp [5]19,53921,266450,884implicit0.11%19,539864,157Trust
Amazon-Book [6]52,46391,5992,984,108implicit0.11%---

Reference

[1]. Tang, J., Gao, H., Liu, H.: mtrust:discerning multi-faceted trust in a connected world. In: International Conference on Web Search and Web Data Mining, WSDM 2012, Seattle, Wa, Usa, February. pp. 93–102 (2012)

[2]. Massa, P., Avesani, P.: Trust-aware recommender systems. In: Proceedings of the 2007 ACM conference on Recommender systems. pp. 17–24. ACM (2007)

[3]. G. Zhao, X. Qian, and X. Xie, “User-service rating prediction by exploring social users’ rating behaviors,” IEEE Transactions on Multimedia, vol. 18, no. 3, pp. 496–506, 2016.

[4]. Iván Cantador, Peter Brusilovsky, and Tsvi Kuflik. 2011. 2nd Workshop on Information Heterogeneity and Fusion in Recom- mender Systems (HetRec 2011). In Proceedings of the 5th ACM conference on Recommender systems (RecSys 2011). ACM, New York, NY, USA

[5]. Yu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.

[6]. He et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.

Acknowledgment

This project is supported by the Responsible Big Data Intelligence Lab (RBDI) at the school of ITEE, University of Queensland, and Chongqing University.

If our project is helpful to you, please cite one of these papers.

@inproceedings{yu2021socially,
title={Socially-aware self-supervised tri-training for recommendation},
author={Yu, Junliang and Yin, Hongzhi and Gao, Min and Xia, Xin and Zhang, Xiangliang and Viet Hung, Nguyen Quoc},
booktitle={Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining},
pages={2084--2092},
year={2021}
}

@inproceedings{yu2021self,
title={Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation},
author={Yu, Junliang and Yin, Hongzhi and Li, Jundong and Wang, Qinyong and Hung, Nguyen Quoc Viet and Zhang, Xiangliang},
booktitle={Proceedings of the Web Conference 2021},
pages={413--424},
year={2021}
}

About

QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

Topics

Resources

Stars

1.6k stars

Watchers

65 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' GitHub - Coder-Yu/QRec: QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based) · GitHub
Skip to content

Repository files navigation

logo

GitHub last commit

Introduction

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented. QRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.
Founder and principal contributor: @Coder-Yu
Other contributors: @DouTong@Niki666@HuXiLiFeng@BigPowerZ@flyxu
Supported by: @AIhongzhi (A/Prof. Hongzhi Yin, UQ), @mingaoo (A/Prof. Min Gao, CQU)

We also provide Pytorch implementations of some models in another library. Please click here

What's New

31/03/2022 - SimGCL proposed in our SIGIR'22 paper has been added.
12/10/2021 - BUIR proposed in SIGIR'21 paper has been added.
30/07/2021 - We have transplanted QRec from py2 to py3.
07/06/2021 - SEPT proposed in our KDD'21 paper has been added.
16/05/2021 - SGL proposed in SIGIR'21 paper has been added.
16/01/2021 - MHCN proposed in our WWW'21 paper has been added.
22/09/2020 - DiffNet proposed in SIGIR'19 has been added.
19/09/2020 - DHCF proposed in KDD'20 has been added.
29/07/2020 - ESRF proposed in my TKDE paper has been added.
23/07/2020 - LightGCN proposed in SIGIR'20 has been added.
17/09/2019 - NGCF proposed in SIGIR'19 has been added.
13/08/2019 - RSGAN proposed in ICDM'19 has been added.
09/08/2019 - Our paper is accepted as full research paper by ICDM'19.
20/02/2019 - IRGAN proposed in SIGIR'17 has been added.
12/02/2019 - CFGAN proposed in CIKM'18 has been added.

Architecture

QRec Architecture

Workflow

QRec Architecture

Features

  • Cross-platform: QRec can be easily deployed and executed in any platforms, including MS Windows, Linux and Mac OS.
  • Fast execution: QRec is based on Numpy, Tensorflow and some lightweight structures, which make it run fast.
  • Easy configuration: QRec configs recommenders with a configuration file and provides multiple evaluation protocols.
  • Easy expansion: QRec provides a set of well-designed recommendation interfaces by which new algorithms can be easily implemented.

Requirements

  • gensim==4.1.2
  • joblib==1.1.0
  • mkl==2022.0.0
  • mkl_service==2.4.0
  • networkx==2.6.2
  • numba==0.53.1
  • numpy==1.20.3
  • scipy==1.6.2
  • tensorflow==1.14.0

Usage

There are two ways to run the recommendation models in QRec:

  • 1.Configure the xx.conf file in the directory named config. (xx is the name of the model you want to run)
  • 2.Run main.py.

Or

  • Follow the codes in snippet.py.

For more details, we refer you to the handbook of QRec.

Configuration

Essential Options

EntryExampleDescription
ratingsD:/MovieLens/100K.txtSet the file path of the dataset. Format: each row separated by empty, tab or comma symbol.
socialD:/MovieLens/trusts.txtSet the file path of the social dataset. Format: each row separated by empty, tab or comma symbol.
ratings.setup-columns 0 1 2-columns: (user, item, rating) columns of rating data are used.
social.setup-columns 0 1 2-columns: (trustor, trustee, weight) columns of social data are used.
mode.nameUserKNNname of the recommendation model.
evaluation.setup-testSet ./dataset/test.txt Main option: -testSet, -ap, -cv (choose one of them)
-testSet path/to/test/file (need to specify the test set manually)
-ap ratio (ap means that the ratings are automatically partitioned into training set and test set, the number is the ratio of the test set. e.g. -ap 0.2)
-cv k (-cv means cross validation, k is the number of the fold. e.g. -cv 5)
-predict path/to/user list/file (predict for a given list of users without evaluation; need to mannually specify the user list file (each line presents a user))
Secondary option:-b, -p, -cold, -tf, -val (multiple choices)
-val ratio (model test would be conducted on the validation set which is generated by randomly sampling the training dataset with the given ratio.)
-b thres (binarizing the rating values. Ratings equal or greater than thres will be changed into 1, and ratings lower than thres will be left out. e.g. -b 3.0)
-p (if this option is added, the cross validation wll be executed parallelly, otherwise executed one by one)
-tf (model training will be conducted on TensorFlow (only applicable and needed for shallow models))
-cold thres (evaluation on cold-start users; users in the training set with rated items more than thres will be removed from the test set)
item.rankingoff -topN -1 Main option: whether to do item ranking
-topN N1,N2,N3...: the length of the recommendation list. *QRec can generate multiple evaluation results for different N at the same time
output.setupon -dir ./Results/Main option: whether to output recommendation results
-dir path: the directory path of output results.

Memory-based Options

similaritypcc/cosSet the similarity method to use. Options: PCC, COS;
num.neighbors30Set the number of neighbors used for KNN-based algorithms such as UserKNN, ItemKNN.

Model-based Options

num.factors5/10/20/numberSet the number of latent factors
num.max.epoch100/200/numberSet the maximum number of epoch for iterative recommendation algorithms.
learnRate-init 0.01 -max 1-init initial learning rate for iterative recommendation algorithms;
-max: maximum learning rate (default 1);
reg.lambda-u 0.05 -i 0.05 -b 0.1 -s 0.1 -u: user regularizaiton; -i: item regularization; -b: bias regularizaiton; -s: social regularization

Implement Your Model

  • 1.Make your new algorithm generalize the proper base class.
  • 2.Reimplement some of the following functions as needed.
- readConfiguration()
- printAlgorConfig()
- initModel()
- trainModel()
- saveModel()
- loadModel()
- predictForRanking()
- predict()

For more details, we refer you to the handbook of QRec.

Implemented Algorithms

Rating predictionPaper
SlopeOneLemire and Maclachlan, Slope One Predictors for Online Rating-Based Collaborative Filtering, SDM'05.
PMFSalakhutdinov and Mnih, Probabilistic Matrix Factorization, NIPS'08.
SoRecMa et al., SoRec: Social Recommendation Using Probabilistic Matrix Factorization, SIGIR'08.
SVD++Koren, Factorization meets the neighborhood: a multifaceted collaborative filtering model, SIGKDD'08.
RSTEMa et al., Learning to Recommend with Social Trust Ensemble, SIGIR'09.
SVDY. Koren, Collaborative Filtering with Temporal Dynamics, SIGKDD'09.
SocialMFJamali and Ester, A Matrix Factorization Technique with Trust Propagation for Recommendation in Social Networks, RecSys'10.
EEKhoshneshin et al., Collaborative Filtering via Euclidean Embedding, RecSys'10.
SoRegMa et al., Recommender systems with social regularization, WSDM'11.
LOCABALTang, Jiliang, et al. Exploiting local and global social context for recommendation, AAAI'13.
SREELi et al., Social Recommendation Using Euclidean embedding, IJCNN'17.
CUNE-MFZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17.

Item RankingPaper
BPRRendle et al., BPR: Bayesian Personalized Ranking from Implicit Feedback, UAI'09.
WRMFYifan Hu et al.Collaborative Filtering for Implicit Feedback Datasets, KDD'09.
SBPRZhao et al., Leveraing Social Connections to Improve Personalized Ranking for Collaborative Filtering, CIKM'14
ExpoMFLiang et al., Modeling User Exposure in Recommendation, WWW''16.
CoFactorLiang et al., Factorization Meets the Item Embedding: Regularizing Matrix Factorization with Item Co-occurrence, RecSys'16.
TBPRWang et al. Social Recommendation with Strong and Weak Ties, CIKM'16'.
CDAEWu et al., Collaborative Denoising Auto-Encoders for Top-N Recommender Systems, WSDM'16'.
DMFXue et al., Deep Matrix Factorization Models for Recommender Systems, IJCAI'17'.
NeuMFHe et al. Neural Collaborative Filtering, WWW'17.
CUNE-BPRZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17'.
IRGANWang et al., IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval Models, SIGIR'17'.
SERecWang et al., Collaborative Filtering with Social Exposure: A Modular Approach to Social Recommendation, AAAI'18'.
APRHe et al., Adversarial Personalized Ranking for Recommendation, SIGIR'18'.
IF-BPRYu et al. Adaptive Implicit Friends Identification over Heterogeneous Network for Social Recommendation, CIKM'18'.
CFGANChae et al. CFGAN: A Generic Collaborative Filtering Framework based on Generative Adversarial Networks, CIKM'18.
NGCFWang et al. Neural Graph Collaborative Filtering, SIGIR'19'.
DiffNetWu et al. A Neural Influence Diffusion Model for Social Recommendation, SIGIR'19'.
RSGANYu et al. Generating Reliable Friends via Adversarial Learning to Improve Social Recommendation, ICDM'19'.
LightGCNHe et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.
DHCFJi et al. Dual Channel Hypergraph Collaborative Filtering, KDD'20.
ESRFYu et al. Enhancing Social Recommendation with Adversarial Graph Convlutional Networks, TKDE'20.
MHCNYu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.
SGLWu et al. Self-supervised Graph Learning for Recommendation, SIGIR'21.
SEPTYu et al. Socially-Aware Self-supervised Tri-Training for Recommendation, KDD'21.
BUIRLee et al. Bootstrapping User and Item Representations for One-Class Collaborative Filtering, SIGIR'21.
SimGCLYu et al. Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for Recommendation, SIGIR'22.

Related Datasets

Data SetBasic MetaUser Context
UsersItemsRatings (Scale)DensityUsersLinks (Type)
Ciao [1]7,375105,114284,086[1, 5]0.0365%7,375111,781Trust
Epinions [2]40,163139,738664,824[1, 5]0.0118%49,289487,183Trust
Douban [3]2,84839,586894,887[1, 5]0.794%2,84835,770Trust
LastFM [4]1,89217,63292,834implicit0.27%1,89225,434Trust
Yelp [5]19,53921,266450,884implicit0.11%19,539864,157Trust
Amazon-Book [6]52,46391,5992,984,108implicit0.11%---

Reference

[1]. Tang, J., Gao, H., Liu, H.: mtrust:discerning multi-faceted trust in a connected world. In: International Conference on Web Search and Web Data Mining, WSDM 2012, Seattle, Wa, Usa, February. pp. 93–102 (2012)

[2]. Massa, P., Avesani, P.: Trust-aware recommender systems. In: Proceedings of the 2007 ACM conference on Recommender systems. pp. 17–24. ACM (2007)

[3]. G. Zhao, X. Qian, and X. Xie, “User-service rating prediction by exploring social users’ rating behaviors,” IEEE Transactions on Multimedia, vol. 18, no. 3, pp. 496–506, 2016.

[4]. Iván Cantador, Peter Brusilovsky, and Tsvi Kuflik. 2011. 2nd Workshop on Information Heterogeneity and Fusion in Recom- mender Systems (HetRec 2011). In Proceedings of the 5th ACM conference on Recommender systems (RecSys 2011). ACM, New York, NY, USA

[5]. Yu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.

[6]. He et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.

Acknowledgment

This project is supported by the Responsible Big Data Intelligence Lab (RBDI) at the school of ITEE, University of Queensland, and Chongqing University.

If our project is helpful to you, please cite one of these papers.

@inproceedings{yu2021socially,
title={Socially-aware self-supervised tri-training for recommendation},
author={Yu, Junliang and Yin, Hongzhi and Gao, Min and Xia, Xin and Zhang, Xiangliang and Viet Hung, Nguyen Quoc},
booktitle={Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining},
pages={2084--2092},
year={2021}
}

@inproceedings{yu2021self,
title={Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation},
author={Yu, Junliang and Yin, Hongzhi and Li, Jundong and Wang, Qinyong and Hung, Nguyen Quoc Viet and Zhang, Xiangliang},
booktitle={Proceedings of the Web Conference 2021},
pages={413--424},
year={2021}
}

About

QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

Topics

Resources

Stars

1.6k stars

Watchers

65 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - Coder-Yu/QRec: QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based) · GitHub
Skip to content

Repository files navigation

logo

GitHub last commit

Introduction

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented. QRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.
Founder and principal contributor: @Coder-Yu
Other contributors: @DouTong@Niki666@HuXiLiFeng@BigPowerZ@flyxu
Supported by: @AIhongzhi (A/Prof. Hongzhi Yin, UQ), @mingaoo (A/Prof. Min Gao, CQU)

We also provide Pytorch implementations of some models in another library. Please click here

What's New

31/03/2022 - SimGCL proposed in our SIGIR'22 paper has been added.
12/10/2021 - BUIR proposed in SIGIR'21 paper has been added.
30/07/2021 - We have transplanted QRec from py2 to py3.
07/06/2021 - SEPT proposed in our KDD'21 paper has been added.
16/05/2021 - SGL proposed in SIGIR'21 paper has been added.
16/01/2021 - MHCN proposed in our WWW'21 paper has been added.
22/09/2020 - DiffNet proposed in SIGIR'19 has been added.
19/09/2020 - DHCF proposed in KDD'20 has been added.
29/07/2020 - ESRF proposed in my TKDE paper has been added.
23/07/2020 - LightGCN proposed in SIGIR'20 has been added.
17/09/2019 - NGCF proposed in SIGIR'19 has been added.
13/08/2019 - RSGAN proposed in ICDM'19 has been added.
09/08/2019 - Our paper is accepted as full research paper by ICDM'19.
20/02/2019 - IRGAN proposed in SIGIR'17 has been added.
12/02/2019 - CFGAN proposed in CIKM'18 has been added.

Architecture

QRec Architecture

Workflow

QRec Architecture

Features

  • Cross-platform: QRec can be easily deployed and executed in any platforms, including MS Windows, Linux and Mac OS.
  • Fast execution: QRec is based on Numpy, Tensorflow and some lightweight structures, which make it run fast.
  • Easy configuration: QRec configs recommenders with a configuration file and provides multiple evaluation protocols.
  • Easy expansion: QRec provides a set of well-designed recommendation interfaces by which new algorithms can be easily implemented.

Requirements

  • gensim==4.1.2
  • joblib==1.1.0
  • mkl==2022.0.0
  • mkl_service==2.4.0
  • networkx==2.6.2
  • numba==0.53.1
  • numpy==1.20.3
  • scipy==1.6.2
  • tensorflow==1.14.0

Usage

There are two ways to run the recommendation models in QRec:

  • 1.Configure the xx.conf file in the directory named config. (xx is the name of the model you want to run)
  • 2.Run main.py.

Or

  • Follow the codes in snippet.py.

For more details, we refer you to the handbook of QRec.

Configuration

Essential Options

EntryExampleDescription
ratingsD:/MovieLens/100K.txtSet the file path of the dataset. Format: each row separated by empty, tab or comma symbol.
socialD:/MovieLens/trusts.txtSet the file path of the social dataset. Format: each row separated by empty, tab or comma symbol.
ratings.setup-columns 0 1 2-columns: (user, item, rating) columns of rating data are used.
social.setup-columns 0 1 2-columns: (trustor, trustee, weight) columns of social data are used.
mode.nameUserKNNname of the recommendation model.
evaluation.setup-testSet ./dataset/test.txt Main option: -testSet, -ap, -cv (choose one of them)
-testSet path/to/test/file (need to specify the test set manually)
-ap ratio (ap means that the ratings are automatically partitioned into training set and test set, the number is the ratio of the test set. e.g. -ap 0.2)
-cv k (-cv means cross validation, k is the number of the fold. e.g. -cv 5)
-predict path/to/user list/file (predict for a given list of users without evaluation; need to mannually specify the user list file (each line presents a user))
Secondary option:-b, -p, -cold, -tf, -val (multiple choices)
-val ratio (model test would be conducted on the validation set which is generated by randomly sampling the training dataset with the given ratio.)
-b thres (binarizing the rating values. Ratings equal or greater than thres will be changed into 1, and ratings lower than thres will be left out. e.g. -b 3.0)
-p (if this option is added, the cross validation wll be executed parallelly, otherwise executed one by one)
-tf (model training will be conducted on TensorFlow (only applicable and needed for shallow models))
-cold thres (evaluation on cold-start users; users in the training set with rated items more than thres will be removed from the test set)
item.rankingoff -topN -1 Main option: whether to do item ranking
-topN N1,N2,N3...: the length of the recommendation list. *QRec can generate multiple evaluation results for different N at the same time
output.setupon -dir ./Results/Main option: whether to output recommendation results
-dir path: the directory path of output results.

Memory-based Options

similaritypcc/cosSet the similarity method to use. Options: PCC, COS;
num.neighbors30Set the number of neighbors used for KNN-based algorithms such as UserKNN, ItemKNN.

Model-based Options

num.factors5/10/20/numberSet the number of latent factors
num.max.epoch100/200/numberSet the maximum number of epoch for iterative recommendation algorithms.
learnRate-init 0.01 -max 1-init initial learning rate for iterative recommendation algorithms;
-max: maximum learning rate (default 1);
reg.lambda-u 0.05 -i 0.05 -b 0.1 -s 0.1 -u: user regularizaiton; -i: item regularization; -b: bias regularizaiton; -s: social regularization

Implement Your Model

  • 1.Make your new algorithm generalize the proper base class.
  • 2.Reimplement some of the following functions as needed.
- readConfiguration()
- printAlgorConfig()
- initModel()
- trainModel()
- saveModel()
- loadModel()
- predictForRanking()
- predict()

For more details, we refer you to the handbook of QRec.

Implemented Algorithms

Rating predictionPaper
SlopeOneLemire and Maclachlan, Slope One Predictors for Online Rating-Based Collaborative Filtering, SDM'05.
PMFSalakhutdinov and Mnih, Probabilistic Matrix Factorization, NIPS'08.
SoRecMa et al., SoRec: Social Recommendation Using Probabilistic Matrix Factorization, SIGIR'08.
SVD++Koren, Factorization meets the neighborhood: a multifaceted collaborative filtering model, SIGKDD'08.
RSTEMa et al., Learning to Recommend with Social Trust Ensemble, SIGIR'09.
SVDY. Koren, Collaborative Filtering with Temporal Dynamics, SIGKDD'09.
SocialMFJamali and Ester, A Matrix Factorization Technique with Trust Propagation for Recommendation in Social Networks, RecSys'10.
EEKhoshneshin et al., Collaborative Filtering via Euclidean Embedding, RecSys'10.
SoRegMa et al., Recommender systems with social regularization, WSDM'11.
LOCABALTang, Jiliang, et al. Exploiting local and global social context for recommendation, AAAI'13.
SREELi et al., Social Recommendation Using Euclidean embedding, IJCNN'17.
CUNE-MFZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17.

Item RankingPaper
BPRRendle et al., BPR: Bayesian Personalized Ranking from Implicit Feedback, UAI'09.
WRMFYifan Hu et al.Collaborative Filtering for Implicit Feedback Datasets, KDD'09.
SBPRZhao et al., Leveraing Social Connections to Improve Personalized Ranking for Collaborative Filtering, CIKM'14
ExpoMFLiang et al., Modeling User Exposure in Recommendation, WWW''16.
CoFactorLiang et al., Factorization Meets the Item Embedding: Regularizing Matrix Factorization with Item Co-occurrence, RecSys'16.
TBPRWang et al. Social Recommendation with Strong and Weak Ties, CIKM'16'.
CDAEWu et al., Collaborative Denoising Auto-Encoders for Top-N Recommender Systems, WSDM'16'.
DMFXue et al., Deep Matrix Factorization Models for Recommender Systems, IJCAI'17'.
NeuMFHe et al. Neural Collaborative Filtering, WWW'17.
CUNE-BPRZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17'.
IRGANWang et al., IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval Models, SIGIR'17'.
SERecWang et al., Collaborative Filtering with Social Exposure: A Modular Approach to Social Recommendation, AAAI'18'.
APRHe et al., Adversarial Personalized Ranking for Recommendation, SIGIR'18'.
IF-BPRYu et al. Adaptive Implicit Friends Identification over Heterogeneous Network for Social Recommendation, CIKM'18'.
CFGANChae et al. CFGAN: A Generic Collaborative Filtering Framework based on Generative Adversarial Networks, CIKM'18.
NGCFWang et al. Neural Graph Collaborative Filtering, SIGIR'19'.
DiffNetWu et al. A Neural Influence Diffusion Model for Social Recommendation, SIGIR'19'.
RSGANYu et al. Generating Reliable Friends via Adversarial Learning to Improve Social Recommendation, ICDM'19'.
LightGCNHe et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.
DHCFJi et al. Dual Channel Hypergraph Collaborative Filtering, KDD'20.
ESRFYu et al. Enhancing Social Recommendation with Adversarial Graph Convlutional Networks, TKDE'20.
MHCNYu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.
SGLWu et al. Self-supervised Graph Learning for Recommendation, SIGIR'21.
SEPTYu et al. Socially-Aware Self-supervised Tri-Training for Recommendation, KDD'21.
BUIRLee et al. Bootstrapping User and Item Representations for One-Class Collaborative Filtering, SIGIR'21.
SimGCLYu et al. Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for Recommendation, SIGIR'22.

Related Datasets

Data SetBasic MetaUser Context
UsersItemsRatings (Scale)DensityUsersLinks (Type)
Ciao [1]7,375105,114284,086[1, 5]0.0365%7,375111,781Trust
Epinions [2]40,163139,738664,824[1, 5]0.0118%49,289487,183Trust
Douban [3]2,84839,586894,887[1, 5]0.794%2,84835,770Trust
LastFM [4]1,89217,63292,834implicit0.27%1,89225,434Trust
Yelp [5]19,53921,266450,884implicit0.11%19,539864,157Trust
Amazon-Book [6]52,46391,5992,984,108implicit0.11%---

Reference

[1]. Tang, J., Gao, H., Liu, H.: mtrust:discerning multi-faceted trust in a connected world. In: International Conference on Web Search and Web Data Mining, WSDM 2012, Seattle, Wa, Usa, February. pp. 93–102 (2012)

[2]. Massa, P., Avesani, P.: Trust-aware recommender systems. In: Proceedings of the 2007 ACM conference on Recommender systems. pp. 17–24. ACM (2007)

[3]. G. Zhao, X. Qian, and X. Xie, “User-service rating prediction by exploring social users’ rating behaviors,” IEEE Transactions on Multimedia, vol. 18, no. 3, pp. 496–506, 2016.

[4]. Iván Cantador, Peter Brusilovsky, and Tsvi Kuflik. 2011. 2nd Workshop on Information Heterogeneity and Fusion in Recom- mender Systems (HetRec 2011). In Proceedings of the 5th ACM conference on Recommender systems (RecSys 2011). ACM, New York, NY, USA

[5]. Yu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.

[6]. He et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.

Acknowledgment

This project is supported by the Responsible Big Data Intelligence Lab (RBDI) at the school of ITEE, University of Queensland, and Chongqing University.

If our project is helpful to you, please cite one of these papers.

@inproceedings{yu2021socially,
title={Socially-aware self-supervised tri-training for recommendation},
author={Yu, Junliang and Yin, Hongzhi and Gao, Min and Xia, Xin and Zhang, Xiangliang and Viet Hung, Nguyen Quoc},
booktitle={Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining},
pages={2084--2092},
year={2021}
}

@inproceedings{yu2021self,
title={Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation},
author={Yu, Junliang and Yin, Hongzhi and Li, Jundong and Wang, Qinyong and Hung, Nguyen Quoc Viet and Zhang, Xiangliang},
booktitle={Proceedings of the Web Conference 2021},
pages={413--424},
year={2021}
}

About

QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

Topics

Resources

Stars

1.6k stars

Watchers

65 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - Coder-Yu/QRec: QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based) · GitHub
Skip to content

Repository files navigation

logo

GitHub last commit

Introduction

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented. QRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.
Founder and principal contributor: @Coder-Yu
Other contributors: @DouTong@Niki666@HuXiLiFeng@BigPowerZ@flyxu
Supported by: @AIhongzhi (A/Prof. Hongzhi Yin, UQ), @mingaoo (A/Prof. Min Gao, CQU)

We also provide Pytorch implementations of some models in another library. Please click here

What's New

31/03/2022 - SimGCL proposed in our SIGIR'22 paper has been added.
12/10/2021 - BUIR proposed in SIGIR'21 paper has been added.
30/07/2021 - We have transplanted QRec from py2 to py3.
07/06/2021 - SEPT proposed in our KDD'21 paper has been added.
16/05/2021 - SGL proposed in SIGIR'21 paper has been added.
16/01/2021 - MHCN proposed in our WWW'21 paper has been added.
22/09/2020 - DiffNet proposed in SIGIR'19 has been added.
19/09/2020 - DHCF proposed in KDD'20 has been added.
29/07/2020 - ESRF proposed in my TKDE paper has been added.
23/07/2020 - LightGCN proposed in SIGIR'20 has been added.
17/09/2019 - NGCF proposed in SIGIR'19 has been added.
13/08/2019 - RSGAN proposed in ICDM'19 has been added.
09/08/2019 - Our paper is accepted as full research paper by ICDM'19.
20/02/2019 - IRGAN proposed in SIGIR'17 has been added.
12/02/2019 - CFGAN proposed in CIKM'18 has been added.

Architecture

QRec Architecture

Workflow

QRec Architecture

Features

  • Cross-platform: QRec can be easily deployed and executed in any platforms, including MS Windows, Linux and Mac OS.
  • Fast execution: QRec is based on Numpy, Tensorflow and some lightweight structures, which make it run fast.
  • Easy configuration: QRec configs recommenders with a configuration file and provides multiple evaluation protocols.
  • Easy expansion: QRec provides a set of well-designed recommendation interfaces by which new algorithms can be easily implemented.

Requirements

  • gensim==4.1.2
  • joblib==1.1.0
  • mkl==2022.0.0
  • mkl_service==2.4.0
  • networkx==2.6.2
  • numba==0.53.1
  • numpy==1.20.3
  • scipy==1.6.2
  • tensorflow==1.14.0

Usage

There are two ways to run the recommendation models in QRec:

  • 1.Configure the xx.conf file in the directory named config. (xx is the name of the model you want to run)
  • 2.Run main.py.

Or

  • Follow the codes in snippet.py.

For more details, we refer you to the handbook of QRec.

Configuration

Essential Options

EntryExampleDescription
ratingsD:/MovieLens/100K.txtSet the file path of the dataset. Format: each row separated by empty, tab or comma symbol.
socialD:/MovieLens/trusts.txtSet the file path of the social dataset. Format: each row separated by empty, tab or comma symbol.
ratings.setup-columns 0 1 2-columns: (user, item, rating) columns of rating data are used.
social.setup-columns 0 1 2-columns: (trustor, trustee, weight) columns of social data are used.
mode.nameUserKNNname of the recommendation model.
evaluation.setup-testSet ./dataset/test.txt Main option: -testSet, -ap, -cv (choose one of them)
-testSet path/to/test/file (need to specify the test set manually)
-ap ratio (ap means that the ratings are automatically partitioned into training set and test set, the number is the ratio of the test set. e.g. -ap 0.2)
-cv k (-cv means cross validation, k is the number of the fold. e.g. -cv 5)
-predict path/to/user list/file (predict for a given list of users without evaluation; need to mannually specify the user list file (each line presents a user))
Secondary option:-b, -p, -cold, -tf, -val (multiple choices)
-val ratio (model test would be conducted on the validation set which is generated by randomly sampling the training dataset with the given ratio.)
-b thres (binarizing the rating values. Ratings equal or greater than thres will be changed into 1, and ratings lower than thres will be left out. e.g. -b 3.0)
-p (if this option is added, the cross validation wll be executed parallelly, otherwise executed one by one)
-tf (model training will be conducted on TensorFlow (only applicable and needed for shallow models))
-cold thres (evaluation on cold-start users; users in the training set with rated items more than thres will be removed from the test set)
item.rankingoff -topN -1 Main option: whether to do item ranking
-topN N1,N2,N3...: the length of the recommendation list. *QRec can generate multiple evaluation results for different N at the same time
output.setupon -dir ./Results/Main option: whether to output recommendation results
-dir path: the directory path of output results.

Memory-based Options

similaritypcc/cosSet the similarity method to use. Options: PCC, COS;
num.neighbors30Set the number of neighbors used for KNN-based algorithms such as UserKNN, ItemKNN.

Model-based Options

num.factors5/10/20/numberSet the number of latent factors
num.max.epoch100/200/numberSet the maximum number of epoch for iterative recommendation algorithms.
learnRate-init 0.01 -max 1-init initial learning rate for iterative recommendation algorithms;
-max: maximum learning rate (default 1);
reg.lambda-u 0.05 -i 0.05 -b 0.1 -s 0.1 -u: user regularizaiton; -i: item regularization; -b: bias regularizaiton; -s: social regularization

Implement Your Model

  • 1.Make your new algorithm generalize the proper base class.
  • 2.Reimplement some of the following functions as needed.
- readConfiguration()
- printAlgorConfig()
- initModel()
- trainModel()
- saveModel()
- loadModel()
- predictForRanking()
- predict()

For more details, we refer you to the handbook of QRec.

Implemented Algorithms

Rating predictionPaper
SlopeOneLemire and Maclachlan, Slope One Predictors for Online Rating-Based Collaborative Filtering, SDM'05.
PMFSalakhutdinov and Mnih, Probabilistic Matrix Factorization, NIPS'08.
SoRecMa et al., SoRec: Social Recommendation Using Probabilistic Matrix Factorization, SIGIR'08.
SVD++Koren, Factorization meets the neighborhood: a multifaceted collaborative filtering model, SIGKDD'08.
RSTEMa et al., Learning to Recommend with Social Trust Ensemble, SIGIR'09.
SVDY. Koren, Collaborative Filtering with Temporal Dynamics, SIGKDD'09.
SocialMFJamali and Ester, A Matrix Factorization Technique with Trust Propagation for Recommendation in Social Networks, RecSys'10.
EEKhoshneshin et al., Collaborative Filtering via Euclidean Embedding, RecSys'10.
SoRegMa et al., Recommender systems with social regularization, WSDM'11.
LOCABALTang, Jiliang, et al. Exploiting local and global social context for recommendation, AAAI'13.
SREELi et al., Social Recommendation Using Euclidean embedding, IJCNN'17.
CUNE-MFZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17.

Item RankingPaper
BPRRendle et al., BPR: Bayesian Personalized Ranking from Implicit Feedback, UAI'09.
WRMFYifan Hu et al.Collaborative Filtering for Implicit Feedback Datasets, KDD'09.
SBPRZhao et al., Leveraing Social Connections to Improve Personalized Ranking for Collaborative Filtering, CIKM'14
ExpoMFLiang et al., Modeling User Exposure in Recommendation, WWW''16.
CoFactorLiang et al., Factorization Meets the Item Embedding: Regularizing Matrix Factorization with Item Co-occurrence, RecSys'16.
TBPRWang et al. Social Recommendation with Strong and Weak Ties, CIKM'16'.
CDAEWu et al., Collaborative Denoising Auto-Encoders for Top-N Recommender Systems, WSDM'16'.
DMFXue et al., Deep Matrix Factorization Models for Recommender Systems, IJCAI'17'.
NeuMFHe et al. Neural Collaborative Filtering, WWW'17.
CUNE-BPRZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17'.
IRGANWang et al., IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval Models, SIGIR'17'.
SERecWang et al., Collaborative Filtering with Social Exposure: A Modular Approach to Social Recommendation, AAAI'18'.
APRHe et al., Adversarial Personalized Ranking for Recommendation, SIGIR'18'.
IF-BPRYu et al. Adaptive Implicit Friends Identification over Heterogeneous Network for Social Recommendation, CIKM'18'.
CFGANChae et al. CFGAN: A Generic Collaborative Filtering Framework based on Generative Adversarial Networks, CIKM'18.
NGCFWang et al. Neural Graph Collaborative Filtering, SIGIR'19'.
DiffNetWu et al. A Neural Influence Diffusion Model for Social Recommendation, SIGIR'19'.
RSGANYu et al. Generating Reliable Friends via Adversarial Learning to Improve Social Recommendation, ICDM'19'.
LightGCNHe et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.
DHCFJi et al. Dual Channel Hypergraph Collaborative Filtering, KDD'20.
ESRFYu et al. Enhancing Social Recommendation with Adversarial Graph Convlutional Networks, TKDE'20.
MHCNYu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.
SGLWu et al. Self-supervised Graph Learning for Recommendation, SIGIR'21.
SEPTYu et al. Socially-Aware Self-supervised Tri-Training for Recommendation, KDD'21.
BUIRLee et al. Bootstrapping User and Item Representations for One-Class Collaborative Filtering, SIGIR'21.
SimGCLYu et al. Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for Recommendation, SIGIR'22.

Related Datasets

Data SetBasic MetaUser Context
UsersItemsRatings (Scale)DensityUsersLinks (Type)
Ciao [1]7,375105,114284,086[1, 5]0.0365%7,375111,781Trust
Epinions [2]40,163139,738664,824[1, 5]0.0118%49,289487,183Trust
Douban [3]2,84839,586894,887[1, 5]0.794%2,84835,770Trust
LastFM [4]1,89217,63292,834implicit0.27%1,89225,434Trust
Yelp [5]19,53921,266450,884implicit0.11%19,539864,157Trust
Amazon-Book [6]52,46391,5992,984,108implicit0.11%---

Reference

[1]. Tang, J., Gao, H., Liu, H.: mtrust:discerning multi-faceted trust in a connected world. In: International Conference on Web Search and Web Data Mining, WSDM 2012, Seattle, Wa, Usa, February. pp. 93–102 (2012)

[2]. Massa, P., Avesani, P.: Trust-aware recommender systems. In: Proceedings of the 2007 ACM conference on Recommender systems. pp. 17–24. ACM (2007)

[3]. G. Zhao, X. Qian, and X. Xie, “User-service rating prediction by exploring social users’ rating behaviors,” IEEE Transactions on Multimedia, vol. 18, no. 3, pp. 496–506, 2016.

[4]. Iván Cantador, Peter Brusilovsky, and Tsvi Kuflik. 2011. 2nd Workshop on Information Heterogeneity and Fusion in Recom- mender Systems (HetRec 2011). In Proceedings of the 5th ACM conference on Recommender systems (RecSys 2011). ACM, New York, NY, USA

[5]. Yu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.

[6]. He et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.

Acknowledgment

This project is supported by the Responsible Big Data Intelligence Lab (RBDI) at the school of ITEE, University of Queensland, and Chongqing University.

If our project is helpful to you, please cite one of these papers.

@inproceedings{yu2021socially,
title={Socially-aware self-supervised tri-training for recommendation},
author={Yu, Junliang and Yin, Hongzhi and Gao, Min and Xia, Xin and Zhang, Xiangliang and Viet Hung, Nguyen Quoc},
booktitle={Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining},
pages={2084--2092},
year={2021}
}

@inproceedings{yu2021self,
title={Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation},
author={Yu, Junliang and Yin, Hongzhi and Li, Jundong and Wang, Qinyong and Hung, Nguyen Quoc Viet and Zhang, Xiangliang},
booktitle={Proceedings of the Web Conference 2021},
pages={413--424},
year={2021}
}

About

QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

Topics

Resources

Stars

1.6k stars

Watchers

65 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); GitHub - Coder-Yu/QRec: QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based) · GitHub
Skip to content

Repository files navigation

logo

GitHub last commit

Introduction

QRec is a Python framework for recommender systems (Supported by Python 3.7.4 and Tensorflow 1.14+) in which a number of influential and newly state-of-the-art recommendation models are implemented. QRec has a lightweight architecture and provides user-friendly interfaces. It can facilitate model implementation and evaluation.
Founder and principal contributor: @Coder-Yu
Other contributors: @DouTong@Niki666@HuXiLiFeng@BigPowerZ@flyxu
Supported by: @AIhongzhi (A/Prof. Hongzhi Yin, UQ), @mingaoo (A/Prof. Min Gao, CQU)

We also provide Pytorch implementations of some models in another library. Please click here

What's New

31/03/2022 - SimGCL proposed in our SIGIR'22 paper has been added.
12/10/2021 - BUIR proposed in SIGIR'21 paper has been added.
30/07/2021 - We have transplanted QRec from py2 to py3.
07/06/2021 - SEPT proposed in our KDD'21 paper has been added.
16/05/2021 - SGL proposed in SIGIR'21 paper has been added.
16/01/2021 - MHCN proposed in our WWW'21 paper has been added.
22/09/2020 - DiffNet proposed in SIGIR'19 has been added.
19/09/2020 - DHCF proposed in KDD'20 has been added.
29/07/2020 - ESRF proposed in my TKDE paper has been added.
23/07/2020 - LightGCN proposed in SIGIR'20 has been added.
17/09/2019 - NGCF proposed in SIGIR'19 has been added.
13/08/2019 - RSGAN proposed in ICDM'19 has been added.
09/08/2019 - Our paper is accepted as full research paper by ICDM'19.
20/02/2019 - IRGAN proposed in SIGIR'17 has been added.
12/02/2019 - CFGAN proposed in CIKM'18 has been added.

Architecture

QRec Architecture

Workflow

QRec Architecture

Features

  • Cross-platform: QRec can be easily deployed and executed in any platforms, including MS Windows, Linux and Mac OS.
  • Fast execution: QRec is based on Numpy, Tensorflow and some lightweight structures, which make it run fast.
  • Easy configuration: QRec configs recommenders with a configuration file and provides multiple evaluation protocols.
  • Easy expansion: QRec provides a set of well-designed recommendation interfaces by which new algorithms can be easily implemented.

Requirements

  • gensim==4.1.2
  • joblib==1.1.0
  • mkl==2022.0.0
  • mkl_service==2.4.0
  • networkx==2.6.2
  • numba==0.53.1
  • numpy==1.20.3
  • scipy==1.6.2
  • tensorflow==1.14.0

Usage

There are two ways to run the recommendation models in QRec:

  • 1.Configure the xx.conf file in the directory named config. (xx is the name of the model you want to run)
  • 2.Run main.py.

Or

  • Follow the codes in snippet.py.

For more details, we refer you to the handbook of QRec.

Configuration

Essential Options

EntryExampleDescription
ratingsD:/MovieLens/100K.txtSet the file path of the dataset. Format: each row separated by empty, tab or comma symbol.
socialD:/MovieLens/trusts.txtSet the file path of the social dataset. Format: each row separated by empty, tab or comma symbol.
ratings.setup-columns 0 1 2-columns: (user, item, rating) columns of rating data are used.
social.setup-columns 0 1 2-columns: (trustor, trustee, weight) columns of social data are used.
mode.nameUserKNNname of the recommendation model.
evaluation.setup-testSet ./dataset/test.txt Main option: -testSet, -ap, -cv (choose one of them)
-testSet path/to/test/file (need to specify the test set manually)
-ap ratio (ap means that the ratings are automatically partitioned into training set and test set, the number is the ratio of the test set. e.g. -ap 0.2)
-cv k (-cv means cross validation, k is the number of the fold. e.g. -cv 5)
-predict path/to/user list/file (predict for a given list of users without evaluation; need to mannually specify the user list file (each line presents a user))
Secondary option:-b, -p, -cold, -tf, -val (multiple choices)
-val ratio (model test would be conducted on the validation set which is generated by randomly sampling the training dataset with the given ratio.)
-b thres (binarizing the rating values. Ratings equal or greater than thres will be changed into 1, and ratings lower than thres will be left out. e.g. -b 3.0)
-p (if this option is added, the cross validation wll be executed parallelly, otherwise executed one by one)
-tf (model training will be conducted on TensorFlow (only applicable and needed for shallow models))
-cold thres (evaluation on cold-start users; users in the training set with rated items more than thres will be removed from the test set)
item.rankingoff -topN -1 Main option: whether to do item ranking
-topN N1,N2,N3...: the length of the recommendation list. *QRec can generate multiple evaluation results for different N at the same time
output.setupon -dir ./Results/Main option: whether to output recommendation results
-dir path: the directory path of output results.

Memory-based Options

similaritypcc/cosSet the similarity method to use. Options: PCC, COS;
num.neighbors30Set the number of neighbors used for KNN-based algorithms such as UserKNN, ItemKNN.

Model-based Options

num.factors5/10/20/numberSet the number of latent factors
num.max.epoch100/200/numberSet the maximum number of epoch for iterative recommendation algorithms.
learnRate-init 0.01 -max 1-init initial learning rate for iterative recommendation algorithms;
-max: maximum learning rate (default 1);
reg.lambda-u 0.05 -i 0.05 -b 0.1 -s 0.1 -u: user regularizaiton; -i: item regularization; -b: bias regularizaiton; -s: social regularization

Implement Your Model

  • 1.Make your new algorithm generalize the proper base class.
  • 2.Reimplement some of the following functions as needed.
- readConfiguration()
- printAlgorConfig()
- initModel()
- trainModel()
- saveModel()
- loadModel()
- predictForRanking()
- predict()

For more details, we refer you to the handbook of QRec.

Implemented Algorithms

Rating predictionPaper
SlopeOneLemire and Maclachlan, Slope One Predictors for Online Rating-Based Collaborative Filtering, SDM'05.
PMFSalakhutdinov and Mnih, Probabilistic Matrix Factorization, NIPS'08.
SoRecMa et al., SoRec: Social Recommendation Using Probabilistic Matrix Factorization, SIGIR'08.
SVD++Koren, Factorization meets the neighborhood: a multifaceted collaborative filtering model, SIGKDD'08.
RSTEMa et al., Learning to Recommend with Social Trust Ensemble, SIGIR'09.
SVDY. Koren, Collaborative Filtering with Temporal Dynamics, SIGKDD'09.
SocialMFJamali and Ester, A Matrix Factorization Technique with Trust Propagation for Recommendation in Social Networks, RecSys'10.
EEKhoshneshin et al., Collaborative Filtering via Euclidean Embedding, RecSys'10.
SoRegMa et al., Recommender systems with social regularization, WSDM'11.
LOCABALTang, Jiliang, et al. Exploiting local and global social context for recommendation, AAAI'13.
SREELi et al., Social Recommendation Using Euclidean embedding, IJCNN'17.
CUNE-MFZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17.

Item RankingPaper
BPRRendle et al., BPR: Bayesian Personalized Ranking from Implicit Feedback, UAI'09.
WRMFYifan Hu et al.Collaborative Filtering for Implicit Feedback Datasets, KDD'09.
SBPRZhao et al., Leveraing Social Connections to Improve Personalized Ranking for Collaborative Filtering, CIKM'14
ExpoMFLiang et al., Modeling User Exposure in Recommendation, WWW''16.
CoFactorLiang et al., Factorization Meets the Item Embedding: Regularizing Matrix Factorization with Item Co-occurrence, RecSys'16.
TBPRWang et al. Social Recommendation with Strong and Weak Ties, CIKM'16'.
CDAEWu et al., Collaborative Denoising Auto-Encoders for Top-N Recommender Systems, WSDM'16'.
DMFXue et al., Deep Matrix Factorization Models for Recommender Systems, IJCAI'17'.
NeuMFHe et al. Neural Collaborative Filtering, WWW'17.
CUNE-BPRZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM'17'.
IRGANWang et al., IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval Models, SIGIR'17'.
SERecWang et al., Collaborative Filtering with Social Exposure: A Modular Approach to Social Recommendation, AAAI'18'.
APRHe et al., Adversarial Personalized Ranking for Recommendation, SIGIR'18'.
IF-BPRYu et al. Adaptive Implicit Friends Identification over Heterogeneous Network for Social Recommendation, CIKM'18'.
CFGANChae et al. CFGAN: A Generic Collaborative Filtering Framework based on Generative Adversarial Networks, CIKM'18.
NGCFWang et al. Neural Graph Collaborative Filtering, SIGIR'19'.
DiffNetWu et al. A Neural Influence Diffusion Model for Social Recommendation, SIGIR'19'.
RSGANYu et al. Generating Reliable Friends via Adversarial Learning to Improve Social Recommendation, ICDM'19'.
LightGCNHe et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.
DHCFJi et al. Dual Channel Hypergraph Collaborative Filtering, KDD'20.
ESRFYu et al. Enhancing Social Recommendation with Adversarial Graph Convlutional Networks, TKDE'20.
MHCNYu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.
SGLWu et al. Self-supervised Graph Learning for Recommendation, SIGIR'21.
SEPTYu et al. Socially-Aware Self-supervised Tri-Training for Recommendation, KDD'21.
BUIRLee et al. Bootstrapping User and Item Representations for One-Class Collaborative Filtering, SIGIR'21.
SimGCLYu et al. Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for Recommendation, SIGIR'22.

Related Datasets

Data SetBasic MetaUser Context
UsersItemsRatings (Scale)DensityUsersLinks (Type)
Ciao [1]7,375105,114284,086[1, 5]0.0365%7,375111,781Trust
Epinions [2]40,163139,738664,824[1, 5]0.0118%49,289487,183Trust
Douban [3]2,84839,586894,887[1, 5]0.794%2,84835,770Trust
LastFM [4]1,89217,63292,834implicit0.27%1,89225,434Trust
Yelp [5]19,53921,266450,884implicit0.11%19,539864,157Trust
Amazon-Book [6]52,46391,5992,984,108implicit0.11%---

Reference

[1]. Tang, J., Gao, H., Liu, H.: mtrust:discerning multi-faceted trust in a connected world. In: International Conference on Web Search and Web Data Mining, WSDM 2012, Seattle, Wa, Usa, February. pp. 93–102 (2012)

[2]. Massa, P., Avesani, P.: Trust-aware recommender systems. In: Proceedings of the 2007 ACM conference on Recommender systems. pp. 17–24. ACM (2007)

[3]. G. Zhao, X. Qian, and X. Xie, “User-service rating prediction by exploring social users’ rating behaviors,” IEEE Transactions on Multimedia, vol. 18, no. 3, pp. 496–506, 2016.

[4]. Iván Cantador, Peter Brusilovsky, and Tsvi Kuflik. 2011. 2nd Workshop on Information Heterogeneity and Fusion in Recom- mender Systems (HetRec 2011). In Proceedings of the 5th ACM conference on Recommender systems (RecSys 2011). ACM, New York, NY, USA

[5]. Yu et al. Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation, WWW'21.

[6]. He et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, SIGIR'20.

Acknowledgment

This project is supported by the Responsible Big Data Intelligence Lab (RBDI) at the school of ITEE, University of Queensland, and Chongqing University.

If our project is helpful to you, please cite one of these papers.

@inproceedings{yu2021socially,
title={Socially-aware self-supervised tri-training for recommendation},
author={Yu, Junliang and Yin, Hongzhi and Gao, Min and Xia, Xin and Zhang, Xiangliang and Viet Hung, Nguyen Quoc},
booktitle={Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining},
pages={2084--2092},
year={2021}
}

@inproceedings{yu2021self,
title={Self-Supervised Multi-Channel Hypergraph Convolutional Network for Social Recommendation},
author={Yu, Junliang and Yin, Hongzhi and Li, Jundong and Wang, Qinyong and Hung, Nguyen Quoc Viet and Zhang, Xiangliang},
booktitle={Proceedings of the Web Conference 2021},
pages={413--424},
year={2021}
}

About

QRec: A Python Framework for quick implementation of recommender systems (TensorFlow Based)

Topics

Resources

Stars

1.6k stars

Watchers

65 watching

Forks

Releases

Packages

Used by

Contributors

Languages