Improve time complexity of IntersectionSearchSpace#5982
Merged
c-bata merged 1 commit intooptuna:masterfrom Feb 19, 2025
Merged
Conversation
Member
|
Thank you for your PR! |
Member
Contributor
Author
|
Thanks. I'll keep that in mind. |
not522
reviewed
Feb 17, 2025
not522
approved these changes
Feb 18, 2025
Member
not522
left a comment
There was a problem hiding this comment.
LGTM! I confirmed that this PR will speed up the following code.
import optuna
def objective(trial):
return sum(trial.suggest_float(f"x{i}", 0, 1) ** 2 for i in range(10))
study = optuna.create_study(sampler=optuna.samplers.CmaEsSampler(seed=42))
study.optimize(objective, n_trials=10000)master
real 1m15.972s
user 1m14.434s
sys 0m1.037s
PR
real 1m8.455s
user 1m7.028s
sys 0m1.076s
Collaborator
|
LGTM! I tested this in my local environment and confirmed that the PR will speed up the code @not522 provided above. master PR |
Member
|
Let me merge this PR since this PR got two approvals. @GittyHarsha Thank you for your contribution! |
IntersectionSearchSpace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fix #5949
Description of the changes
Removed this line
optuna/optuna/search_space/intersection.py
Line 29 in 5a7760c
Added filtering logic inside the for-loop so that the loop breaks to avoid putting filter checks on the trials with
trial.numberless thancached_trial_number