Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.pad.base
Commits
cbf1f1c5
Commit
cbf1f1c5
authored
Jul 10, 2018
by
Guillaume HEUSCH
Browse files
[algorithm] fixed criteria for stopping the training loop
parent
0d6da9b9
Pipeline
#21776
passed with stage
in 22 minutes and 58 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/pad/base/algorithm/MLP.py
View file @
cbf1f1c5
...
...
@@ -98,12 +98,12 @@ class MLP(Algorithm):
n_iter
=
0
previous_cost
=
0
current_cost
=
1
while
(
n_iter
<
self
.
max_iter
)
or
(
abs
(
previous_cost
-
current_cost
)
>
self
.
precision
):
while
(
n_iter
<
self
.
max_iter
)
and
(
abs
(
previous_cost
-
current_cost
)
>
self
.
precision
):
previous_cost
=
current_cost
trainer
.
train
(
self
.
mlp
,
X
,
Y
)
current_cost
=
trainer
.
cost
(
self
.
mlp
,
X
,
Y
)
n_iter
+=
1
logger
.
debug
(
"Iteration {} -> cost = {} (previous = {})"
.
format
(
n_iter
,
trainer
.
cost
(
self
.
mlp
,
X
,
Y
),
previous_cost
))
logger
.
debug
(
"Iteration {} -> cost = {} (previous =
{}, max_iter =
{})"
.
format
(
n_iter
,
trainer
.
cost
(
self
.
mlp
,
X
,
Y
),
previous_cost
,
self
.
max_iter
))
f
=
bob
.
io
.
base
.
HDF5File
(
projector_file
,
'w'
)
self
.
mlp
.
save
(
f
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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