Move fit_kernel_params to GPRegressor#6243
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6243 +/- ##
==========================================
+ Coverage 89.11% 89.18% +0.07%
==========================================
Files 208 208
Lines 13796 13818 +22
==========================================
+ Hits 12294 12324 +30
+ Misses 1502 1494 -8 ☔ View full report in Codecov by Sentry. |
|
@gen740 @kAIto47802 Could you review this PR? |
|
This pull request has not seen any recent activity. |
Co-authored-by: kAIto47802 <115693559+kAIto47802@users.noreply.github.com>
|
I used the following benchmark code (in #6244): 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())And I found that the master branch is much faster:
I tested several times, but the results were consistent. |
|
@gen740 |
|
@nabenabe0928
import optuna
import optunahub
wfg = optunahub.load_module("benchmarks/wfg")
wfg4 = wfg.Problem(function_id=4, n_objectives=4, dimension=8, k=6)
sampler = optuna.samplers.GPSampler(seed=0)
study = optuna.create_study(
sampler=sampler,
directions=wfg4.directions,
)
study.optimize(wfg4, n_trials=100)
print(
(
study.trials[-1].datetime_complete - study.trials[0].datetime_start
).total_seconds()
) |
Co-authored-by: kAIto47802 <115693559+kAIto47802@users.noreply.github.com>
Motivation
This PR is necessary to cache the pair-wise distances of
X_train, which speeds upGPSampler, done in:GPSampler#6244Description of the changes
fit_kernel_paramstoGPRegressor