class_docstr: This class computes data balance measures for columns of interest
  based on a reference distribution. Currently, only the uniform reference
  distribution is supported.
class_docstr_tok: ["This","class","computes","data","balance","measures","for","columns","of","interest","based","on","a","reference","distribution",".","Currently",",","only","the","uniform","reference","distribution","is","supported","."]
docstr: Returns a dictionary of distribution balance measures based on the
  given dataset and column of interest.
  
  :param df: The dataset to compute distribution measures on.
  :type df: pd.DataFrame
  :param col_of_interest: The column of interest to compute
      distribution measures on.
  :type col_of_interest: str
  :return: A `dict` of <measure name, measure value> pairs.
  :rtype: Dict[Measures, float]
docstr_tok: ["Returns","a","dictionary","of","distribution","balance","measures","based","on","the","given","dataset","and","column","of","interest",".",":","param","df",":","The","dataset","to","compute","distribution","measures","on",".",":","type","df",":","pd.DataFrame",":","param","col_of_interest",":","The","column","of","interest","to","compute","distribution","measures","on",".",":","type","col_of_interest",":","str",":","return",":","A","`","dict","`","of","<","measure","name",",","measure","value",">","pairs",".",":","rtype",":","Dict","[","Measures",",","float","]"]
code: def _get_distribution_measures_for_col(
      df: pd.DataFrame, col_of_interest: str
  ) -> Dict[Measures, float]:
      """
      Returns a dictionary of distribution balance measures based on the
      given dataset and column of interest.
  
      :param df: The dataset to compute distribution measures on.
      :type df: pd.DataFrame
      :param col_of_interest: The column of interest to compute
          distribution measures on.
      :type col_of_interest: str
      :return: A `dict` of <measure name, measure value> pairs.
      :rtype: Dict[Measures, float]
      """
      f_obs = (
          df.groupby(col_of_interest).size().reset_index(name="count")
      )
      sum_obs = f_obs["count"].sum()
      obs = f_obs["count"] / sum_obs
      ref = DistributionBalanceMeasures._create_reference_distribution(
          n=f_obs.shape[0]
      )
      f_ref = ref * sum_obs
  
      measures = {Constants.FEATURE_NAME.value: col_of_interest}
      for (
          measure,
          func,
      ) in DistributionBalanceMeasures.DISTRIBUTION_METRICS.items():
          if measure in [
              Measures.CHISQ_PVALUE,
              Measures.CHISQ_STATISTIC,
          ]:
              measures[measure.value] = func(f_obs["count"], f_ref)
          else:
              measures[measure.value] = func(obs, ref)
  
      return measures
  
file_path: responsible-ai-toolbox/responsibleai/responsibleai/databalanceanalysis/distribution_balance_measures.py
imports: from typing import Callable, Dict, List
  import numpy
  import pandas
  import scipy
  from responsibleai.databalanceanalysis.balance_measures import BalanceMeasures
  from responsibleai.databalanceanalysis.constants import Constants, Measures
label_desc: Use image node_id 3 for calling the DistributionBalanceMeasures obj's underlying member method code with example usage: obj._get_distribution_measures_for_col(df, col_of_interest) and returns: measures