lenskit.basic.popularity.PopScorer#

class lenskit.basic.popularity.PopScorer(config=None, **kwargs)#

Bases: lenskit.pipeline.Component[lenskit.data.ItemList], lenskit.training.Trainable

Score items by their popularity. Use with TopN to get a most-popular-items recommender.

Stability:
Caller (see Stability Levels).
Parameters:
  • config (object | None)

  • kwargs (Any)

config: PopConfig#

The component configuration object. Component classes that support configuration must redefine this attribute with their specific configuration class type, which can be a Python dataclass or a Pydantic model class.

items: lenskit.data.Vocabulary#

Vocabulary of known items at training time.

item_scores: numpy.ndarray[tuple[int], numpy.dtype[numpy.float32]]#

Array of per-item popularity scores.

is_trained()#

Query if this component has already been trained.

train(data, options=TrainingOptions())#

Train the model to learn its parameters from a training dataset.

Parameters:
__call__(items)#

Run the pipeline’s operation and produce a result. This is the key method for components to implement.

Parameters:

items (lenskit.data.ItemList)

Return type:

lenskit.data.ItemList