lenskit.basic.history#
Components that look up user history from the training data.
Classes#
Look up a user's history from the training data. |
|
Score items by returning their values from the training data. |
Module Contents#
- class lenskit.basic.history.LookupConfig#
- class lenskit.basic.history.UserTrainingHistoryLookup(config=None, **kwargs)#
Bases:
lenskit.pipeline.Component[lenskit.data.ItemList],lenskit.training.TrainableLook up a user’s history from the training data.
- Stability:
- Caller (see Stability Levels).
- Parameters:
config (object | None)
kwargs (Any)
- config: LookupConfig#
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.
- interactions: lenskit.data.MatrixRelationshipSet | None#
- 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:
data (lenskit.data.Dataset) – The training dataset.
options (lenskit.training.TrainingOptions) – The training options.
- __call__(query)#
Look up the user’s data from the training history (if needed), and ensure a fully-populated
RecQuery.- Parameters:
query (lenskit.data.QueryInput)
- Return type:
- class lenskit.basic.history.KnownRatingConfig#
Bases:
LookupConfig- 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:
lenskit.pipeline.Component[lenskit.data.ItemList],lenskit.training.TrainableScore items by returning their values from the training data.
- Stability:
- Caller (see Stability Levels).
- Parameters:
config (object | None)
kwargs (Any)
- config: KnownRatingConfig#
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.
- interactions: lenskit.data.MatrixRelationshipSet#
- 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:
data (lenskit.data.Dataset) – The training dataset.
options (lenskit.training.TrainingOptions) – The training options.
- __call__(query, items)#
Run the pipeline’s operation and produce a result. This is the key method for components to implement.
- Parameters:
query (lenskit.data.QueryInput)
items (lenskit.data.ItemList)
- Return type:
Exported Aliases#
- class lenskit.basic.history.Dataset#
Re-exported alias for
lenskit.data.Dataset.
- class lenskit.basic.history.ItemList#
Re-exported alias for
lenskit.data.ItemList.
- class lenskit.basic.history.MatrixRelationshipSet#
Re-exported alias for
lenskit.data.MatrixRelationshipSet.
- lenskit.basic.history.QueryInput#
Re-exported alias for
lenskit.data.QueryInput.
- class lenskit.basic.history.RecQuery#
Re-exported alias for
lenskit.data.RecQuery.
- exception lenskit.basic.history.DataError#
Re-exported alias for
lenskit.diagnostics.DataError.
- lenskit.basic.history.get_logger()#
Re-exported alias for
lenskit.logging.get_logger().
- lenskit.basic.history.trace()#
Re-exported alias for
lenskit.logging.trace().
- class lenskit.basic.history.Component#
Re-exported alias for
lenskit.pipeline.Component.
- class lenskit.basic.history.Trainable#
Re-exported alias for
lenskit.training.Trainable.
- class lenskit.basic.history.TrainingOptions#
Re-exported alias for
lenskit.training.TrainingOptions.