Skip to main content

Module binary_encoder

Module binary_encoder 

Source
Expand description

Binary encoder: encode categorical integers as binary digits.

BinaryEncoder encodes each categorical integer feature into ceil(log2(k)) binary columns, where k is the number of distinct categories. This is more compact than one-hot encoding for high-cardinality features.

§Example

Input column with categories {0, 1, 2, 3}:
  0 → [0, 0]
  1 → [0, 1]
  2 → [1, 0]
  3 → [1, 1]

Structs§

BinaryEncoder
An unfitted binary encoder.
FittedBinaryEncoder
A fitted binary encoder holding the number of categories and binary digits per input feature.