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

Add Trial Selection page #996

Merged
merged 29 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5dec895
Add trial compare page
hrntsm Nov 18, 2024
7b07330
Add ParallelCoord & ParetoFront interaction
hrntsm Nov 25, 2024
ae31544
Add TrialTable in TrialCompare page
hrntsm Nov 27, 2024
6ade08b
Add csv get to trial_ids query
hrntsm Nov 27, 2024
68bee80
Add csv get test
hrntsm Dec 1, 2024
98c1efb
Fix csv get test type annotation
hrntsm Dec 1, 2024
c60e53d
Add single objective support for TrialCompare
hrntsm Dec 4, 2024
8058261
Add Include dominated trials toggle
hrntsm Dec 5, 2024
245d4f1
Remove SelectionData interface
hrntsm Dec 5, 2024
70cfca8
Update GraphParetoFront to use tslib getIsDominated
hrntsm Dec 5, 2024
0973d05
Merge branch 'main' into feature/add-trial-compare
hrntsm Dec 6, 2024
cbe6057
Add showExperimentalFeature toggle in settings
hrntsm Dec 6, 2024
b51d4c6
Add Include Infeasible toggle
hrntsm Dec 6, 2024
1197c23
apply fmt
hrntsm Dec 8, 2024
bf96c83
Update graph codes to merge TC codes
hrntsm Dec 17, 2024
ad4be1f
Fix type-check
hrntsm Dec 18, 2024
0cb20e8
Add show artifact toggle in selection
hrntsm Jan 12, 2025
885f925
Add min-max calculation and border color logic for artifact cards
hrntsm Jan 12, 2025
6d14847
Add target artifact and value selection for artifact cards
hrntsm Jan 12, 2025
51caf03
Update artifact toggle to disable when no artifacts are available
hrntsm Jan 12, 2025
2f7d5ff
Merge pull request #1 from hrntsm/feature/trial-selection-w-artifact
hrntsm Jan 12, 2025
4f5c5fe
Merge commit 'dfcce8bf883f0d7671c2137e3e1569003be8dbb8' into feature/…
hrntsm Jan 12, 2025
0f398cf
Merge branch 'main' into feature/add-trial-compare
hrntsm Jan 20, 2025
ab8b9e9
fix null artifact error
hrntsm Jan 21, 2025
7e01f7f
Fix artifact border color value range
hrntsm Jan 21, 2025
48edf11
Address review comment
hrntsm Jan 31, 2025
ab441d8
Merge branch 'main' into feature/add-trial-compare
hrntsm Jan 31, 2025
967032a
Optimize trial filtering by using a Set for improved performance
hrntsm Feb 5, 2025
3cb2802
Fix syntax by adding missing commas in function definitions
hrntsm Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion optuna_dashboard/_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,14 +512,31 @@ def save_trial_note(study_id: int, trial_id: int) -> dict[str, Any]:

@app.get("/csv/<study_id:int>")
def download_csv(study_id: int) -> BottleViewReturn:
trial_ids_str = request.query.get("trial_ids", "")
trial_ids: Optional[list[int]] = None
if trial_ids_str:
try:
trial_ids = [int(tid.strip()) for tid in trial_ids_str.split(",")]
except ValueError:
response.status = 400 # Bad Request
return {"reason": "Invalid trial_ids format. Expected comma-separated integers"}

# Create a CSV file
try:
study_name = storage.get_study_name_from_id(study_id)
study = optuna.load_study(storage=storage, study_name=study_name)
except KeyError:
response.status = 404 # Not found
return {"reason": f"study_id={study_id} is not found"}
trials = study.trials

if trial_ids is not None:
trials = [t for t in study.trials if t.number in trial_ids]
if not trials:
response.status = 404
return {"reason": "all specified trial_ids is not found"}
else:
trials = study.trials

param_names = sorted(set(chain.from_iterable([t.params.keys() for t in trials])))
user_attr_names = sorted(set(chain.from_iterable([t.user_attrs.keys() for t in trials])))
param_names_header = [f"Param {x}" for x in param_names]
Expand Down
9 changes: 9 additions & 0 deletions optuna_dashboard/ts/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ export const App: FC = () => {
/>
}
/>
<Route
path={url_prefix + "/studies/:studyId/trialSelection"}
element={
<StudyDetail
toggleColorMode={toggleColorMode}
page={"trialSelection"}
/>
}
/>
<Route
path={url_prefix + "/studies/:studyId/note"}
element={
Expand Down
27 changes: 27 additions & 0 deletions optuna_dashboard/ts/components/AppDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Brightness7Icon from "@mui/icons-material/Brightness7"
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft"
import ChevronRightIcon from "@mui/icons-material/ChevronRight"
import RateReviewIcon from "@mui/icons-material/RateReview"
import RuleIcon from "@mui/icons-material/Rule"
import SettingsIcon from "@mui/icons-material/Settings"
import SyncIcon from "@mui/icons-material/Sync"
import SyncDisabledIcon from "@mui/icons-material/SyncDisabled"
Expand Down Expand Up @@ -34,6 +35,7 @@ import { useRecoilState, useRecoilValue } from "recoil"
import {
drawerOpenState,
reloadIntervalState,
useShowExperimentalFeature,
useStudyIsPreferential,
} from "../state"
import { Settings } from "./Settings"
Expand All @@ -56,6 +58,7 @@ export type PageId =
| "analytics"
| "trialTable"
| "trialList"
| "trialSelection"
| "note"
| "preferenceHistory"
| "graph"
Expand Down Expand Up @@ -145,6 +148,7 @@ export const AppDrawer: FC<{
const reloadInterval = useRecoilValue<number>(reloadIntervalState)
const isPreferential =
studyId !== undefined ? useStudyIsPreferential(studyId) : null
const [showExperimentalFeatures] = useShowExperimentalFeature()

const styleListItem = {
display: "block",
Expand Down Expand Up @@ -345,6 +349,29 @@ export const AppDrawer: FC<{
<ListItemText primary="Trials (Table)" sx={styleListItemText} />
</ListItemButton>
</ListItem>
{showExperimentalFeatures === true ? (
<ListItem
key="TrialSelection"
disablePadding
sx={styleListItem}
title="Trials (Selection)"
>
<ListItemButton
component={Link}
to={`${url_prefix}/studies/${studyId}/trialSelection`}
sx={styleListItemButton}
selected={page === "trialSelection"}
>
<ListItemIcon sx={styleListItemIcon}>
<RuleIcon />
</ListItemIcon>
<ListItemText
primary="Trials (Selection)"
sx={styleListItemText}
/>
</ListItemButton>
</ListItem>
) : null}
hrntsm marked this conversation as resolved.
Show resolved Hide resolved
<ListItem key="Note" disablePadding sx={styleListItem} title="Note">
<ListItemButton
component={Link}
Expand Down
Loading
Loading