lenskit.basic.topn.TopNRanker ============================= .. py:class:: lenskit.basic.topn.TopNRanker(config = None, **kwargs) Bases: :py:obj:`lenskit.pipeline.components.Component`\ [\ :py:obj:`lenskit.data.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 .. py:attribute:: config :type: TopNConfig Configuration object. .. py:method:: __call__(*, items, n = None) Rank the items. :param items: The items to rank, with scores. Items with missing scores are not included in the final ranking. :param n: The number of items to return, or -1 to return all scored items. If ``None``, the length configured at construction time is used. :returns: An ordered list of items, with scores and all other attributes preserved.