Support fixed_params

This commit is contained in:
c-bata
2023-01-07 20:34:54 +09:00
parent dbda2b58af
commit ae4f6fdff4
4 changed files with 33 additions and 8 deletions
+7 -1
View File
@@ -162,14 +162,20 @@ def serialize_frozen_trial(
"distribution": serialize_distribution(distribution),
}
)
trial_system_attrs = getattr(trial, "_system_attrs", {})
fixed_params = trial_system_attrs.get("fixed_params", {})
serialized = {
"trial_id": trial._trial_id,
"study_id": study_id,
"number": trial.number,
"state": trial.state.name.capitalize(),
"params": params,
"fixed_params": [
{"name": param_name, "param_external_value": str(fixed_params.get(param_name, None))}
for param_name in fixed_params
],
"user_attrs": serialize_attrs(trial.user_attrs),
"system_attrs": serialize_attrs(getattr(trial, "_system_attrs", {})),
"system_attrs": serialize_attrs(trial_system_attrs),
"note": note.get_note_from_system_attrs(study_system_attrs, trial._trial_id),
}
+5
View File
@@ -12,6 +12,10 @@ interface TrialResponse {
datetime_start?: string
datetime_complete?: string
params: TrialParam[]
fixed_params: {
name: string
param_external_value: string
}[]
user_attrs: Attribute[]
system_attrs: Attribute[]
note: Note
@@ -32,6 +36,7 @@ const convertTrialResponse = (res: TrialResponse): Trial => {
? new Date(res.datetime_complete)
: undefined,
params: res.params,
fixed_params: res.fixed_params,
user_attrs: res.user_attrs,
system_attrs: res.system_attrs,
note: res.note,
+17 -7
View File
@@ -160,13 +160,23 @@ const TrialListDetail: FC<{
Values = [
{trial.values?.map((v) => v.toString()).join(" ") || "None"}]
</Typography>
<Typography>
Params = [
{trial.params
.map((p) => `${p.name}: ${p.param_external_value}`)
.join(", ")}
]
</Typography>
{trial.state !== "Waiting" ? (
<Typography>
Params = [
{trial.params
.map((p) => `${p.name}: ${p.param_external_value}`)
.join(", ")}
]
</Typography>
) : (
<Typography>
Params = [
{trial.fixed_params
.map((p) => `${p.name}: ${p.param_external_value}`)
.join(", ")}
]
</Typography>
)}
<Typography>
Started At ={" "}
{trial?.datetime_start ? trial?.datetime_start.toString() : null}
+4
View File
@@ -98,6 +98,10 @@ type Trial = {
datetime_start?: Date
datetime_complete?: Date
params: TrialParam[]
fixed_params: {
name: string
param_external_value: string
}[]
user_attrs: Attribute[]
system_attrs: Attribute[]
note: Note