Drop smck hull_offset defaults#2445
Conversation
|
@jeromekelleher |
jeromekelleher
left a comment
There was a problem hiding this comment.
See comment above - that should make it less painful
msprime/ancestry.py
Outdated
|
|
||
| # We have to define an __init__ to enforce keyword-only behaviour | ||
| def __init__(self, *, duration=None, hull_offset=0.0): | ||
| def __init__(self, *, duration=None, hull_offset): |
There was a problem hiding this comment.
I think we should make hull offset a required positional arg, like
def __init__(self, hull_offset, *, duration=None):
...
I don't think we put much thought into this when it was going in initially, just put something in to get things working.
(unless this breaks other things?)
There was a problem hiding this comment.
it does not break other things 👍
Ooh - that's a nasty one! Can you confirm by making k=1.00001 and rerunning? |
hull_offset=1.00001 gives similar results to 1. both fail the test |
85155aa to
1fb660c
Compare
|
Hmm, good catch. We'll have to think about that. |
|
Ah right, the problem is k is too big. Here, the genome is one unit long, so k=1 means we allow all possible overlaps. If we put k=0.00001 in this example we get the right answer. Now, I'm not entirely sure what the right value of the smc_prime is in a continuous genome model. I guess it's a very small number? It's an annoying one. |
|
In a math term, it should be when k -> 0. I am not sure if we set it to the smallest float that could be stored, it would be a sustainable universal solution. Also, we would have to set the k value differently for discrete genomes (k=1). |
|
Let's try a small value like 1e-14 or something so as the default, and see if that does the right thing for the discrete genome case. Having a different mapping for discrete genome and not would be quite tricky, as we'd have to pass the Using very small values like flt_min or whatever could have unexpected consequences, so I think a reasonable like 1e-14 is less likely overall to bite us. |
I considered this, but it's not trivial because of the complex structure of the Hmm, this is annoying. OK, let's drop the remapping of the strings for now, and keep the reparameterisation of smck to require the parameter. At least this excecise has shown us that a default of 1 was definitely not the right thing to do... It may be simpler to just do this in a different PR or update this one, it's up to you. |
1fb660c to
edbb3ce
Compare
ded178c to
0b6bf90
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| msprime.SweepGenicSelection(1) | ||
|
|
||
| def test_smck_coalescent(self): | ||
| model = msprime.SmcKApproxCoalescent() |
There was a problem hiding this comment.
Should resinstate this test to check that it raises a TypeError (or whatever it is)
# mandatory positional argument
with pytest.raises(TypeError):
msprime.SmcKApproxCoalescent()
0b6bf90 to
185a1a8
Compare
|
check now. Also check the recommendation in the documentation: for smc_prime the documentation recommends smck(1) for discrete and smck(1e-14) for continuous genomes |
185a1a8 to
8de716c
Compare
|
Docstring is malformed, that's why the docs build is failing |
update documentation and float k values hull offset a required positional arg remove string remapping fix verifications added lost test not remove named argument and add a test fix test fix doc
8de716c to
902179d
Compare
|
yes, should be fixed now |
|
@jeromekelleher Can be merged |

closes #2443