mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-10 12:23:22 +08:00
Add includePruned as optional
This commit is contained in:
@@ -8,13 +8,14 @@ export const GraphHistory: FC<{
|
||||
studies: StudyDetail[]
|
||||
logScale: boolean
|
||||
includePruned: boolean
|
||||
}> = ({ studies, logScale }) => {
|
||||
}> = ({ studies, logScale, includePruned }) => {
|
||||
const theme = useTheme()
|
||||
const colorTheme = usePlotlyColorTheme(theme.palette.mode)
|
||||
return (
|
||||
<PlotHistory
|
||||
studies={studies}
|
||||
logScale={logScale}
|
||||
includePruned={includePruned}
|
||||
colorTheme={colorTheme}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -37,10 +37,9 @@ interface HistoryPlotInfo {
|
||||
export const PlotHistory: FC<{
|
||||
studies: Optuna.Study[]
|
||||
logScale?: boolean
|
||||
includePruned?: boolean
|
||||
colorTheme?: Partial<Plotly.Template>
|
||||
}> = ({ studies, logScale, colorTheme }) => {
|
||||
const filterPrunedTrial = false
|
||||
|
||||
}> = ({ studies, logScale, includePruned, colorTheme }) => {
|
||||
const { graphComponentState, notifyGraphDidRender } = useGraphComponentState()
|
||||
|
||||
const theme = useTheme()
|
||||
@@ -52,6 +51,8 @@ export const PlotHistory: FC<{
|
||||
>("number")
|
||||
|
||||
const [logScaleInternal, setLogScaleInternal] = useState<boolean>(false)
|
||||
const [includePrunedInternal, setIncludePrunedInternal] =
|
||||
useState<boolean>(true)
|
||||
|
||||
const [markerSize, setMarkerSize] = useState<number>(5)
|
||||
|
||||
@@ -61,7 +62,7 @@ export const PlotHistory: FC<{
|
||||
const trials = useFilteredTrialsFromStudies(
|
||||
studies,
|
||||
[selected],
|
||||
filterPrunedTrial
|
||||
includePruned === undefined ? !includePrunedInternal : !includePruned
|
||||
)
|
||||
|
||||
const historyPlotInfos = studies.map((study, index) => {
|
||||
@@ -82,6 +83,10 @@ export const PlotHistory: FC<{
|
||||
setLogScaleInternal(!logScaleInternal)
|
||||
}
|
||||
|
||||
const handleIncludePrunedChange = () => {
|
||||
setIncludePrunedInternal(!includePrunedInternal)
|
||||
}
|
||||
|
||||
const handleXAxisChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||
if (e.target.value === "number") {
|
||||
setXAxis("number")
|
||||
@@ -189,6 +194,19 @@ export const PlotHistory: FC<{
|
||||
/>
|
||||
</FormControl>
|
||||
) : null}
|
||||
{includePruned === undefined ? (
|
||||
<FormControl
|
||||
component="fieldset"
|
||||
sx={{ marginBottom: theme.spacing(2) }}
|
||||
>
|
||||
<FormLabel component="legend"> Include PRUNED trials:</FormLabel>
|
||||
<Switch
|
||||
checked={includePrunedInternal}
|
||||
onChange={handleIncludePrunedChange}
|
||||
value="enable"
|
||||
/>
|
||||
</FormControl>
|
||||
) : null}
|
||||
<FormControl>
|
||||
<FormLabel component="legend">Marker size:</FormLabel>
|
||||
<Slider
|
||||
|
||||
Reference in New Issue
Block a user