Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate 时,计算 item 得分的最小计算单元是什么? #1890

Closed
KpiHang opened this issue Oct 16, 2023 · 4 comments
Closed

Evaluate 时,计算 item 得分的最小计算单元是什么? #1890

KpiHang opened this issue Oct 16, 2023 · 4 comments
Assignees

Comments

@KpiHang
Copy link

KpiHang commented Oct 16, 2023

#1878 中讨论了,
"the real eval_batch_size = eval_batch_size(that you set)// item_number,because each test case needs to be scored with all items. Each user has item_number's data" #1878 (comment)

对于这里的 eval_batch_size(that you set)// item_number 很困惑,为什么需要整除 item_number?

在本人以往的经验中,在序列推荐中,一个样本,eg(inter1,inter2...interN; next)

猜测,Evaluate 时,计算 item 得分的最小计算单元是一个item,每次只计算一个item的得分?

对此感到非常疑惑,期待与您讨论。

@zhengbw0324
Copy link
Collaborator

@KpiHang
您好!以序列推荐和全排序测试为例,每一个测试序列样本需要与所有 item 计算 score(计算item number次score),然后 item 需要根据对应 score 排序,供后续 NDCG、MRR 等根据 item 排序计算的指标使用。
也就是对于一个测试样例(一个历史序列),由于我们在进行全排序测评时需要对所有 item 排序,所以需要计算 item number 次 score。

@KpiHang
Copy link
Author

KpiHang commented Oct 19, 2023

@zhengbw0324
谢谢您的回复。

所以这个计算所有item score 的过程,并不是矩阵乘法并行计算的,而是一次一个的计算,

因此,才需要整除 item_number,不知道我这样理解是否正确?

@zhengbw0324
Copy link
Collaborator

@KpiHang
您好,最后这个score计算过程能否通过矩阵乘法计算往往取决于模型的score计算方式,如果最终通过内积计算,如SASRec,那么可以简单通过矩阵乘法计算,但如果score通过一个MLP计算,如NeuMF,那么最终score则需要进行多次forward。

另外,进行负采样测评时,由于每个测试实例的负例不同,也无法通过矩阵相乘计算。

其实eval_batch_size只是控制一下每个批次的数据量,只要根据GPU的内存调整就好。

@KpiHang
Copy link
Author

KpiHang commented Oct 19, 2023

明白,感谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants