docstr: Plot ROC curve per protected group.
  
  :param model: H2O Model Object
  :param frame: H2OFrame
  :param protected_columns: List of categorical columns that contain sensitive information
                            such as race, gender, age etc.
  :param reference: List of values corresponding to a reference for each protected columns.
                    If set to ``None``, it will use the biggest group as the reference.
  :param favorable_class: Positive/favorable outcome class of the response.
  :param figsize: Figure size; passed directly to Matplotlib
  :param save_plot_path: A path to save the plot via using matplotlib function savefig.
  
  :return: Matplotlib Figure object
  
  :examples:
  >>> from h2o.estimators import H2OGradientBoostingEstimator
  >>> data = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/admissibleml_test/taiwan_credit_card_uci.csv")
  >>> x = ['LIMIT_BAL', 'AGE', 'PAY_0', 'PAY_2', 'PAY_3', 'PAY_4', 'PAY_5', 'PAY_6', 'BILL_AMT1', 'BILL_AMT2', 'BILL_AMT3',
  >>>      'BILL_AMT4', 'BILL_AMT5', 'BILL_AMT6', 'PAY_AMT1', 'PAY_AMT2', 'PAY_AMT3', 'PAY_AMT4', 'PAY_AMT5', 'PAY_AMT6']
  >>> y = "default payment next month"
  >>> protected_columns = ['SEX', 'EDUCATION']
  >>>
  >>> for c in [y] + protected_columns:
  >>>     data[c] = data[c].asfactor()
  >>>
  >>> train, test = data.split_frame([0.8])
  >>>
  >>> reference = ["1", "2"]  # university educated man
  >>> favorable_class = "0"  # no default next month
  >>>
  >>> gbm = H2OGradientBoostingEstimator()
  >>> gbm.train(x, y, training_frame=train)
  >>>
  >>> gbm.fair_roc_plot(test, protected_columns, reference, favorable_class)
docstr_tok: ["Plot","ROC","curve","per","protected","group",".",":","param","model",":","H2O","Model","Object",":","param","frame",":","H2OFrame",":","param","protected_columns",":","List","of","categorical","columns","that","contain","sensitive","information","such","as","race",",","gender",",","age","etc",".",":","param","reference",":","List","of","values","corresponding","to","a","reference","for","each","protected","columns",".","If","set","to","``","None","``",",","it","will","use","the","biggest","group","as","the","reference",".",":","param","favorable_class",":","Positive\/favorable","outcome","class","of","the","response",".",":","param","figsize",":","Figure","size",";","passed","directly","to","Matplotlib",":","param","save_plot_path",":","A","path","to","save","the","plot","via","using","matplotlib","function","savefig",".",":","return",":","Matplotlib","Figure","object",":","examples",":",">",">",">","from","h2o.estimators","import","H2OGradientBoostingEstimator",">",">",">","data","=","h2o.import_file","(","``","https",":","\/\/s3.amazonaws.com\/h2o-public-test-data\/smalldata\/admissibleml_test\/taiwan_credit_card_uci.csv","''",")",">",">",">","x","=","[","'LIMIT_BAL","'",",","'AGE","'",",","'PAY_0","'",",","'PAY_2","'",",","'PAY_3","'",",","'PAY_4","'",",","'PAY_5","'",",","'PAY_6","'",",","'BILL_AMT1","'",",","'BILL_AMT2","'",",","'BILL_AMT3","'",",",">",">",">","'BILL_AMT4","'",",","'BILL_AMT5","'",",","'BILL_AMT6","'",",","'PAY_AMT1","'",",","'PAY_AMT2","'",",","'PAY_AMT3","'",",","'PAY_AMT4","'",",","'PAY_AMT5","'",",","'PAY_AMT6","'","]",">",">",">","y","=","``","default","payment","next","month","''",">",">",">","protected_columns","=","[","'SEX","'",",","'EDUCATION","'","]",">",">",">",">",">",">","for","c","in","[","y","]","+","protected_columns",":",">",">",">","data","[","c","]","=","data","[","c","]",".asfactor","(",")",">",">",">",">",">",">","train",",","test","=","data.split_frame","(","[","0.8","]",")",">",">",">",">",">",">","reference","=","[","``","1","''",",","``","2","''","]","#","university","educated","man",">",">",">","favorable_class","=","``","0","''","#","no","default","next","month",">",">",">",">",">",">","gbm","=","H2OGradientBoostingEstimator","(",")",">",">",">","gbm.train","(","x",",","y",",","training_frame=train",")",">",">",">",">",">",">","gbm.fair_roc_plot","(","test",",","protected_columns",",","reference",",","favorable_class",")"]
code: def fair_roc_plot(
      self,
      frame,
      protected_columns,
      reference,
      favorable_class,
      figsize=(16, 9),
      save_plot_path=None,
  ):
      """
      Plot ROC curve per protected group.
  
      :param model: H2O Model Object
      :param frame: H2OFrame
      :param protected_columns: List of categorical columns that contain sensitive information
                                such as race, gender, age etc.
      :param reference: List of values corresponding to a reference for each protected columns.
                        If set to ``None``, it will use the biggest group as the reference.
      :param favorable_class: Positive/favorable outcome class of the response.
      :param figsize: Figure size; passed directly to Matplotlib
      :param save_plot_path: A path to save the plot via using matplotlib function savefig.
  
      :return: Matplotlib Figure object
  
      :examples:
      >>> from h2o.estimators import H2OGradientBoostingEstimator
      >>> data = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/admissibleml_test/taiwan_credit_card_uci.csv")
      >>> x = ['LIMIT_BAL', 'AGE', 'PAY_0', 'PAY_2', 'PAY_3', 'PAY_4', 'PAY_5', 'PAY_6', 'BILL_AMT1', 'BILL_AMT2', 'BILL_AMT3',
      >>>      'BILL_AMT4', 'BILL_AMT5', 'BILL_AMT6', 'PAY_AMT1', 'PAY_AMT2', 'PAY_AMT3', 'PAY_AMT4', 'PAY_AMT5', 'PAY_AMT6']
      >>> y = "default payment next month"
      >>> protected_columns = ['SEX', 'EDUCATION']
      >>>
      >>> for c in [y] + protected_columns:
      >>>     data[c] = data[c].asfactor()
      >>>
      >>> train, test = data.split_frame([0.8])
      >>>
      >>> reference = ["1", "2"]  # university educated man
      >>> favorable_class = "0"  # no default next month
      >>>
      >>> gbm = H2OGradientBoostingEstimator()
      >>> gbm.train(x, y, training_frame=train)
      >>>
      >>> gbm.fair_roc_plot(test, protected_columns, reference, favorable_class)
      """
      import h2o
      from h2o.utils.shared_utils import can_use_numpy
  
      if not can_use_numpy():
          raise ImportError("numpy is required for fair_roc_plot.")
      from h2o.explanation._explain import NumpyFrame
      from h2o.plot import get_matplotlib_pyplot
      from h2o.utils.typechecks import assert_is_type
  
      assert_is_type(frame, h2o.H2OFrame)
      assert_is_type(protected_columns, [str])
      assert_is_type(reference, [str])
      assert_is_type(favorable_class, str)
      assert_is_type(figsize, tuple, list)
  
      plt = get_matplotlib_pyplot(False, raise_if_not_available=True)
      fair = self.fairness_metrics(
          frame=frame,
          protected_columns=protected_columns,
          reference=reference,
          favorable_class=favorable_class,
      )
      roc_prefix = "thresholds_and_metrics_"
      rocs = [k for k in fair.keys() if k.startswith(roc_prefix)]
      plt.figure(figsize=figsize)
      for roc in rocs:
          df = NumpyFrame(fair[roc])
          plt.plot(df["fpr"], df["tpr"], label=roc[len(roc_prefix) :])
      plt.plot([0, 1], [0, 1], c="gray", linestyle="dashed")
      plt.grid()
      plt.legend()
      plt.xlabel("False Positive Rate")
      plt.ylabel("True Positive Rate")
      plt.title("Receiver Operating Characteristic Curve")
      if save_plot_path is not None:
          plt.savefig(fname=save_plot_path)
      return plt.gcf()
  
file_path: h2o-3/h2o-py/h2o/model/extensions/fairness.py
imports: from collections import defaultdict
  from itertools import product
  from h2o.utils.threading import local_context
label_desc: Use image node_id 3 for calling the Fairness obj's underlying member method code with example usage: obj.fair_roc_plot(frame, protected_columns, reference, favorable_class, figsize, save_plot_path) and returns: plt