class_docstr: This class computes a set of feature balance measures that allow us to see
  whether each combination of a feature is receiving the positive outcome
  (true prediction) at balanced probability.
docstr: For the column of interest, computes "gaps" between two classes
  (feature values) for every combination of values in the column.
  Returns a dataframe that contains as many rows as there are unique
  combinations in the column of interest and for each row, the
  two feature values being compared and a dictionary of measure values.
  
  :param df: The dataset to compute gaps between feature values on.
  :type df: pd.DataFrame
  :param col_of_interest: The column of interest to compute gaps between
      feature values on.
  :type col_of_interest: str
  :param label_col: The name of the label column.
  :type label_col: str
  :param pos_label: The label value that denotes a positive label.
  :type pos_label: str
  :return: A dataframe that contains four columns.
  :rtype: pd.DataFrame
docstr_tok: ["For","the","column","of","interest",",","computes","``","gaps","''","between","two","classes","(","feature","values",")","for","every","combination","of","values","in","the","column",".","Returns","a","dataframe","that","contains","as","many","rows","as","there","are","unique","combinations","in","the","column","of","interest","and","for","each","row",",","the","two","feature","values","being","compared","and","a","dictionary","of","measure","values",".",":","param","df",":","The","dataset","to","compute","gaps","between","feature","values","on",".",":","type","df",":","pd.DataFrame",":","param","col_of_interest",":","The","column","of","interest","to","compute","gaps","between","feature","values","on",".",":","type","col_of_interest",":","str",":","param","label_col",":","The","name","of","the","label","column",".",":","type","label_col",":","str",":","param","pos_label",":","The","label","value","that","denotes","a","positive","label",".",":","type","pos_label",":","str",":","return",":","A","dataframe","that","contains","four","columns",".",":","rtype",":","pd.DataFrame"]
code: def _get_measure_gaps_for_col(
      df: pd.DataFrame,
      col_of_interest: str,
      label_col: str,
      pos_label: str,
  ) -> pd.DataFrame:
      """
      For the column of interest, computes "gaps" between two classes
      (feature values) for every combination of values in the column.
      Returns a dataframe that contains as many rows as there are unique
      combinations in the column of interest and for each row, the
      two feature values being compared and a dictionary of measure values.
  
      :param df: The dataset to compute gaps between feature values on.
      :type df: pd.DataFrame
      :param col_of_interest: The column of interest to compute gaps between
          feature values on.
      :type col_of_interest: str
      :param label_col: The name of the label column.
      :type label_col: str
      :param pos_label: The label value that denotes a positive label.
      :type pos_label: str
      :return: A dataframe that contains four columns.
      :rtype: pd.DataFrame
      """
      unique_vals = df[col_of_interest].unique()
  
      if unique_vals.size < 2:
          warnings.warn(
              (
                  f"Column '{col_of_interest}' has less than 2"
                  " unique values, so feature balance measures for"
                  f" {label_col}=={pos_label} are not being computed"
                  " for this column."
              )
          )
          return pd.DataFrame()
  
      # create list of tuples of the pairings of classes
      pairs = list(itertools.combinations(unique_vals, 2))
      gap_df = pd.DataFrame(
          pairs,
          columns=[
              FeatureBalanceMeasures.CLASS_A,
              FeatureBalanceMeasures.CLASS_B,
          ],
      )
      gap_df[Constants.FEATURE_NAME.value] = col_of_interest
  
      metrics_df = FeatureBalanceMeasures._get_individual_measures(
          df=df,
          col_of_interest=col_of_interest,
          label_col=label_col,
          pos_label=pos_label,
      )
  
      for measure in FeatureBalanceMeasures.FEATURE_METRICS.keys():
          classA_metric = gap_df[FeatureBalanceMeasures.CLASS_A].apply(
              lambda row: metrics_df.loc[row]
          )[measure.value]
          classB_metric = gap_df[FeatureBalanceMeasures.CLASS_B].apply(
              lambda row: metrics_df.loc[row]
          )[measure.value]
          gap_df[measure.value] = classA_metric - classB_metric
  
      # For overall stats
      for (
          measure,
          test_stat,
      ), func in FeatureBalanceMeasures.OVERALL_METRICS.items():
          gap_df[measure.value] = gap_df[test_stat.value].apply(
              lambda row: func(row, len(unique_vals))
          )
  
      return gap_df
  
imports: import itertools
  import warnings
  from typing import Callable, Dict, List, Tuple
  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 FeatureBalanceMeasures obj's underlying member method code with example usage: obj._get_measure_gaps_for_col(df, col_of_interest, label_col, pos_label) and returns: gap_df, pd