-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Violin span fix #2650
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
Violin span fix #2650
Conversation
... when Silverman's rule give too small of a results
I still have two concerns about this:
What if the automatic bandwidth just used Silverman but limited it to |
- to avoid "sharp" transitions from Silverman to Scott value - make custom bandwidth value use that same fallback when "too small" - rename "scott-rule" mock to "bandwidth-edge-cases"
Going with |
src/traces/violin/calc.js
Outdated
// to not blow up kde computations. | ||
return ((cdi.max - cdi.min) / bw) < 1e5 ? | ||
bw : | ||
(cdi.max - cdi.min) / 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, that's still going to jump from 1/1e5 up to 1/100. I had in mind something like:
if(trace.bandwidth) {
return Math.max(trace.bandwidth, span / 1e5);
}
else {
return Math.max(silvermanValue, span / 100);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. My bad -> c554070
.. this time to "really" make the transition smooth
src/traces/violin/calc.js
Outdated
(cdi.max - cdi.min) / 100; | ||
|
||
if(trace.bandwidth) { | ||
return Math.max(trace.bandwidth, span / 1e4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From slack, for the record:
@etpinard: limiting custom bandwidth at (span / 1e5) is still pretty slow. ok if I increase it to span / 1e4 ?
Me: sure, that’s still more than 1 bw/px. I’m not quite so worried about it though, at that point the user has asked for something explicitly ridiculous… but I guess we don’t want our mock to take forever to render!
Looks great! 💃 |
Fixes #2631 and supersedes #2552
This PR uses @joshua-gould's 9329a4d where the set bandwidth value is used to determine the number of pts in the kde estimate (as opposed to the min of the set bandwidth and the Silverman's rule of thumb).
Moreover, this PR uses Scott's rule of thumb when the Silverman value yields too many kde points. This happens when the IQR is not a very good estimate of the distribution's spread like in the data of #2552 (comment).
cc @alexcjohnson