optimagic-dev / optimagic

optimagic is a Python package for numerical optimization. It is a unified interface to optimizers from SciPy, NlOpt and other packages. optimagic's minimize function works just like SciPy's, so you don't have to adjust your code. You simply get more optimizers for free. On top you get diagnostic tools, parallel numerical derivatives and more.
https://optimagic.readthedocs.io/
MIT License
270 stars 30 forks source link

Refactor/logging #519

Closed schroedk closed 3 months ago

schroedk commented 3 months ago

The proposed logging is described here.

This refactoring introduces the following abstractions:

The old class OptimizationLogReader redirects to SQLiteLogReader in a backward-compatible way.

review-notebook-app[bot] commented 3 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 94.16283% with 38 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/optimagic/logging/base.py 85.71% 11 Missing :warning:
src/optimagic/logging/logger.py 95.34% 10 Missing :warning:
src/optimagic/logging/sqlalchemy.py 95.56% 7 Missing :warning:
src/optimagic/typing.py 84.09% 7 Missing :warning:
src/optimagic/optimization/multistart.py 71.42% 2 Missing :warning:
...imagic/optimization/create_optimization_problem.py 90.90% 1 Missing :warning:
Files with missing lines Coverage Δ
src/estimagic/estimate_ml.py 82.47% <ø> (ø)
src/estimagic/estimate_msm.py 89.68% <ø> (ø)
src/optimagic/__init__.py 100.00% <100.00%> (+8.33%) :arrow_up:
src/optimagic/deprecations.py 100.00% <100.00%> (ø)
src/optimagic/logging/__init__.py 100.00% <100.00%> (ø)
src/optimagic/logging/read_log.py 100.00% <100.00%> (+4.27%) :arrow_up:
src/optimagic/logging/types.py 100.00% <100.00%> (ø)
src/optimagic/optimization/get_algorithm.py 93.04% <100.00%> (-0.06%) :arrow_down:
...imagic/optimization/internal_criterion_template.py 82.60% <100.00%> (ø)
src/optimagic/optimization/optimization_logging.py 100.00% <100.00%> (ø)
... and 10 more

... and 2 files with indirect coverage changes

schroedk commented 3 months ago

I am through now. Thanks a lot for this PR!

One thing that is left to do is adding a logger field to the OptimizeResult.

Done