复现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’)

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值