NCL icon indicating copy to clipboard operation
NCL copied to clipboard

sparsity level analysis

Open Iwillcome opened this issue 3 years ago • 3 comments

Dear Author: Hi, RecBole is used as an integrated recomendation system framework that encapsulates the underlying operations to make rapid development possible. However, It also result in some diffcult. For me, I didn't how use the NCL code to make sparsity-level analysis due to the dataset can't change. Another issue is that how to implement the sparisty-level analysis for the quick-start code, such as BPR, LightGCN and so on. Thinks!

Iwillcome avatar Jan 08 '23 05:01 Iwillcome

Hi, thanks for your attention! For the sparsity analysis, one possible way is to temporally modify the source code of RecBole 1.0.1. In detail, in recbole/evaluator/metrics.py, you can change the function calculate_metric in class Recall as following:

issue33

g_inter_num = pos_len.sum() / 5
idx_list = [(i, _) for i, _ in enumerate(list(pos_len))]
idx_list.sort(key=lambda t: t[1])

tot = 0
tmp_list = []
gid = 0
for idx, cnt in idx_list:
    tot += cnt
    tmp_list.append(result[idx, 9])
    if tot >= g_inter_num * (gid + 1):
        gid += 1
        res = np.mean(tmp_list)
        tmp_list = []
        print(f'Recall@10-Group-{gid}: {round(res, 4)}', flush=True)

Then while evaluating the saved model, it will print the results of different sparsity groups.

hyp1231 avatar Jan 10 '23 08:01 hyp1231

Dear Author: Thanks for you response! we reproduce the result based on the code, But there still exist some problem about the result. The all item is divid to 5 group, we dcan't know how much item in every group. Anthor, we test many inditor, such as @., @., and so on. The code seem bind the firt indidtor, so how to modfiy it. Thinks!------------------ Original ------------------ @.> Date: Tue, Jan 10, 2023 04:39 PM @.>; @.@.>; Subject: Re: [RUCAIBox/NCL] sparsity level analysis (Issue #33)

Iwillcome avatar Jan 13 '23 14:01 Iwillcome

Dear Author: Thanks for you response! we reproduce the result based on the code, But there still exist some problem about the result. The all item is divid to 5 group, we dcan't know how much item in every group. Anthor, we test many inditor, such as Recall@5, Recall@20, and so on. The code seem bind the firt indidtor, so how to modfiy it. Thinks!

Iwillcome avatar Jan 13 '23 15:01 Iwillcome