yobx.sklearn.linear_model.sgd_one_class_svm#

yobx.sklearn.linear_model.sgd_one_class_svm.sklearn_sgd_one_class_svm(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: SGDOneClassSVM, X: str, name: str = 'sgd_one_class_svm') str | Tuple[str, str][source]#

Converts a sklearn.linear_model.SGDOneClassSVM into ONNX.

SGDOneClassSVM is a linear approximation of One-Class SVM trained via SGD. The decision function is:

decision_function(X) = X @ coef_.T - offset_

Samples with decision_function(X) >= 0 are predicted as inliers (+1) and those with decision_function(X) < 0 as outliers (-1).

This converter inherits from OutlierMixin, so it returns two outputs: the predicted label and the raw decision scores.

Graph structure:

X  ──Gemm(coef_, offset_)──►  decision (N,)
            │
    GreaterOrEqual(0) ──►  is_inlier (N,)
            │
    Where(is_inlier, 1, -1) ──►  label (N,)
Parameters:
  • g – the graph builder to add nodes to

  • sts – shapes defined by scikit-learn

  • outputs – desired output names; two entries (label, scores)

  • estimator – a fitted SGDOneClassSVM

  • X – input tensor name

  • name – prefix for added node names

Returns:

label tensor name, or tuple (label, scores)