code: def test_merge_with_defaults():
      # configuration with legacy parameters
      legacy_config_format = {
          "ludwig_version": "0.4",
          INPUT_FEATURES: [
              {
                  "type": "numerical",
                  "name": "number_input_feature",
                  "encoder": {"type": "dense"},
              },
              {
                  "type": "image",
                  "name": "image_input_feature",
                  "encoder": "stacked_cnn",
                  "conv_bias": True,
                  "conv_layers": [
                      {
                          "num_filters": 32,
                          "pool_size": 2,
                          "pool_stride": 2,
                          "bias": False,
                      },
                      {
                          "num_filters": 64,
                          "pool_size": 2,
                          "pool_stride": 2,
                      },
                  ],
              },
          ],
          OUTPUT_FEATURES: [
              {
                  "type": "numerical",
                  "name": "number_output_feature",
              },
          ],
          "training": {
              "eval_batch_size": 0,
              "optimizer": {"type": "adadelta"},
          },
          HYPEROPT: {
              "parameters": {
                  "training.learning_rate": {
                      "space": "choice",
                      "categories": [0.0001, 0.001, 0.01],
                  },
                  "training.early_stop": {
                      "space": "choice",
                      "categories": [5, 10, 15],
                  },
                  "number_input_feature.encoder.num_layers": {
                      "space": "choice",
                      "categories": [2, 3, 4],
                  },
                  "number_output_feature.decoder.fc_output_size": {
                      "space": "choice",
                      "categories": [128, 256, 512],
                  },
                  "number_output_feature.decoder.fc_dropout": {
                      "space": "uniform",
                      "lower": 0,
                      "upper": 1,
                  },
              },
              "executor": {
                  "type": "serial",
                  "search_alg": {TYPE: "variant_generator"},
              },
              "sampler": {
                  "num_samples": 99,
                  "scheduler": {},
              },
          },
      }
  
      updated_config = upgrade_config_dict_to_latest_version(
          legacy_config_format
      )
      merged_config = ModelConfig.from_dict(updated_config).to_dict()
  
      assert len(merged_config[DEFAULTS]) == 13
      assert ENCODER in merged_config[DEFAULTS][CATEGORY]
      assert PREPROCESSING in merged_config[DEFAULTS][CATEGORY]
      assert DECODER in merged_config[DEFAULTS][CATEGORY]
      assert LOSS in merged_config[DEFAULTS][CATEGORY]
      assert COMBINER in merged_config
      assert merged_config[TRAINER][EARLY_STOP] == 5
      assert SCHEDULER in merged_config[HYPEROPT][EXECUTOR]
      assert (
          merged_config[HYPEROPT][EXECUTOR][SCHEDULER]["type"] == "fifo"
      )
      assert TYPE in merged_config[INPUT_FEATURES][1][ENCODER]
      assert TYPE in merged_config[OUTPUT_FEATURES][0][DECODER]
  
file_path: ludwig/tests/ludwig/utils/test_defaults.py
imports: import copy
  import pytest
  from ludwig.constants import CATEGORY, COMBINER, DECODER, DEFAULTS, DEPENDENCIES, DROP_ROW, EARLY_STOP, ENCODER, EXECUTOR, FILL_WITH_MODE, HYPEROPT, INPUT_FEATURES, LOSS, MISSING_VALUE_STRATEGY, MODEL_ECD, MODEL_TYPE, OUTPUT_FEATURES, PREPROCESSING, REDUCE_DEPENDENCIES, REDUCE_INPUT, SCHEDULER, SUM, TIED, TOP_K, TRAINER, TYPE
  from ludwig.schema.model_config import ModelConfig
  from ludwig.schema.trainer import ECDTrainerConfig
  from ludwig.utils.backward_compatibility import upgrade_config_dict_to_latest_version
  from ludwig.utils.misc_utils import merge_dict, set_default_values
  from tests.integration_tests.utils import binary_feature, category_feature, number_feature, sequence_feature, text_feature, vector_feature
label_desc: Use image node_id 5 for calling a global function with example usage: test_merge_with_defaults() without return types