Commit 9a00a14c authored by suiguoxin's avatar suiguoxin
Browse files

fix qloguniform issue

parent a2e45f23
......@@ -45,7 +45,7 @@ All types of sampling strategies and their parameter are listed here:
* When optimizing, this variable is constrained to a two-sided interval.
* {"_type":"quniform","_value":[low, high, q]}
* Which means the variable value is a value like randint(np.floor((high-low)/q)+1)*q + low. For example, for _value specified as [0, 10, 2.5], possible values are [0, 2.5, 5.0, 7.5, 10.0]; For _value specified as [2, 10, 5], possible values are [2, 7]. All possible values have the same possibility to be selected.
* Which means the variable value is a value like randint(floor((high-low)/q)+1)*q + low. For example, for _value specified as [0, 10, 2.5], possible values are [0, 2.5, 5.0, 7.5, 10.0]; For _value specified as [2, 10, 5], possible values are [2, 7]. All possible values have the same possibility to be selected.
* Suitable for a discrete value with respect to which the objective is still somewhat "smooth", but which should be bounded both above and below. If you want to uniformly choose integer from a range [low, high], you can write `_value` like this: `[low, high, 1]`.
......@@ -54,7 +54,7 @@ All types of sampling strategies and their parameter are listed here:
* When optimizing, this variable is constrained to be positive.
* {"_type":"qloguniform","_value":[low, high, q]}
* Which means the variable value is a value like round(loguniform(low, high)) / q) * q
* Which means the variable value is a value like floor((loguniform(low, high) - low) / q) * q + low
* Suitable for a discrete variable with respect to which the objective is "smooth" and gets smoother with the size of the value, but which should be bounded both above and below.
* {"_type":"normal","_value":[mu, sigma]}
......
......@@ -77,7 +77,7 @@ def qloguniform(low, high, q, random_state):
q: sample step
random_state: an object of numpy.random.RandomState
'''
return np.round(loguniform(low, high, random_state) / q) * q
return np.floor((loguniform(low, high, random_state) - low) / q) * q + low
def normal(mu, sigma, random_state):
......
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