-
-
Notifications
You must be signed in to change notification settings - Fork 971
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
Use all trials in TPESampler
even when multivariate=True
#4079
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4079 +/- ##
==========================================
- Coverage 90.10% 90.10% -0.01%
==========================================
Files 161 161
Lines 12655 12652 -3
==========================================
- Hits 11403 11400 -3
Misses 1252 1252
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@not522 @HideakiImamura Could you review this PR? |
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.
Thanks for the great simplification of TPESampler
. I have a comment. PTAL.
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.
Thanks for your swift actions! LGTM!
I resolved the conflict with #4073. PTAL 🙏 |
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.
Could you update the document of n_startup_trials
? It does not match the current behavior.
optuna/samplers/_tpe/sampler.py
Outdated
n_sampled = sum( | ||
step < float("inf") and param is not None | ||
for (step, _), param in zip(scores, list(values.values())[0]) | ||
) |
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.
Please add a comment for this counting. It is a bit complicated to understand the behavior.
@not522 Thanks for the comments. As discussed privately, I decided to keep the original behavior of |
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.
LGTM
TPESampler
even when multivariate=True
Motivation
In the current TPE, the trials without parameters that we want to sample are skipped when
multivatiate=True
(link). However, whenmultivariate=False
, those trials are used effectively in the following two steps.below
andabove
.This PR fixes the behavior of
multivariate=True
and makes it consistent withmultivariate=False
.Description of the changes
multivariate=False
.multivariate
argument from_get_observation_pairs
.[Note] This PR slightly changes the current behavior of
TPESampler
in the following points.multivariate=True
andgroup=True
, the trials that do not include suggesting parameters are also used. (Whenmultivariate=True
andgroup=False
, this does not change the behavior because parameters in the intersection search space are included in all trials)Comparen_startup_trials
with only the number of trials that include suggesting parameters.