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: Validate that data balance measures can be computed. Raises ValueError
  if not valid.
docstr_tok: ["Validate","that","data","balance","measures","can","be","computed",".","Raises","ValueError","if","not","valid","."]
code: def _validate(self):
      """
      Validate that data balance measures can be computed. Raises ValueError
      if not valid.
      """
      if self._train is None and self._test is None:
          raise ValueError(
              (
                  "Either `train` or `test` must be provided to RAIInsights"
                  " to compute data balance measures."
              )
          )
  
      if not self._target_column:
          raise ValueError(
              (
                  "The `target_column` must be provided to compute"
                  " data balance measures."
              )
          )
  
      if self._target_column not in self._df.columns:
          raise ValueError(
              (
                  f"The target_column '{self._target_column}' must be"
                  " present in the dataset."
              )
          )
  
      if not self._classes:
          raise ValueError(
              (
                  f"The target_column '{self._target_column}' must have"
                  " at least one value."
              )
          )
  
      if self._task_type != TaskType.CLASSIFICATION:
          raise ValueError(
              (
                  f"The task_type '{self._task_type}' must be"
                  " 'classification' to compute data balance measures."
              )
          )
  
      if not self._cols_of_interest:
          raise ValueError(
              (
                  "The `cols_of_interest` must be provided to compute"
                  " data balance measures."
              )
          )
  
      if not all(
          col in self._df.columns for col in self._cols_of_interest
      ):
          raise ValueError(
              (
                  "All columns in `cols_of_interest` must be present in"
                  " the dataset."
              )
          )
  
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 3 for calling the DataBalanceManager obj's underlying member method code with example usage: obj._validate() without return types