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

Made error message easier to understand for create_study's direction #5806 #5839

Closed
wants to merge 1 commit into from

Conversation

unKnownNG
Copy link
Contributor

Motivation

Users sometimes pass a list of directions to the direction argument, expecting multi-objective optimization, when they should use directions instead.
The previous error message:
ValueError: Please set either 'minimize' or 'maximize' to direction. You can also set the corresponding 'StudyDirection' member.

This message doesn't clearly explain that multi-objective optimization requires using directions. The updated message provides clearer guidance. The issue was raised in the #5806

Description of the changes

The error message is changed to Use 'directions' instead of 'direction' for multi-objective optimization.

@not522 not522 self-assigned this Dec 9, 2024
@not522
Copy link
Member

not522 commented Dec 9, 2024

Thank you for your PR.

The original message is useful for wrong direction names, for example, "min." Could you add branching based on type?

optuna.create_study(direction="min")

@HideakiImamura
Copy link
Member

@y0z Could you review this PR?

@y0z y0z added the code-fix Change that does not change the behavior, such as code refactoring. label Dec 9, 2024
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.

I think it will be mergeable once #5839 (comment) have been addressed.

@nabenabe0928
Copy link
Collaborator

I think the original comment should stay as is, but what we should check is whether the typing of direction is correct, meaning that we should check whether direction is a list or not.
If direction is a list, we should raise the error suggested by @unKnownNG .

What do you, @y0z @not522 , think?

Copy link
Contributor

This pull request has not seen any recent activity.

@github-actions github-actions bot added the stale Exempt from stale bot labeling. label Dec 22, 2024
Copy link
Contributor

github-actions bot commented Jan 6, 2025

This pull request was closed automatically because it had not seen any recent activity. If you want to discuss it, you can reopen it freely.

@github-actions github-actions bot closed this Jan 6, 2025
@unKnownNG unKnownNG deleted the error-message-5806 branch January 9, 2025 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-fix Change that does not change the behavior, such as code refactoring. stale Exempt from stale bot labeling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants