mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-11 12:30:25 +08:00
Fix code in optuna-dashboard
This commit is contained in:
@@ -5,7 +5,6 @@ import {
|
||||
FeedbackComponentType,
|
||||
FormWidgets,
|
||||
Note,
|
||||
ParamImportance,
|
||||
PlotlyGraphObject,
|
||||
PreferenceFeedbackMode,
|
||||
PreferenceHistory,
|
||||
@@ -113,7 +112,7 @@ export type UploadArtifactAPIResponse = {
|
||||
}
|
||||
|
||||
export interface ParamImportancesResponse {
|
||||
param_importances: ParamImportance[][]
|
||||
param_importances: Optuna.ParamImportance[][]
|
||||
}
|
||||
|
||||
export type PlotResponse = {
|
||||
@@ -228,7 +227,9 @@ export abstract class APIClient {
|
||||
trialId: number,
|
||||
user_attrs: { [key: string]: number | string }
|
||||
): Promise<void>
|
||||
abstract getParamImportances(studyId: number): Promise<ParamImportance[][]>
|
||||
abstract getParamImportances(
|
||||
studyId: number
|
||||
): Promise<Optuna.ParamImportance[][]>
|
||||
abstract reportPreference(
|
||||
studyId: number,
|
||||
candidates: number[],
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
} from "./apiClient"
|
||||
import {
|
||||
FeedbackComponentType,
|
||||
ParamImportance,
|
||||
StudyDetail,
|
||||
StudySummary,
|
||||
Trial,
|
||||
@@ -230,7 +229,9 @@ export class AxiosClient extends APIClient {
|
||||
.then(() => {
|
||||
return
|
||||
})
|
||||
getParamImportances = (studyId: number): Promise<ParamImportance[][]> =>
|
||||
getParamImportances = (
|
||||
studyId: number
|
||||
): Promise<Optuna.ParamImportance[][]> =>
|
||||
this.axiosInstance
|
||||
.get<ParamImportancesResponse>(
|
||||
`/api/studies/${studyId}/param_importances`
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as Optuna from "@optuna/types"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { AxiosError } from "axios"
|
||||
import { useSnackbar } from "notistack"
|
||||
import { useEffect } from "react"
|
||||
import { ParamImportance } from "ts/types/optuna"
|
||||
import { useAPIClient } from "../apiClientProvider"
|
||||
|
||||
export const useParamImportance = ({
|
||||
@@ -13,7 +13,7 @@ export const useParamImportance = ({
|
||||
const { enqueueSnackbar } = useSnackbar()
|
||||
|
||||
const { data, isLoading, error } = useQuery<
|
||||
ParamImportance[][],
|
||||
Optuna.ParamImportance[][],
|
||||
AxiosError<{ reason: string }>
|
||||
>({
|
||||
queryKey: ["paramImportance", studyId, numCompletedTrials],
|
||||
|
||||
Reference in New Issue
Block a user