[🐛BUG] Not able to generate and save recommended items from FM (CARS).
See original GitHub issueThe bug I am running FM using additonal user features as contextual information.
To Reproduce Steps to reproduce the behavior:
- yaml file
# Training and evaluation config
data_path:
epochs: 50
train_batch_size: 4096
eval_batch_size: 4096
neg_sampling: ~
load_col:
inter: [user_id, item_id, rating, timestamp]
user: [user_id, gender] # age, gender, occupation, zip_code]
threshold:
rating: 3
TIME_FIELD: timestamp
eval_args:
group_by: ~
order: TO
split: {'RS': [0.8,0.1,0.1]}
mode: uni1000 # Not able to use neither labeled nor full options!
metrics: ['Recall', 'MRR', 'NDCG', 'Hit', 'Precision', 'ItemCoverage', 'GiniIndex', 'ShannonEntropy']
topk: 50
valid_metric: MRR@50
metric_decimal_place: 4
eval_step: 10
save_dataset: True
save_dataloaders: True
reproducibility: True
seed: 2020
filter_inter_by_user_or_item: True
user_inter_num_interval: [20, 1500]
- Code
from recbole.quick_start import run_recbole
from recbole.utils.case_study import full_sort_topk
config_file_list= ['test.yaml']
run_recbole(model='FM', dataset='ml-100k', config_file_list= config_file_list)
- Output results
Expected behavior I get the recommendation metrics as follow: `Evaluate : 100%|████████████████████████████████████████████████| 166/166 [00:07<00:00, 21.65it/s]
30 Dec 16:50 INFO best valid : {‘recall@50’: 0.134, ‘mrr@50’: 0.2801, ‘ndcg@50’: 0.173, ‘hit@50’: 0.7411, ‘precision@50’: 0.1366, ‘itemcoverage@50’: 0.1289, ‘giniindex@50’: 0.957, ‘shannonentropy@50’: 0.0209}
30 Dec 16:50 INFO test result: {‘recall@50’: 0.117, ‘mrr@50’: 0.2771, ‘ndcg@50’: 0.1783, ‘hit@50’: 0.6867, ‘precision@50’: 0.1475, ‘itemcoverage@50’: 0.1182, ‘giniindex@50’: 0.9555, ‘shannonentropy@50’: 0.023} `
But once I try to run case study: topk_score, topk_iid_list = full_sort_topk(uid_series, model, test_data, k=50, device=config['device'])
I get the following error:
AttributeError: 'NegSampleEvalDataLoader' object has no attribute 'is_sequential'
Looking forward to hear back from you. Thank you.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9
It can be solved by the ‘group_by’ parameter. Because the data set has a strong time dependence, it is necessary to group by user to ensure that each data set of {train,valid,test} divided by ‘TO’ has history_item.
Thank you so much. It works now 💯