lenskit.basic.topn#

Basic Top-N ranking.

Classes

TopNRanker([n])

Rank scored items by their score and take the top N.

class lenskit.basic.topn.TopNRanker(n=-1)#

Bases: Component

Rank scored items by their score and take the top N. The ranking length can be passed either at runtime or at component instantiation time, with the latter taking precedence.

Parameters:

n (int) – The desired ranking length. If negative, then scored items are ranked but the ranking is not truncated.