yobx.sklearn.pipeline.feature_union#

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

Converts a sklearn.pipeline.FeatureUnion into ONNX.

The converter applies each transformer in the union to the same input tensor X and concatenates their outputs along the feature axis (axis=-1) using an ONNX Concat node, mirroring what sklearn.pipeline.FeatureUnion.transform() does.

Transformers whose weight is 0 (i.e. they were explicitly disabled via transformer_weights) are skipped, exactly as scikit-learn does.

X ──► transformer_A ──► out_A ──┐
  ──► transformer_B ──► out_B ──┤ Concat(axis=-1) ──► output
  ──► transformer_C ──► out_C ──┘
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 union result

  • estimator – a fitted sklearn.pipeline.FeatureUnion

  • X – name of the input tensor to the feature union

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

  • function_options – to export every transformer as a local function

Returns:

name of the output tensor

Raises:

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