code: def metalearner_parameters_test():
      train = h2o.import_file(
          pyunit_utils.locate("smalldata/iris/iris_train.csv")
      )
      test = h2o.import_file(
          pyunit_utils.locate("smalldata/iris/iris_test.csv")
      )
      x = train.columns
      y = "species"
      x.remove(y)
  
      nfolds = 2
      gbm = H2OGradientBoostingEstimator(
          nfolds=nfolds,
          fold_assignment="Modulo",
          keep_cross_validation_predictions=True,
      )
      gbm.train(x=x, y=y, training_frame=train)
      rf = H2ORandomForestEstimator(
          nfolds=nfolds,
          fold_assignment="Modulo",
          keep_cross_validation_predictions=True,
      )
      rf.train(x=x, y=y, training_frame=train)
  
      se_nb = H2OStackedEnsembleEstimator(
          training_frame=train,
          validation_frame=test,
          base_models=[gbm.model_id, rf.model_id],
          metalearner_algorithm="naivebayes",
          metalearner_params={"min_prob": 0.5},
      )
      se_nb.train(x=x, y=y, training_frame=train)
  
      assert (
          se_nb.actual_params["metalearner_algorithm"] == "naivebayes"
      )
      assert (
          '{"min_prob": [0.5]}'
          == se_nb.actual_params["metalearner_params"]
      )
  
      se_xgb = H2OStackedEnsembleEstimator(
          training_frame=train,
          validation_frame=test,
          base_models=[gbm.model_id, rf.model_id],
          metalearner_algorithm="xgboost",
          metalearner_params={"booster": "dart"},
      )
      se_xgb.train(x=x, y=y, training_frame=train)
  
      assert se_xgb.actual_params["metalearner_algorithm"] == "xgboost"
      assert (
          '{"booster": ["dart"]}'
          == se_xgb.actual_params["metalearner_params"]
      )
  
file_path: h2o-3/h2o-py/tests/testdir_algos/stackedensemble/pyunit_stackedensemble_metalearner.py
imports: import sys
  import warnings
  import h2o
  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 3 for calling a global function with example usage: metalearner_parameters_test() without return types