Skip to content
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

Use tslib's PlotHistory in optuna-dashboard #928

Merged
merged 8 commits into from
Sep 11, 2024

Conversation

keisuke-umezawa
Copy link
Member

Contributor License Agreement

This repository (optuna-dashboard) and Goptuna share common code.
This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.

  • I agree this patch may be ported to Goptuna by other Goptuna contributors.

Reference Issues/PRs

NA

What does this implement/fix? Explain your changes.

Use tslib's PlotHistory in optuna-dashboard

@keisuke-umezawa keisuke-umezawa force-pushed the feature/tslib-plothistory branch from c039577 to c1802ae Compare August 20, 2024 13:51
@keisuke-umezawa keisuke-umezawa marked this pull request as ready for review August 21, 2024 04:49
Copy link
Collaborator

@porink0424 porink0424 left a comment

Choose a reason for hiding this comment

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

Looks almost good to me! I left just one comment.

Comment on lines -81 to -114
const element = document.getElementById(plotDomId)
if (element !== null && studies.length >= 1) {
// @ts-ignore
element.on("plotly_click", (data) => {
if (data.points[0].data.mode !== "lines") {
let studyId = 1
if (data.points[0].data.name.includes("Infeasible Trial of")) {
const studyInfo: { id: number; name: string }[] = []
studies.forEach((study) => {
studyInfo.push({ id: study.id, name: study.name })
})
const dataPointStudyName = data.points[0].data.name.replace(
"Infeasible Trial of ",
""
)
const targetId = studyInfo.find(
(s) => s.name === dataPointStudyName
)?.id
if (targetId !== undefined) {
studyId = targetId
}
} else {
studyId = studies[Math.floor(data.points[0].curveNumber / 2)].id
}
navigate(
url_prefix +
`/studies/${studyId}/trials?numbers=${data.points[0].x}`
)
}
})
return () => {
// @ts-ignore
element.removeAllListeners("plotly_click")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this part is missing in tslib/react/src/components/PlotHistory.tsx.

Copy link
Member Author

Choose a reason for hiding this comment

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

I missed this part. Thank you.

@keisuke-umezawa
Copy link
Member Author

@porink0424 I followed your suggestion, and implemented it like we did it for TrialTable.

@porink0424
Copy link
Collaborator

LGTM!

@porink0424 porink0424 merged commit 7d6b619 into optuna:main Sep 11, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants