class_docstr: Convert ordered ChoiceParameters to integer RangeParameters.
  
  Parameters will be transformed to an integer RangeParameters, mapped from the
  original choice domain to a contiguous range `0, 1, ..., n_choices - 1`
  of integers. Does not transform task parameters.
  
  In the inverse transform, parameters will be mapped back onto the original domain.
  
  In order to encode all ChoiceParameters (not just ordered ChoiceParameters),
  use ChoiceEncode instead.
  
  Transform is done in-place.
class_docstr_tok: ["Convert","ordered","ChoiceParameters","to","integer","RangeParameters",".","Parameters","will","be","transformed","to","an","integer","RangeParameters",",","mapped","from","the","original","choice","domain","to","a","contiguous","range","`","0",",","1",",","...",",","n_choices","-","1","`","of","integers",".","Does","not","transform","task","parameters",".","In","the","inverse","transform",",","parameters","will","be","mapped","back","onto","the","original","domain",".","In","order","to","encode","all","ChoiceParameters","(","not","just","ordered","ChoiceParameters",")",",","use","ChoiceEncode","instead",".","Transform","is","done","in-place","."]
code: def __init__(
      self,
      search_space: SearchSpace,
      observations: List[Observation],
      modelbridge: Optional[
          "modelbridge_module.base.ModelBridge"
      ] = None,
      config: Optional[TConfig] = None,
  ) -> None:
      # Identify parameters that should be transformed
      self.encoded_parameters: Dict[str, Dict[TParamValue, int]] = {}
      for p in search_space.parameters.values():
          if (
              isinstance(p, ChoiceParameter)
              and p.is_ordered
              and not p.is_task
          ):
              self.encoded_parameters[p.name] = {
                  original_value: transformed_value
                  for transformed_value, original_value in enumerate(
                      p.values
                  )
              }
      self.encoded_parameters_inverse: Dict[
          str, Dict[int, TParamValue]
      ] = {
          p_name: {
              transformed_value: original_value
              for original_value, transformed_value in transforms.items()
          }
          for p_name, transforms in self.encoded_parameters.items()
      }
  
file_path: Ax/ax/modelbridge/transforms/choice_encode.py
imports: from typing import Dict, List, Optional, Tuple, TYPE_CHECKING
  import numpy
  from ax.core.observation import Observation, ObservationFeatures
  from ax.core.parameter import ChoiceParameter, Parameter, ParameterType, RangeParameter
  from ax.core.search_space import SearchSpace
  from ax.core.types import TParamValue
  from ax.modelbridge.transforms.base import Transform
  from ax.modelbridge.transforms.utils import ClosestLookupDict, construct_new_search_space
  from ax.models.types import TConfig
label_desc: Use image node_id 1 to create a new OrderedChoiceEncode object from inherited base classes: ChoiceEncode with example: obj = OrderedChoiceEncode(search_space, observations, modelbridge, config)