class_docstr: Class for computing metrics based on two StructuredDatasets.
docstr: Compute the average Mahalanobis distance between the samples from the
  two datasets.
docstr_tok: ["Compute","the","average","Mahalanobis","distance","between","the","samples","from","the","two","datasets","."]
code: def mahalanobis_distance(self, privileged=None, returned=False):
      """Compute the average Mahalanobis distance between the samples from the
      two datasets.
      """
      condition = self._to_condition(privileged)
      X_orig = self.dataset.features
      X_distort = self.distorted_dataset.features
      dist_fun = partial(
          scdist.mahalanobis,
          VI=np.linalg.inv(np.cov(np.vstack([X_orig, X_distort]).T)).T,
      )
      distance, mask = utils.compute_distance(
          X_orig,
          X_distort,
          self.dataset.protected_attributes,
          self.dataset.protected_attribute_names,
          dist_fun=dist_fun,
          condition=condition,
      )
      if returned:
          return distance, self.dataset.instance_weights[mask]
      return distance
  
imports: from functools import partial
  import numpy
  import scipy.spatial.distance
  from aif360.datasets import StructuredDataset
  from aif360.metrics import DatasetMetric, utils
label_desc: Use image node_id 7 for calling the SampleDistortionMetric obj's underlying member method code with example usage: obj.mahalanobis_distance(privileged, returned) and returns: distance, distance,  self