yobx.sklearn.compose.column_transformer#

yobx.sklearn.compose.column_transformer.sklearn_column_transformer(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: ColumnTransformer, X: str, name: str = 'column_transformer', function_options: FunctionOptions | None = None) str[source]#

Converts a sklearn.compose.ColumnTransformer into ONNX.

The converter:

  1. Iterates over transformers_ (the fitted transformer list).

  2. For each entry it selects the requested feature columns from the input tensor with an ONNX Gather node (axis=1).

  3. Transformers flagged as 'drop' are skipped entirely.

  4. Passthrough transformers (the 'passthrough' string or a FunctionTransformer with func=None) contribute the gathered sub-matrix directly.

  5. All remaining transformers are converted via their own registered converter using get_sklearn_converter().

  6. All partial outputs are concatenated along the feature axis with an ONNX Concat node (axis=-1).

X ──Gather(cols_A)──► X_A ──converter_A──► out_A ──┐
  ──Gather(cols_B)──► X_B ──converter_B──► out_B ──┤ Concat ──► output
  ──Gather(cols_C)──► X_C ──(passthrough)──────────┘
Parameters:
  • g – the graph builder to add nodes to

  • sts – shapes and types defined by scikit-learn

  • outputs – desired output tensor names

  • estimator – a fitted ColumnTransformer

  • X – name of the input tensor

  • name – prefix used for names of nodes added by this converter

  • function_options – function options

Returns:

name of the output tensor

Raises:

ValueError – when all transformers are 'drop' (empty output)