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 arefeature_names
and 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]
wheren
isX.shape[0]
. Values areTrue
if the corresponding row satisfies thecondition
andFalse
otherwise.
Examples
>>> condition = [{'sex': 1, 'age': 1}, {'sex': 0}]
This corresponds to
(sex == 1 AND age == 1) OR (sex == 0)
.