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 by lenskit.parallel.config.initialize()).

Parameters:

n_jobs (int | None)

__init__(*, n_jobs=None)#
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.

Parameters:
  • component (str) – The name of the rating predictor component to run.

  • output (str) – The name of the results in the output dictionary.

recommend(component='recommender', *, output='recommendations', **extra)#

Request the batch run to generate recomendations.

Parameters:
  • component (str) – The name of the recommender component to run.

  • output (str) – The name of the results in the output dictionary.

  • extra (Any) – Extra inputs to the recommender. A common option is n, the number of recommendations to return (a default may be baked into the pipeline).

run(pipeline, test_data)#

Run the pipeline and return its results.

Parameters:
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:

BatchResults