lenskit.basic.popularity#
Classes
|
Configuration for popularity scoring. |
|
Score items by their popularity. |
|
|
|
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:
config (PopConfig)
kwargs (Any)
- 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:
data (Dataset) – The training dataset.
options (TrainingOptions) – The training options.
- class lenskit.basic.popularity.TimeBoundedPopConfig(*, score='quantile', cutoff)#
Bases:
PopConfig
- 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:
config (TimeBoundedPopConfig)
kwargs (Any)
- item_scores_#
Time-bounded item popularity scores.
- Type:
- train(data, options=TrainingOptions(retrain=True, device=None, rng=None))#
Train the model to learn its parameters from a training dataset.
- Parameters:
data (Dataset) – The training dataset.
options (TrainingOptions) – The training options.