class_docstr: Class for computing metrics based on one StructuredDataset.
docstr: Compute the number of instances, :math:`n`, in the dataset conditioned
  on protected attributes if necessary.
  
  Args:
      privileged (bool, optional): Boolean prescribing whether to
          condition this metric on the `privileged_groups`, if `True`, or
          the `unprivileged_groups`, if `False`. Defaults to `None`
          meaning this metric is computed over the entire dataset.
  
  Raises:
      AttributeError: `privileged_groups` or `unprivileged_groups` must be
          must be provided at initialization to condition on them.
code: def num_instances(self, privileged=None):
      """Compute the number of instances, :math:`n`, in the dataset conditioned
      on protected attributes if necessary.
  
      Args:
          privileged (bool, optional): Boolean prescribing whether to
              condition this metric on the `privileged_groups`, if `True`, or
              the `unprivileged_groups`, if `False`. Defaults to `None`
              meaning this metric is computed over the entire dataset.
  
      Raises:
          AttributeError: `privileged_groups` or `unprivileged_groups` must be
              must be provided at initialization to condition on them.
      """
      condition = self._to_condition(privileged)
      return utils.compute_num_instances(
          self.dataset.protected_attributes,
          self.dataset.instance_weights,
          self.dataset.protected_attribute_names,
          condition=condition,
      )
  
file_path: AIF360/aif360/metrics/dataset_metric.py
imports: import numpy
  from aif360.datasets import StructuredDataset
  from aif360.metrics import Metric, utils
label_desc: Use image node_id 5 for calling the DatasetMetric obj's underlying member method code with example usage: obj.num_instances(privileged) and returns: utils