-
Notifications
You must be signed in to change notification settings - Fork 35
PBS #368
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
PBS #368
Conversation
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.
I like it, but minor query on numerics
sgkit/stats/popgen.py
Outdated
variables.validate(ds, {stat_Fst: variables.stat_Fst_spec}) | ||
|
||
fst = ds[variables.stat_Fst] | ||
fst = fst.clip(min=0, max=0.99999) |
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.
0.99999 feels a bit arbitrary and I worry this will lead to numerical artefacts for values of Fst near 1. Something like
>>> 1 - np.finfo(float).epsneg
0.9999999999999999
>>> np.log(1 - np.finfo(float).epsneg)
-1.1102230246251565e-16
seems a bit more defensible.
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.
This looks very reasonable, and I've updated this PR in the way you suggest. cc-ing @alimanfoo since the value 0.99999
came from scikit-allel's implementation: https://github.com/cggh/scikit-allel/blob/master/allel/stats/selection.py#L1323
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.
I've marked this as automerge as I doubt there was any deep reason for the 5-digit 0.9999.
Codecov Report
@@ Coverage Diff @@
## master #368 +/- ##
==========================================
- Coverage 95.53% 95.18% -0.35%
==========================================
Files 31 31
Lines 2239 2266 +27
==========================================
+ Hits 2139 2157 +18
- Misses 100 109 +9
Continue to review full report at Codecov.
|
Fixes #230