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 Downloads
Python Conda Platforms 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 numpy scipy
    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
Hybrid neural recommendation with joint deep representation learning of ratings and reviews (HRDR), paper requirements.txt hrdr_example.py
2019 Embarrassingly Shallow Autoencoders for Sparse Data (EASEᴿ), paper N/A ease_movielens.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., Journal of Machine Learning Research, 21(95):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, 25(4):50–57, 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}
    }
    
  • Multi-Modal Recommender Systems: Hands-On Exploration, Truong et al., ACM Conference on Recommender Systems, 2021.

    @inproceedings{truong2021multi,
      title={Multi-modal recommender systems: Hands-on exploration},
      author={Truong, Quoc-Tuan and Salah, Aghiles and Lauw, Hady},
      booktitle={Fifteenth ACM Conference on Recommender Systems},
      pages={834--837},
      year={2021}
    }
    

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.16.0.tar.gz (8.6 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.16.0-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

cornac-1.16.0-cp311-cp311-manylinux1_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.11

cornac-1.16.0-cp311-cp311-macosx_10_9_universal2.whl (6.4 MB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

cornac-1.16.0-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

cornac-1.16.0-cp310-cp310-manylinux1_x86_64.whl (20.6 MB view details)

Uploaded CPython 3.10

cornac-1.16.0-cp310-cp310-macosx_11_0_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

cornac-1.16.0-cp39-cp39-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.9Windows x86-64

cornac-1.16.0-cp39-cp39-manylinux1_x86_64.whl (20.7 MB view details)

Uploaded CPython 3.9

cornac-1.16.0-cp39-cp39-macosx_11_0_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

cornac-1.16.0-cp38-cp38-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.8Windows x86-64

cornac-1.16.0-cp38-cp38-manylinux1_x86_64.whl (22.2 MB view details)

Uploaded CPython 3.8

cornac-1.16.0-cp38-cp38-macosx_11_0_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.8macOS 11.0+ x86-64

File details

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

File metadata

  • Download URL: cornac-1.16.0.tar.gz
  • Upload date:
  • Size: 8.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for cornac-1.16.0.tar.gz
Algorithm Hash digest
SHA256 6c2da5e42fbd0a9c4f304bb415d5694c23c625a1bee5b892bc80d50e28634b9c
MD5 4c59d59ec21080f441f34021f68d8cc2
BLAKE2b-256 8c66f15b214e4dd291340340b3bec3c7dbd8683cf80dc66ce743bb2d9f858a63

See more details on using hashes here.

File details

Details for the file cornac-1.16.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: cornac-1.16.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for cornac-1.16.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 50bdb526c02a13d25aa94209336bb79dc250cb32d55385c490a342bec820d302
MD5 9c28c90fe57dbe7f78dbb0294c8d9463
BLAKE2b-256 e401cd26fde0229d5956ca991c6d05b34678e1606ade214cba1884083ac419e7

See more details on using hashes here.

File details

Details for the file cornac-1.16.0-cp311-cp311-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cornac-1.16.0-cp311-cp311-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0b56e1b4d7829dd850607792e78cf0b0d9b00cb3fcd57682556b328bcd40b5c0
MD5 dfa3ed9c915d5c337028e301037b6e81
BLAKE2b-256 a301e85d0f47f34ca744fd267636cb3a435491dc560855cc4ed6e1a909289a47

See more details on using hashes here.

File details

Details for the file cornac-1.16.0-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for cornac-1.16.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c7b88fd9b07106863fccbbfadfe5b8d069aa9d6c0b96b082e48b0db1661880f9
MD5 d1cd1adf4dee1ed7ea0bfac4f5a8957d
BLAKE2b-256 747f513e475303537760343c4ae157d4eef1feaad0f75000ae1db9cbf3979447

See more details on using hashes here.

File details

Details for the file cornac-1.16.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: cornac-1.16.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for cornac-1.16.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cc29f7b2d54b72ab3c4954a41c458ad88b85704ee41e3557113cc818a5e0f823
MD5 eeaf1ccd8c74bc6639a7c8d367fb8797
BLAKE2b-256 7d8427c44c379498aa3805d0814e1ffb69deeb9efc158ce52de29018e411d5eb

See more details on using hashes here.

File details

Details for the file cornac-1.16.0-cp310-cp310-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cornac-1.16.0-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6c152bb7929c898c436aa3b610f783b5c7c3f10fcace86fab289c442437203da
MD5 53bbcb94d5206d965e9d867c4682dd59
BLAKE2b-256 b114019bfdf14216ba6e70a2144ad41f7a1ec27bb0ebdf871a40fdca80decd3a

See more details on using hashes here.

File details

Details for the file cornac-1.16.0-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for cornac-1.16.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 5f8f98b2e84ae57952abd9b899c264c33baf1a0aac2f11cd1bc9101abf4ded72
MD5 6bcb0918645f16da64754dd29b06b772
BLAKE2b-256 a7832e4e5737e36d4aae67b34b2763d628a1085541498fa8902718226ae156d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cornac-1.16.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for cornac-1.16.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 dda3f0912db98bfba0688469c13e3376138370c34b84bd43c41ae17aa19ef133
MD5 5ea725b8a94239b2324d572d17e32012
BLAKE2b-256 ddb76469ebfd28a9fd4a408011fb88e332d3c36dbfadca8749ef45ac061b3d65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cornac-1.16.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 712f1a04200d59099ddff6db7ed0f124f8d9559f41d3815c00116719e1049713
MD5 1e6815c9056072ffad2f227bb326a380
BLAKE2b-256 9fbc8f06bcc9cd25cc7dd08753c5fc65028bb6043ba43c0db65f6f770cd8654a

See more details on using hashes here.

File details

Details for the file cornac-1.16.0-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for cornac-1.16.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a412d3be778462eecfd6563adf617ab8f74db02a8f971899e1d6d6fe38440765
MD5 30bfc994c6c8124f1c22a5d96a70c6d8
BLAKE2b-256 f1aab7ecd3ea1a58c9a3d9ac194e430859f7b8020bd6fca4fae7e7da645b3fa8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cornac-1.16.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for cornac-1.16.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f4806d850e08d078361f841e0458f5970060ca707e5912aad28084f3963f0939
MD5 e9a4facdba4c9f1066178ce93ee297c2
BLAKE2b-256 a2e1b6236a1fbdeefc363de9c482d4cda127e004a198c6c7d6b3c77a1f83ac2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cornac-1.16.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6ea2cc8a17a361077c1ac1314c2f7ca85f697d3da2ce15d59adf2a01f93214f3
MD5 787af5cb9813ff674b4d00720bb7cb0b
BLAKE2b-256 7b2eb165ca50a3460ec4f186f1e8a965796a47a67f9afb825b4532df6f98f49c

See more details on using hashes here.

File details

Details for the file cornac-1.16.0-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for cornac-1.16.0-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 88121283cb3955b87ca3a6b995255fc71284332343a5615b5ef11be1b946a9e6
MD5 41b04dba632c99078e9bc0b7aa7ad40e
BLAKE2b-256 1df3dd77560a88daaf9765be5b3aa19ebdb92439bd7c4161cb12fad57f05f5aa

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