docstr: Test case to configure Tuner with StudyConfig object.
docstr_tok: ["Test","case","to","configure","Tuner","with","StudyConfig","object","."]
code: def testCloudTunerStudyConfig(self):
      """Test case to configure Tuner with StudyConfig object."""
      # Configure the search space. Specification:
      # https://cloud.google.com/ai-platform/optimizer/docs/reference/rest/v1/projects.locations.studies#StudyConfig  # pylint: disable=line-too-long
      study_config = {
          "metrics": [{"goal": "MAXIMIZE", "metric": "acc"}],
          "parameters": [
              {
                  "discrete_value_spec": {
                      "values": [0.0001, 0.001, 0.01]
                  },
                  "parameter": "learning_rate",
                  "type": "DISCRETE",
              },
              {
                  "integer_value_spec": {
                      "max_value": 10,
                      "min_value": 2,
                  },
                  "parameter": "num_layers",
                  "type": "INTEGER",
              },
              {
                  "discrete_value_spec": {"values": [32, 64, 96, 128]},
                  "parameter": "units",
                  "type": "DISCRETE",
              },
          ],
          "algorithm": "ALGORITHM_UNSPECIFIED",
          "automatedStoppingConfig": {
              "decayCurveStoppingConfig": {"useElapsedTime": True}
          },
      }
  
      study_id = "{}_study_config".format(_STUDY_ID_BASE)
      self._study_id = study_id
  
      tuner = CloudTuner(
          _build_model,
          project_id=_PROJECT_ID,
          region=_REGION,
          study_config=study_config,
          study_id=study_id,
          max_trials=5,
          directory=os.path.join(self.get_temp_dir(), study_id),
      )
  
      self._assert_output(
          tuner.search_space_summary,
          r".*Search space summary(?=.*learning_rate \(Choice\))"
          r"(?=.*num_layers \(Int\))(?=.*units \(Int\))",
      )
  
      tuner.search(
          x=self._x,
          y=self._y,
          epochs=2,
          steps_per_epoch=20,
          validation_steps=10,
          validation_data=(self._val_x, self._val_y),
      )
  
      self._assert_results_summary(tuner.results_summary)
  
imports: import contextlib
  import io
  import multiprocessing
  import os
  import re
  import time
  import keras_tuner
  import tensorflow
  from tensorflow import keras
  from tensorflow_cloud import CloudTuner
  from tensorflow_cloud.tuner import vizier_client
label_desc: Use image node_id 4 for calling the CloudTunerIntegrationTest obj's underlying member method code with example usage: obj.testCloudTunerStudyConfig() without return types