yobx.sklearn.multioutput.multioutput#
- yobx.sklearn.multioutput.multioutput.sklearn_multi_output_classifier(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: MultiOutputClassifier, X: str, name: str = 'multi_output_classifier') str | Tuple[str, str][source]#
Converts a
sklearn.multioutput.MultiOutputClassifierinto ONNX.The converter iterates over the fitted sub-estimators, calls the registered converter for each one to obtain per-target labels, and concatenates the reshaped
(N, 1)labels into a final label tensor of shape(N, n_targets).When probabilities are requested (i.e.
len(outputs) > 1) and every target has the same number of classes, the per-target probability matrices(N, n_classes)are unsqueezed to(N, 1, n_classes)and concatenated into a(N, n_targets, n_classes)tensor.Graph structure (labels only):
X ──[sub-est 0 converter]──► label_0 (N,) ──Cast(INT64)──Reshape(N,1)──┐ X ──[sub-est 1 converter]──► label_1 (N,) ──Cast(INT64)──Reshape(N,1)──┤ ... │ +-----------------------------------------------------+ │ Concat(axis=1) ─────────► labels (N, n_targets)Graph structure (with probabilities, all targets same n_classes):
X ──[sub-est 0 converter]──► proba_0 (N, n_cls) ──Unsqueeze──► (N,1,n_cls)──┐ X ──[sub-est 1 converter]──► proba_1 (N, n_cls) ──Unsqueeze──► (N,1,n_cls)──┤ ... │ +-----------------------------------------------------+ │ Concat(axis=1) ───────────► probabilities (N, n_targets, n_cls)- Parameters:
g – the graph builder to add nodes to
sts – shapes and types defined by scikit-learn
outputs – desired output tensor names (label, or label + probabilities)
estimator – a fitted
MultiOutputClassifierX – name of the input tensor
name – prefix used for names of nodes added by this converter
- Returns:
label tensor name, or tuple
(label, probabilities)- Raises:
NotImplementedError – when probabilities are requested but targets have a different number of classes or sub-estimators do not expose
predict_proba()
- yobx.sklearn.multioutput.multioutput.sklearn_multi_output_regressor(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: MultiOutputRegressor, X: str, name: str = 'multi_output_regressor') str[source]#
Converts a
sklearn.multioutput.MultiOutputRegressorinto ONNX.The converter iterates over the fitted sub-estimators, calls the registered converter for each one, and reshapes every 1-D prediction
(N,)to(N, 1)before concatenating them into the final output of shape(N, n_targets).Graph structure:
X ──[sub-est 0 converter]──► pred_0 (N,) ──Reshape(N,1)──┐ X ──[sub-est 1 converter]──► pred_1 (N,) ──Reshape(N,1)──┤ ... │ Concat(axis=1) ─────► predictions (N, n_targets)- 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
MultiOutputRegressorX – name of the input tensor
name – prefix used for names of nodes added by this converter
- Returns:
name of the output tensor of shape
(N, n_targets)