class_docstr: Choice of one value among a predefined set of possible values.
  
  Args:
      name: A string. the name of parameter. Must be unique for each
          `HyperParameter` instance in the search space.
      values: A list of possible values. Values must be int, float,
          str, or bool. All values must be of the same type.
      ordered: Optional boolean, whether the values passed should be
          considered to have an ordering. Defaults to `True` for float/int
          values.  Must be `False` for any other values.
      default: Optional default value to return for the parameter.
          If unspecified, the default value will be:
          - None if None is one of the choices in `values`
          - The first entry in `values` otherwise.
class_docstr_tok: ["Choice","of","one","value","among","a","predefined","set","of","possible","values",".","Args",":","name",":","A","string",".","the","name","of","parameter",".","Must","be","unique","for","each","`","HyperParameter","`","instance","in","the","search","space",".","values",":","A","list","of","possible","values",".","Values","must","be","int",",","float",",","str",",","or","bool",".","All","values","must","be","of","the","same","type",".","ordered",":","Optional","boolean",",","whether","the","values","passed","should","be","considered","to","have","an","ordering",".","Defaults","to","`","True","`","for","float\/int","values",".","Must","be","`","False","`","for","any","other","values",".","default",":","Optional","default","value","to","return","for","the","parameter",".","If","unspecified",",","the","default","value","will","be",":","-","None","if","None","is","one","of","the","choices","in","`","values","`","-","The","first","entry","in","`","values","`","otherwise","."]
code: def __init__(
      self, name, values, ordered=None, default=None, **kwargs
  ):
      super().__init__(name=name, default=default, **kwargs)
      if not values:
          raise ValueError("`values` must be provided for `Choice`.")
  
      # Type checking.
      types = {type(v) for v in values}
      if len(types) > 1:
          raise TypeError(
              "A `Choice` can contain only one type of value, "
              f"found values: {str(values)} with types {types}."
          )
  
      # Standardize on str, int, float, bool.
      if isinstance(values[0], six.string_types):
          values = [str(v) for v in values]
          if default is not None:
              default = str(default)
      elif isinstance(values[0], six.integer_types):
          values = [int(v) for v in values]
          if default is not None:
              default = int(default)
      elif not isinstance(values[0], (bool, float)):
          raise TypeError(
              "A `Choice` can contain only `int`, `float`, `str`, or "
              "`bool`, found values: " + str(values) + "with "
              "types: " + str(type(values[0]))
          )
      self._values = values
  
      if default is not None and default not in values:
          raise ValueError(
              "The default value should be one of the choices. "
              f"You passed: values={values}, default={default}"
          )
      self._default = default
  
      # Get or infer ordered.
      self.ordered = ordered
      is_numeric = isinstance(values[0], (six.integer_types, float))
      if self.ordered and not is_numeric:
          raise ValueError(
              "`ordered` must be `False` for non-numeric types."
          )
      if self.ordered is None:
          self.ordered = is_numeric
  
file_path: keras-tuner/keras_tuner/engine/hyperparameters/hp_types/choice_hp.py
imports: import six
  from keras_tuner import protos
  from keras_tuner.api_export import keras_tuner_export
  from keras_tuner.engine import conditions
  from keras_tuner.engine.hyperparameters import hp_utils
  from keras_tuner.engine.hyperparameters import hyperparameter
label_desc: Use image node_id 1 to create a new Choice object from inherited base classes: hyperparameter with example: obj = Choice(name, values, ordered, default)