Cornac:推荐系统实验框架库

网友投稿 779 2022-10-22

Cornac:推荐系统实验框架库

Cornac:推荐系统实验框架库

Cornac

Cornac is a comparative framework for multimodal recommender systems. It focuses on making it convenient to work with models leveraging auxiliary data (e.g., item descriptive text and image, social network, etc). Cornac enables fast experiments and straightforward implementations of new models. It is highly compatible with existing machine learning libraries (e.g., TensorFlow, PyTorch).

Quick Links

Website | Documentation | Tutorials | Examples | Models | Datasets | Paper | Preferred.AI

Installation

Currently, we are supporting python 3. There are several ways to install Cornac:

From PyPI (you may need a C++ compiler):

pip3 install cornac

From Anaconda:

conda install cornac -c conda-forge

From the GitHub source (for latest updates):

pip3 install Cythongit clone https://github.com/PreferredAI/cornac.gitcd cornacpython3 setup.py install

Note:

Additional dependencies required by models are listed here.

Some algorithm implementations use OpenMP to support multi-threading. For OSX users, in order to run those algorithms efficiently, you might need to install gcc from Homebrew to have an OpenMP compiler:

brew install gcc | brew link gcc

If you want to utilize your GPUs, you might consider:

TensorFlow installation instructions.PyTorch installation instructions.cuDNN (for Nvidia GPUs).

Getting started: your first Cornac experiment

Flow of an Experiment in Cornac

Load the built-in MovieLens 100K dataset (will be downloaded if not cached):

import cornacml_100k = cornac.datasets.movielens.load_feedback(variant="100K")

Split the data based on ratio:

rs = cornac.eval_methods.RatioSplit(data=ml_100k, test_size=0.2, rating_threshold=4.0, seed=123)

Here we are comparing Biased MF, PMF, and BPR:

mf = cornac.models.MF(k=10, max_iter=25, learning_rate=0.01, lambda_reg=0.02, use_bias=True, seed=123)pmf = cornac.models.PMF(k=10, max_iter=100, learning_rate=0.001, lambda_reg=0.001, seed=123)bpr = cornac.models.BPR(k=10, max_iter=200, learning_rate=0.001, lambda_reg=0.01, seed=123)

Define metrics used to evaluate the models:

mae = cornac.metrics.MAE()rmse = cornac.metrics.RMSE()prec = cornac.metrics.Precision(k=10)recall = cornac.metrics.Recall(k=10)ndcg = cornac.metrics.NDCG(k=10)auc = cornac.metrics.AUC()mAP = cornac.metrics.MAP()

Put everything together into an experiment and run it:

cornac.Experiment( eval_method=rs, models=[mf, pmf, bpr], metrics=[mae, rmse, recall, ndcg, auc, mAP], user_based=True).run()

Output:

MAERMSEAUCMAPNDCG@10Precision@10Recall@10Train (s)Test (s)
MF0.74300.89980.74450.04070.04790.04370.03520.131.57
PMF0.75340.91380.77440.04910.06170.05330.04792.181.64
BPRN/AN/A0.86950.07530.09750.07270.08913.741.49

For more details, please take a look at our examples as well as tutorials.

Models

The recommender models supported by Cornac are listed below. Why don't you join us to lengthen the list?

YearModel and paperAdditional dependenciesExamples
2018Collaborative Context Poisson Factorization (C2PF), paperN/Ac2pf_exp.py
Multi-Task Explainable Recommendation (MTER), paperN/Amter_exp.py
Probabilistic Collaborative Representation Learning (PCRL), paperrequirements.txtpcrl_exp.py
Variational Autoencoder for Collaborative Filtering (VAECF), paperrequirements.txtvaecf_citeulike.py
2017Collaborative Variational Autoencoder (CVAE), paperrequirements.txtcvae_exp.py
Generalized Matrix Factorization (GMF), paperrequirements.txtncf_exp.py
Indexable Bayesian Personalized Ranking (IBPR), paperrequirements.txtibpr_exp.py
Matrix Co-Factorization (MCF), paperN/Amcf_office.py
Multi-Layer Perceptron (MLP), paperrequirements.txtncf_exp.py
Neural Matrix Factorization (NeuMF) / Neural Collaborative Filtering (NCF), paperrequirements.txtncf_exp.py
Online Indexable Bayesian Personalized Ranking (Online IBPR), paperrequirements.txt
Visual Matrix Factorization (VMF), paperrequirements.txtvmf_clothing.py
2016Collaborative Deep Ranking (CDR), paperrequirements.txtcdr_exp.py
Collaborative Ordinal Embedding (COE), paperrequirements.txt
Convolutional Matrix Factorization (ConvMF), paperrequirements.txtconvmf_exp.py
Spherical K-means (SKM), paperN/A
Visual Bayesian Personalized Ranking (VBPR), paperrequirements.txtvbpr_tradesy.py
2015Collaborative Deep Learning (CDL), paperrequirements.txtcdl_exp.py
Hierarchical Poisson Factorization (HPF), paperN/A
2014Explicit Factor Model (EFM), paperN/Aefm_exp.py
Social Bayesian Personalized Ranking (SBPR), paperN/Asbpr_epinions.py
2013Hidden Factors and Hidden Topics (HFT), paperN/Ahft_exp.py
2012Weighted Bayesian Personalized Ranking (WBPR), paperN/Abpr_netflix.py
2011Collaborative Topic Modeling (CTR), paperN/Actr_citeulike.py
EarlierBaseline Only, paperN/Asvd_exp.py
Bayesian Personalized Ranking (BPR), paperN/Abpr_netflix.py
Global Average (GlobalAvg), paperN/Abiased_mf.py
Item K-Nearest-Neighbors (ItemKNN), paperN/Aknn_movielens.py
Matrix Factorization (MF), paperN/Abiased_mf.py, given_data.py
Maximum Margin Matrix Factorization (MMMF), paperN/Ammmf_exp.py
Most Popular (MostPop), paperN/Abpr_netflix.py
Non-negative Matrix Factorization (NMF), paperN/Anmf_exp.py
Probabilistic Matrix Factorization (PMF), paperN/Apmf_ratio.py
Singular Value Decomposition (SVD), paperN/Asvd_exp.py
Social Recommendation using PMF (SoRec), paperN/Asorec_filmtrust.py
User K-Nearest-Neighbors (UserKNN), paperN/Aknn_movielens.py
Weighted Matrix Factorization (WMF), paperrequirements.txtwmf_exp.py

Support

Your contributions at any level of the library are welcome. If you intend to contribute, please:

Fork the Cornac repository to your own account.Make changes and create pull requests.

You can also post bug reports and feature requests in GitHub issues.

Citation

If you use Cornac in a scientific publication, we would appreciate citations to the following paper:

Cornac: A Comparative Framework for Multimodal Recommender Systems, Salah et al., JMLR 21, pp. 1-5, 2020.

Bibtex entry:

@article{cornac, author = {Aghiles Salah and Quoc-Tuan Truong and Hady W. Lauw}, title = {Cornac: A Comparative Framework for Multimodal Recommender Systems}, journal = {Journal of Machine Learning Research}, year = {2020}, volume = {21}, number = {95}, pages = {1-5}, url = {http://jmlr.org/papers/v21/19-805.html}}

License

Apache License 2.0

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

上一篇:Swift编写的EOS开源框架 - SwiftyEOS
下一篇:让Tux逃离虚拟世界
相关文章

 发表评论

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