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.FeatureUnioninto ONNX.The converter applies each transformer in the union to the same input tensor
Xand concatenates their outputs along the feature axis (axis=-1) using an ONNXConcatnode, mirroring whatsklearn.pipeline.FeatureUnion.transform()does.Transformers whose weight is
0(i.e. they were explicitly disabled viatransformer_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
FunctionOptionsvalue under the key_FUNCTION_OPTIONS_KEYoutputs – desired output tensor names for the union result
estimator – a fitted
sklearn.pipeline.FeatureUnionX – 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)