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
dictswhere the keys arefeature_namesand the values are values inX. 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. IfNone, the condition specifies the entire set of instances,X.
- Returns:
numpy.ndarray(bool) – Boolean conditioning vector. Shape is
[n]wherenisX.shape[0]. Values areTrueif the corresponding row satisfies theconditionandFalseotherwise.
Examples
>>> condition = [{'sex': 1, 'age': 1}, {'sex': 0}]
This corresponds to
(sex == 1 AND age == 1) OR (sex == 0).