(key: str, hp: SearchSpaceNumber)
Returns either a list of values intended to be sampled uniformly or a frozen scipy.stats distribution
Returns either a list of values intended to be sampled uniformly or a frozen scipy.stats distribution
Returns either a list of values intended to be sampled uniformly or a frozen scipy . stats distribution
def SearchSpaceNumberToSMAC(key: str, hp: SearchSpaceNumber) -> Hyperparameter:
    """Returns either a list of values intended to be sampled uniformly or a frozen scipy.stats distribution"""
    dist = "uniform"
    if hp.distribution:
        dist = hp.distribution
    if hp.maximum is None:
        raise ValueError(
            f"maximum not specified for a number with distribution {dist} for {key}"
        )
    max = hp.getInclusiveMax()
    if hp.minimum is None:
        raise ValueError(
            f"minimum not specified for a number with distribution {dist} for {key}"
        )
    min = hp.getInclusiveMin()

    log: bool
    if dist == "uniform" or dist == "integer":
        log = False
    elif dist == "loguniform":
        log = True
    else:
        raise ValueError(f"unknown/unsupported distribution {dist} for {key}")

    if hp.discrete:
        return UniformIntegerHyperparameter(key, min, max, log=log)
    else:
        return UniformFloatHyperparameter(key, min, max, log=log)
def SearchSpaceNumberToSMAC ( key : str , hp : SearchSpaceNumber ) -> Hyperparameter : dist = "uniform" if hp . distribution : dist = hp . distribution if hp . maximum is None : raise ValueError ( f"maximum not specified for a number with distribution {dist} for {key}" ) max = hp . getInclusiveMax ( ) if hp . minimum is None : raise ValueError ( f"minimum not specified for a number with distribution {dist} for {key}" ) min = hp . getInclusiveMin ( ) log : bool if dist == "uniform" or dist == "integer" : log = False elif dist == "loguniform" : log = True else : raise ValueError ( f"unknown/unsupported distribution {dist} for {key}" ) if hp . discrete : return UniformIntegerHyperparameter ( key , min , max , log = log ) else : return UniformFloatHyperparameter ( key , min , max , log = log )