RUCAIBox / RecBole

A unified, comprehensive and efficient recommendation library
https://recbole.io/
MIT License
3.43k stars 613 forks source link

[🐛BUG] label数据生成 #1678

Open fkuabc opened 1 year ago

fkuabc commented 1 year ago

这什么玩意? » python run_recbole.py --model=WideDeep --dataset=ml-1m

Trainable parameters: 108574 Train 0: 0%| | 0/391 [00:00<?, ?it/s] Traceback (most recent call last): File "run_recbole.py", line 25, in run_recbole(model=args.model, dataset=args.dataset, config_file_list=config_file_list) File "/home/RecBole/recbole/quick_start/quick_start.py", line 56, in run_recbole best_valid_score, best_valid_result = trainer.fit( File "/home/RecBole/recbole/trainer/trainer.py", line 335, in fit train_loss = self._train_epoch(train_data, epoch_idx, show_progress=show_progress) File "/home/RecBole/recbole/trainer/trainer.py", line 181, in _train_epoch losses = loss_func(interaction) File "/home/RecBole/recbole/model/context_aware_recommender/widedeep.py", line 65, in calculate_loss label = interaction[self.LABEL] File "/home/RecBole/recbole/data/interaction.py", line 131, in getitem return self.interaction[index] KeyError: 'label'

我还根本没用自定义配置,就用默认设置跑了一下都能出错?

zhengbw0324 commented 1 year ago

@fkuabc 您好! 对于WideDeep这类 context-aware model,要求数据存在label,MovieLens-1m原始数据集并没有直接的label数据,需要在配置文件中设置threshold参数,根据threshold生成label。例如: https://github.com/RUCAIBox/RecBole/blob/692926f1fb4b268745402d08d11ebe59652a162f/recbole/properties/quick_start_config/context-aware_ml-100k.yaml#L1-L5 上述配置为样例数据ml-100k的配置,数据中rating大于等于4的数据label为1,否则label为0。其他数据配置信息请参考文档