add robust and informative condition for large magnitude projections (tests only off-diagonal) #113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is closely related to #96. This adds a more robust condition that raises for the user what is actually happening during the calculations.
@ljwolf shared with me an example using cenpy for a GeoDataFrame with a large unit for the centroid and realized that the RelativeClustering measure was behaving unexpectedly. It worked for Phoenix, but not for Tucson (was returning an NaN). However, in that case, even for Phoenix the index might be problematic since numerically the internal calculations are unstable. For Phoenix we got virtually zero for the exp(-d) of the distances:
And for Tucson we were having equal zero (therefore resulting in a NaN index):
The commit of this PR fix this and raises an informative ValueError better and perform a more assertive test than the old one.