code: def deformat_parameters(
      formatted_parameters: FormattedParameters,
      formatted_search_space: FormattedSearchSpace,
  ) -> Parameters:
      """
      Convert internal format parameters to users' expected format.
  
      "test/ut/sdk/test_hpo_formatting.py" provides examples of how this works.
  
      The function do following jobs:
       1. For "choice" and "randint", convert index (integer) to corresponding value.
       2. For "*log*", convert x to `exp(x)`.
       3. For "q*", convert x to `round(x / q) * q`, then clip into range.
       4. For nested choices, convert flatten key-value pairs into nested structure.
      """
      ret: Parameters = {}
      for key, x in formatted_parameters.items():
          spec = formatted_search_space[key]
          if spec.categorical:
              x = cast(int, x)
              if spec.type == "randint":
                  lower = min(math.ceil(float(x)) for x in spec.values)
                  _assign(ret, key, int(lower + x))
              elif _is_nested_choices(spec.values):
                  _assign(
                      ret,
                      tuple([*key, "_name"]),
                      spec.values[x]["_name"],
                  )
              else:
                  _assign(ret, key, spec.values[x])
          else:
              if spec.log_distributed:
                  x = math.exp(x)
              if spec.q is not None:
                  x = round(x / spec.q) * spec.q
              if spec.clip:
                  x = max(x, spec.clip[0])
                  x = min(x, spec.clip[1])
              if isinstance(x, np.number):
                  x = x.item()
              _assign(ret, key, x)
      return ret
  
file_path: nni/nni/common/hpo_utils/formatting.py
imports: from __future__ import annotations
  import math
  from types import SimpleNamespace
  from typing import Any, Dict, NamedTuple, Tuple, cast
  import numpy
  from nni.typehint import Parameters, SearchSpace
label_desc: Use image node_id 2 for calling a global function with example usage: deformat_parameters(formatted_parameters, formatted_search_space) and returns: ret