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.ColumnTransformerinto ONNX.The converter:
Iterates over
transformers_(the fitted transformer list).For each entry it selects the requested feature columns from the input tensor with an ONNX
Gathernode (axis=1).Transformers flagged as
'drop'are skipped entirely.Passthrough transformers (the
'passthrough'string or aFunctionTransformerwithfunc=None) contribute the gathered sub-matrix directly.All remaining transformers are converted via their own registered converter using
get_sklearn_converter().All partial outputs are concatenated along the feature axis with an ONNX
Concatnode (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
ColumnTransformerX – 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)