class_docstr: Class for the visualization of Pareto models. Handles the intermediary steps
  between having the results and creating the plot.
  
  Parameters
  ----------
  results : dict[str, dict[str, Result]]
      A dictionary of results, obtained from
      aequitas.fairflow.utils.artifacts.read_results.
  dataset : str
      Name of the dataset to be used in the Pareto plot.
  method : str, optional
      Name of the method to plot. If none, all methods will be plotted.
  fairness_metric : {"Predictive Equality", "Equal Opportunity", "Demographic Parity"}
      The default fairness metric to use in the Pareto plot.
  performance_metric : {"TPR", "FPR", "FNR", "Accuracy", "Precision"}
      The default performance metric to use in the Pareto plot.
  alpha : float, optional
      The alpha value to use in the Pareto plot.
  direction : {"minimize", "maximize"}, optional
      The direction to use in the Pareto plot.
class_docstr_tok: ["Class","for","the","visualization","of","Pareto","models",".","Handles","the","intermediary","steps","between","having","the","results","and","creating","the","plot",".","Parameters","--","--","--","--","--","results",":","dict","[","str",",","dict","[","str",",","Result","]","]","A","dictionary","of","results",",","obtained","from","aequitas.fairflow.utils.artifacts.read_results",".","dataset",":","str","Name","of","the","dataset","to","be","used","in","the","Pareto","plot",".","method",":","str",",","optional","Name","of","the","method","to","plot",".","If","none",",","all","methods","will","be","plotted",".","fairness_metric",":","{","``","Predictive","Equality","''",",","``","Equal","Opportunity","''",",","``","Demographic","Parity","''","}","The","default","fairness","metric","to","use","in","the","Pareto","plot",".","performance_metric",":","{","``","TPR","''",",","``","FPR","''",",","``","FNR","''",",","``","Accuracy","''",",","``","Precision","''","}","The","default","performance","metric","to","use","in","the","Pareto","plot",".","alpha",":","float",",","optional","The","alpha","value","to","use","in","the","Pareto","plot",".","direction",":","{","``","minimize","''",",","``","maximize","''","}",",","optional","The","direction","to","use","in","the","Pareto","plot","."]
docstr: Render interactive application to audit bias of a given model.
  
  Parameters
  ----------
  model_id : int
      The id of the model to audit.
docstr_tok: ["Render","interactive","application","to","audit","bias","of","a","given","model",".","Parameters","--","--","--","--","--","model_id",":","int","The","id","of","the","model","to","audit","."]
code: def bias_audit(
      self,
      model_id: int,
      dataset: Any,
      sensitive_attribute: Union[str, list[str]],
      metrics: list[str] = ["tpr", "fpr"],
      fairness_threshold: float = 1.2,
      results_path: Union[Path, str] = "examples/experiment_results",
      reference_groups: Optional[dict[str, str]] = None,
  ):
      """Render interactive application to audit bias of a given model.
  
      Parameters
      ----------
      model_id : int
          The id of the model to audit.
      """
      if isinstance(results_path, str):
          results_path = Path(results_path)
  
      if isinstance(sensitive_attribute, str):
          sensitive_attribute = [sensitive_attribute]
  
      method_name = self.results.iloc[model_id]["internal_method_name"]
      method_id = self.results.iloc[model_id]["internal_id"]
  
      predictions_path = (
          results_path
          / self.dataset
          / method_name
          / str(method_id)
          / "test_bin.parquet"
      )
  
      # Check if predictions path exists
      if not predictions_path.exists():
          raise FileNotFoundError(
              f"Predictions for model {method_name} with id {method_id} not found. "
              "Please make sure that the predictions are stored in the correct path."
          )
  
      # Read the predictions
      predictions = pd.read_parquet(predictions_path)
  
      # Add the predictions to the DataFrame
      label = dataset.y.name
      dataset = dataset.copy()
      dataset["predictions"] = predictions
  
      dataset[sensitive_attribute] = dataset[
          sensitive_attribute
      ].astype(str)
  
      g = Group()
      b = Bias()
  
      cm_metrics, _ = g.get_crosstabs(
          df=dataset,
          score_col="predictions",
          label_col=label,
          attr_cols=sensitive_attribute,
      )
  
      if not reference_groups:
          reference_groups = {
              attr: dataset[attr].mode().values[0]
              for attr in sensitive_attribute
          }
  
      disparity_metrics = b.get_disparity_predefined_groups(
          cm_metrics, dataset, ref_groups_dict=reference_groups
      )
  
      return summary(
          disparity_metrics,
          metrics,
          fairness_threshold=fairness_threshold,
      )
  
file_path: aequitas/src/aequitas/fairflow/plots/pareto/plot.py
imports: from typing import Any, Literal, Optional, Union
  from pathlib import Path
  import numpy
  import pandas
  from ...evaluation import Result
  from ....bias import Bias
  from ....group import Group
  from ....plot import summary
label_desc: Use image node_id 8 for calling the Plot obj's underlying member method code with example usage: obj.bias_audit(model_id, dataset, sensitive_attribute, metrics, fairness_threshold, results_path, reference_groups) and returns: summary