Skip to main content

A Comparative Framework for Multimodal Recommender Systems

Project description

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

.github/workflows/python-package.yml CircleCI AppVeyor Codecov Docs
Release PyPI Conda Conda Recipe
Python License

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 Cython
    git clone https://github.com/PreferredAI/cornac.git
    cd cornac
    python3 setup.py install
    

Note:

Additional dependencies required by models are listed here.

Some algorithm implementations use OpenMP to support multi-threading. For Mac OS 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

Getting started: your first Cornac experiment

Flow of an Experiment in Cornac

import cornac
from cornac.eval_methods import RatioSplit
from cornac.models import MF, PMF, BPR
from cornac.metrics import MAE, RMSE, Precision, Recall, NDCG, AUC, MAP

# load the built-in MovieLens 100K and split the data based on ratio
ml_100k = cornac.datasets.movielens.load_feedback()
rs = RatioSplit(data=ml_100k, test_size=0.2, rating_threshold=4.0, seed=123)

# initialize models, here we are comparing: Biased MF, PMF, and BPR
models = [
    MF(k=10, max_iter=25, learning_rate=0.01, lambda_reg=0.02, use_bias=True, seed=123),
    PMF(k=10, max_iter=100, learning_rate=0.001, lambda_reg=0.001, seed=123),
    BPR(k=10, max_iter=200, learning_rate=0.001, lambda_reg=0.01, seed=123),
]

# define metrics to evaluate the models
metrics = [MAE(), RMSE(), Precision(k=10), Recall(k=10), NDCG(k=10), AUC(), MAP()]

# put it together in an experiment, voilà!
cornac.Experiment(eval_method=rs, models=models, metrics=metrics, user_based=True).run()

Output:

MAE RMSE AUC MAP NDCG@10 Precision@10 Recall@10 Train (s) Test (s)
MF 0.7430 0.8998 0.7445 0.0407 0.0479 0.0437 0.0352 0.13 1.57
PMF 0.7534 0.9138 0.7744 0.0491 0.0617 0.0533 0.0479 2.18 1.64
BPR N/A N/A 0.8695 0.0753 0.0975 0.0727 0.0891 3.74 1.49

For more details, please take a look at our examples as well as tutorials. For learning purposes, this list of tutorials on recommender systems will be more organized and comprehensive.

Models

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

Year Model and paper Additional dependencies Examples
2021 Bilateral Variational Autoencoder for Collaborative Filtering (BiVAECF), paper requirements.txt PreferredAI/bi-vae
Causal Inference for Visual Debiasing in Visually-Aware Recommendation (CausalRec), paper requirements.txt causalrec_clothing.py
Explainable Recommendation with Comparative Constraints on Product Aspects (ComparER), paper N/A PreferredAI/ComparER
2020 Adversarial Training Towards Robust Multimedia Recommender System (AMR), paper requirements.txt amr_clothing.py
2018 Collaborative Context Poisson Factorization (C2PF), paper N/A c2pf_exp.py
Multi-Task Explainable Recommendation (MTER), paper N/A mter_exp.py
Neural Attention Rating Regression with Review-level Explanations (NARRE), paper requirements.txt narre_example.py
Probabilistic Collaborative Representation Learning (PCRL), paper requirements.txt pcrl_exp.py
Variational Autoencoder for Collaborative Filtering (VAECF), paper requirements.txt vaecf_citeulike.py
2017 Collaborative Variational Autoencoder (CVAE), paper requirements.txt cvae_exp.py
Conditional Variational Autoencoder for Collaborative Filtering (CVAECF), paper requirements.txt cvaecf_filmtrust.py
Generalized Matrix Factorization (GMF), paper requirements.txt ncf_exp.py
Indexable Bayesian Personalized Ranking (IBPR), paper requirements.txt ibpr_exp.py
Matrix Co-Factorization (MCF), paper N/A mcf_office.py
Multi-Layer Perceptron (MLP), paper requirements.txt ncf_exp.py
Neural Matrix Factorization (NeuMF) / Neural Collaborative Filtering (NCF), paper requirements.txt ncf_exp.py
Online Indexable Bayesian Personalized Ranking (Online IBPR), paper requirements.txt
Visual Matrix Factorization (VMF), paper requirements.txt vmf_clothing.py
2016 Collaborative Deep Ranking (CDR), paper requirements.txt cdr_exp.py
Collaborative Ordinal Embedding (COE), paper requirements.txt
Convolutional Matrix Factorization (ConvMF), paper requirements.txt convmf_exp.py
Spherical K-means (SKM), paper N/A skm_movielens.py
Visual Bayesian Personalized Ranking (VBPR), paper requirements.txt vbpr_tradesy.py
2015 Collaborative Deep Learning (CDL), paper requirements.txt cdl_exp.py
Hierarchical Poisson Factorization (HPF), paper N/A hpf_movielens.py
2014 Explicit Factor Model (EFM), paper N/A efm_exp.py
Social Bayesian Personalized Ranking (SBPR), paper N/A sbpr_epinions.py
2013 Hidden Factors and Hidden Topics (HFT), paper N/A hft_exp.py
2012 Weighted Bayesian Personalized Ranking (WBPR), paper N/A bpr_netflix.py
2011 Collaborative Topic Regression (CTR), paper N/A ctr_citeulike.py
Earlier Baseline Only, paper N/A svd_exp.py
Bayesian Personalized Ranking (BPR), paper N/A bpr_netflix.py
Factorization Machines (FM), paper Linux only fm_example.py
Global Average (GlobalAvg), paper N/A biased_mf.py
Item K-Nearest-Neighbors (ItemKNN), paper N/A knn_movielens.py
Matrix Factorization (MF), paper N/A biased_mf.py, given_data.py
Maximum Margin Matrix Factorization (MMMF), paper N/A mmmf_exp.py
Most Popular (MostPop), paper N/A bpr_netflix.py
Non-negative Matrix Factorization (NMF), paper N/A nmf_exp.py
Probabilistic Matrix Factorization (PMF), paper N/A pmf_ratio.py
Singular Value Decomposition (SVD), paper N/A svd_exp.py
Social Recommendation using PMF (SoRec), paper N/A sorec_filmtrust.py
User K-Nearest-Neighbors (UserKNN), paper N/A knn_movielens.py
Weighted Matrix Factorization (WMF), paper requirements.txt wmf_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 papers:

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

    @article{salah2020cornac,
      title={Cornac: A Comparative Framework for Multimodal Recommender Systems},
      author={Salah, Aghiles and Truong, Quoc-Tuan and Lauw, Hady W},
      journal={Journal of Machine Learning Research},
      volume={21},
      number={95},
      pages={1--5},
      year={2020}
    }
    
  • Exploring Cross-Modality Utilization in Recommender Systems, Truong et al., IEEE Internet Computing, 2021.

    @article{truong2021exploring,
      title={Exploring Cross-Modality Utilization in Recommender Systems},
      author={Truong, Quoc-Tuan and Salah, Aghiles and Tran, Thanh-Binh and Guo, Jingyao and Lauw, Hady W},
      journal={IEEE Internet Computing},
      year={2021},
      publisher={IEEE}
    }
    

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cornac-1.13.0.tar.gz (8.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cornac-1.13.0-cp39-cp39-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.9Windows x86-64

cornac-1.13.0-cp39-cp39-manylinux1_x86_64.whl (18.7 MB view details)

Uploaded CPython 3.9

cornac-1.13.0-cp39-cp39-macosx_10_14_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.9macOS 10.14+ x86-64

cornac-1.13.0-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8Windows x86-64

cornac-1.13.0-cp38-cp38-manylinux1_x86_64.whl (20.7 MB view details)

Uploaded CPython 3.8

cornac-1.13.0-cp38-cp38-macosx_10_14_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

cornac-1.13.0-cp37-cp37m-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.7mWindows x86-64

cornac-1.13.0-cp37-cp37m-manylinux1_x86_64.whl (17.8 MB view details)

Uploaded CPython 3.7m

cornac-1.13.0-cp37-cp37m-macosx_10_14_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

cornac-1.13.0-cp36-cp36m-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.6mWindows x86-64

cornac-1.13.0-cp36-cp36m-manylinux1_x86_64.whl (17.8 MB view details)

Uploaded CPython 3.6m

cornac-1.13.0-cp36-cp36m-macosx_10_14_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

File details

Details for the file cornac-1.13.0.tar.gz.

File metadata

  • Download URL: cornac-1.13.0.tar.gz
  • Upload date:
  • Size: 8.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0.tar.gz
Algorithm Hash digest
SHA256 120254326ecc208d4193ab2940bdc6e62ff6b4112a2829e351707cae7cd76a12
MD5 e36e61b7c869e4ef8231dfd58f8a511c
BLAKE2b-256 6bf6c947f9ff67a7b7dee4c227fbc83ce26b51ea59115b7dc4a01f2b37e4d892

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2cac5f1a62c15fcaae250b0bcc5b531b0a95a1bccbf3a193d365e31e32c0914d
MD5 d5c8117d90719e3e1dde75d4d1077903
BLAKE2b-256 e6d2fb46cb74229eeabb234b88e4353802f16a2b6fc778ec188e598faa97c515

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 18.7 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a615411f81c715fbde87c0a2a4df0f0f7a9fa3e3dd862e489a915315da9a5114
MD5 db3f1f920d219b8797c0e49dcf192e9b
BLAKE2b-256 85a8d70e97641360653356a73fa320d48e682db099d6c2d54d89fcbbddf76072

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 7dc004011d783a9c507c7df8232ac888c17a124eafd9258627d9c42547e896a6
MD5 931a4b88f906a7f65517575e50884c9f
BLAKE2b-256 ac3f3e9b67b6a3d5e03b2981fbb71ad49515bfd9bb00f04110769c850b95d937

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d884c7f4844e4892b7cfaf62c676daa95ae3bae437f837a065ad2202cb3b2578
MD5 db1b12c264cf7f26c5e794fe5c013ab4
BLAKE2b-256 c7989ee950641e2dd338476c7d9fd4a92fbe08530864e00121a506a27ef2b149

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 20.7 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7e19eb78abe4cdf8cae4714a4d6dfe680bbeda17540477b84d11e6f420b8aa5d
MD5 36d9ace9fe9756ec92fcfc4f1eb4dca5
BLAKE2b-256 1b0615eb3eba299f8696a315cf5f73c695434b429bb61f2d24345b12bd28a83a

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 4.0 MB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 c9a19e5401c0474d22b8e639d91045bef17e8c073b77d2b2c0602012d45226af
MD5 c2ad7171d51a464e8120ee2a9f0eaad4
BLAKE2b-256 09f588b11a1a30f7ef87deb9073efe9ab4135fef6145c8df24f8fd0cfcd2668c

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10

File hashes

Hashes for cornac-1.13.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 a05b70dd27e43f19d98a77139a28f79a98b21dd57ab78e14ec131dbed0d552bc
MD5 932b2afded4ae28a8de511fdec704cfe
BLAKE2b-256 32d036bde3b3780207dc41aa2d97fb1246a82a47e6b20075b507228990b3165c

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 17.8 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 66b1e56bb862e524516afd9ee425959679227ab4b82e2df1fd72a7409a8276dd
MD5 d70318087d195d8100a2cc47fd08dd4f
BLAKE2b-256 90de15db873cad92c47a6059f8f7962255d721dc9842121474efc56ca26faf2b

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 55513aecf48b5d7752fe1577f0ceaf4bb789312f0ddfba7afe7e656028b9d0cb
MD5 a697833548bab563a7a4b55b31d55179
BLAKE2b-256 6dbf1f8546e38085f29955d2b3e879d9ae809f59268493605a250a6d43887757

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.13

File hashes

Hashes for cornac-1.13.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 bcaffd25e1a2424dcb1a49940d95bde0d0b1839e473e9794b2b673fce9297ef2
MD5 737984197f621534189248196f06f896
BLAKE2b-256 5d18424aefb8ab29c5012e0bc0f533f042f03f52aa3c7094b76dc78f79b89f8a

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 17.8 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ce6a6e194d993c92343f6f91506ce379ff7af6b18601d42336e7c0d066cac11c
MD5 48357fbf8f463fc206153ecc0347cde2
BLAKE2b-256 f2a007804107794aa2de14351dd5139e4214dc1984e0de5e8ed84cd29d6736f3

See more details on using hashes here.

File details

Details for the file cornac-1.13.0-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: cornac-1.13.0-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for cornac-1.13.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 1a313a07932d2cfb78c3934dfed25f22a6bc765b62595e79677f7235e289aa70
MD5 150987cb28c97f2f8efab7c9fe6ef22f
BLAKE2b-256 99b84cbf0f577fb52a9804a5eef85b8a9ca4a04a31e873751417bfd2fd43d872

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page