diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-05-08 23:10:13 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-05-08 23:10:13 -0400 |
commit | ad16eda6dedf3475e3ab952418dde8decf0dceca (patch) | |
tree | 33726f21afae248a63d4f64e26e0f3198152eb76 | |
parent | 33d4601da5e2e715260619a38f5899645d157952 (diff) |
better logging
-rw-r--r-- | training/liblbfgs/lbfgs++.h | 6 |
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, ¶m); 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 |