From c16297a59ed2ab9692e07d07d7ef82e3cdb6eb4b Mon Sep 17 00:00:00 2001 From: Kostyukov Date: Fri, 2 Jun 2017 14:59:56 +0300 Subject: [PATCH] Bug was fixed in delta criterion Delta criterion didn't work properly. Please, consider fix to add --- lib/lbfgs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/lbfgs.c b/lib/lbfgs.c index 30ffcf2..c710cf3 100644 --- a/lib/lbfgs.c +++ b/lib/lbfgs.c @@ -510,7 +510,7 @@ int lbfgs( /* Test for stopping criterion. The criterion is given by the following formula: - (f(past_x) - f(x)) / f(x) < \delta + |(f(past_x) - f(x))| / f(x) < \delta */ if (pf != NULL) { /* We don't test the stopping criterion while k < past. */ @@ -519,7 +519,7 @@ int lbfgs( rate = (pf[k % param.past] - fx) / fx; /* The stopping criterion. */ - if (rate < param.delta) { + if (fabs(rate) < param.delta) { ret = LBFGS_STOP; break; }