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

Improve Handling of Fill-Values in RAD_MAX Estimator #282

Merged
merged 4 commits into from
May 14, 2024
Merged

Conversation

RuneDominik
Copy link
Member

In the current version, the RAD_MAX estimator does not handle fill-values and thus produces results that inter-/extrapolate between actual values and fill-values, yielding results that do not resemble the expected behavior in edge-cases (e.g. RAD_MAX values sharply rising after some energy, see Fig. below). This PR introduces some form of combinatoric edge-case handling in 1 and 2D grids.

rad_max_cuts_new.pdf

Copy link

codecov bot commented Mar 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.74%. Comparing base (cb92eef) to head (b6b33c9).
Report is 2 commits behind head on main.

❗ Current head b6b33c9 differs from pull request most recent head 26a9d8b. Consider uploading reports for the commit 26a9d8b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #282      +/-   ##
==========================================
+ Coverage   95.60%   95.74%   +0.13%     
==========================================
  Files          62       62              
  Lines        3278     3381     +103     
==========================================
+ Hits         3134     3237     +103     
  Misses        144      144              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

docs/changes/282.feature.rst Outdated Show resolved Hide resolved
elif self.grid_dim == 2:
target_simplex = self.triangulation.find_simplex(target_point)

if (target_simplex == -1) and issubclass(
Copy link
Member

Choose a reason for hiding this comment

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

You are checking for BaseNearestNeighborSearcher here twice, only the check on target_simplex is added, but then you do the same in both cases.

So just checking for issubclass(BaseNearestNeighborSearcher should be enough?

Copy link
Member Author

Choose a reason for hiding this comment

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

target_simplex == -1 means target_point outside grid, thus this checks for cases, where extrapolation will actually be applied and only in these cases the issubclass check on self.extrapolator.__class__ yields the needed information. In the second case, thus target_simplex != -1, this needs to check self.interpolator.__class__.

Basically, this accounts for the possibility that the user mixes and uses NearestNeighbor for extrapolation and actual interpolation otherwise (and vice-versa) at the same time.

"Fill-value handling only supported in up to two grid dimensions."
)

# Early exit if a nearest neighbor estimation would be overwritten
Copy link
Member

Choose a reason for hiding this comment

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

Why can't we just check for nearest neighbor? Why this complex setup?

Copy link
Member Author

Choose a reason for hiding this comment

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

That setup is to catch cases where the user decided to mix approaches and use e.g. NearestNeighbor for interpolation but an actual extrapolator for extrapolation or vice-versa. I'll extend the comment in code to make this more clear for the future.

@maxnoe maxnoe merged commit a296ed2 into main May 14, 2024
7 checks passed
@maxnoe maxnoe deleted the cutval_estimation branch May 14, 2024 10:04
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