yobx.sklearn.svm.svm#
- yobx.sklearn.svm.svm.sklearn_svc(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: SVC | NuSVC, X: str, name: str = 'svc') str | Tuple[str, str][source]#
Converts a
sklearn.svm.SVCorsklearn.svm.NuSVCinto ONNX using theSVMClassifieroperator from theai.onnx.mldomain.Supported kernels:
'linear','poly','rbf','sigmoid'. Callable kernels are not supported.When the estimator was trained with
probability=True(i.e., it exposespredict_proba()), the converter includes the Platt scaling calibration parametersprob_a/prob_bin theSVMClassifiernode, which causes the ONNX runtime to output calibrated probabilities automatically. The output is then the tuple(label, probabilities). Withoutprobability=True, only the predicted label is returned.Coefficient layout for the
SVMClassifiernode:Binary (2 classes): ONNX coefficients =
-dual_coef_.flatten(),rho = -intercept_.Multiclass (≥ 3 classes, OvO): ONNX coefficients =
dual_coef_.flatten(),rho = intercept_.
- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
outputs – desired output names (label only, or label + probabilities)
estimator – a fitted
SVCorNuSVCX – input tensor name
name – prefix for added node names
- Returns:
label tensor name, or tuple
(label, probabilities)
- yobx.sklearn.svm.svm.sklearn_svr(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: SVR | NuSVR, X: str, name: str = 'svr') str[source]#
Converts a
sklearn.svm.SVRorsklearn.svm.NuSVRinto ONNX using theSVMRegressoroperator from theai.onnx.mldomain.Supported kernels:
'linear','poly','rbf','sigmoid'. Callable kernels are not supported.Graph structure:
X ──SVMRegressor──► predictions (N,1)
- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
outputs – desired output names
estimator – a fitted
SVRorNuSVRX – input tensor name
name – prefix for added node names
- Returns:
output tensor name