mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-10 12:23:22 +08:00
Remove type def from standalone_app
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { JournalFileStorage } from "@optuna/storage"
|
||||
import { SQLite3Storage } from "@optuna/storage"
|
||||
import type { OptunaStorage } from "@optuna/storage"
|
||||
import React, { FC, createContext, useState } from "react"
|
||||
|
||||
export const StorageContext = createContext<{
|
||||
|
||||
@@ -33,7 +33,7 @@ export const StudyDetail: FC<{
|
||||
const idxNumber = parseInt(idx || "", 10)
|
||||
|
||||
const { storage } = useContext(StorageContext)
|
||||
const [study, setStudy] = useState<Study | null>(null)
|
||||
const [study, setStudy] = useState<Optuna.Study | null>(null)
|
||||
useEffect(() => {
|
||||
const fetchStudy = async () => {
|
||||
if (storage === null) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
useTheme,
|
||||
} from "@mui/material"
|
||||
import { styled } from "@mui/system"
|
||||
import * as Optuna from "@optuna/types"
|
||||
import React, {
|
||||
FC,
|
||||
useEffect,
|
||||
@@ -36,7 +37,7 @@ export const StudyList: FC<{
|
||||
}> = ({ toggleColorMode }) => {
|
||||
const theme = useTheme()
|
||||
const { storage } = useContext(StorageContext)
|
||||
const [studies, setStudies] = useState<StudySummary[]>([])
|
||||
const [studies, setStudies] = useState<Optuna.StudySummary[]>([])
|
||||
|
||||
const [_studyFilterText, setStudyFilterText] = useState<string>("")
|
||||
const [sortBy, setSortBy] = useState<"id-asc" | "id-desc">("id-asc")
|
||||
@@ -52,7 +53,7 @@ export const StudyList: FC<{
|
||||
fetchStudies()
|
||||
}, [storage])
|
||||
const filteredStudies = useMemo(() => {
|
||||
const studyFilter = (row: StudySummary): boolean => {
|
||||
const studyFilter = (row: Optuna.StudySummary): boolean => {
|
||||
const keywords = studyFilterText.split(" ")
|
||||
return !keywords.every((k) => {
|
||||
if (k === "") {
|
||||
@@ -61,7 +62,9 @@ export const StudyList: FC<{
|
||||
return row.study_name.indexOf(k) >= 0
|
||||
})
|
||||
}
|
||||
let filteredStudies: StudySummary[] = studies.filter((s) => !studyFilter(s))
|
||||
let filteredStudies: Optuna.StudySummary[] = studies.filter(
|
||||
(s) => !studyFilter(s)
|
||||
)
|
||||
if (sortBy === "id-desc") {
|
||||
filteredStudies = filteredStudies.reverse()
|
||||
}
|
||||
|
||||
Vendored
+1
-99
@@ -1,99 +1 @@
|
||||
declare const IS_VSCODE: boolean
|
||||
|
||||
type TrialState = "Running" | "Complete" | "Pruned" | "Fail" | "Waiting"
|
||||
type TrialStateFinished = "Complete" | "Fail" | "Pruned"
|
||||
type StudyDirection = "maximize" | "minimize"
|
||||
|
||||
type OptunaStorage = {
|
||||
getStudies: () => Promise<StudySummary[]>
|
||||
getStudy: (idx: number) => Promise<Study | null>
|
||||
}
|
||||
|
||||
type FloatDistribution = {
|
||||
type: "FloatDistribution"
|
||||
low: number
|
||||
high: number
|
||||
step: number | null
|
||||
log: boolean
|
||||
}
|
||||
|
||||
type IntDistribution = {
|
||||
type: "IntDistribution"
|
||||
low: number
|
||||
high: number
|
||||
step: number | null
|
||||
log: boolean
|
||||
}
|
||||
|
||||
type CategoricalChoiceType = null | boolean | number | string
|
||||
type CategoricalDistribution = {
|
||||
type: "CategoricalDistribution"
|
||||
choices: CategoricalChoiceType[]
|
||||
}
|
||||
|
||||
type TrialIntermediateValue = {
|
||||
step: number
|
||||
value: number
|
||||
}
|
||||
|
||||
type Distribution =
|
||||
| FloatDistribution
|
||||
| IntDistribution
|
||||
| CategoricalDistribution
|
||||
|
||||
type Attribute = {
|
||||
key: string
|
||||
value: string
|
||||
}
|
||||
|
||||
type AttributeSpec = {
|
||||
key: string
|
||||
sortable: boolean
|
||||
}
|
||||
|
||||
type StudySummary = {
|
||||
study_id: number
|
||||
study_name: string
|
||||
directions: StudyDirection[]
|
||||
}
|
||||
|
||||
type Study = {
|
||||
study_id: number
|
||||
study_name: string
|
||||
directions: StudyDirection[]
|
||||
union_search_space: SearchSpaceItem[]
|
||||
intersection_search_space: SearchSpaceItem[]
|
||||
union_user_attrs: AttributeSpec[]
|
||||
datetime_start?: Date
|
||||
trials: Trial[]
|
||||
}
|
||||
|
||||
type Trial = {
|
||||
trial_id: number
|
||||
number: number
|
||||
study_id: number
|
||||
state: TrialState
|
||||
values?: number[]
|
||||
params: TrialParam[]
|
||||
intermediate_values: TrialIntermediateValue[]
|
||||
user_attrs: Attribute[]
|
||||
datetime_start?: Date
|
||||
datetime_complete?: Date
|
||||
}
|
||||
|
||||
type TrialParam = {
|
||||
name: string
|
||||
param_internal_value: number
|
||||
param_external_value: CategoricalChoiceType
|
||||
param_external_type: string
|
||||
distribution: Distribution
|
||||
}
|
||||
|
||||
type SearchSpaceItem = {
|
||||
name: string
|
||||
}
|
||||
|
||||
type ParamImportance = {
|
||||
name: string
|
||||
importance: number
|
||||
}
|
||||
declare const IS_VSCODE: boolean
|
||||
Reference in New Issue
Block a user