Skip to content

Commit

Permalink
Merge pull request #332 from hrntsm/fix/3d-pareto-front
Browse files Browse the repository at this point in the history
Fix/3d pareto front
  • Loading branch information
hrntsm authored Oct 16, 2024
2 parents d616513 + 050cc39 commit 0d31792
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ for now removed features.
- Mesh could not be put directly into Artifact.
- Human in the loop exception with _stop_flag.
- Even the multi-purpose Human in the loop specifies GP and the optimization does not flow, so TPE is chosen.
- Pareto Front plot with 3 objectives visualize error

### Security

Expand Down
25 changes: 13 additions & 12 deletions Optuna/Visualization/Python/plot_pareto_front.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@

def plot_pareto_front(
study: Study,
objective_name: str,
objective_names: list[str],
objective_index: list[int],
hasConstraint: bool,
includeDominatedTrials: bool,
) -> go.Figure:
fig = optuna.visualization.plot_pareto_front(
if len(objective_index) == 2:
targets = lambda t: (t.values[objective_index[0]], t.values[objective_index[1]])
elif len(objective_index) == 3:
targets = lambda t: [
t.values[objective_index[0]],
t.values[objective_index[1]],
t.values[objective_index[2]],
]

fig: go.Figure = optuna.visualization.plot_pareto_front(
study,
target_names=objective_name,
targets=lambda t: (
[t.values[objective_index[0]], t.values[objective_index[1]]]
if len(objective_index) == 2
else lambda t: [
t.values[objective_index[0]],
t.values[objective_index[1]],
t.values[objective_index[2]],
]
),
target_names=objective_names,
targets=targets,
constraints_func=constraint_func if hasConstraint else None,
include_dominated_trials=True if includeDominatedTrials else False,
)
Expand Down

0 comments on commit 0d31792

Please sign in to comment.