alibi.utils.data module

class alibi.utils.data.Bunch(**kwargs)[source]

Bases: dict

Container object for internal datasets Dictionary-like object that exposes its keys as attributes.

alibi.utils.data.gen_category_map(data, categorical_columns=None)[source]
Parameters
  • data (Union[DataFrame, ndarray]) – 2-dimensional pandas dataframe or numpy array.

  • categorical_columns (Union[List[int], List[str], None]) – A list of columns indicating categorical variables. Optional if passing a pandas dataframe as inference will be used based on dtype ‘O’. If passing a numpy array this is compulsory.

Return type

Dict[int, list]

Returns

category_map – A dictionary with keys being the indices of the categorical columns and values being lists of categories for that column. Implicitly each category is mapped to the index of its position in the list.