yobx.sklearn.category_encoders.quantile_encoder#

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

Converts a category_encoders.QuantileEncoder into ONNX.

The encoder replaces each categorical column with the quantile of the target distribution conditioned on that category value. Non-categorical columns pass through unchanged.

X  ──col_j (categorical)──►  Equal(val_i)?──►  quantile_i
                              ...
                              IsNaN?──────────►  nan_quantile
                              default──────────►  unknown_quantile

X  ──col_k (numerical)──►  unchanged

The conversion pre-computes a combined lookup table (original category value → quantile) 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 QuantileEncoder

  • outputs – desired output names

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

  • name – prefix name for the added nodes

Returns:

output name