code: def test_suite_stackedensemble_validation_frame(blending=False):
      def test_validation_metrics_are_computed_when_providing_validation_frame():
          ds = prepare_data(blending)
          base_models = train_base_models(ds)
          se_valid = train_stacked_ensemble(
              ds, base_models, validation_frame=ds.valid
          )
  
          assert se_valid.model_performance(valid=True) is not None
          assert (
              type(se_valid.model_performance(valid=True))
              == h2o.model.metrics.binomial.H2OBinomialModelMetrics
          )
          assert type(se_valid.auc(valid=True)) == float
  
      def test_a_better_model_is_produced_with_validation_frame():
          ds = prepare_data(blending)
          base_models = train_base_models(ds)
          se_no_valid = train_stacked_ensemble(ds, base_models)
          se_valid = train_stacked_ensemble(
              ds, base_models, validation_frame=ds.valid
          )
  
          assert se_no_valid.model_performance(valid=True) is None
          assert se_valid.model_performance(valid=True) is not None
  
          se_no_valid_perf = se_no_valid.model_performance(
              test_data=ds.test
          )
          se_valid_perf = se_valid.model_performance(test_data=ds.test)
          tolerance = 1e-3  # ad hoc tolerance as there's no guarantee perf will actually be better with validation frame
          assert (
              se_no_valid_perf.auc() < se_valid_perf.auc()
              or (se_no_valid_perf.auc() - se_valid_perf.auc())
              < tolerance
          ), (
              "Expected that a better model would be produced when passing a validation frame, bot obtained: "
              "AUC (no validation) = {}, AUC (validation frame) = {}".format(
                  se_no_valid_perf.auc(), se_valid_perf.auc()
              )
          )
  
      return [
          pu.tag_test(test, "blending" if blending else None)
          for test in [
              test_validation_metrics_are_computed_when_providing_validation_frame,
              test_a_better_model_is_produced_with_validation_frame,
          ]
      ]
  
file_path: h2o-3/h2o-py/tests/testdir_algos/stackedensemble/pyunit_stackedensemble_validation_frame.py
imports: import h2o
  import sys
  import h2o.model.metrics.binomial
  from h2o.estimators.random_forest import H2ORandomForestEstimator
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
  from h2o.estimators.stackedensemble import H2OStackedEnsembleEstimator
  from tests import pyunit_utils
label_desc: Use image node_id 4 for calling a global function with example usage: test_suite_stackedensemble_validation_frame(blending) and returns: unknown