amazon-science/PIAVAE
Python
Captured source
source ↗amazon-science/PIAVAE
Language: Python
License: NOASSERTION
Stars: 4
Forks: 1
Open issues: 7
Created: 2025-10-15T03:38:24Z
Pushed: 2026-02-11T16:04:02Z
Default branch: main
Fork: no
Archived: no
README:
ON THE MECHANISMS OF COLLABORATIVE LEARNING IN VAE RECOMMENDERS
This repository contains code to reproduce the experiments in the paper "ON THE MECHANISMS OF COLLABORATIVE LEARNING IN VAE RECOMMENDERS": arXiv.
Datasets and preprocessing
After downloading the datasets:
- Place them in a suitable location, e.g.,
/your_root_directory/data.
- Rename the unzipped folders as needed. For example, the code expects the MovieLens data in
/your_root_directory/data/ml-20m.
Preparing Input Data
- MovieLens 20m
python -m utils.movieLens -root /your_root_directory
- Netflix
python -m utils.netflix -root /your_root_directory
- Million Song
python -m utils.MSD -root /your_root_directory
This will generate the following files:
unique_sid.txtis used for helping to readtrain.csvand it is optional.train.csvcontains the training data.validation_tr.csvis used as input for the model in validation stage.validation_te.csvis used for testing the model output in validation stage.test_tr.csv,test_te.csvare the same asvalidation_tr.csv,validation_te.csvbut used in testing stage.
Train
To train the model, run:
python -m train -root /your_root_directory -dataset ml-20m -lambda_alignment 8 -lambda_scale 1.2
The best-val model obtained in training will be saved by default at /your_root_directory/checkpoint/model_name.pt.
Model type
-model_type shallow-model_type rec-model_type hierachical_gated
Prior type
-prior_type normal-prior_type composition-prior_type vamp
Personalized Item Alignment (Default Settings)
-lambda_alignment 8-rho 5-lambda_scale 1.2
To disable Personalized Item Alignment, set: -lambda_alignment 0
Examples
Multi-VAE
python -m train -dataset ml-20m -lambda_alignment 8 -lambda_scale 1.2 python -m train -dataset MSD -lambda_alignment 8 -lambda_scale 1.2 python -m train -dataset netflix -lambda_alignment 8 -lambda_scale 1.2
RecVAE with Full Settings: Alternative training, composition prior, and adaptive beta (RecVAE repository):
python -m train -dataset ml-20m -lambda_alignment 8 -lambda_scale 1.2 -model_type rec -lambda_alignment -prior_type composition
RecVAE Architecture Only: Reduced training time with rec architecture-only implementation:
python -m train -dataset MSD -lambda_alignment 8 -lambda_scale 1.2 -model_type rec python -m train -dataset netflix -lambda_alignment 8 -lambda_scale 1.2 -model_type rec
Hvamp (Hvamp repository):
python -m train -dataset ml-20m -prior_type vamp -model_type hierachical_gated -lambda_alignment 2 -lambda_scale 1.0
Evaluation
To evaluate a trained model e.g., /your_root_directory/checkpoint/model_name.pt:
python -m evaluation -root /your_root_directory -dataset ml-20m -model_type model -model model_name
Visualization
To visualize user representations using t-SNE:
python -m plot_tsne -root /your_root_directory -dataset ml-20m -model model_name
Notability
notability 3.0/10Low stars, routine repo