Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update multistart option handling #513

Merged
merged 34 commits into from
Aug 5, 2024
Merged

Update multistart option handling #513

merged 34 commits into from
Aug 5, 2024

Conversation

timmens
Copy link
Member

@timmens timmens commented Aug 2, 2024

In this PR, I update the multistart options handing.

  • Add public MultistartOptions data class
  • Add internal MultistartInfo data class
  • Add a lot of type and value checks to the public data class
  • Add deprecations and exceptions
  • Only use MultistartOptions instead of dictionaries internally
  • Add deprecation test
  • Change default "sampling_method" to "random".
  • Validate that RNG can be used as seeds.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@timmens timmens changed the base branch from main to 0.5.0 August 2, 2024 18:56
Copy link

codecov bot commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 94.92188% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/optimagic/optimization/multistart_options.py 95.62% 7 Missing ⚠️
...imagic/optimization/create_optimization_problem.py 72.72% 3 Missing ⚠️
src/optimagic/optimization/multistart.py 92.59% 2 Missing ⚠️
src/optimagic/optimization/optimize_result.py 92.30% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/optimagic/__init__.py 100.00% <100.00%> (+10.00%) ⬆️
src/optimagic/deprecations.py 100.00% <100.00%> (ø)
src/optimagic/exceptions.py 86.66% <100.00%> (+0.45%) ⬆️
src/optimagic/optimization/optimize.py 91.73% <100.00%> (+1.59%) ⬆️
src/optimagic/optimization/process_results.py 96.10% <100.00%> (-0.05%) ⬇️
src/optimagic/parameters/scaling.py 97.22% <100.00%> (+0.34%) ⬆️
src/optimagic/optimization/optimize_result.py 93.89% <92.30%> (-0.28%) ⬇️
src/optimagic/optimization/multistart.py 92.56% <92.59%> (+0.11%) ⬆️
...imagic/optimization/create_optimization_problem.py 84.74% <72.72%> (-0.32%) ⬇️
src/optimagic/optimization/multistart_options.py 95.62% <95.62%> (ø)

... and 1 file with indirect coverage changes

@timmens timmens requested a review from janosg August 3, 2024 18:01
Copy link
Member

@janosg janosg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice PR.

After you are done with the current comments I will go over the how-to guide; Will be easier to make changes there myself than describing changes in comments.

One more thing: Since it is a breaking change we should convert the multistart_info dict in the OptimizeResult to a dataclass. You can add a __getitem__ method such that it behaves a bit more like a dict.

src/optimagic/optimization/multistart.py Outdated Show resolved Hide resolved
src/optimagic/optimization/multistart.py Outdated Show resolved Hide resolved
src/optimagic/optimization/multistart.py Show resolved Hide resolved
src/optimagic/optimization/multistart.py Outdated Show resolved Hide resolved
src/optimagic/optimization/multistart.py Outdated Show resolved Hide resolved
src/optimagic/optimization/multistart.py Outdated Show resolved Hide resolved
src/optimagic/optimization/multistart.py Outdated Show resolved Hide resolved
tests/optimagic/parameters/test_scaling.py Outdated Show resolved Hide resolved
Copy link
Member

@janosg janosg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot. We can merge after two mini comments.

src/optimagic/optimization/multistart_options.py Outdated Show resolved Hide resolved
src/optimagic/optimization/multistart_options.py Outdated Show resolved Hide resolved
@timmens timmens merged commit 694b537 into 0.5.0 Aug 5, 2024
16 checks passed
@timmens timmens deleted the update-multistart branch August 5, 2024 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants