复现UPC-SDG

复现Privacy-Preserving Synthetic Data Generation for Recommendation Systems的UPC-SDG遇到了一点问题

记录自己的复现流程

  1. 首先按照GitHub所说:
    (1)Create the empty folders, output and data.
    (2)Download the train data from the Amazon Review Data and SNAP Page, details setting see Dataset section
    (3)Prepare for pre-trained User/Item embedding weight from Google Ddrive and put them in ./code/embedding

  2. 数据准备好之后会出现路径问题
    在电脑上的话,要修改的代码是main.py line28
    pretrain_file_path = ‘./embedding/mf-Office-64.pth.tar’ #原’./code/embedding/mf-Office-64.pth.tar’
    还有
    \Procedure.py", line 219返回值对不上,需要:
    need_replace, replaceable_items, replaceable_items_feature, feature_loss = \
    recommend_model.computer_pos_score(unique_user, user_pos_items, mask, train_pos)
    改成
    need_replace, replaceable_items, replaceable_items_feature, similarity_loss, similarity, feature_loss = \
    recommend_model.computer_pos_score(unique_user, user_pos_items, mask, train_pos)

  3. 代码执行时
    需要先进入D:\Code\UPC-SDG-main\UPC-SDG-main\code
    然后执行代码 执行时去掉原作者的./code
    直接是
    python -u main.py --decay=1e-1 --lr=0.001 --seed=2022 --dataset=“Office” --topks=“[20]” --recdim=64 --bpr_batch=2048 --load=1 --replace_ratio=0.2 --privacy_ratio=0.1 --bpr_loss_d=1 --similarity_loss_d=3

大功告成~
不不不 想要图形化界面运行
还需要用pycharm直接到code目录 然后改parse.py line42
parser.add_argument(‘–privacy_ratio’, type=float, default=0.1,
help=‘set the ratio of user’s privacy sensitivity’)

你可能感兴趣的:(实验记录,pytorch)