Unverified Commit 3b60f115 authored by Guoxin's avatar Guoxin Committed by GitHub
Browse files

Metis ss (#1438)

* use same pattern of quniform/randint as other tuners
parent 485245a0
......@@ -55,7 +55,7 @@ def rand(x_bounds, x_types):
temp = x_bounds[i][random.randint(0, len(x_bounds[i]) - 1)]
outputs.append(temp)
elif x_types[i] == "range_int":
temp = random.randint(x_bounds[i][0], x_bounds[i][1])
temp = random.randint(x_bounds[i][0], x_bounds[i][1] -1)
outputs.append(temp)
elif x_types[i] == "range_continuous":
temp = random.uniform(x_bounds[i][0], x_bounds[i][1])
......
......@@ -121,13 +121,12 @@ class MetisTuner(Tuner):
key_range = search_space[key]['_value']
idx = self.key_order.index(key)
if key_type == 'quniform':
if key_range[2] == 1:
self.x_bounds[idx] = [key_range[0], key_range[1]]
if key_range[2] == 1 and key_range[0].is_integer() and key_range[1].is_integer():
self.x_bounds[idx] = [key_range[0], key_range[1]+1]
self.x_types[idx] = 'range_int'
else:
bounds = []
for value in np.arange(key_range[0], key_range[1], key_range[2]):
bounds.append(value)
low, high, q = key_range
bounds = np.clip(np.arange(np.round(low/q), np.round(high/q)+1) * q, low, high)
self.x_bounds[idx] = bounds
self.x_types[idx] = 'discrete_int'
elif key_type == 'randint':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment