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

Add functionality to Region class #444

Merged
merged 13 commits into from
Mar 13, 2023
Merged

Add functionality to Region class #444

merged 13 commits into from
Mar 13, 2023

Conversation

timmens
Copy link
Member

@timmens timmens commented Mar 10, 2023

In this PR, I extend the functionality of the Region class. I create modules region.py and bounds.py and add tests for their private functions and classes.

The biggest change happened to the Region class. Which is now a dataclass object with attributes (center, radius, bounds); properties (shape, cube_bounds, cube_center) and methods (map_to_unit, map_from_unit). The properties are dynamically updated based on the center, radius and the user-provided bounds. If any of the bounds is binding we switch from a spherical trustregion shape to a cube one. The methods map_to_unit and map_from_unit map points from the trustregion to the unit space and back. They are attached to this class because they are used in multiple modules and only depend on the information stored in the trustregion.

@timmens timmens changed the base branch from main to cleanup March 10, 2023 16:35
@timmens timmens requested a review from janosg March 10, 2023 17:43
@codecov
Copy link

codecov bot commented Mar 10, 2023

Codecov Report

Merging #444 (62d0e0f) into cleanup (aa779b8) will increase coverage by 0.02%.
The diff coverage is 98.25%.

@@             Coverage Diff             @@
##           cleanup     #444      +/-   ##
===========================================
+ Coverage    92.95%   92.97%   +0.02%     
===========================================
  Files          244      248       +4     
  Lines        18373    18508     +135     
===========================================
+ Hits         17078    17208     +130     
- Misses        1295     1300       +5     
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%) ⬇️
...s/optimization/tranquilo/test_estimate_variance.py 100.00% <ø> (ø)
src/estimagic/optimization/tranquilo/bounds.py 94.11% <94.11%> (ø)
src/estimagic/optimization/tranquilo/region.py 95.58% <95.58%> (ø)
...imagic/optimization/tranquilo/estimate_variance.py 100.00% <100.00%> (ø)
src/estimagic/optimization/tranquilo/geometry.py 96.55% <100.00%> (-0.12%) ⬇️
src/estimagic/optimization/tranquilo/models.py 93.70% <100.00%> (ø)
... and 11 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.

@timmens timmens requested a review from janosg March 12, 2023 16:03
src/estimagic/optimization/tranquilo/region.py Outdated Show resolved Hide resolved
src/estimagic/optimization/tranquilo/region.py Outdated Show resolved Hide resolved
src/estimagic/optimization/tranquilo/sample_points.py Outdated Show resolved Hide resolved
src/estimagic/optimization/tranquilo/tranquilo.py Outdated Show resolved Hide resolved
src/estimagic/optimization/tranquilo/tranquilo.py Outdated Show resolved Hide resolved
tests/optimization/tranquilo/test_region.py Outdated Show resolved Hide resolved
Comment on lines +73 to +75
deviations.groupby(["algorithm", "n_evaluations"])
.mean(numeric_only=True)[outcome]
.reset_index()
Copy link
Member Author

Choose a reason for hiding this comment

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

Response to deprecation warning.

@timmens timmens merged commit 0dcbc52 into cleanup Mar 13, 2023
@timmens timmens deleted the region branch March 13, 2023 16:32
timmens added a commit that referenced this pull request Mar 13, 2023
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