Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.learn.tensorflow
Commits
fe0c9672
Commit
fe0c9672
authored
Jun 06, 2018
by
Amir MOHAMMADI
Browse files
save best models based on the loss
parent
01e02f37
Pipeline
#20864
failed with stage
in 46 minutes and 50 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/learn/tensorflow/script/eval.py
View file @
fe0c9672
...
...
@@ -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
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment