Skip to content

Speed up LogEI implementation#6248

Merged
not522 merged 6 commits intooptuna:masterfrom
nabenabe0928:enhance/optimize-logei-impl
Aug 25, 2025
Merged

Speed up LogEI implementation#6248
not522 merged 6 commits intooptuna:masterfrom
nabenabe0928:enhance/optimize-logei-impl

Conversation

@nabenabe0928
Copy link
Copy Markdown
Contributor

Motivation

By optimizing the logei implementation, this PR speeds up GPSampler.

Important

This PR speeds up the master branch by 27% using when using the following code 🎉 :

import optuna


def objective(trial: optuna.Trial) -> float:
    return sum(trial.suggest_float(f"x{i}", -5, 5)**2 for i in range(5))


sampler = optuna.samplers.GPSampler(seed=0)
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=300)
print((study.trials[-1].datetime_complete - study.trials[0].datetime_start).total_seconds())

Description of the changes

  • Skip unnecessary calculations using caching

@nabenabe0928 nabenabe0928 marked this pull request as ready for review August 15, 2025 07:07
@nabenabe0928 nabenabe0928 added the enhancement Change that does not break compatibility and not affect public interfaces, but improves performance. label Aug 19, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.26%. Comparing base (eba34c9) to head (eaee61f).
⚠️ Report is 13 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6248      +/-   ##
==========================================
+ Coverage   89.15%   89.26%   +0.10%     
==========================================
  Files         208      208              
  Lines       13818    13820       +2     
==========================================
+ Hits        12320    12336      +16     
+ Misses       1498     1484      -14     

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

@y0z
Copy link
Copy Markdown
Member

y0z commented Aug 20, 2025

@not522 @fusawa-yugo Could you review this PR?

@fusawa-yugo
Copy link
Copy Markdown
Contributor

Thank you for submitting PR.
LGTM!! I also confirmed the speedup.

Co-authored-by: Naoto Mizuno <naotomizuno@preferred.jp>
@nabenabe0928
Copy link
Copy Markdown
Contributor Author

@not522 Thank you for the catch:) I applied your suggestion!

Copy link
Copy Markdown
Member

@not522 not522 left a comment

Choose a reason for hiding this comment

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

LGTM!

@not522 not522 merged commit 233a129 into optuna:master Aug 25, 2025
14 checks passed
@not522 not522 added this to the v4.6.0 milestone Aug 25, 2025
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.

4 participants