in bayesmark/space.py [0:0]
def __init__(self, warp=None, values=None, range_=None):
"""Build Integer space class.
Parameters
----------
warp : None
Must be omitted or None, provided for consitency with other types.
values : list(str)
Possible values for space to take. Values must be unicode strings. Requiring type unicode (``'U'``) rather
than strings (``'S'``) corresponds to the native string type.
range_ : None
Must be omitted or None, provided for consitency with other types.
"""
assert warp is None, "cannot warp cat"
assert values is not None, "must pass in explicit values for cat"
assert range_ is None, "cannot pass in range for cat"
values = np.unique(values) # values now 1D ndarray no matter what
check_array(values, "values", pre=True, ndim=1, kind=CAT_KIND, min_size=2)
self.values = values
self.dtype = CAT_DTYPE
# Debatable if decode should go in unwarp or round_to_values
self.warp_f = self._encode
self.unwarp_f = identity
self.round_to_values = self._decode
self.lower, self.upper = None, None # Don't need them
self.lower_warped = np.zeros(len(values), dtype=WARPED_DTYPE)
self.upper_warped = np.ones(len(values), dtype=WARPED_DTYPE)