This repository implements Ranking-Critical Training (RaCT) for Collaborative Filtering with additional information to improve quality of recommendation
This code is originally created from https://github.com/samlobel/RaCT_CF/ and modified to be able to use side information
The main result of this paper can be reproduced via running the scripts/main_vae.ipynb
file:
-
Install the requirements in a python3 environment
mkvirtualenv --python=python3 CRITIC_CF && pip install -r requirements.txt
-
Install Tensorflow, version range >=1.10.0,<=1.14.
-
Download the dataset you want to run with
python setup_data.py --dataset=DATASET_OF_CHOICE
Default is ml-100k, which is the smallest dataset. Other options are ml-1m
, ml-20m
, netflix-prize
and msd
. Or, run with dataset=all
to download all.
-
setup side information
python setup_side_data.py
This script is only applied to ml-100k
dataset.
-
To train a model, run one of the scripts in the
scripts
directory namedmain_*.ipynb
(see theMain Scripts
section of the Readme). These scripts were used to generate the models and data in this paper. Or, create your own by modifying the hyperparameters or models used in one of these scripts. -
The
train
method saves a model in a nested directory determined by its hyperparameters, within thecheckpoints
directory. It stores the data necessary for plotting in theplotting_data
directory, and logs to thelogging
directory. -
Passing these same hyperparameters to the
test
method as you did totrain
method will run the trained model against the held-out test data. After runningtest
, results are written to theTEST_RESULTS.txt
file, as well as to the console.
The importable code used in the training scripts is located in the ./utils
directory.
warp_utils.py
contain the logic for implementing a listwise WARP-losslambdarank_utils.py
contains the logic for implementing LambdaRankevaluation_functions.py
contains the logic for the ranking objective functionsbase_models.py
andmodels.py
contain the different models we train.training.py
contains thetrain
andtest
function used to run experiments.data_loaders.py
implements importing the downloaded files as Tensorflow Datasets.
All of the scripts used to generate data are located in the ./scripts
directory.
main_vae.ipynb
: This provides the paper's main result, by running the MultiVAE model with and without the critic, on all datasets.main_vae_with_userinfo.py
is used to generate results for MultiVAE with user-category side information.main_vae_with_userinfo2.py
is used to generate results for MultiVAE with user-item side information.