Skip to content

Document the precision-at-K denominator for held-out items - #760

Open
justavibedev wants to merge 1 commit into
benfred:mainfrom
justavibedev:docs/precision-at-k-denominator
Open

justavibedev wants to merge 1 commit into
benfred:mainfrom
justavibedev:docs/precision-at-k-denominator

Conversation

@justavibedev

Copy link
Copy Markdown

Users in #412 and #713 got different precision scores from what they expected when some users had fewer than K held-out items. The API docs called the result P@K but didn’t say how the denominator was calculated.

This adds a two-user example to precision_at_k and a reference from ranking_metrics_at_k. At K=3, one hit each for users with one and three held-out items gives 2 / (1 + 3) = 0.5.

I checked the example against the released 0.7.3 wheel and compared both public functions against the documented calculation across 100 small synthetic cases, including users with no held-out items. Codex assisted with the edit and verification.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant