class_docstr: PUBDEV-1843: Grid testing.  Subtask 5.
  
  This class is created to test the gridsearch for kmeans algo over differ validation datasets.  Only one test
  is performed here.
  
  Test Descriptions:
      a. choose a fixed set of parameters to use in the hyper-parameters for gridsearch.  However, must grid over
         the validation_frame parameter.
      b. Next, build H2O kmeans models using grid search and check out the performance metrics with the different
         validation datasets.
class_docstr_tok: ["PUBDEV-1843",":","Grid","testing",".","Subtask","5",".","This","class","is","created","to","test","the","gridsearch","for","kmeans","algo","over","differ","validation","datasets",".","Only","one","test","is","performed","here",".","Test","Descriptions",":","a.","choose","a","fixed","set","of","parameters","to","use","in","the","hyper-parameters","for","gridsearch",".","However",",","must","grid","over","the","validation_frame","parameter",".","b",".","Next",",","build","H2O","kmeans","models","using","grid","search","and","check","out","the","performance","metrics","with","the","different","validation","datasets","."]
docstr: test_kmeans_grid_search_over_validation_datasets performs the following:
  a. build H2O kmeans models using grid search.
  b. For each model built using grid search, print out the total_sum_squares errors.
  c. If an exception was thrown, mark the test as failed.
docstr_tok: ["test_kmeans_grid_search_over_validation_datasets","performs","the","following",":","a.","build","H2O","kmeans","models","using","grid","search",".","b",".","For","each","model","built","using","grid","search",",","print","out","the","total_sum_squares","errors",".","c.","If","an","exception","was","thrown",",","mark","the","test","as","failed","."]
code: def test_kmeans_grid_search_over_validation_datasets(self):
      """
      test_kmeans_grid_search_over_validation_datasets performs the following:
      a. build H2O kmeans models using grid search.
      b. For each model built using grid search, print out the total_sum_squares errors.
      c. If an exception was thrown, mark the test as failed.
      """
      print(
          "*******************************************************************************************"
      )
      print(
          "test_kmeans_grid_search_over_validation_datasets for kmeans "
      )
      h2o.cluster_info()
  
      print(
          "Hyper-parameters used here is {0}".format(self.hyper_params)
      )
  
      # try:
      #   start grid search
      grid_model = H2OGridSearch(
          H2OKMeansEstimator(), hyper_params=self.hyper_params
      )
      grid_model.train(
          x=self.x_indices, training_frame=self.training1_data
      )
  
      for each_model in grid_model:
          summary_list = each_model._model_json["output"][
              "validation_metrics"
          ]
          if (summary_list is not None) and (
              summary_list._metric_json is not None
          ):
              grid_model_metrics = summary_list._metric_json["totss"]
              print(
                  "total sum of squares of a model is: {0}".format(
                      grid_model_metrics
                  )
              )
          else:
              print(
                  'model._model_json["output"]["validation_metrics"] of a model is None for some reason....'
              )
  
file_path: h2o-3/h2o-py/dynamic_tests/testdir_algos/kmeans/pyunit_NOFEATURE_kmeans_gridsearch_over_validation_frame.py
imports: import sys
  import os
  from builtins import range
  import time
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.kmeans import H2OKMeansEstimator
  from h2o.grid.grid_search import H2OGridSearch
label_desc: Use image node_id 3 for calling the Test_kmeans_grid_search obj's underlying member method code with example usage: obj.test_kmeans_grid_search_over_validation_datasets() without return types