• Stars
    star
    874
  • Rank 52,219 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Comparative Framework for Multimodal Recommender Systems

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

More Repositories

1

tutorials

A tutorial series by Preferred.AI
Jupyter Notebook
166
star
2

vista-net

Code for the paper "VistaNet: Visual Aspect Attention Network for Multimodal Sentiment Analysis", AAAI'19
Python
92
star
3

venom

Your preferred open source focused crawler for the deep web.
Java
72
star
4

vs-cnn

Code for the paper "Visual Sentiment Analysis for Review Images with Item-Oriented and User-Oriented CNN", ACM MM'17
Python
45
star
5

bi-vae

Code for the paper "Bilateral Variational Autoencoder for Collaborative Filtering", WSDM'21
Python
34
star
6

beacon

The implementation of "Correlation-Sensitive Next-Basket Recommendation"", published in IJCAI'19
Python
31
star
7

mrg

Code for the paper "Multimodal Review Generation for Recommender Systems", WWW'19
Python
28
star
8

cerebro

Your personalized retrieval engine
Java
27
star
9

recommendation-retrieval

A tutorial on scalable retrieval of matrix factorization recommendations
Jupyter Notebook
26
star
10

cornac-ab

Recommendation A/B Testing Integration with Cornac
Vue
15
star
11

compare-lda

A Topic Model for Document Comparison
Go
13
star
12

venom-tutorial

A tutorial based on your preferred open source focused crawler for the deep web.
Java
13
star
13

cbs

Modeling Contemporaneous Basket Sequences with Twin Networks for Next-Item Recommendation
Python
12
star
14

mp-simrank

This repository provides a Matlab implementation of MP-SimRank, a graph-based framework that models multiple perspective of similarity in the data
C
11
star
15

core-technologies

Core technologies developed by Preferred.AI
9
star
16

seer

Code of the paper "Synthesizing Aspect-Driven Recommendation Explanations from Reviews", IJCAI'20
Python
9
star
17

venom-examples

A basic web crawler example
Java
9
star
18

csvpl

CSV Processing Language
Java
7
star
19

helm-charts

Preferred.AI Helm Chart Repository
Mustache
6
star
20

adjacent-encoder

Source code of the AAAI-2020 paper "Topic Modeling on Document Networks with Adjacent-Encoder"
Python
6
star
21

plrmm

Plackett-Luce Regression Mixture Model
Python
5
star
22

ReIntNTM

ReIntNTM: A Tool for extracting better topics from neural topic models
Jupyter Notebook
4
star
23

sml

Code for the paper "Sentiment-Oriented Metric Learning for Text-to-Image Retrieval", ECIR'21
Python
3
star
24

topic-metrics

Your preferred tool for meddling with topics
Jupyter Notebook
3
star
25

HypAR

Code of the paper "Hypergraphs with Attention on Reviews for Explainable Recommendation", ECIR'24
Python
3
star
26

sequentialign

Code for the AIED-2022 Paper "Towards Aligning Slides and Video Snippets: Mitigating Sequence and Content Mismatches"
Python
2
star
27

cerebro-tutorial

A tutorial based on Cerebro
Java
2
star
28

ComparER

Code of the paper "Explainable Recommendation with Comparative Constraints on Product Aspects", WSDM'21
Python
2
star
29

superposed-topics

Jupyter Notebook
1
star