[tune] Fix hpo randint limits (#11946)

Co-authored-by: Sumanth Ratna <sumanthratna@gmail.com>
This commit is contained in:
Kai Fricke
2020-11-12 08:45:49 -08:00
committed by GitHub
co-authored by Sumanth Ratna
parent 07f401d99d
commit 02c02369ca
3 changed files with 5 additions and 15 deletions
+1 -11
View File
@@ -361,17 +361,7 @@ class HyperOptSearch(Searcher):
logger.warning(
"HyperOpt does not support quantization for "
"integer values. Reverting back to 'randint'.")
if domain.lower != 0:
raise ValueError(
"HyperOpt only allows integer sampling with "
f"lower bound 0. Got: {domain.lower}.")
if domain.upper < 1:
raise ValueError(
"HyperOpt does not support integer sampling "
"of values lower than 0. Set your maximum range "
"to something above 0 (currently {})".format(
domain.upper))
return hpo.hp.randint(par, domain.upper)
return hpo.hp.randint(par, domain.lower, high=domain.upper)
elif isinstance(domain, Categorical):
if isinstance(sampler, Uniform):
return hpo.hp.choice(par, [