Merge pull request #22 from mikhailkin/patch-1

Bug was fixed in delta criterion
This commit is contained in:
Sangwhan "fish" Moon 2019-06-04 20:53:00 +09:00 committed by GitHub
commit 6aa4a77c99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}