diff --git a/optuna_dashboard/ts/apiClient.ts b/optuna_dashboard/ts/apiClient.ts index f1a7ad8c5..e618e21fc 100644 --- a/optuna_dashboard/ts/apiClient.ts +++ b/optuna_dashboard/ts/apiClient.ts @@ -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 - abstract getParamImportances(studyId: number): Promise + abstract getParamImportances( + studyId: number + ): Promise abstract reportPreference( studyId: number, candidates: number[], diff --git a/optuna_dashboard/ts/axiosClient.ts b/optuna_dashboard/ts/axiosClient.ts index bb2b811ad..9b29f2db4 100644 --- a/optuna_dashboard/ts/axiosClient.ts +++ b/optuna_dashboard/ts/axiosClient.ts @@ -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 => + getParamImportances = ( + studyId: number + ): Promise => this.axiosInstance .get( `/api/studies/${studyId}/param_importances` diff --git a/optuna_dashboard/ts/hooks/useParamImportance.ts b/optuna_dashboard/ts/hooks/useParamImportance.ts index 9cddaafa4..e5baef6f0 100644 --- a/optuna_dashboard/ts/hooks/useParamImportance.ts +++ b/optuna_dashboard/ts/hooks/useParamImportance.ts @@ -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], diff --git a/optuna_dashboard/ts/types/optuna.ts b/optuna_dashboard/ts/types/optuna.ts index 01844f722..f69d008a6 100644 --- a/optuna_dashboard/ts/types/optuna.ts +++ b/optuna_dashboard/ts/types/optuna.ts @@ -21,12 +21,6 @@ export type TrialParam = { distribution: Optuna.Distribution } -export type ParamImportance = { - name: string - importance: number - distribution: Optuna.Distribution -} - export type SearchSpaceItem = { name: string distribution: Optuna.Distribution