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

Tranquilo cleanup #443

Closed timmens closed 1 year ago

timmens commented 1 year ago

In this PR, we clean up certain components of tranquilo:

  1. We create a new module bounds.py for the Bounds dataclass.
  2. We create a new module region.py for the Region dataclass
    1. The region class is now aware of its shape, which is a sphere if bounds aren't binding and a cube otherwise
    2. The region class now provides methods map_to_unit and map_from_unit for transitioning between the unit space used in points sampling, fitting, and solving the subproblem, and the regular trustregion space.
  3. The sampling code now adaptively samples from the correct shape using the new shape information of the trustregion.
  4. We replace the class ModelInfo with the string model_type which can only be either linear or quadratic.
codecov[bot] commented 1 year ago

Codecov Report

Merging #443 (25cb4eb) into main (75d3747) will increase coverage by 0.12%. The diff coverage is 97.97%.

@@            Coverage Diff             @@
##             main     #443      +/-   ##
==========================================
+ Coverage   92.86%   92.98%   +0.12%     
==========================================
  Files         244      248       +4     
  Lines       18497    18526      +29     
==========================================
+ Hits        17177    17227      +50     
+ Misses       1320     1299      -21     
Impacted Files Coverage Δ
src/estimagic/optimization/tranquilo/options.py 100.00% <ø> (ø)
src/estimagic/optimization/tranquilo/weighting.py 81.81% <ø> (ø)
src/estimagic/visualization/deviation_plot.py 100.00% <ø> (ø)
src/estimagic/visualization/visualize_tranquilo.py 84.97% <ø> (-0.14%) :arrow_down:
...s/optimization/tranquilo/test_estimate_variance.py 100.00% <ø> (ø)
src/estimagic/optimization/tranquilo/fit_models.py 86.36% <85.71%> (-0.70%) :arrow_down:
src/estimagic/optimization/tranquilo/bounds.py 94.11% <94.11%> (ø)
src/estimagic/optimization/tranquilo/region.py 97.14% <97.14%> (ø)
...timagic/optimization/tranquilo/aggregate_models.py 87.27% <100.00%> (-0.45%) :arrow_down:
...imagic/optimization/tranquilo/estimate_variance.py 100.00% <100.00%> (ø)
... and 17 more

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.