lenskit.batch.BatchPipelineRunner#
- class lenskit.batch.BatchPipelineRunner(*, n_jobs=None, profiler=None)#
Bases:
objectApply a pipeline to a collection of test users.
- Stability:
- Caller (see Stability Levels).
- Parameters:
- Argss:
- pipeline:
The pipeline to evaluate.
- n_jobs:
The number of parallel processes to use, or
Nonefor the default (defined bylenskit.parallel.config.initialize()).
- __init__(*, n_jobs=None, profiler=None)#
Methods
__init__(*[, n_jobs, profiler])add_invocation(inv)predict([component, output])Request the batch run to generate test item rating predictions.
recommend([component, output])Request the batch run to generate recomendations.
run()Run the pipeline and return its results.
score([component, output])Request the batch run to generate test item scores.
Attributes
n_jobsprofilerinvocations- score(component='scorer', *, output='scores')#
Request the batch run to generate test item scores.
- predict(component='rating-predictor', *, output='predictions')#
Request the batch run to generate test item rating predictions. It is identical to
score()but with different defaults.
- recommend(component='recommender', *, output='recommendations', **extra)#
Request the batch run to generate recomendations.
- run(pipeline: Pipeline, queries: Iterable[RecQuery] | Iterable[tuple[RecQuery, ItemList]] | Iterable[int | str | bytes | integer[Any] | str_ | bytes_ | object_ | tuple[int | str | bytes | integer[Any] | str_ | bytes_ | object_, ...]] | ItemListCollection[tuple[int | str | bytes | integer[Any] | str_ | bytes_ | object_, ...]] | Mapping[int | str | bytes | integer[Any] | str_ | bytes_ | object_, ItemList] | DataFrame) BatchResults#
- run(pipeline: Pipeline, *, test_data: Iterable[int | str | bytes | integer[Any] | str_ | bytes_ | object_ | tuple[int | str | bytes | integer[Any] | str_ | bytes_ | object_, ...]] | ItemListCollection[tuple[int | str | bytes | integer[Any] | str_ | bytes_ | object_, ...]] | Mapping[int | str | bytes | integer[Any] | str_ | bytes_ | object_, ItemList] | DataFrame) BatchResults
Run the pipeline and return its results.
- Parameters:
pipeline – The pipeline to run.
queries – The collection of test queries use. See Batch Queries for details on the various input formats.
- Returns:
The results, as a nested dictionary. The outer dictionary maps component output names to inner dictionaries of result data.