yobx.sklearn.preprocessing.normalizer#
- yobx.sklearn.preprocessing.normalizer.sklearn_normalizer(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: Normalizer, X: str, name: str = 'normalizer') str[source]#
Converts a
sklearn.preprocessing.Normalizerinto ONNX.Each sample (row) is scaled independently to unit norm. The
normparameter selects which norm is used:norm = ReduceL2/L1/Max(|X|, axis=1, keepdims=True) → (N, 1) safe_norm = Where(norm == 0, 1, norm) → (N, 1) output = X / safe_norm → (N, F)
When a row has zero norm it is left unchanged (divided by 1), which matches
sklearn.preprocessing.normalize().Supported values for
norm:'l2'(default),'l1','max'.- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
estimator – a fitted or unfitted
Normalizeroutputs – desired output names
X – input tensor name
name – prefix for added node names
- Returns:
output tensor name