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
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.15.3.tar.gz (7.9 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.15.3-cp311-cp311-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.11Windows x86-64

cornac-1.15.3-cp311-cp311-manylinux1_x86_64.whl (19.2 MB view details)

Uploaded CPython 3.11

cornac-1.15.3-cp311-cp311-macosx_10_9_universal2.whl (5.7 MB view details)

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

cornac-1.15.3-cp310-cp310-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.10Windows x86-64

cornac-1.15.3-cp310-cp310-manylinux1_x86_64.whl (18.5 MB view details)

Uploaded CPython 3.10

cornac-1.15.3-cp310-cp310-macosx_11_0_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

cornac-1.15.3-cp39-cp39-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.9Windows x86-64

cornac-1.15.3-cp39-cp39-manylinux1_x86_64.whl (18.8 MB view details)

Uploaded CPython 3.9

cornac-1.15.3-cp39-cp39-macosx_11_0_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

cornac-1.15.3-cp38-cp38-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.8Windows x86-64

cornac-1.15.3-cp38-cp38-manylinux1_x86_64.whl (20.2 MB view details)

Uploaded CPython 3.8

cornac-1.15.3-cp38-cp38-macosx_10_15_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

File details

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

File metadata

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

File hashes

Hashes for cornac-1.15.3.tar.gz
Algorithm Hash digest
SHA256 6b748629f39b40f6ad9f4cdad50010d4cd15dc204c99335b95bcf065645a84df
MD5 98e6c3505faf511f56c034245edb029c
BLAKE2b-256 47dfd281a354bdc3df4c6be0d39651cd14b8d589ebf9535330d5ec559a78d545

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cornac-1.15.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8fd0030a47838bccd13b214ec6f659ee0c47f30057fbaa5ff397956f182bd300
MD5 d4892480059fda2cf807fd6dd5b91631
BLAKE2b-256 f8cb44776d684a39e4699e8d2e6d8ab3de615332269e4aab864c69a28cc0ee18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cornac-1.15.3-cp311-cp311-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 eedfd4c767cfe75223f6dceeed70f6d31d73232dc67cc44ff54ebdfcc5932be6
MD5 d302d9f28a8a29afcd9c6a5fb3a63ee2
BLAKE2b-256 a1ac530c40040e5781352dd493009d8a662d560995d274143213e9670ace908b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cornac-1.15.3-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 bb537bb3a8b16b32b4cab2ca2d0b654752598b1f7d0ec7a129a371266187a0e8
MD5 d3a058b20f21e7a85487f10752688327
BLAKE2b-256 f055f59492781da342ee564bedbfe0d35625110ab95fec38809ea240ec85d134

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cornac-1.15.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6c7f8cb42f570a7dafe7c834fe3c4bbbf7105ce592f95a93f4468aac6e0d8b26
MD5 18ba76eabd57981676d67cf8a4417928
BLAKE2b-256 a3690b830a71586ff123ee246aeebea22863c733e68abcc626add9226607656b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cornac-1.15.3-cp310-cp310-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f2b7961b53d5617478814d008da5bfa80773a13c96bb3120e03ffc7660645f04
MD5 d904817b397f37484f040f55222cbb89
BLAKE2b-256 f1e02cebae3eea9d348943aa6005d1a005d513a832c1cec8a6dfc80a7c0df314

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cornac-1.15.3-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c33bb49b5c96f18306a1bab0de79a11136d9cf320f7d5ba39b4dd6269eba89f1
MD5 2dbaceb3da297e893b5ba769a1672e01
BLAKE2b-256 e5ff3e7b2a2abf98c35f70242e45af8e51e51de802995dcc1f3a6fc136a4b8f4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cornac-1.15.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 faf891cc3a6c486f5fa57c0677b925b17f85b0c605cea21296709bbf09efd6aa
MD5 cd1555bfbb1f01e89af49d8deb3797fd
BLAKE2b-256 25d444d2ec64ac5d75ec5080fe8c9ec2db699dbae5d082fccdd755b7b2fd0166

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cornac-1.15.3-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4f6710aab27867217cf4bf3180c1ae7c989e4cecfa2cd43c9ca7d1141ec42b56
MD5 0807c17703c8b744435f9705fdb8317b
BLAKE2b-256 e5a685a5cee829a59065a95ee8106d2e51e684d4a7e526ce069dfff3eeb6719c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cornac-1.15.3-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 5ac0f9dbdbf201934b82a83803f914a8f77a6f3d72f212479d700f3dfdcceb43
MD5 3f8691f6517c661a1b9b1afe9ffa8b60
BLAKE2b-256 67316ddf8625b67be7b54a4f369779f1129ae7ac2affc3a354cb9a873542093c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cornac-1.15.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7c1f6a4fe82e40d8f34a1f3bc9dcaf3306d975b7b6e8eda9ae7ed2085468c65c
MD5 a73e8c95d6412d8ebd4678f4cd85f4b7
BLAKE2b-256 3662ba80c6928ff69ac501de2b7dd4ce6d2dc7379077b1d35c4c6dd322203861

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cornac-1.15.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 07e72db1b3c44c39ad6a5c8d2d4426ec501d851457b7c3a9154a500d95958dee
MD5 47c60757aefc0894a4b1766b8c1c82a2
BLAKE2b-256 52c9b582407a593fa74aa3986fc94c39fc43ee51b1ba2b7b940dd380a9016ea6

See more details on using hashes here.

File details

Details for the file cornac-1.15.3-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for cornac-1.15.3-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 743e097af8052a7a3db02d95117f3307ed55c07d218e034364a9c7285ff18b0f
MD5 d6749d72ed5207f52fcbff6645f49f47
BLAKE2b-256 6059cea7f8537d74fe0957cfa9045b37d44f90f834bfb0aa1a93a6bdc1f5f414

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