Skip to content
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

Enhance GPSampler performance (other than introducing local search) #5279

Merged
merged 20 commits into from Mar 1, 2024

Conversation

contramundum53
Copy link
Member

Motivation

We split PR #5274 into two. This PR introduces all improvements other than local search.

Description of the changes

See #5274.

Copy link

codecov bot commented Feb 26, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 89.58%. Comparing base (ec0d5b5) to head (5823e52).
Report is 69 commits behind head on master.

Files Patch % Lines
optuna/samplers/_gp/sampler.py 85.71% 1 Missing ⚠️
optuna/terminator/improvement/evaluator.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5279      +/-   ##
==========================================
+ Coverage   89.56%   89.58%   +0.01%     
==========================================
  Files         209      209              
  Lines       13103    13144      +41     
==========================================
+ Hits        11736    11775      +39     
- Misses       1367     1369       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@nabenabe0928 nabenabe0928 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for separating the PR, I left some minor comments.

optuna/_gp/gp.py Outdated Show resolved Hide resolved
optuna/samplers/_gp/sampler.py Outdated Show resolved Hide resolved
optuna/samplers/_gp/sampler.py Outdated Show resolved Hide resolved
optuna/samplers/_gp/sampler.py Outdated Show resolved Hide resolved
optuna/_gp/prior.py Outdated Show resolved Hide resolved
optuna/_gp/prior.py Show resolved Hide resolved
contramundum53 and others added 8 commits February 27, 2024 16:01
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
@contramundum53
Copy link
Member Author

@nabenabe0928 I applied your comments. PTAL.

optuna/_gp/gp.py Show resolved Hide resolved
optuna/_gp/gp.py Outdated Show resolved Hide resolved
optuna/_gp/prior.py Show resolved Hide resolved
optuna/samplers/_gp/sampler.py Show resolved Hide resolved
optuna/_gp/gp.py Outdated Show resolved Hide resolved
optuna/_gp/prior.py Outdated Show resolved Hide resolved
optuna/_gp/prior.py Outdated Show resolved Hide resolved
optuna/_gp/gp.py Outdated Show resolved Hide resolved
optuna/_gp/gp.py Outdated Show resolved Hide resolved
optuna/samplers/_gp/sampler.py Show resolved Hide resolved
Co-authored-by: Shuhei Watanabe <47781922+nabenabe0928@users.noreply.github.com>
Copy link
Collaborator

@nabenabe0928 nabenabe0928 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work, LGTM!

@@ -164,7 +166,8 @@ def _fit_kernel_params(
np.log(initial_kernel_params.inverse_squared_lengthscales.detach().numpy()),
[
np.log(initial_kernel_params.kernel_scale.item()),
np.log(initial_kernel_params.noise_var.item() - minimum_noise),
# We add 0.01 * minimum_noise to initial noise_var to avoid instability.
np.log(initial_kernel_params.noise_var.item() - 0.99 * minimum_noise),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the comment above (i.e., "add 0.01 * minimum_noise to initial noise_var"), I feel this line should be like below.

np.log(initial_kernel_params.noise_var.item() + 0.01 * minimum_noise)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line is trying to transform the variable so that the search space is gonna be $(-\infty, \infty)$.
So probably, what @y0z wanted to say was actually this?

transformed_noise = initial_kernel_params.noise_var.item() - minimum_noise
...=np.log(transformed_noise + 0.01 * minimum_noise)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memo: The intention is below.

(initial_noise_var + 0.01 * minimum_noise) - minimum_noise = initial_var - 0.99 * minimum_noise.

Copy link
Member

@y0z y0z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@nabenabe0928 nabenabe0928 merged commit 30696b8 into optuna:master Mar 1, 2024
20 checks passed
@nabenabe0928 nabenabe0928 added the enhancement Change that does not break compatibility and not affect public interfaces, but improves performance. label Mar 11, 2024
@nabenabe0928 nabenabe0928 added this to the v3.6.0 milestone Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Change that does not break compatibility and not affect public interfaces, but improves performance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants