class_docstr: Calculates absolute metrics for a given dataframe with model scores and
  labels, divided by different values on protected attributes.
  
  Attributes
  ----------
  absolute_metrics : List[str]
      Calculated bias metrics.
  
  Methods
  -------
  get_crosstabs(df, score_thresholds=None, attr_cols=None, score_col="score", label_col="label_value")
      Calculates metrics for a given dataframe.
  get_multimodel_crosstabs(df, score_thresholds=None, attr_cols=None, score_col="score", label_col="label_value")
      Calculates metrics for a given dataframe with multiple models.
class_docstr_tok: ["Calculates","absolute","metrics","for","a","given","dataframe","with","model","scores","and","labels",",","divided","by","different","values","on","protected","attributes",".","Attributes","--","--","--","--","--","absolute_metrics",":","List","[","str","]","Calculated","bias","metrics",".","Methods","--","--","--","-","get_crosstabs","(","df",",","score_thresholds=None",",","attr_cols=None",",","score_col=","''","score","''",",","label_col=","''","label_value","''",")","Calculates","metrics","for","a","given","dataframe",".","get_multimodel_crosstabs","(","df",",","score_thresholds=None",",","attr_cols=None",",","score_col=","''","score","''",",","label_col=","''","label_value","''",")","Calculates","metrics","for","a","given","dataframe","with","multiple","models","."]
docstr: Creates a summary plot of the fairness metrics.
  
  Parameters
  ----------
  df : pandas.DataFrame
      Results of model classification. Must contain:
      [score_col, label_col, attr_cols].
  score_col : str
      Column of the dataframe that represents classification result.
      Must be numeric / binary.
  label_col : str
      Column of the dataframe that represents label of instance.
      Values in the column must be binary.
  attr_cols : List[str]
      Columns with protected attributes. If not specified, all
      columns except 'id', 'model_id', 'entity_id', 'score', 'label_value'
      are used. The values in these columns must be categorical.
  reference_groups : dict[str, str], optional
      Dictionary with the reference groups for each attribute. Defaults
      to None.
  **kwargs
      Keyword arguments to pass to the `get_crosstabs` method.
docstr_tok: ["Creates","a","summary","plot","of","the","fairness","metrics",".","Parameters","--","--","--","--","--","df",":","pandas.DataFrame","Results","of","model","classification",".","Must","contain",":","[","score_col",",","label_col",",","attr_cols","]",".","score_col",":","str","Column","of","the","dataframe","that","represents","classification","result",".","Must","be","numeric","\/","binary",".","label_col",":","str","Column","of","the","dataframe","that","represents","label","of","instance",".","Values","in","the","column","must","be","binary",".","attr_cols",":","List","[","str","]","Columns","with","protected","attributes",".","If","not","specified",",","all","columns","except","'id","'",",","'model_id","'",",","'entity_id","'",",","'score","'",",","'label_value'","are","used",".","The","values","in","these","columns","must","be","categorical",".","reference_groups",":","dict","[","str",",","str","]",",","optional","Dictionary","with","the","reference","groups","for","each","attribute",".","Defaults","to","None",".","*","*","kwargs","Keyword","arguments","to","pass","to","the","`","get_crosstabs","`","method","."]
code: def calculate_disparities(
      self,
      df: pd.DataFrame,
      score_col: str,
      label_col: str,
      attr_cols: List[str],
      reference_groups: dict[str, str] = None,
      **kwargs,
  ):
      """
      Creates a summary plot of the fairness metrics.
  
      Parameters
      ----------
      df : pandas.DataFrame
          Results of model classification. Must contain:
          [score_col, label_col, attr_cols].
      score_col : str
          Column of the dataframe that represents classification result.
          Must be numeric / binary.
      label_col : str
          Column of the dataframe that represents label of instance.
          Values in the column must be binary.
      attr_cols : List[str]
          Columns with protected attributes. If not specified, all
          columns except 'id', 'model_id', 'entity_id', 'score', 'label_value'
          are used. The values in these columns must be categorical.
      reference_groups : dict[str, str], optional
          Dictionary with the reference groups for each attribute. Defaults
          to None.
      **kwargs
          Keyword arguments to pass to the `get_crosstabs` method.
      """
      cm_metrics, _ = self.get_crosstabs(
          df=df,
          score_col=score_col,
          label_col=label_col,
          attr_cols=attr_cols,
          **kwargs,
      )
  
      if not reference_groups:
          reference_groups = {
              attr: df[attr].mode().values[0] for attr in attr_cols
          }
  
      b = Bias()
  
      disparity_metrics = b.get_disparity_predefined_groups(
          cm_metrics, df, ref_groups_dict=reference_groups
      )
  
      return disparity_metrics
  
file_path: aequitas/src/aequitas/group.py
imports: import logging
  import uuid
  from typing import Any, Dict, List, Tuple, Union
  from collections import OrderedDict
  import numpy
  import pandas
  from .bias import Bias
  from .plot import summary, disparity, absolute
label_desc: Use image node_id 7 for calling the Group obj's underlying member method code with example usage: obj.calculate_disparities(df, score_col, label_col, attr_cols, reference_groups) and returns: disparity_metrics