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

MAP@k #17

Open
Geethi2020 opened this issue Sep 22, 2020 · 1 comment
Open

MAP@k #17

Geethi2020 opened this issue Sep 22, 2020 · 1 comment

Comments

@Geethi2020
Copy link

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.

@xhulianoThe1
Copy link

Could you post your code that throws an error?

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