yobx.sklearn.category_encoders.woe_encoder#

yobx.sklearn.category_encoders.woe_encoder.category_encoders_woe_encoder(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: WOEEncoder, X: str, name: str = 'woe_encoder') str[source]#

Converts a category_encoders.WOEEncoder into ONNX.

The encoder replaces each categorical column with the Weight of Evidence (WOE) of the target distribution conditioned on that category value. Non-categorical columns pass through unchanged.

X  ──col_j (categorical)──►  Equal(val_i)?──►  woe_i
                              ...
                              IsNaN?──────────►  nan_woe
                              default──────────►  unknown_woe

X  ──col_k (numerical)──►  unchanged

The conversion pre-computes a combined lookup table (original category value → WOE) from the fitted ordinal_encoder and mapping attributes. Unknown categories and NaN inputs are handled via separate Where nodes that override the default value.

Parameters:
  • g – the graph builder to add nodes to

  • sts – shapes defined by scikit-learn

  • estimator – a fitted WOEEncoder

  • outputs – desired output names

  • X – input name (shape (N, F))

  • name – prefix name for the added nodes

Returns:

output name