Repository navigation
1d stats - #2417
1d stats#2417
Conversation
|
Hmm, it might be worth making a separate test for |
|
Hmm, not sure why the docs build is failing but it doesn't appear to be in the part of the API that I changed 🤷 |
Codecov Report
@@ Coverage Diff @@
## main #2417 +/- ##
=======================================
Coverage 93.44% 93.44%
=======================================
Files 28 28
Lines 27380 27386 +6
Branches 1253 1255 +2
=======================================
+ Hits 25584 25590 +6
Misses 1762 1762
Partials 34 34
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
I think this is ready to look at, btw -- it doesn't obviously look like these test errors are to do with the code I've changed here. |
jeromekelleher
left a comment
There was a problem hiding this comment.
LGTM. Let's move the description of the general rule for dropping to a scalar to the higher-level docs, and put in a signpost there in the places you've updated.
| :param bool span_normalise: Whether to divide the result by the span of the | ||
| window (defaults to True). | ||
| :return: A numpy array whose length is equal to the number of sample sets. | ||
| If there is just one sample set and one window, a numpy scalar is returned. |
There was a problem hiding this comment.
I'm not sure we want to update all these return values independently. How about we just update to note the change? We could also add a sentence like "Please see :ref:sec_stats_output_format for information on the dimensionality of the returned array, and the conditions for dropping dimensions." to all these return descriptions?
There was a problem hiding this comment.
The reason why I updated these is because the output is no longer always a NumPy array now. What about something like
"Please see :ref:sec_stats_output_format for information about the shape and type of the returned NumPy object"?
Although I can see that the existing output is quite repetitive (and a pain to update), I think there's a case to make for leaving it in its current explicit form s well. "Dimensionality" can be quite an off-putting word to non-mathy folks, and I think talking about "dropping dimensions" is likely to be even more confusing as that is something that happens entirely under the hood here.
|
Thanks Jerome! I fixed the changelog issue, might wait to see if there are any further thoughts about the return values before I make any modifications there. |
|
Hm, I'm not sure about this yet (but maybe I'm confused) - looking at the rules in the docs I think that what we want to do is:
If I'm reading it right, though, this would drop down to a scalar even if you did then currently we'd get first a length-2 vector and then a length-1 vector. This change would give us a scalar the second time around, requiring special-casing that in the code (e.g., So, my proposal is to make this behavior only happen if |
Agreed - well spotted @petrelharp |
|
thanks Peter and Jerome! I'll need a little time to fix this (trying to
finish up other stuff atm), will get back on this next week
…On Thu, Jul 21, 2022 at 6:26 PM Jerome Kelleher ***@***.***> wrote:
So, my proposal is to make this behavior only happen if windows=None?
Agreed - well spotted @petrelharp <https://github.com/petrelharp>
—
Reply to this email directly, view it on GitHub
<#2417 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEHOXQVWD6BBLAXPI5YKTFTVVECS3ANCNFSM533C7VWA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
PhD Student
Melbourne Integrative Genomics and School of Mathematics and Statistics
University of Melbourne
https://gtsambos.github.io/
|
|
Hopefully this addresses @petrelharp's comments above? I also edited the Changelog as this PR was not part of the 0.5.2 release on Friday. |
petrelharp
left a comment
There was a problem hiding this comment.
I've suggested a few more tests to make sure we're hitting all the conditions. I'm also not sure about adding the boilerplate to the return values of all the functions - but, I guess you're right, that we shoudl do it. However, it'd be nice to uniformize them more - right now, the strings differ in minor ways.
| **Changes** | ||
|
|
||
| - Single statistics computed with ``TreeSequence.general_stat`` are now returned | ||
| as numpy scalars if windows=None. (:user:`gtsambos`, :issue:`2308`) |
There was a problem hiding this comment.
| as numpy scalars if windows=None. (:user:`gtsambos`, :issue:`2308`) | |
| as numpy scalars if windows=None and samples is a single list or None. (:user:`gtsambos`, :issue:`2308`) |
There was a problem hiding this comment.
This is only true for one-way stats, right? (Since this is just the changelog, maybe these details don't matter so much here)
There was a problem hiding this comment.
Right, good point. You're right, we don't have to give the complete specification here, but we should have something accurate (which it wasn't quite, previously). I'm not thinking of a nice concise way to say this at the moment...
|
I'm starting to lose track of what conditions we want to require to return a scalar stat, and why. Does this cover it? One way stat:
K-way stat:
? |
|
Hm, let's see. I think the guideline is that if we drop dimensions twice, we should get a scalar, not a 1D array. And, the conditions under which we drop dimensions are listed in the docs:
... and, yes, this is exactly what you've got! I agree! |
|
Hm - codecov is telling us that some of the code isn't being hit. |
d13d885 to
c5c928d
Compare
|
pending the code checks, I hope this is good to go now 💀 |
benjeffery
left a comment
There was a problem hiding this comment.
LGTM one nit about the changelog.
| - Single statistics computed with ``TreeSequence.general_stat`` are now | ||
| returned as numpy scalars if windows=None, AND; samples is a single | ||
| list or None (for a 1-way stat), OR indexes is None or a single list of | ||
| length k (instead of a list of length-k lists). (:user:`gtsambos`, :issue:`2308`) |
There was a problem hiding this comment.
We usually add the PR number here too.
|
I fixed that nit, so we should be good to go - but, will the automerge-requested bot squash commits? Or, will the "squash and merge" button also rebase? |
|
And, thanks for getting this through, @gtsambos - this is a good idea, and annoyingly tricky to get right. |
Neither! But you can ask mergify to squash before adding the automerge label: @Mergifyio squash first-commit (Only triggers if it is the sole content in a comment) |
|
@Mergifyio squash first-commit |
✅ Pull request squashed successfully |
90f4b56 to
14931d4
Compare
|
Hmm, that removes @gtsambos's author credit! How rude of the bot. I'll fix it. |
|
@gtsambos 's honour is restored. I'll merge. |
|
thanks for defending my honour @benjeffery (and @petrelharp) ⚔️ |
Single statistics computed with the
general_statmethod are now returned as numpy scalars.Fixes #2308
It didn't break any existing tests!
It would be good for someone to check my changes to the documented return values. I don't know what all these statistics are, so it would be easy for me to make a mistake there.