bartz.prepcovars.RangeEvenBinner

class bartz.prepcovars.RangeEvenBinner(X, *, max_bins=256, key=None)[source]

Binner with cutpoints evenly spaced over the observed range.

For each predictor, max_bins - 1 cutpoints are placed at equally spaced positions strictly between the minimum and the maximum value observed in the training matrix. All predictors use the same number of cutpoints.

Parameters:
  • X (Real[Array, 'p n']) – Training predictors with p predictors and n observations.

  • max_bins (int, default: 256) – The number of bins per predictor; max_bins - 1 cutpoints are produced per predictor.

  • key (Key[Array, ''] | None, default: None) – Accepted for protocol uniformity; unused.

max_split: UInt[Array, 'p']

The number of cutpoints actually used for each of the p predictors.

bin(X)[source]

Map predictors to bin indices using the cutpoints chosen at construction.

Parameters:

X (Real[Array, 'p n']) – A matrix with p predictors and n observations. Must have the same number of predictors as the training matrix passed to the constructor.

Returns:

UInt[Array, 'p n'] – Quantized X with minimal data type.