class_docstr: Class for computing metrics based on two StructuredDatasets.
docstr: Args:
      dataset (StructuredDataset): A StructuredDataset.
      distorted_dataset (StructuredDataset): A StructuredDataset.
      privileged_groups (list(dict)): Privileged groups. Format is a list
          of `dicts` where the keys are `protected_attribute_names` and
          the values are values in `protected_attributes`. Each `dict`
          element describes a single group. See examples for more details.
      unprivileged_groups (list(dict)): Unprivileged groups in the same
          format as `privileged_groups`.
  
  Raises:
      TypeError: `dataset` and `distorted_dataset` must be
          :obj:`~aif360.datasets.StructuredDataset` types.
docstr_tok: ["Args",":","dataset","(","StructuredDataset",")",":","A","StructuredDataset",".","distorted_dataset","(","StructuredDataset",")",":","A","StructuredDataset",".","privileged_groups","(","list","(","dict",")",")",":","Privileged","groups",".","Format","is","a","list","of","`","dicts","`","where","the","keys","are","`","protected_attribute_names","`","and","the","values","are","values","in","`","protected_attributes","`",".","Each","`","dict","`","element","describes","a","single","group",".","See","examples","for","more","details",".","unprivileged_groups","(","list","(","dict",")",")",":","Unprivileged","groups","in","the","same","format","as","`","privileged_groups","`",".","Raises",":","TypeError",":","`","dataset","`","and","`","distorted_dataset","`","must","be",":","obj",":","`","~aif360.datasets.StructuredDataset","`","types","."]
code: def __init__(
      self,
      dataset,
      distorted_dataset,
      unprivileged_groups=None,
      privileged_groups=None,
  ):
      """
      Args:
          dataset (StructuredDataset): A StructuredDataset.
          distorted_dataset (StructuredDataset): A StructuredDataset.
          privileged_groups (list(dict)): Privileged groups. Format is a list
              of `dicts` where the keys are `protected_attribute_names` and
              the values are values in `protected_attributes`. Each `dict`
              element describes a single group. See examples for more details.
          unprivileged_groups (list(dict)): Unprivileged groups in the same
              format as `privileged_groups`.
  
      Raises:
          TypeError: `dataset` and `distorted_dataset` must be
              :obj:`~aif360.datasets.StructuredDataset` types.
      """
      # sets self.dataset, self.unprivileged_groups, self.privileged_groups
      super(SampleDistortionMetric, self).__init__(
          dataset,
          unprivileged_groups=unprivileged_groups,
          privileged_groups=privileged_groups,
      )
  
      if isinstance(distorted_dataset, StructuredDataset):
          self.distorted_dataset = distorted_dataset
      else:
          raise TypeError(
              "'distorted_dataset' should be a StructuredDataset"
          )
  
      with dataset.temporarily_ignore("features", "labels", "scores"):
          if dataset != distorted_dataset:
              raise ValueError(
                  "The two datasets may differ in features and "
                  "labels/scores only."
              )
  
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 1 to create a new SampleDistortionMetric object from inherited base classes: DatasetMetric with example: obj = SampleDistortionMetric(dataset, distorted_dataset, unprivileged_groups, privileged_groups)