Commit fe0c9672 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

save best models based on the loss

parent 01e02f37
Pipeline #20864 failed with stage
in 46 minutes and 50 seconds
......@@ -29,9 +29,9 @@ def save_n_best_models(train_dir, save_dir, evaluated_file,
def _key(x):
x = x[1]
ac = x.get('accuracy')
ac = x.get('accuracy') or 0
lo = x.get('loss') or 0
return ac * -1 if ac is not None else lo
return (lo, ac * -1)
best_models = OrderedDict(sorted(
evaluated.items(), key=_key)[:keep_n_best_models])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment