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

Include recall computation #66

Open
johnarevalo opened this issue Sep 13, 2024 · 0 comments
Open

Include recall computation #66

johnarevalo opened this issue Sep 13, 2024 · 0 comments

Comments

@johnarevalo
Copy link
Member

@shntnu as per our discussion.

An starting point could be this function:

def average_precision(rel_k) -> np.ndarray:
"""Compute average precision based on binary list sorted by relevance"""
tp = np.cumsum(rel_k, axis=1)
num_pos = tp[:, -1]
k = np.arange(1, rel_k.shape[1] + 1)
pr_k = tp / k
ap = (pr_k * rel_k).sum(axis=1) / num_pos
return ap

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

1 participant