Add convergence information to optimization outputs#3379
Conversation
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
| if (ss.str().length() > 0) | ||
| logger.info(ss); | ||
| values.insert(values.begin(), lp); | ||
| values.insert(values.begin(), {lp, 0}); |
There was a problem hiding this comment.
Newton converges whenever the difference in lp is less than 1e-8. So why don't we just have an int ret = -1 at the beginning of the loop like in lbfgs so that whenever if (std::fabs(lp - lastlp) <= 1e-8) goes off we set it to 0 so we know that newton converged
There was a problem hiding this comment.
Good suggestion, I've updated it to use the same numeric codes as lbfgs/bfgs for the two possible options (absolute tolerance reached and max iterations reached)
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
Submission Checklist
./runTests.py src/test/unitmake cpplintSummary
This adds a second column of diagnostic parameters to the optimize algorithms,
converged__, which corresponds to theper-iteration return of the algorithm (e.g.,
0is a sucessful step but not done,-1is a failure, positive numbers indicate different convergence criteria hit). These values are defined instan::optimize::TerminationConditionIt also adds the message associated with the final value, which is currently printed to stdout, as a trailing comment in the CSV file
Intended Effect
Allow consumers of the output files to understand if optimization converged, c.f. stan-dev/cmdstanpy#851 (comment)
How to Verify
Side Effects
Documentation
I will update the documentation for cmdstan after this is merged.
Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):
Simons Foundation
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: