alibi_detect.utils.discretizer module

class alibi_detect.utils.discretizer.Discretizer(data, categorical_features, feature_names, percentiles=[25, 50, 75])[source]

Bases: object

__init__(data, categorical_features, feature_names, percentiles=[25, 50, 75])[source]

Initialize the discretizer.

Parameters:
  • data (ndarray) – Data to discretize

  • categorical_features (List[int]) – List of indices corresponding to the categorical columns. These features will not be discretized. The other features will be considered continuous and therefore discretized.

  • feature_names (List[str]) – List with feature names

  • percentiles (List[int]) – Percentiles used for discretization

bins(data)[source]
Parameters:

data (ndarray) – Data to discretize

Return type:

List[ndarray]

Returns:

List with bin values for each feature that is discretized.

discretize(data)[source]
Parameters:

data (ndarray) – Data to discretize

Return type:

ndarray

Returns:

Discretized version of data with the same dimension.