lenskit.basic.candidates#
Classes
|
Candidate selector that selects all known items from the training data. |
|
Base class for candidate selectors using the training data. |
|
Configuration for |
|
Candidate selector that selects all known items from the training data, optionally excluding certain items from the query (i.e., the request user's history). |
|
Candidate selector that selects all known items from the training data that do not appear in the request user's history ( |
- class lenskit.basic.candidates.TrainingCandidateSelectorBase(config=None, **kwargs)#
Bases:
Component[ItemList, …],TrainableBase class for candidate selectors using the training data.
- Stability:
- Caller (see Stability Levels).
- Parameters:
config (None)
kwargs (Any)
- items_: Vocabulary#
List of known items from the training data.
- 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.candidates.AllTrainingItemsCandidateSelector(config=None, **kwargs)#
Bases:
TrainingCandidateSelectorBaseCandidate selector that selects all known items from the training data.
Deprecated since version 2025.6: Use
TrainingItemsCandidateSelectorwithNoneforTrainingItemsCandidateConfig.excludeinstead.- Stability:
- Caller (see Stability Levels).
- Parameters:
config (None)
kwargs (Any)
- class lenskit.basic.candidates.UnratedTrainingItemsCandidateSelector(config=None, **kwargs)#
Bases:
TrainingCandidateSelectorBaseCandidate selector that selects all known items from the training data that do not appear in the request user’s history (
RecQuery.history_items). If no item history is available, then all training items are returned.In order to look up the user’s history in the training data, this needs to be combined with a component like
UserTrainingHistoryLookup.Deprecated since version 2025.6: Use
TrainingItemsCandidateSelectorwith default settings or the"history"option forTrainingItemsCandidateConfig.excludeinstead.- Stability:
- Caller (see Stability Levels).
- Parameters:
config (None)
kwargs (Any)
- class lenskit.basic.candidates.TrainingItemsCandidateConfig(exclude='query')#
Bases:
objectConfiguration for
TrainingItemsCandidateSelector.- Parameters:
exclude (None | Literal['query', 'all', 'history', 'session', 'context'] | ~collections.abc.Sequence[~typing.Literal['history', 'session', 'context']])
- exclude: None | Literal['query', 'all', 'history', 'session', 'context'] | Sequence[Literal['history', 'session', 'context']] = 'query'#
Specify the items from the query to exclude from the candidates.
NoneExclude no items from the request.
"query"Excludes the query items (
RecQuery.query_items) from the request. This is the default."all"Exclude all mentioned items from the request.
"history","session","context"Exclude the specified items from the request.
- class lenskit.basic.candidates.TrainingItemsCandidateSelector(config=None, **kwargs)#
Bases:
TrainingCandidateSelectorBaseCandidate selector that selects all known items from the training data, optionally excluding certain items from the query (i.e., the request user’s history).
In order to look up the user’s history in the training data, this needs to be combined with a component like
UserTrainingHistoryLookup.- Stability:
- Caller (see Stability Levels).
- Parameters:
config (TrainingItemsCandidateConfig)
kwargs (Any)