TopKSample: Sampler to generate N top-k lists according to p

Description Usage Arguments Details Value Note Author(s) Examples

Description

Sampler to generate N top-k lists according to p. A function wrapping to a native C implementation is available as well.

Usage

1
2

Arguments

p

Matrix of dimension n*(k+1), n is the number of items (to be ranked) and k is the top elements in the joint ranking. Each column is a multinomial probability vector.

N

The number of samples

Details

A pure R implementation TopKSample and a native C method TopKSample.c are available.

Value

N TopKlists

Note

By default the C implementation is used due to its better performance.

Author(s)

Jie Ding <jding@jimmy.harvard.edu>

Examples

1
2
3
4
5
6
7
8
set.seed(1234)
rank.pool <- 1:10
a <- sample(rank.pool, 10)
b <- sample(rank.pool, 10)
c <- sample(rank.pool, 10)
M <- cbind(a, b, c)

TopKSample.c(M, 4)

TopKLists documentation built on May 2, 2019, 4:41 p.m.