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

Change the definition of union_search_space, intersect_search_space #1026

Merged
merged 11 commits into from
Feb 19, 2025

Conversation

porink0424
Copy link
Collaborator

@porink0424 porink0424 commented Feb 5, 2025

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code.
This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

  • I agree this patch may be ported to Goptuna by other Goptuna contributors.

Reference Issues/PRs

Fixes #1012

What does this implement/fix? Explain your changes.

The following changes have been made:

  • Relaxed the condition for determining whether search_space remains the same.
  • Fixed an issue in TrialTable where parameters with the same name resulted in identical row IDs, causing duplicate key props and triggering a React warning.

@porink0424 porink0424 changed the title Change the definition of union_search_space Change the definition of union_search_space, intersect_search_space Feb 12, 2025
@porink0424 porink0424 marked this pull request as ready for review February 12, 2025 02:17
Comment on lines 132 to 135
for n1, d1 in trial.distributions.items():
for n2, d2 in self._union_search_space:
if n1 == n2:
if _is_same_float_distribution(d1, d2):
Copy link
Member

@c-bata c-bata Feb 19, 2025

Choose a reason for hiding this comment

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

I'm just wondering if there's a better approach to mitigate this deeply nested code. Do you think we could define functions like the following to make the code easier to read?

def get_union_search_space(space_1, space_2) -> ...:
    ...

def get_intersection_search_space(space_1, space_2) -> ...:
    ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I reduced the nesting by one level, but I couldn't think of a good way to simplify it further...
The functions you mentioned might not be the best since original code requires break inside an if statement.

Copy link
Member

@c-bata c-bata left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your contribution.

@c-bata c-bata merged commit b938d26 into optuna:main Feb 19, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trial table duplicates values
2 participants