-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
TPM microsats model transition matrix error #2237
Comments
looks like that value of
my first blush reaction is that something wonky is happening with matrix_mutation_model class on the C side? not sure yet |
a little further digging -- this looks like rounding error in the transition matrix construction
|
the negative element in the matrix is on the diagonal of the rate matrix, so the numerical issue is creeping in here most likely (from row_sums = rate_matrix.sum(axis=1, dtype="float64")
np.fill_diagonal(rate_matrix, 1.0 - row_sums) |
@petrelharp any recs on how best to beat this? set small diagonal values to zero? |
Well, here's the problem, I think:
In the problematic code, the max row sum is Doing as you suggest and changing that line to
fixes the error at least with this set of parameters. I'm not sure if there's a better way other than changing the code that throws the error to be more tolerant of a little slop? I've got a PR, will throw it up. |
Fix LGTM. Messiness like this near zeros is inevitable I think. |
When specifying the following
MicrosatMutationModel
I get an "Each row of the transition matrix must be non-negative and sum to one" error.I just followed the instructions from the docs to generate a random model. If this is not a valid parameter combination then this should have been caught I think. @andrewkern any idea what is going on here?
The text was updated successfully, but these errors were encountered: