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

Quantile: Newton: introduce oscillation dampening #1899

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

LebedevRI
Copy link

@LebedevRI LebedevRI commented Sep 12, 2024

It is well known that Newton's method has an oscillation problem.
In fact, it can reasonably happen on real-world, non-synthetic,
distributions, when computing quantiles.

This situation appears easy to detect - just check that we've converged
with the root we had two steps ago - i may be mistaken, but i'm not sure
this can happen in any situation other than during oscillation.

Likewise, it appears to be easily circumventable,
by picking a new x0 in-between the oscillation bounds,
by using just half of the delta-x we'd apply otherwise.

NOTE: i do not have a proof that this solves all the issues,
does not introduce new ones, nor do i know that the choice of,
specifically, half of the delta-x is optimal.

Fixes #1571
Fixes #1833
Fixes #1898

@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.94%. Comparing base (b219803) to head (b0bc737).

Files with missing lines Patch % Lines
src/quantilealgs.jl 94.44% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1899      +/-   ##
==========================================
- Coverage   85.99%   85.94%   -0.05%     
==========================================
  Files         144      144              
  Lines        8666     8668       +2     
==========================================
- Hits         7452     7450       -2     
- Misses       1214     1218       +4     

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

@devmotion
Copy link
Member

Thank you for the PR!

My general feeling though is that we should not re-invent and re-implement numerical algorithms that already exist and are better maintained in other packages such as Roots.jl. This also has the additional benefit that all other dependencies and users can benefit from any improvements or modifications possibly needed for Distributions.

@LebedevRI
Copy link
Author

Sure, let me see what i can do...

@LebedevRI
Copy link
Author

@devmotion #1900

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants