code: def test_gridsearch():
      h2o_data = h2o.import_file(
          path=pyunit_utils.locate(
              "smalldata/gam_test/synthetic_20Cols_binomial_20KRows.csv"
          )
      )
      h2o_data["response"] = h2o_data["response"].asfactor()
      h2o_data["C3"] = h2o_data["C3"].asfactor()
      h2o_data["C7"] = h2o_data["C7"].asfactor()
      h2o_data["C8"] = h2o_data["C8"].asfactor()
      h2o_data["C10"] = h2o_data["C10"].asfactor()
      names = h2o_data.names
      myY = "response"
      myX = names.remove(myY)
      search_criteria = {"strategy": "Cartesian"}
      hyper_parameters = {
          "lambda": [1, 2],
          "subspaces": [
              {
                  "scale": [[0.001], [0.0002]],
                  "bs": [[1], [0]],
                  "gam_columns": [[["c_0"]], [["c_1"]]],
              },
              {
                  "scale": [
                      [0.001, 0.001, 0.001],
                      [0.0002, 0.0002, 0.0002],
                  ],
                  "bs": [[2, 0, 1], [3, 2, 1]],
                  "gam_columns": [
                      [["c_0"], ["c_1"], ["c_3", "c_4", "c_5"]],
                      [["c_1"], ["c_2"], ["c_4", "c_5", "c_6"]],
                  ],
              },
          ],
      }
      hyper_parameters2 = {
          "lambda": [1, 2],
          "subspaces": [
              {
                  "scale": [[0.001], [0.0002]],
                  "bs": [[1], [0]],
                  "gam_columns": [[["c_0"]], [["c_1"]]],
              },
              {
                  "scale": [
                      [0.001, 0.001, 0.001],
                      [0.0002, 0.0002, 0.0002],
                  ],
                  "bs": [[2, 0, 1], [3, 2, 1]],
                  "gam_columns": [
                      ["c_0", ["c_1"], ["c_3", "c_4", "c_5"]],
                      ["c_1", ["c_2"], ["c_4", "c_5", "c_6"]],
                  ],
              },
          ],
      }
      h2o_model = H2OGridSearch(
          H2OGeneralizedAdditiveEstimator(
              family="binomial", keep_gam_cols=True, seed=1
          ),
          hyper_params=hyper_parameters,
          search_criteria=search_criteria,
      )
      h2o_model.train(x=myX, y=myY, training_frame=h2o_data)
      h2o_model2 = H2OGridSearch(
          H2OGeneralizedAdditiveEstimator(
              family="binomial", keep_gam_cols=True, seed=1
          ),
          hyper_params=hyper_parameters2,
          search_criteria=search_criteria,
      )
      h2o_model2.train(x=myX, y=myY, training_frame=h2o_data)
      # compare two models by checking their coefficients.  They should be the same
      for index in range(0, len(h2o_model)):
          model1Coef = h2o_model[index].coef()
          model2Coef = h2o_model2[index].coef()
          pyunit_utils.assertEqualCoeffDicts(
              model1Coef, model2Coef, tol=1e-6
          )
  
imports: import sys
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.gam import H2OGeneralizedAdditiveEstimator
  from h2o.grid.grid_search import H2OGridSearch
label_desc: Use image node_id 1 for calling a global function with example usage: test_gridsearch() without return types