yobx.sklearn.pipeline.pipeline#

yobx.sklearn.pipeline.pipeline.sklearn_pipeline(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: Pipeline, X: str, name: str = 'pipeline', function_options: FunctionOptions | None = None) str | Tuple[str, ...][source]#

Converts a sklearn.pipeline.Pipeline into ONNX using registered converters for each step in the pipeline.

The converter iterates over the pipeline steps and chains each step’s converter output into the next step’s input. Intermediate tensor names are generated with GraphBuilder.unique_name to avoid collisions.

When sts contains a FunctionOptions under the _FUNCTION_OPTIONS_KEY key each step is exported as a separate ONNX local function instead of being inlined into the graph.

Parameters:
  • g – the graph builder to add nodes to

  • sts – shapes and types defined by scikit-learn; also carries an optional FunctionOptions value under the key _FUNCTION_OPTIONS_KEY

  • outputs – desired output tensor names for the pipeline result

  • estimator – a fitted sklearn.pipeline.Pipeline

  • X – name of the input tensor to the pipeline

  • name – prefix used for names of nodes added for each pipeline step

  • function_options – to export every step as a local function

Returns:

name of the output tensor, or a tuple of output tensor names