MAP@k
Geethi2020 opened this issue · comments
Geethi2020 commented
Hi,
Would you please clarify if the code in the book for MAP@k (page 63 in kindle version) needs to add square-bracket for y_true[i] and y_pred[i] ? I was getting error "'int' is not subscriptable' while trying it out.
def mapk(y_true, y_pred, k):
apk_values = []
for i in range(len(y_true)):
apk_values.append(
apk([y_true[i]], [y_pred[i]], k=k)
)
return (sum(apk_values) / len(apk_values)
And, when I use the same y_true and y_pred examples mentioned in page 64, I am getting error "unhashable type 'list'". Would you please help me understand why ? Thanks in advance.
Xhuliano Brace commented
Could you post your code that throws an error?