Skip to content

Extend parallel coordinate plots to conditional, multi-objective, and constrained studies - #6763

Merged
sawa3030 merged 7 commits into
optuna:masterfrom
y0z:feature/extend-pcp
Aug 13, 2026
Merged

sawa3030 merged 7 commits into
optuna:masterfrom
y0z:feature/extend-pcp

Conversation

@y0z

@y0z y0z commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

Motivation & Description of the changes

The existing parallel coordinate plot has limited support for conditional search spaces, multi-objective studies, and constrained optimization.

This PR extends both the Plotly and Matplotlib implementations to visualize these studies consistently.

  • Support conditional parameters.

    • Missing values are displayed using a fixed None label.
    • If an actual categorical value is also represented as None, it is displayed as None (value) to distinguish it from a missing value.
  • Support multi-objective studies without requiring target.

    • All objective values are displayed as separate axes.
    • Lines are colored by Pareto rank (Pareto ranks are computed from objective values independently of constraints).
  • Support constrained studies.

    • Feasible trials are drawn with solid lines.
    • Infeasible trials are drawn with dotted lines.
  • Use Scatter traces for the Plotly implementation.

    • This allows each trial to have an individual line style, which is not supported by go.Parcoords.

Plotly
image

Matplotlib
image

@y0z y0z added the feature Change that does not break compatibility, but affects the public interfaces. label Jul 21, 2026
@sawa3030

Copy link
Copy Markdown
Contributor

Sorry for the late review. I have a couple of suggestions.

First, would it make sense to rename dim_objective to dims_objectives and include all objective dimensions there? I think this would make the structure a little easier to follow.

Second, would it be better for color_values and draw_order to always be populated in _get_parallel_coordinate_info rather than sometimes being None? If _get_parallel_coordinate_info fully prepares these values, the plotting functions could be simplified to only consume the already-prepared data.

I tried a small refactor along these lines here: sawa3030@ace083e

I’d appreciate it if you could take a look!

@c-bata

c-bata commented Jul 29, 2026

Copy link
Copy Markdown
Member

@gen740 Could you review this PR?

…olor_values, and draw_order

Rename dim_objective to dims_objectives holding all objective dimensions,
and always populate color_values and draw_order in _get_parallel_coordinate_info
so the plotting functions only consume prepared data.

Co-authored-by: sawa3030 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
@y0z

y0z commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

Thank you for your review. Updated.

@gen740 gen740 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for your PR! I left several comments on the tests.

@y0z

y0z commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

@gen740 Thank you for your suggestions. All comments have been applied.

@gen740 gen740 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@sawa3030 sawa3030 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the update. I left a few minor comments. PTAL.

from optuna.visualization._plotly_imports import _imports
from optuna.visualization._utils import _check_plot_args
from optuna.visualization._utils import _filter_nonfinite
from optuna.visualization._utils import _get_skipped_trial_numbers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

_get_skipped_trial_numbers does not appear to be referenced anywhere else in the codebase, so we can probably delete it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch. I removed the function.

@sawa3030 sawa3030 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@sawa3030
sawa3030 merged commit 1b666ee into optuna:master Aug 13, 2026
14 checks passed
@sawa3030 sawa3030 added this to the v5.0.0 milestone Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Change that does not break compatibility, but affects the public interfaces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants