Skip to content

Commit

Permalink
Merge pull request optuna#905 from keisuke-umezawa/feature/add-distri…
Browse files Browse the repository at this point in the history
…bution-paramimportance-tslib

Remove distribution property in ParamImportance
  • Loading branch information
c-bata authored Jul 23, 2024
2 parents 249906e + 7366550 commit 1845ba3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
7 changes: 4 additions & 3 deletions optuna_dashboard/ts/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
FeedbackComponentType,
FormWidgets,
Note,
ParamImportance,
PlotlyGraphObject,
PreferenceFeedbackMode,
PreferenceHistory,
Expand Down Expand Up @@ -113,7 +112,7 @@ export type UploadArtifactAPIResponse = {
}

export interface ParamImportancesResponse {
param_importances: ParamImportance[][]
param_importances: Optuna.ParamImportance[][]
}

export type PlotResponse = {
Expand Down Expand Up @@ -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[],
Expand Down
5 changes: 3 additions & 2 deletions optuna_dashboard/ts/axiosClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from "./apiClient"
import {
FeedbackComponentType,
ParamImportance,
StudyDetail,
StudySummary,
Trial,
Expand Down Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions optuna_dashboard/ts/hooks/useParamImportance.ts
Original file line number Diff line number Diff line change
@@ -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 = ({
Expand All @@ -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],
Expand Down
6 changes: 0 additions & 6 deletions optuna_dashboard/ts/types/optuna.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1845ba3

Please sign in to comment.