Home

Awesome

UMPR

Implementation for the paper:

Xu, Cai, Ziyu Guan, Wei Zhao, Quanzhou Wu, Meng Yan, Long Chen, and Qiguang Miao. "Recommendation by Users' Multi-modal Preferences for Smart City Applications." IEEE Transactions on Industrial Informatics (2020).

Environments

Dataset and Word Embedding

UMPR
│
├─data
│  │
│  ├─amazonCSJ
│  │       reviews_Clothing_Shoes_and_Jewelry.json.gz
│  │       meta_Clothing_Shoes_and_Jewelry.json.gz
│  │
│  ├─music
│  │       reviews_Digital_Music.json.gz
│  │       meta_Digital_Music.json.gz
│  │
│  └─yelp
│     │    yelp_academic_dataset_review.json
│     │    photos.json
│     │
│     └─photos
│              *.jpg
│
└─embedding
           glove.6B.50d.txt
           punctuations.txt
           stopwords.txt

Running

  1. Pre-process dataset. Execute data_process.py to generate train.csv,valid.csv,test.csv,photos.json.

    python data/data_process.py --data_type amazon \
        --data_path ./data/music/reviews_Digital_Music.json.gz \
        --meta_path ./data/music/meta_Digital_Music.json.gz \
        --save_dir ./data/music \
        --train_rate 0.8
    
  2. Download photos of items. For amazon(not yelp), execute down_photos.py to download photos/*.jpg.

    python data/down_photos.py --photos_json ./data/music/photos.json
    
  3. Training Strategy (optional step)

    Click Here

  4. Train and evaluate the model. All parameters are defined in config.py.

    UMPR:

    python main.py --data_dir ./data/music
    
    python main.py --data_dir ./data/yelp --views ['food', 'inside', 'outside', 'drink']
    

    UMPR-R (only review_net work):

    python main.py --data_dir ./data/yelp --review_net_only True
    

    Test only:

    python main.py --data_dir ./data/music --test_only True \
        --model_path ./model/your_trained_model_name.pt
    
    python main.py --data_dir ./data/yelp --test_only True \
        --views ['food', 'inside', 'outside', 'drink'] \
        --model_path ./model/your_trained_model_name.pt
    

Experiment

<div align="center">
Dataset (number of reviews)MFNeulMFDeepCoNNTransNetsMPCNUMPR-RUMPR
Amazon Music small (64,706)0.9008990.822472---------1.1170170.925538
Amazon Music (836,006)0.8752240.825261---------1.1391870.955383
Amazon Clothing, Shoes and Jewelry (5,748,920)1.5125511.502135---------1.3069691.218940
Yelp (8,021,121)2.1710642.041674---------1.2824751.194455
</div> <p align="center"> <b> Table 1. Performance comparison (mean squared error) on several datasets. </b> </p>

MF: General Matrix Factorization. Details

NeuMF: Neural Collaborative Filtering. Details

DeepCoNN: Details

TransNets: Details

MPCN: Details

UMPR-R: Only review network part of UMPR.

UMPR: Our complete model.

Experiment Notebook