lenskit.basic.popularity#

Classes

PopConfig(*[, score])

Configuration for popularity scoring.

PopScorer([config])

Score items by their popularity.

TimeBoundedPopConfig(*[, score])

TimeBoundedPopScore([config])

Score items by their time-bounded popularity, i.e., the popularity in the most recent time_window period.

class lenskit.basic.popularity.PopConfig(*, score='quantile')#

Bases: BaseModel

Configuration for popularity scoring.

Parameters:

score (Literal['quantile', 'rank', 'count'])

score: Literal['quantile', 'rank', 'count']#

The method for computing popularity scores. For all methods, higher scores represent more popular items.

model_config: ClassVar[ConfigDict] = {}#

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

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

Bases: Component[ItemList, …], Trainable

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

Stability:
Caller (see Stability Levels).
Parameters:
item_pop_#

Item popularity scores.

train(data, options=TrainingOptions(retrain=True, device=None, rng=None))#

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

Parameters:
class lenskit.basic.popularity.TimeBoundedPopConfig(*, score='quantile', cutoff)#

Bases: PopConfig

Parameters:
cutoff: datetime#

Time window for computing popularity scores.

model_config: ClassVar[ConfigDict] = {}#

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

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

Bases: PopScorer

Score items by their time-bounded popularity, i.e., the popularity in the most recent time_window period. Use with TopN to get a most-popular-recent-items recommender.

Parameters:
item_scores_#

Time-bounded item popularity scores.

Type:

pandas.Series

train(data, options=TrainingOptions(retrain=True, device=None, rng=None))#

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

Parameters: