summaryrefslogtreecommitdiff
path: root/training/liblbfgs/lbfgs++.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-05-08 23:10:13 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-05-08 23:10:13 -0400
commitdcb0a499dba305d75bc0d4a28c252ef8ba9bc10d (patch)
tree2538b589a0b26a8662ea2ee93def6fb069b087a8 /training/liblbfgs/lbfgs++.h
parent1fbe902c5199ef71541489158fe75fc66a4ff6d4 (diff)
better logging
Diffstat (limited to 'training/liblbfgs/lbfgs++.h')
-rw-r--r--training/liblbfgs/lbfgs++.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/training/liblbfgs/lbfgs++.h b/training/liblbfgs/lbfgs++.h
index 6c4d1807..342f9b0e 100644
--- a/training/liblbfgs/lbfgs++.h
+++ b/training/liblbfgs/lbfgs++.h
@@ -49,6 +49,7 @@ class LBFGS {
int MinimizeFunction(bool s = false) {
silence = s;
+ ec = 0;
lbfgsfloatval_t fx;
int ret = lbfgs(m_x.size(), &m_x[0], &fx, _evaluate, _progress, this, &param);
if (!silence) {
@@ -84,6 +85,7 @@ class LBFGS {
const lbfgsfloatval_t step) {
(void) n;
(void) step;
+ if (!silence) { ec++; std::cerr << '.'; }
assert(x == &m_x[0]); // sanity check, ensures pass m_x is okay
return func(m_x, g);
}
@@ -121,6 +123,9 @@ class LBFGS {
(void) n;
(void) ls;
if (!silence) {
+ if (ec < 8) std::cerr << '\t';
+ if (ec < 16) std::cerr << '\t';
+ ec = 0;
std::cerr << "Iteration " << k << ':' << "\tfx = " << fx << "\t"
<< " xnorm = " << xnorm << ", gnorm = " << gnorm << ", step = " << step << std::endl;
}
@@ -132,6 +137,7 @@ class LBFGS {
const Function& func;
lbfgs_parameter_t param;
bool silence;
+ int ec;
};
#endif