class_docstr: Defines the DataBalanceManager for finding data balance measures
  on a dataset.
class_docstr_tok: ["Defines","the","DataBalanceManager","for","finding","data","balance","measures","on","a","dataset","."]
docstr: Computes data balance measures on the dataset.
docstr_tok: ["Computes","data","balance","measures","on","the","dataset","."]
code: def compute(self):
      """
      Computes data balance measures on the dataset.
      """
      if not self._is_added:
          return
  
      try:
          self._validate()
  
          self._df = prepare_df(df=self._df)
  
          feature_balance_measures = {}
          for pos_label in self._classes:
              feature_balance_measures[
                  pos_label
              ] = FeatureBalanceMeasures(
                  cols_of_interest=self._cols_of_interest,
                  label_col=self._target_column,
                  pos_label=pos_label,
              ).measures(
                  dataset=self._df
              )
  
          distribution_balance_measures = DistributionBalanceMeasures(
              cols_of_interest=self._cols_of_interest
          ).measures(dataset=self._df)
          aggregate_balance_measures = AggregateBalanceMeasures(
              cols_of_interest=self._cols_of_interest
          ).measures(dataset=self._df)
  
          self._set_data_balance_measures(
              feature_balance_measures=feature_balance_measures,
              distribution_balance_measures=distribution_balance_measures,
              aggregate_balance_measures=aggregate_balance_measures,
          )
      except Exception as e:
          warnings.warn(
              f"Failed to compute data balance measures due to {e!r}."
          )
  
imports: import json
  import warnings
  from pathlib import Path
  from typing import Dict, List
  import numpy
  import pandas
  from responsibleai._interfaces import TaskType
  from responsibleai._internal.constants import DataBalanceManagerKeys
  from responsibleai._internal.constants import FileFormats, ListProperties, ManagerNames
  from responsibleai._tools.shared.state_directory_management import DirectoryManager
  from responsibleai.databalanceanalysis import AggregateBalanceMeasures, DistributionBalanceMeasures, FeatureBalanceMeasures
  from responsibleai.databalanceanalysis.data_balance_utils import prepare_df, transform_measures_to_dict
  from responsibleai.managers.base_manager import BaseManager
label_desc: Use image node_id 4 for calling the DataBalanceManager obj's underlying member method code with example usage: obj.compute() without return types