$$P@k = |rel \cap top_k| / k$$
The denominator is k itself, so a short result list is penalized.
Usage
PrecK(pred_rank, relevant, k)
Arguments
- pred_rank
Ranked item ids, best first.
- relevant
Relevant item ids.
- k
Cutoff rank.
Value
Named list with estimate, hits, k, n_relevant, method.
References
Standard IR metric; no single owning source.
Examples
PrecK(c(1, 2, 3, 4, 5), c(2, 4, 9), 3)
#> $estimate
#> [1] 0.3333333
#>
#> $hits
#> [1] 1
#>
#> $k
#> [1] 3
#>
#> $n_relevant
#> [1] 3
#>
#> $method
#> [1] "precision at k"
#>