class_docstr: PUBDEV-1843: Grid testing.  Subtask 2.
  
  This class is created to test the gridsearch for PCA algo and make sure it runs.  Only one test is performed
  here.
  
  Test Descriptions:
      a. grab all truely griddable parameters and randomly or manually set the parameter values.
      b. Next, build H2O PCA models using grid search.  Count and make sure models
         are only built for hyper-parameters set to legal values.  No model is built for bad hyper-parameters
         values.  We should instead get a warning/error message printed out.
      c. For each model built using grid search, we will extract the parameters used in building
         that model and manually build a H2O PCA model.  Training metrics are calculated from the
         gridsearch model and the manually built model.  If their metrics
         differ by too much, print a warning message but don't fail the test.
      d. we will check and make sure the models are built within the max_runtime_secs time limit that was set
         for it as well.  If max_runtime_secs was exceeded, declare test failure.
  
  Note that for hyper-parameters containing all legal parameter names and parameter value lists with legal
  and illegal values, grid-models should be built for all combinations of legal parameter values.  For
  illegal parameter values, a warning/error message should be printed out to warn the user but the
  program should not throw an exception.
class_docstr_tok: ["PUBDEV-1843",":","Grid","testing",".","Subtask","2",".","This","class","is","created","to","test","the","gridsearch","for","PCA","algo","and","make","sure","it","runs",".","Only","one","test","is","performed","here",".","Test","Descriptions",":","a.","grab","all","truely","griddable","parameters","and","randomly","or","manually","set","the","parameter","values",".","b",".","Next",",","build","H2O","PCA","models","using","grid","search",".","Count","and","make","sure","models","are","only","built","for","hyper-parameters","set","to","legal","values",".","No","model","is","built","for","bad","hyper-parameters","values",".","We","should","instead","get","a","warning\/error","message","printed","out",".","c.","For","each","model","built","using","grid","search",",","we","will","extract","the","parameters","used","in","building","that","model","and","manually","build","a","H2O","PCA","model",".","Training","metrics","are","calculated","from","the","gridsearch","model","and","the","manually","built","model",".","If","their","metrics","differ","by","too","much",",","print","a","warning","message","but","do","n't","fail","the","test",".","d.","we","will","check","and","make","sure","the","models","are","built","within","the","max_runtime_secs","time","limit","that","was","set","for","it","as","well",".","If","max_runtime_secs","was","exceeded",",","declare","test","failure",".","Note","that","for","hyper-parameters","containing","all","legal","parameter","names","and","parameter","value","lists","with","legal","and","illegal","values",",","grid-models","should","be","built","for","all","combinations","of","legal","parameter","values",".","For","illegal","parameter","values",",","a","warning\/error","message","should","be","printed","out","to","warn","the","user","but","the","program","should","not","throw","an","exception","."]
docstr: This function performs all initializations necessary:
  load the data sets and set the training set indices and response column index
docstr_tok: ["This","function","performs","all","initializations","necessary",":","load","the","data","sets","and","set","the","training","set","indices","and","response","column","index"]
code: def setup_data(self):
      """
      This function performs all initializations necessary:
      load the data sets and set the training set indices and response column index
      """
  
      # create and clean out the sandbox directory first
      self.sandbox_dir = pyunit_utils.make_Rsandbox_dir(
          self.current_dir, self.test_name, True
      )
  
      self.training1_data = h2o.import_file(
          path=pyunit_utils.locate(self.training1_filenames)
      )
      self.x_indices = list(range(self.training1_data.ncol))
  
      # save the training data files just in case the code crashed.
      pyunit_utils.remove_csv_files(
          self.current_dir,
          ".csv",
          action="copy",
          new_dir_path=self.sandbox_dir,
      )
  
file_path: h2o-3/h2o-py/dynamic_tests/testdir_algos/pca/pyunit_pca_gridsearch_over_all_params_large.py
imports: import sys
  import random
  import os
  from builtins import range
  import time
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.pca import H2OPrincipalComponentAnalysisEstimator
  from h2o.grid.grid_search import H2OGridSearch
label_desc: Use image node_id 2 for calling the Test_PCA_grid_search obj's underlying member method code with example usage: obj.setup_data() without return types