Skip to content

Commit

Permalink
Apply the change suggested by umezawa
Browse files Browse the repository at this point in the history
  • Loading branch information
nabenabe0928 committed Feb 13, 2024
1 parent 797a8cd commit c13654f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions optuna_dashboard/ts/components/TrialTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,24 @@ export const TrialTable: FC<{
studyDetail?.intersection_search_space.length
studyDetail?.union_search_space.forEach((s) => {
const sortable = s.distribution.type !== "CategoricalDistribution"
const filterChoices =
const filterChoices: (string | null)[] | undefined =
s.distribution.type === "CategoricalDistribution"
? s.distribution.choices.map((c) => c.value)
: undefined
const filterChoicesWithNull: (string | null)[] | undefined = filterChoices
? [...filterChoices, null]
: undefined
const hasMissingValue = trials.some(
(t) => !t.params.some((p) => p.name === s.name)
)
if (filterChoices !== undefined && isDynamicSpace && hasMissingValue) {
filterChoices.push(null)
}
columns.push({
field: "params",
label: `Param ${s.name}`,
toCellValue: (i) =>
trials[i].params.find((p) => p.name === s.name)?.param_external_value ||
null,
sortable: sortable,
filterChoices: isDynamicSpace ? filterChoicesWithNull : filterChoices,
filterChoices: filterChoices,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
less: (firstEl, secondEl, _): number => {
const firstVal = firstEl.params.find(
Expand Down

0 comments on commit c13654f

Please sign in to comment.