lenskit.pipeline#

LensKit pipeline abstraction.

Submodules#

components

Definition of the component interfaces.

config

Old location of pipeline configuration schema.

nodes

Node objects used to represent pipelines internally. It is very rare

Attributes#

Classes#

PipelineBuilder

Builder for LensKit recommendation pipelines. Pipelines

PipelineCache

A cache to share components between pipelines.

RecPipelineBuilder

Builder to help assemble common pipeline patterns.

MermaidDiagrammer

Render pipeline diagrams.

ComponentInputHook

Inspect or process data as it passes to a component's input.

Pipeline

LensKit recommendation pipeline. This is the core abstraction for using

PipelineProfiler

Collect pipeline run statistics for profiling pipeline executions.

ProfileSink

Interface for creating recording pipeline run profiling information.

PipelineState

Full results of running a pipeline. A pipeline state is a dictionary

Functions#

predict_pipeline(scorer, *[, fallback, ...])

Create a pipeline that predicts ratings, but does not include any

topn_pipeline(scorer[, config, predicts_ratings, ...])

Create a pipeline that produces top-N recommendations using a scoring model.

Package Contents#

lenskit.pipeline.predict_pipeline(scorer, *, fallback=True, history_lookup=True, name=None)#

Create a pipeline that predicts ratings, but does not include any ranking capabilities. Mostly userful for testing and historical purposes. The resulting pipeline must be called with an item list.

Stability:
Caller (see Stability Levels).
Parameters:
  • scorer (lenskit.pipeline.components.Component) – The scorer to use in the pipeline (it will added with the component name scorer, see Component Names).

  • fallback (bool | lenskit.pipeline.components.Component) – Whether to use a fallback predictor when the scorer cannot score. When configured, the scorer node is the scorer, and the rating-predictor node applies the fallback.

  • history_lookup (bool) – Look up user history from training data. Set to False when queries supply their own history.

  • name (str | None) – The pipeline name.

Return type:

lenskit.pipeline._impl.Pipeline

lenskit.pipeline.topn_pipeline(scorer, config=None, *, predicts_ratings=False, history_lookup=True, n=None, name=None)#

Create a pipeline that produces top-N recommendations using a scoring model.

Stability:
Caller (see Stability Levels).
Parameters:
  • scorer (lenskit.pipeline.components.Component | lenskit.pipeline.components.ComponentConstructor) – The scorer to use in the pipeline (it will added with the component name scorer, see Component Names).

  • predicts_ratings (bool | Literal['raw']) – If True, make set up to predict ratings (rating-predictor), using scorer with a fallback of BiasScorer; if "raw", use scorer directly with no fallback.

  • history_lookup (bool) – Look up user history from training data. Set to False when queries supply their own history.

  • n (int | None) – The recommendation list length to configure in the pipeline.

  • name (str | None) – The pipeline name.

  • config (object | None)

Return type:

lenskit.pipeline._impl.Pipeline

type lenskit.pipeline.CloneMethod = Literal['config', 'pipeline-config']#

Exported Aliases#

exception lenskit.pipeline.PipelineError#

Re-exported alias for lenskit.diagnostics.PipelineError.

exception lenskit.pipeline.PipelineWarning#

Re-exported alias for lenskit.diagnostics.PipelineWarning.

class lenskit.pipeline.Lazy#

Re-exported alias for lenskit.lazy.Lazy.

class lenskit.pipeline.Component#

Re-exported alias for lenskit.pipeline.components.Component.

class lenskit.pipeline.ComponentConstructor#

Re-exported alias for lenskit.pipeline.components.ComponentConstructor.

lenskit.pipeline.PipelineFunction#

Re-exported alias for lenskit.pipeline.components.PipelineFunction.

class lenskit.pipeline.PipelineConfig#

Re-exported alias for lenskit.pipeline.config.PipelineConfig.

class lenskit.pipeline.Node#

Re-exported alias for lenskit.pipeline.nodes.Node.