Skip to content

amazon-science/PIAVAE

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.txt is used for helping to read train.csv and it is optional.
  • train.csv contains the training data.
  • validation_tr.csv is used as input for the model in validation stage.
  • validation_te.csv is used for testing the model output in validation stage.
  • test_tr.csv, test_te.csv are the same as validation_tr.csv, validation_te.csv but 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
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

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages