code: def test_train_subset_models_taiwan():
      data = h2o.import_file(
          pyunit_utils.locate(
              "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",
          "MARRIAGE",
      ]
  
      for c in [y] + protected_columns:
          data[c] = data[c].asfactor()
  
      train, test = data.split_frame([0.8])
  
      reference = ["1", "2", "2"]  # university educated single man
      favorable_class = "0"  # no default next month
  
      ig = H2OInfogram(protected_columns=protected_columns)
      ig.train(x, y, training_frame=train)
  
      # GBM
      da = ig.train_subset_models(
          H2OGradientBoostingEstimator,
          y,
          train,
          test,
          protected_columns,
          reference,
          favorable_class,
      )
      assert da.nrows == len(x)
      assert (
          (da[:, "cair"] > 0.8) & (da[:, "cair"] < 1.25)
      ).any()  # four-fifths rule
  
      # AutoML
      da = ig.train_subset_models(
          H2OAutoML,
          y,
          train,
          test,
          protected_columns,
          reference,
          favorable_class,
          max_models=2,
      )
      assert da.nrows == 2 * len(x) + len(x)  # models + SEs
      assert (
          (da[:, "cair"] > 0.8) & (da[:, "cair"] < 1.25)
      ).any()  # four-fifths rule
  
      # GRID
      da = ig.train_subset_models(
          H2OGridSearch,
          y,
          train,
          test,
          protected_columns,
          reference,
          favorable_class,
          model=H2OGradientBoostingEstimator(),
          hyper_params=dict(ntrees=[1, 3, 5]),
      )
      assert da.nrows == 3 * len(x)
      assert ((da[:, "cair"] > 0.8) & (da[:, "cair"] < 1.25)).any()
  
file_path: h2o-3/h2o-py/tests/testdir_misc/pyunit_fairness_grid.py
imports: import os
  import sys
  import h2o
  from tests import pyunit_utils, test_plot_result_saving
  from h2o.automl import H2OAutoML
  from h2o.estimators import *
  from h2o.grid import *
label_desc: Use image node_id 2 for calling a global function with example usage: test_train_subset_models_taiwan() without return types