lenskit.operations#
Top-level LensKit functions for recommender operations.
Functions#
|
Generate recommendations for a user or query. This calls the specified |
|
Score items with respect to a user or query. This calls the specified |
|
Predict ratings for items. This is exactly like |
Module Contents#
- lenskit.operations.recommend(pipeline, query, n=None, items=None, *, component='recommender', profiler=None)#
Generate recommendations for a user or query. This calls the specified pipeline component (the
'recommender'by default) and returns the resulting item list.- Stability:
- Full (see Stability Levels).
- Parameters:
pipeline (lenskit.pipeline.Pipeline) – The pipeline to run.
query (lenskit.data.QueryInput) – The user ID or other query data for the recommendation.
n (int | None) – The number of items to recommend.
items (lenskit.data.ItemList | lenskit.data.types.IDSequence | None) – The candidate items, or
Noneto use the pipeline’s default candidate selector.component (str) – The name of the component implementing the recommender.
profiler (lenskit.pipeline.PipelineProfiler | None) – A profiler for profiling this pipeline run.
- Returns:
The recommended items as an ordered item list.
- Return type:
- lenskit.operations.score(pipeline, query, items, *, component='scorer', profiler=None)#
Score items with respect to a user or query. This calls the specified pipeline component (the
'scorer'by default) and returns the resulting item list.- Stability:
- Full (see Stability Levels).
- Parameters:
pipeline (lenskit.pipeline.Pipeline) – The pipeline to run.
query (lenskit.data.QueryInput) – The user ID or other query data for the recommendation.
items (lenskit.data.ItemList | lenskit.data.types.IDSequence) – The candidate items, or
Noneto use the pipeline’s default candidate selector.component (str) – The name of the component implementing the scorer.
profiler (lenskit.pipeline.PipelineProfiler | None)
- Returns:
The items with scores in the
scorefield.- Return type:
- lenskit.operations.predict(pipeline, query, items, *, component='rating-predictor', profiler=None)#
Predict ratings for items. This is exactly like
score(), except it defaults to the'rating-predictor'component. In a standard pipeline, the rating predictor may have additional configuration such as fallbacks or transformations to ensure every item is scored and the scores are valid rating predictions; the scorer typically returns raw scores.- Stability:
- Full (see Stability Levels).
- Parameters:
pipeline (lenskit.pipeline.Pipeline)
query (lenskit.data.QueryInput)
items (lenskit.data.ItemList | lenskit.data.types.IDSequence)
component (str)
profiler (lenskit.pipeline.PipelineProfiler | None)
- Return type:
Exported Aliases#
- class lenskit.operations.ItemList#
Re-exported alias for
lenskit.data.ItemList.
- lenskit.operations.QueryInput#
Re-exported alias for
lenskit.data.QueryInput.
- lenskit.operations.IDSequence#
Re-exported alias for
lenskit.data.types.IDSequence.
- class lenskit.operations.Pipeline#
Re-exported alias for
lenskit.pipeline.Pipeline.
- class lenskit.operations.PipelineProfiler#
Re-exported alias for
lenskit.pipeline.PipelineProfiler.