lenskit.batch.BatchPipelineRunner#
- class lenskit.batch.BatchPipelineRunner(*, n_jobs=None)#
Bases:
object
Apply a pipeline to a collection of test users.
- Argss:
- pipeline:
The pipeline to evaluate.
- n_jobs:
The number of parallel processes to use, or
None
for the default (defined bylenskit.parallel.config.initialize()
).
- Parameters:
n_jobs (int | None)
Methods
__init__
(*[, n_jobs])add_invocation
(inv)predict
([component, output])Request the batch run to generate test item scores or rating predictins.
recommend
([component, output])Request the batch run to generate recomendations.
run
(pipeline, test_data)Run the pipeline and return its results.
Attributes
n_jobs
invocations
- predict(component='rating-predictor', *, output='predictions')#
Request the batch run to generate test item scores or rating predictins.
- recommend(component='recommender', *, output='recommendations', **extra)#
Request the batch run to generate recomendations.
- run(pipeline, test_data)#
Run the pipeline and return its results.
- Parameters:
test_data (ItemListCollection[tuple[int | str | bytes | integer[Any] | str_ | bytes_ | object_, ...]] | Mapping[int | str | bytes | integer[Any] | str_ | bytes_ | object_, ItemList] | Iterable[int | str | bytes | integer[Any] | str_ | bytes_ | object_ | tuple[int | str | bytes | integer[Any] | str_ | bytes_ | object_, ...]]) – The collection of test data, as an ItemListCollection, a mapping of user IDs to test data, or as a sequence of item IDs for recommendation.
pipeline (Pipeline)
- Returns:
The results, as a nested dictionary. The outer dictionary maps component output names to inner dictionaries of result data. These inner dictionaries map user IDs to
- Return type: