lenskit.pipeline.RecPipelineBuilder#

class lenskit.pipeline.RecPipelineBuilder#

Bases: object

Builder to help assemble common pipeline patterns.

This is a convenience class; you can always directly assemble a Pipeline if this class’s behavior is inadquate.

__init__()#

Methods

__init__()

build([name])

Build the specified pipeline.

candidate_selector(sel)

Specify the candidate selector component.

predicts_ratings([transform, fallback])

Specify that this pipeline will predict ratings, optionally providing a rating transformer and fallback scorer for the rating predictions.

ranker([rank, n])

Specify the ranker to use.

scorer(score)

Specify the scoring model.

Attributes

is_predictor

scorer(score)#

Specify the scoring model.

Parameters:

score (Component)

ranker(rank=None, *, n=-1)#

Specify the ranker to use. If None, sets up a TopNRanker with n=n.

Parameters:
candidate_selector(sel)#

Specify the candidate selector component. The component should accept a query as its input and return an item list.

Parameters:

sel (Component)

predicts_ratings(transform=None, *, fallback=None)#

Specify that this pipeline will predict ratings, optionally providing a rating transformer and fallback scorer for the rating predictions.

Parameters:
  • transform (Component | None) – A component to transform scores prior to returning them. If supplied, it will be applied to both primary scores and fallback scores.

  • fallback (Component | None) – A fallback scorer to use when the primary scorer cannot score an item. The fallback should accept query and items inputs, and return an item list.

build(name=None)#

Build the specified pipeline.

Parameters:

name (str | None)

Return type:

Pipeline