-
Notifications
You must be signed in to change notification settings - Fork 11
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
Bayesian Model for competition assay #127
Conversation
…es to very slow general binding model
Added example notebook for new competition bayesian model also compares to very slow general binding model. |
I looked through |
It basically shows that the AnalyticalBindingModel (link below) works, and is better and faster than the general binding model. Let me know if you want to go through it in person. |
Going to add a function in our analytical binding model to prevent this error from happening (in ipynb):
|
So right now this PR includes the addition of the Analytic Competition Binding model to For now I've just been making my own simplified version of this One reason I have yet to incorporate this into the real Furthermore I have been playing a bit with simulated data, and the fits seem to get stuck in a way that the real experimental data isn't exhibiting (see stuckness below). The latest commit in this PR, is an ipynb example of this attempt at analyzing simulated data. Perhaps this is also related to some numerical stability that can be easily fixed? |
I think this is the issue we talked about on Wednesday. Does your simulated data have experimental measurement noise in it? Or is it still getting stuck even with that noise? |
It has noise, but it is possible it is not in the right form... |
@jchodera did you ever get a chance to look at the numerical instabilities in this model and see if there are any easy fixes? |
Not yet, but I hope to dive in on Tuesday! |
So I chatted with @chaya about some potential numerical stabilities in the analytical binding model, and these were the candidates we came up with:
@jchodera do you have any opinions about either of these? |
For mathematical functions in pymc3, they recommend using theano's built in functions. Is there something equivalent for pymc, or is that numpy? |
@jchodera did you get a chance to take a look at these numerical instabilities? I'll probably take a stab this week if you have any quick suggestions. |
Since it has gotten burried in other comments, here's a rehash of errors that I think are related to the numerical stability of this competition binding model. These are the ones I have come across in a trial run today to try and get some more insight into this, e.g. by looking at other traces besides just delG.
|
It appears that, somehow, these quantities are going negative: ELC_ex = epsilon_ex*path_length*concentration
ELC_em = epsilon_em*path_length*concentration I'm not sure how this can happen, since all of these quantities must be positive. |
Specifically, it looks like the concentrations are going negative in the notebook! |
They're not just a little negative either:
That's -118 Molar! |
@sonyahanson : OK, the problem is your binding model:
I've added some assertions to the model that check to make sure the concentrations are all nonnegative, and this is failing. Since you derived this model, can you fix it? This is the problematic function. I'd suggest switching to the |
Based on our chat today: @jchodera will
@sonyahanson will
|
…ecks for negative concentrations
@sonyahanson: I think I've sorted out the issues we discussed today! I've committed some changes that make the standard I've also discovered the issue with the warnings from your use of I've checked in an updated Jupyter notebook with my changes, but note that I haven't fixed your I've created an issue for me to implement a simpler API for you: The |
Hmmm. Travis is still failing, but for a different reason, now... |
Looks like a few things are going on here:
I'll try to debug. |
@sonyahanson : I think I've fixed the bug that prevented travis tests from running through. I understand we may be seeing lots of HTTP errors in the future until we migrate to conda-forge, so we may want to think of migrating |
Tests pass now @sonyahanson |
@sonyahanson : I think we should be able to merge your PR! |
Sure, will do. I just climbed out of a grant resubmission whole so still want to check on if there is an obvious answer for why you are seeing negative concentrations with the analytical binding model, but I can do that in a new PR. |
First added simple competition model to
bindingmodels.py