code: def test_megan_failure():
      df = h2o.import_file(
          "https://s3.amazonaws.com/h2o-public-test-data/smalldata/demos/bank-additional-full.csv"
      )
      y = "y"
      x = [
          i
          for i in df.col_names
          if i not in [y, "previous", "poutcome", "pdays"]
      ]
  
      # Build & train the model:
      backward_model = H2OModelSelectionEstimator(
          min_predictor_number=5,
          seed=1234,
          mode="backward",
          remove_collinear_columns=True,
      )
      backward_model.train(x=x, y=y, training_frame=df)
      coefficient_orders = backward_model._model_json["output"][
          "coefficient_names"
      ]
      predictor_z_values = backward_model._model_json["output"][
          "z_values"
      ]
      num_models = len(coefficient_orders)
      # verify that deleted predictors have minimum abs(z-values)
      redundantPredictors = (
          backward_model.get_predictors_removed_per_step()[
              num_models - 1
          ]
      )
      redundantPredictors = redundantPredictors[
          0 : (len(redundantPredictors) - 1)
      ]
      redundantPredictors = [
          x.split("(redundant_predictor)")[0]
          for x in redundantPredictors
      ]
      best_predictor_subset = backward_model.get_best_model_predictors()
  
      counter = 0
      back_coef = backward_model.coef()
      for ind in list(range(num_models - 1, 0, -1)):
          pred_large = coefficient_orders[ind]
          pred_small = coefficient_orders[ind - 1]
          z_values_list = predictor_z_values[ind]
          predictor_removed = list(
              set(pred_large).symmetric_difference(pred_small)
          )
          if len(predictor_removed) > 1:
              predictor_removed = [
                  x
                  for x in predictor_removed
                  if not (x in redundantPredictors)
              ]
          z_values_removed = extract_z_removed(
              pred_large, predictor_removed, z_values_list
          )
  
          # assert z-values removed has smallest magnitude
          x = best_predictor_subset[ind]
          assert_smallest_z_removed(
              back_coef[ind],
              z_values_list,
              z_values_removed,
              pred_large,
              predictor_removed,
              x,
              y,
              df,
          )
  
          counter += 1
  
file_path: h2o-3/h2o-py/tests/testdir_algos/modelselection/pyunit_PUBDEV_8675_modelselection_fail.py
imports: import sys
  import math
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.model_selection import H2OModelSelectionEstimator
  from h2o.estimators.glm import H2OGeneralizedLinearEstimator
label_desc: Use image node_id 1 for calling a global function with example usage: test_megan_failure() without return types