Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lib4neuro
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MolDyn
lib4neuro
Commits
5c7df30d
Commit
5c7df30d
authored
6 years ago
by
Martin Beseda
Browse files
Options
Downloads
Patches
Plain Diff
FIX: Output rewritten properly using macros from message.h.
parent
e517ebce
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/LearningMethods/GradientDescent.cpp
+13
-12
13 additions, 12 deletions
src/LearningMethods/GradientDescent.cpp
with
13 additions
and
12 deletions
src/LearningMethods/GradientDescent.cpp
+
13
−
12
View file @
5c7df30d
...
...
@@ -6,6 +6,7 @@
*/
#include
"GradientDescent.h"
#include
"message.h"
namespace
lib4neuro
{
GradientDescent
::
GradientDescent
(
double
epsilon
,
size_t
n_to_restart
,
int
max_iters
,
size_t
batch
)
{
...
...
@@ -49,10 +50,8 @@ namespace lib4neuro {
ef
.
get_dataset
()
->
get_normalization_strategy
());
}
std
::
cout
<<
"Finding a solution via a Gradient Descent method with adaptive step-length"
<<
std
::
endl
;
std
::
cout
<<
"********************************************************************************************************************************************"
<<
std
::
endl
;
COUT_INFO
(
"Finding a solution via a Gradient Descent method with adaptive step-length..."
<<
std
::
endl
);
double
grad_norm
=
this
->
tolerance
*
10.0
,
gamma
,
sx
,
beta
;
double
grad_norm_prev
;
size_t
i
;
...
...
@@ -131,16 +130,18 @@ namespace lib4neuro {
params_current
=
ptr_mem
;
val
=
ef
.
eval
(
params_current
);
if
(
iter_counter
%
1
==
0
)
{
printf
(
"Iteration %12d. Step size: %15.8f, C: %15.8f, Gradient norm: %15.8f. Total error: %10.8f
\r
"
,
(
int
)
iter_counter
,
gamma
,
c
,
grad_norm
,
val
);
std
::
cout
.
flush
();
}
COUT_DEBUG
(
std
::
string
(
"Iteration: "
)
<<
(
unsigned
int
)(
iter_counter
)
<<
". Step size: "
<<
gamma
<<
". C: "
<<
c
<<
". Gradient norm: "
<<
grad_norm
<<
". Total error: "
<<
val
<<
"."
<<
std
::
endl
);
}
printf
(
"Iteration %12d. Step size: %15.8f, C: %15.8f, Gradient norm: %15.8f. Total error: %10.8f
\n
"
,
(
int
)
iter_counter
,
gamma
,
c
,
grad_norm
,
val
);
std
::
cout
.
flush
();
if
(
iter_idx
==
0
)
{
COUT_INFO
(
"Maximum number of iterations ("
<<
this
->
maximum_niters
<<
") was reached!"
<<
std
::
endl
);
}
*
this
->
optimal_parameters
=
*
params_current
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment