Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

recall and precision #38

Open
zbt78 opened this issue Apr 6, 2023 · 0 comments
Open

recall and precision #38

zbt78 opened this issue Apr 6, 2023 · 0 comments

Comments

@zbt78
Copy link

zbt78 commented Apr 6, 2023

def RecallPrecision_ATk(test_data, r, k): """ test_data should be a list? cause users may have different amount of pos items. shape (test_batch, k) pred_data : shape (test_batch, k) NOTE: pred_data should be pre-sorted k : top-k """ right_pred = r[:, :k].sum(1) precis_n = k recall_n = np.array([len(test_data[i]) for i in range(len(test_data))]) recall = np.sum(right_pred/recall_n) precis = np.sum(right_pred)/precis_n return {'recall': recall, 'precision': precis}

In this way, the result of recall may be greater than 1. Is there any mistakes?

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

No branches or pull requests

1 participant