lenskit.basic.topn#

Basic Top-N ranking.

Classes

TopNConfig(*[, n])

Configuration for top-N ranking.

TopNRanker([config])

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

class lenskit.basic.topn.TopNConfig(*, n=None)#

Bases: BaseModel

Configuration for top-N ranking.

Parameters:

n (int | None)

n: int | None#

The number of items to return. -1 or None to return all scored items.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class lenskit.basic.topn.TopNRanker(config=None, **kwargs)#

Bases: Component[ItemList, …]

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.

Stability:
Caller (see Stability Levels).
Parameters: