class_docstr: This class is created to test the three stopping conditions for randomized gridsearch using
  GLM Binomial family.  The three stopping conditions are :
  
  1. max_runtime_secs:
  2. max_models:
  3. metrics.  We will be picking 2 stopping metrics to test this stopping condition with.  One metric
  will be optimized if it increases and the other one should be optimized if it decreases.
  
  I have written 4 tests:
  1. test1_glm_random_grid_search_model_number: this test will not put any stopping conditions
  on randomized search.  The purpose here is to make sure that randomized search will give us all possible
  hyper-parameter combinations.
  2. test2_glm_random_grid_search_max_model: this test the stopping condition of setting the max_model in
  search criteria;
  3. test3_glm_random_grid_search_max_runtime_secs: this test the stopping condition max_runtime_secs
  in search criteria;
  4. test4_glm_random_grid_search_metric: this test the stopping condition of using a metric which can be
  increasing or decreasing.
class_docstr_tok: ["This","class","is","created","to","test","the","three","stopping","conditions","for","randomized","gridsearch","using","GLM","Binomial","family",".","The","three","stopping","conditions","are",":","1.","max_runtime_secs",":","2.","max_models",":","3.","metrics",".","We","will","be","picking","2","stopping","metrics","to","test","this","stopping","condition","with",".","One","metric","will","be","optimized","if","it","increases","and","the","other","one","should","be","optimized","if","it","decreases",".","I","have","written","4","tests",":","1.","test1_glm_random_grid_search_model_number",":","this","test","will","not","put","any","stopping","conditions","on","randomized","search",".","The","purpose","here","is","to","make","sure","that","randomized","search","will","give","us","all","possible","hyper-parameter","combinations",".","2.","test2_glm_random_grid_search_max_model",":","this","test","the","stopping","condition","of","setting","the","max_model","in","search","criteria",";","3.","test3_glm_random_grid_search_max_runtime_secs",":","this","test","the","stopping","condition","max_runtime_secs","in","search","criteria",";","4.","test4_glm_random_grid_search_metric",":","this","test","the","stopping","condition","of","using","a","metric","which","can","be","increasing","or","decreasing","."]
docstr: This test is used to make sure the randomized gridsearch will generate all models specified in the
  hyperparameters if no stopping condition is given in the search criterion.
  
  :param metric_name: string to denote what grid search model should be sort by
  
  :return: None
docstr_tok: ["This","test","is","used","to","make","sure","the","randomized","gridsearch","will","generate","all","models","specified","in","the","hyperparameters","if","no","stopping","condition","is","given","in","the","search","criterion",".",":","param","metric_name",":","string","to","denote","what","grid","search","model","should","be","sort","by",":","return",":","None"]
code: def test1_glm_random_grid_search_model_number(self, metric_name):
      """
      This test is used to make sure the randomized gridsearch will generate all models specified in the
      hyperparameters if no stopping condition is given in the search criterion.
  
      :param metric_name: string to denote what grid search model should be sort by
  
      :return: None
      """
      print(
          "*******************************************************************************************"
      )
      print(
          "test1_glm_random_grid_search_model_number for GLM "
          + self.family
      )
      h2o.cluster_info()
  
      # setup_data our stopping condition here, random discrete and find all models
      search_criteria = {
          "strategy": "RandomDiscrete",
          "stopping_rounds": 0,
          "seed": round(time.time()),
      }
      print(
          "GLM Gaussian grid search_criteria: {0}".format(
              search_criteria
          )
      )
  
      # fire off random grid-search
      random_grid_model = H2OGridSearch(
          H2OGeneralizedLinearEstimator(
              family=self.family, nfolds=self.nfolds
          ),
          hyper_params=self.hyper_params,
          search_criteria=search_criteria,
      )
      random_grid_model.train(
          x=self.x_indices,
          y=self.y_index,
          training_frame=self.training1_data,
      )
  
      # compare number of models built from both gridsearch
      if not (len(random_grid_model) == self.possible_number_models):
          self.test_failed += 1
          self.test_failed_array[self.test_num] = 1
          print(
              "test1_glm_random_grid_search_model_number for GLM: failed, number of models generated"
              "possible model number {0} and randomized gridsearch model number {1} are not "
              "equal.".format(
                  self.possible_number_models, len(random_grid_model)
              )
          )
      else:
          self.max_grid_runtime = pyunit_utils.find_grid_runtime(
              random_grid_model
          )  # time taken to build all models
  
      if self.test_failed_array[self.test_num] == 0:
          print(
              "test1_glm_random_grid_search_model_number for GLM: passed!"
          )
  
      self.test_num += 1
      sys.stdout.flush()
  
file_path: h2o-3/h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py
imports: import sys
  import random
  import os
  from builtins import range
  import time
  import json
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.glm import H2OGeneralizedLinearEstimator
  from h2o.grid.grid_search import H2OGridSearch
label_desc: Use image node_id 5 for calling the Test_glm_random_grid_search obj's underlying member method code with example usage: obj.test1_glm_random_grid_search_model_number(metric_name) without return types