aif360.metrics.utils
.compute_distance¶
-
aif360.metrics.utils.
compute_distance
(X_orig, X_distort, X_prot, feature_names, dist_fun, condition=None)[source]¶ Compute the distance element-wise for two sets of vectors.
Parameters: - X_orig (numpy.ndarray) – Original features.
- X_distort (numpy.ndarray) – Distorted features. Shape must match
X_orig
. - X_prot (numpy.ndarray) – Protected attributes (used to compute condition). Should be same for both original and distorted.
- feature_names (list) – Names of the protected features.
- dist_fun (function) – Function which returns the distance (float) between
two 1-D arrays (e.g.
scipy.spatial.distance.euclidean()
). - condition (list(dict)) – Same format as
compute_boolean_conditioning_vector()
.
Returns: (numpy.ndarray(numpy.float64), numpy.ndarray(bool)) – * Element-wise distances (1-D). * Condition vector (1-D).