lenskit.basic.history#

Components that look up user history from the training data.

Classes

KnownRatingConfig([interaction_class, ...])

KnownRatingScorer([config])

Score items by returning their values from the training data.

LookupConfig([interaction_class])

UserTrainingHistoryLookup([config])

Look up a user's history from the training data.

class lenskit.basic.history.LookupConfig(interaction_class: 'str | None' = None)#

Bases: object

Parameters:

interaction_class (str | None)

interaction_class: str | None = None#

The name of the interaction class to use. Leave None to use the dataset’s default interaction class.

class lenskit.basic.history.UserTrainingHistoryLookup(config=None, **kwargs)#

Bases: Component[ItemList, …], Trainable

Look up a user’s history from the training data.

Stability:
Caller (see Stability Levels).
Parameters:
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.history.KnownRatingConfig(interaction_class: 'str | None' = None, score: "Literal['rating', 'indicator'] | None" = None, source: "Literal['training', 'query']" = 'training')#

Bases: LookupConfig

Parameters:
  • interaction_class (str | None)

  • score (Literal['rating', 'indicator'] | None)

  • source (Literal['training', 'query'])

score: Literal['rating', 'indicator'] | None = None#

The field name to use to score items, or "indicator" to score with 0/1 based on presence in the training data. The default, None, uses ratings if available, and otherwise scores with ` for interacted items and leaves un-interacted items unscored.

source: Literal['training', 'query'] = 'training'#

Whether to get the known ratings from the training data or from the query.

class lenskit.basic.history.KnownRatingScorer(config=None, **kwargs)#

Bases: Component[ItemList, …], Trainable

Score items by returning their values from the training data.

Stability:
Caller (see Stability Levels).
Parameters:
train(data, options=TrainingOptions(retrain=True, device=None, rng=None))#

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

Parameters: