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 (numpy.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

Return type

None

bins(data)[source]
Parameters

data (numpy.ndarray) – Data to discretize

Return type

List[numpy.ndarray]

Returns

List with bin values for each feature that is discretized.

discretize(data)[source]
Parameters

data (numpy.ndarray) – Data to discretize

Return type

numpy.ndarray

Returns

Discretized version of data with the same dimension.