aif360.metrics.utils.compute_boolean_conditioning_vector

aif360.metrics.utils.compute_boolean_conditioning_vector(X, feature_names, condition=None)[source]

Compute the boolean conditioning vector.

Parameters:
  • X (numpy.ndarray) – Dataset features

  • feature_names (list) – Names of the features.

  • condition (list(dict)) – Specifies the subset of instances we want to use. Format is a list of dicts where the keys are feature_names and the values are values in X. Elements in the list are clauses joined with OR operators while key-value pairs in each dict are joined with AND operators. See examples for more details. If None, the condition specifies the entire set of instances, X.

Returns:

numpy.ndarray(bool) – Boolean conditioning vector. Shape is [n] where n is X.shape[0]. Values are True if the corresponding row satisfies the condition and False otherwise.

Examples

>>> condition = [{'sex': 1, 'age': 1}, {'sex': 0}]

This corresponds to (sex == 1 AND age == 1) OR (sex == 0).