-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Sorts categorical values on axis that contains only numerical values in visualization.matplotlib.plot_slice #2709
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Muktan Thank you for your pull request! It looks great.
Codecov Report
@@ Coverage Diff @@
## master #2709 +/- ##
=======================================
Coverage 91.66% 91.66%
=======================================
Files 140 140
Lines 11522 11522
=======================================
Hits 10562 10562
Misses 960 960
Continue to review full report at Codecov.
|
Sorry, I realised that we can make the conditions simpler. How about replacing this part elif _is_numerical(trials, param):
x_values = [x for x in x_values]
scale = "numerical"
elif _is_categorical(trials, param):
x_values = [str(x) for x in x_values]
scale = "categorical" with as follows?: elif not _is_numerical(trials, param):
x_values = [str(x) for x in x_values]
scale = "categorical" |
Okay, let me try these conditions and if everything is good will create another comit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your quick response. I have one minor comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Again, thank you for your quick update.
Hey @nzw0301! |
Hi @Muktan, the pull request needs two approvals from dev-members to be merged into the master branch. So please kindly give us time. |
Ok got it, Thank You. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for another!
Motivation
The slice plot's axis can be improved (by sorting) when a categorical distribution suggests only int or float values. #2605
Description of the changes
Now the y axis is sorted if it only contains numerical values.
Before:
After:
Also, if y contains mix of categorical and the numerical e.g. y = trial.suggest_categorical("y", [1,"2asd","3asd","asd"])
previous and current result remains same as follows:
Can be reviewed by: @nzw0301