code: def test_hyperopt_run_hyperopt(
      csv_filename, backend, tmpdir, ray_cluster_4cpu
  ):
      input_features = [
          text_feature(
              name="utterance",
              encoder={"cell_type": "lstm", "reduce_output": "sum"},
          ),
          category_feature(
              encoder={"vocab_size": 2}, reduce_input="sum"
          ),
      ]
      output_features = [
          category_feature(
              decoder={"vocab_size": 2},
              reduce_input="sum",
              output_feature=True,
          )
      ]
  
      rel_path = generate_data(
          input_features, output_features, csv_filename
      )
  
      config = {
          "input_features": input_features,
          "output_features": output_features,
          "combiner": {"type": "concat"},
          TRAINER: {
              "epochs": 2,
              "learning_rate": 0.001,
              BATCH_SIZE: 128,
          },
          "backend": {
              "type": backend,
          },
      }
  
      output_feature_name = output_features[0]["name"]
  
      hyperopt_configs = {
          "parameters": {
              "trainer.learning_rate": {
                  "space": "loguniform",
                  "lower": 0.001,
                  "upper": 0.1,
              },
              output_feature_name
              + ".decoder.fc_output_size": {
                  "space": "randint",
                  "lower": 8,
                  "upper": 16,
              },
              output_feature_name
              + ".decoder.num_fc_layers": {
                  "space": "randint",
                  "lower": 0,
                  "upper": 1,
              },
          },
          "goal": "minimize",
          "output_feature": output_feature_name,
          "validation_metrics": "loss",
          "executor": {
              "type": "ray",
              "num_samples": 2,
              "cpu_resources_per_trial": 2,
              "max_concurrent_trials": "auto",
          },
          "search_alg": {"type": "variant_generator"},
      }
  
      @ray.remote(num_cpus=0)
      class Event:
          def __init__(self):
              self._set = False
  
          def is_set(self):
              return self._set
  
          def set(self):
              self._set = True
  
      # Used to trigger a cancel event in the trial, which should subsequently be retried
      event = Event.remote()
  
      class CancelCallback(Callback):
          def on_epoch_start(
              self, trainer, progress_tracker, save_path: str
          ):
              if progress_tracker.epoch == 1 and not ray.get(
                  event.is_set.remote()
              ):
                  ray.get(event.set.remote())
                  raise KeyboardInterrupt()
  
      # add hyperopt parameter space to the config
      config["hyperopt"] = hyperopt_configs
  
      # run for one epoch, then cancel, then resume from where we left off
      run_hyperopt(
          config, rel_path, tmpdir, callbacks=[CancelCallback()]
      )
  
imports: import json
  import logging
  import os.path
  from typing import Dict, List
  import mlflow
  import pandas
  import pytest
  from mlflow.tracking import MlflowClient
  from ludwig.backend import initialize_backend
  from ludwig.callbacks import Callback
  from ludwig.constants import ACCURACY, AUTO, BATCH_SIZE, EXECUTOR, MAX_CONCURRENT_TRIALS, TRAINER
  from ludwig.contribs.mlflow import MlflowCallback
  from ludwig.globals import HYPEROPT_STATISTICS_FILE_NAME, MODEL_HYPERPARAMETERS_FILE_NAME
  from ludwig.hyperopt.results import HyperoptResults
  from ludwig.hyperopt.run import hyperopt
  from ludwig.hyperopt.utils import update_hyperopt_params_with_defaults
  from ludwig.schema.model_config import ModelConfig
  from ludwig.utils.automl.utils import get_model_type
  from tests.integration_tests.utils import category_feature, generate_data, text_feature
label_desc: Use image node_id 5 for calling a global function with example usage: test_hyperopt_run_hyperopt(csv_filename, backend, tmpdir, ray_cluster_4cpu) and returns: self