-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TPE discrete-categorical-loguniform space support #389
TPE discrete-categorical-loguniform space support #389
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #389 +/- ##
===========================================
+ Coverage 46.61% 47.23% +0.62%
===========================================
Files 67 67
Lines 12754 12905 +151
Branches 317 321 +4
===========================================
+ Hits 5945 6096 +151
Misses 6784 6784
Partials 25 25
Continue to review full report at Codecov.
|
src/orion/algo/tpe.py
Outdated
if list(candidate_points): | ||
sampler_above = CategoricalSampler(self, above_points, choices) | ||
|
||
lik_blow = sampler_below.get_loglikelis(candidate_points) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lik_blow = sampler_below.get_loglikelis(candidate_points) | |
lik_below = sampler_below.get_loglikelis(candidate_points) |
src/orion/algo/tpe.py
Outdated
lik_blow = sampler_below.get_loglikelis(candidate_points) | ||
lik_above = sampler_above.get_loglikelis(candidate_points) | ||
|
||
new_point = compute_max_ei_point(candidate_points, lik_blow, lik_above) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new_point = compute_max_ei_point(candidate_points, lik_blow, lik_above) | |
new_point = compute_max_ei_point(candidate_points, lik_below, lik_above) |
src/orion/algo/tpe.py
Outdated
if list(candidate_points): | ||
sampler_above = CategoricalSampler(self, above_points, choices) | ||
|
||
lik_blow = sampler_below.get_loglikelis(candidate_points) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lik_blow = sampler_below.get_loglikelis(candidate_points) | |
lik_below = sampler_below.get_loglikelis(candidate_points) |
src/orion/algo/tpe.py
Outdated
lik_blow = sampler_below.get_loglikelis(candidate_points) | ||
lik_above = sampler_above.get_loglikelis(candidate_points) | ||
|
||
new_point_index = compute_max_ei_point(candidate_points, lik_blow, lik_above) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new_point_index = compute_max_ei_point(candidate_points, lik_blow, lik_above) | |
new_point_index = compute_max_ei_point(candidate_points, lik_below, lik_above) |
tests/unittests/algo/test_tpe.py
Outdated
@@ -262,13 +370,13 @@ def test_set_state(self, tpe): | |||
def test_unsupported_space(self): | |||
"""Test tpe only work for supported search space""" | |||
space = Space() | |||
dim = Integer('yolo1', 'uniform', -2, 4) | |||
dim = Fidelity('epoch', 1, 9, 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could support easily Fidelity by just returning the max like random search does. Integer('yolo1', 'normal', 0, 1)
for testing unsupported priors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is pretty straight forward for random as all suggestions simply follow the same pattern, for tpe, we need to add separate paths to handle fidelity dimension and mention such support in doc. The only value for random or tpe to support fidelity I can think is to make it easier for user to switch from different search algorithms, or user can simply specify fixed fidelity value for random and tpe. And it is actually a little bit confusing as fidelity prior means differently between tpe/random and hyperband/asha,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the advantage of supporting fidelity dimension in algos like random search and TPE is really just to make it easier to switch from one algo to another using the same search space definition.
above_points = [obs_points[25:]] | ||
points = tpe.sample_one_dimension(dim1, 1, | ||
below_points, above_points, tpe._sample_int_point) | ||
assert len(points) == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to test the values as well. That they are integers in the correct interval and correspond roughly to the best region given below_points and above_points.
tests/unittests/algo/test_tpe.py
Outdated
assert len(points) == 2 | ||
|
||
tpe.n_ei_candidates = 0 | ||
points = tpe.sample_real_dimension(dim2, 2, below_points, above_points) | ||
points = tpe.sample_one_dimension(dim2, 2, | ||
below_points, above_points, tpe._sample_real_point) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that we didn't test for values for test_sample_real_dimensions. We could sample separately below and above with different intervals to artificially create the best regions and verify the sampling of the TPE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was same idea for int, categorical and real, as there are separate cases for gmm and categorical sampler. But sure, we can add some specific verification at these places.
Codecov Report
@@ Coverage Diff @@
## develop #389 +/- ##
===========================================
+ Coverage 46.62% 47.30% +0.67%
===========================================
Files 67 67
Lines 12768 12932 +164
Branches 317 321 +4
===========================================
+ Hits 5953 6117 +164
Misses 6790 6790
Partials 25 25
Continue to review full report at Codecov.
|
@@ -283,7 +280,8 @@ def suggest(self, num=1): | |||
above_points[idx: idx + shape[0]], | |||
self._sample_categorical_point) | |||
else: | |||
raise NotImplementedError() | |||
# fidelity dimension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe elif dimension.type == 'fidelity'
to be sure to catch unsupported dimensions that would have been missed in __init__
…-discrete-categorical
…jy/orion into tpe-discrete-categorical
Add discrete and categorical dimension into TPE support.
Now TPE will support uniform, uniform discrete and choices as prior. As for choices prior, the probabilities if any given will be ignored.