Address concerns in gh-12999 for ks_2samp in exact mode. #13168
Closed
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.
Return an estimate of the relative error of the probability computed by
stats._compute_prob_inside_method(). As the desired probability is the
complement of the one computed, subtractive cancellation can occur.
Check if it may have, and declare the attempt a failure. This prevents
a probability ~ 1e-16 being reported when the actual probability is many orders
of magnitude lower.
Reference issue
Closes gh-12999
What does this implement/fix?
Checks if the computation of a probability in stats._compute_prob_inside_method(), using exact algorithm, may have lost too much precision to be used as a complementary probability. If so, back off to the asymptotic computation.
In stats. _compute_prob_outside_square(), do a pre-check to determine if the computation will definitely overflow. If so, return immediately.