Repository navigation
Skip studies without finite observations in plot_edf - #6882
Merged
Merged
Conversation
aswanth-07
marked this pull request as ready for review
October 3, 2026 06:21
Member
|
@kAIto47802 Could you review this PR? |
y0z
reviewed
Oct 5, 2026
y0z
left a comment
Member
There was a problem hiding this comment.
Thank you for your contribution.
The changes look good. Please clarify that studies with no complete trials with finite target values are omitted in the docstring.
Contributor
Author
|
Updated both Plotly and Matplotlib docstrings in e9733ae to state that studies without complete trials with finite target values are omitted. The focused EDF and visualization utility suites pass (72 tests). |
1 task done
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
Comparing a populated study with a study that has no completed finite observations produces a NaN EDF curve and
RuntimeWarning: invalid value encountered in divide. With RuntimeWarnings treated as errors, both Plotly and Matplotlibplot_edfstop before producing the comparison.For example:
Description of the changes
Skip studies with no observations after the existing completed-trial and nonfinite-value filtering in
_get_edf_info, which both backends use. An empty sample has no empirical distribution. Keep each remaining study name paired with its observations and retain the existing empty-plot return when none remain.Add six regression cases across both backends: no trials, only pruned trials, and only nonfinite observations. They check the retained study name, axis, and exact empirical probabilities for observations
[1.0, 3.0], then exercise the public plot function with strict RuntimeWarnings.Clarify both public docstrings to state that only completed trials with finite target values contribute and that studies without such trials are omitted.
Existing users
Populated curves, their order, custom multiobjective targets, and partial nonfinite filtering remain unchanged. The comparison omits empty study entries instead of plotting undefined curves. This read-only plotting change does not write storage, change trials, or alter sampler settings.
Validation
masterat5c8e50dwith the division warning and pass with this change.PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 MPLBACKEND=Agg py -3.13 -m pytest tests/visualization_tests/test_edf.py tests/visualization_tests/test_utils.py -q -W error::RuntimeWarning: 72 passed. The 66 existing tests also pass on pristine upstream.git diff --checkpass.py -3.13 -m mypy --follow-imports=silent optuna/visualization/_edf.py tests/visualization_tests/test_edf.pypasses. The default import-following check reports three errors in unchanged_gp/optim_mixed.pyandvisualization/matplotlib/_rank.pyon pristine upstream as well.Validation used Python 3.13.3, NumPy 2.2.6, Plotly 6.9.0, and Matplotlib 3.10.3 on Windows. The full test matrix and documentation build were not run locally. All 15 CI checks passed on
36e6a50. After the docstring update ine9733ae, the 72 focused tests, Ruff lint and formatting, and diff checks pass locally; CI for the updated head is pending.Checklist