yobx.sklearn.covariance.elliptic_envelope#
- yobx.sklearn.covariance.elliptic_envelope.sklearn_elliptic_envelope(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: EllipticEnvelope, X: str, name: str = 'elliptic_envelope') str | Tuple[str, str][source]#
Converts a
sklearn.covariance.EllipticEnvelopeinto ONNX.The converter produces two outputs:
label: the outlier predictions (1for inlier,-1for outlier), equivalent topredict().scores: the decision function values, equivalent todecision_function().
The decision function is computed as:
where
is
location_,is
precision_, andoffset_is the threshold learned during fitting. The squared Mahalanobis distance is:Full graph structure:
X (N, F) │ └─ Sub(location_) ──► X_centered (N, F) │ ├─ MatMul(precision_) ──► X_prec (N, F) │ │ └──────────────────── Mul ──► X_prec_centered (N, F) │ ReduceSum(axis=1) ──► mahal_sq (N,) │ Neg ──► score_samples (N,) │ Sub(offset_) ──► decision (N,) [scores output] │ GreaterOrEqual(0) ──► mask (N,) │ Where(1, -1) ──► label (N,) [label output]- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
outputs – desired output names;
outputs[0]receives the predicted labels andoutputs[1](if present) receives the decision function valuesestimator – a fitted
EllipticEnvelopeX – input tensor name
name – prefix for added node names
- Returns:
tuple
(label, scores)