RecQ: 推荐系统的Python框架(基于TensorFlow)

网友投稿 647 2022-10-24

RecQ: 推荐系统的Python框架(基于TensorFlow)

RecQ: 推荐系统的Python框架(基于TensorFlow)

RecQ

Introduction

Founder: @Coder-Yu Main Contributors: @DouTong @Niki666 @HuXiLiFeng @BigPowerZ @flyxu

RecQ is a Python library for recommender systems (Python 2.7.x) in which a number of the state-of-the-art recommendation models are implemented. To run RecQ easily (no need to setup packages used in RecQ one by one), the leading open data science platform Anaconda is strongly recommended. It integrates Python interpreter, common scientific computing libraries (such as Numpy, Pandas, and Matplotlib), and package manager. All of them make it a perfect tool for data science researcher. Besides, GPU based deep models are also available (TensorFlow is required).

Latest News

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. 02/20/2019 - IRGAN proposed in SIGIR'17 has been added (tuning...) 02/12/2019 - CFGAN proposed in CIKM'18 has been added. 02/04/2019 - NeuMF proposed in WWW'17 has been added. 10/09/2018 - An Adversarial training based Model: APR has been implemented. 10/02/2018 - Two deep models: DMF CDAE have been implemented. 07/12/2018 - Algorithms supported by TensorFlow: BasicMF, PMF, SVD, EE (Implementing...)

Architecture of RecQ

Features

Cross-platform: as a Python software, RecQ can be easily deployed and executed in any platforms, including MS Windows, Linux and Mac OS.Fast execution: RecQ is based on the fast scientific computing libraries such as Numpy and some light common data structures, which make it run much faster than other libraries based on Python.Easy configuration: RecQ configs recommenders using a configuration file.Easy expansion: RecQ provides a set of well-designed recommendation interfaces by which new algorithms can be easily implemented.Data visualization: RecQ can help visualize the input dataset without running any algorithm.

How to Run it

1.Configure the **xx.conf** file in the directory named config. (xx is the name of the algorithm you want to run)2.Run the **main.py** in the project, and then input following the prompt.

How to Configure it

Essential Options

EntryExampleDescription
ratingsD:/MovieLens/100K.txtSet the path to input dataset. Format: each row separated by empty, tab or comma symbol.
socialD:/MovieLens/trusts.txtSet the path to input 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; -header: to skip the first head line when reading data
social.setup-columns 0 1 2-columns: (trustor, trustee, weight) columns of social data are used; -header: to skip the first head line when reading data
recommenderUserKNN/ItemKNN/SlopeOne/etc.Set the recommender to use.
evaluation.setup-testSet ../dataset/testset.txtMain option: -testSet, -ap, -cv
-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 test set. e.g. -ap 0.2)
-cv k (-cv means cross validation, k is the number of the fold. e.g. -cv 5)
Secondary option:-b, -p, -cold
    -b val (binarizing the rating values. Ratings equal or greater than val will be changed into 1, and ratings lower than val will be changed into 0. 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 would be conducted on TensorFlow if TensorFlow has been installed)
-cold threshold (evaluation on cold-start users, users in training set with ratings more than threshold 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. *RecQ 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.shrinkage25Set the shrinkage parameter to devalue similarity value. -1: to disable simialrity shrinkage.
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.iter100/200/numberSet the maximum number of iterations 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

How to extend it

1.Make your new algorithm generalize the proper base class.2.Rewrite some of the following functions as needed.

- readConfiguration()

- printAlgorConfig()

- initModel()

- buildModel()

- saveModel()

- loadModel()

- predict()

Algorithms Implemented

Note: We use SGD to obtain the local minimum. So, there have some differences between the original papers and the code in terms of fomula presentation. If you have problems in understanding the code, please open an issue to ask for help. We can guarantee that all the implementations are carefully reviewed and tested.

Any suggestions and criticism are welcomed. We will make efforts to improve RecQ.

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

                       
Item RankingPaper
BPRRendle et al., BPR: Bayesian Personalized Ranking from Implicit Feedback, UAI 2009.
WRMFYifan Hu et al.Collaborative Filtering for Implicit Feedback Datasets, KDD 2009.
SBPRZhao et al., Leveraing Social Connections to Improve Personalized Ranking for Collaborative Filtering, CIKM 2014
ExpoMFLiang et al., Modeling User Exposure in Recommendation, WWW 2016.
CoFactorLiang et al., Factorization Meets the Item Embedding: Regularizing Matrix Factorization with Item Co-occurrence, RecSys2016.
TBPRWang et al. Social Recommendation with Strong and Weak Ties, CIKM 2016.
CDAEWu et al., Collaborative Denoising Auto-Encoders for Top-N Recommender Systems, WSDM 2016.
DMFXue et al., Deep Matrix Factorization Models for Recommender Systems, IJCAI 2017.
NeuMFHe et al. Neural Collaborative Filtering, WWW 2017.
CUNE-BPRZhang et al., Collaborative User Network Embedding for Social Recommender Systems, SDM 2017.
IRGANWang et al., IRGAN: A Minimax Game for Unifying Generative and Discriminative Information Retrieval Models, SIGIR 2017.
SERecWang et al., Collaborative Filtering with Social Exposure: A Modular Approach to Social Recommendation, AAAI 2018.
APRHe et al., Adversarial Personalized Ranking for Recommendation, SIGIR 2018.
IF-BPRYu et al. Adaptive Implicit Friends Identification over Heterogeneous Network for Social Recommendation, CIKM 2018.
CFGANChae et al. CFGAN: A Generic Collaborative Filtering Framework based on Generative Adversarial Networks, CIKM 2018.
NGCFWang et al. Neural Graph Collaborative Filtering, SIGIR 2019.
RSGANYu et al. Generating Reliable Friends via Adversarial Learning to Improve Social Recommendation, ICDM 2019.

Category

Generic Recommenders
UserKNNItemKNNBasicMF SlopeOne SVDPMFSVD++EEBPRWRMF
ExpoMF
Social Recommenders
RSTESoRecSoRegSocialMFSBPRSREELOCABALSocialFDTBPRSERec
Network Embedding based Recommenders
CoFactorCUNE-MFCUNE-BPRIF-BPR
Deep Recommenders
APRCDAEDMFNeuMFCFGANIRGAN
Baselines
UserMeanItemMeanMostPopularRand

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

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

Thanks

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

@inproceedings{yu2018adaptive,

title={Adaptive implicit friends identification over heterogeneous network for social recommendation},

author={Yu, Junliang and Gao, Min and Li, Jundong and Yin, Hongzhi and Liu, Huan},

booktitle={Proceedings of the 27th ACM International Conference on Information and Knowledge Management},

pages={357--366},

year={2018},

organization={ACM}

}

@article{yu2019generating,

title={Generating Reliable Friends via Adversarial Training to Improve Social Recommendation},

author={Yu, Junliang and Gao, Min and Yin, Hongzhi and Li, Jundong and Gao, Chongming and Wang, Qinyong},

journal={arXiv preprint arXiv:1909.03529},

year={2019}

}

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:it is a volley+okhttp 的网络请求框架
下一篇:js实现快速排序
相关文章

 发表评论

暂时没有评论,来抢沙发吧~