-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Test model logp before starting any MCMC chains #4116
Comments
Hi, I'm happy to take this on as long as someone can give me pointers on how to implement the proposed solution? |
Both For example, it is assigned to The The General API Quickstart notebook has some cells using Note that the |
So am I right in thinking that this is as simple as updating the start of
Additionally, how do I get it to spit out which variables have the problem? |
Something like that, yes. I wouldn't be surprised if some of the tests break. Your |
Thanks! Actually, As far as the working out which variable is responsible thing, I guess I will drop that for now then. |
You should look at how check_test_point does this. |
Thanks, unless there's anything outright wrong with me doing so I'll probably just inspect the output of that method. I'm having a lot of trouble getting the tests, to work, unfortunately. As it stands, this is the code in
This generates errors that look like the following:
Any ideas on how to proceed would be gratefully received. |
The indexing of It may help to insert a |
Ok, have got that problem fixed. I now have two tests that have errors like this:
Any ideas as to what this one is about? It seems like some sort of environment variable problem, but I'm not sure how it's arising in this context |
I see no connection, but it's hard to tell without the diff. Can you open a Draft PR? |
Sure - PR open |
@StephenHogg you can now merge the latest changes from master into your branch (
|
Suggest closing the issue now that #4211 is merged |
@StephenHogg Small tip: if in your PR you would have written "Closes #4116" this would have happened automatically. |
Description of your problem
When a model contains
nan
observations, or observations that are outside of the support of the prior, the models logp evaluates to-inf
.Both
find_MAP
andsample
don't check against this and fail in different ways that don't make the underlying problem obvious:pm.find_MAP
does two iterations, showing-inf
for the logp, but it doesn't raise errorspm.sample
typically fails withBad initial energy
pm.sample
on Windows with multiprocessing crashes the child processes with uninformative error escalation (output similar as shown in Remove default multiprocessing when on Windows? #3403). If run with Jupyter notebooks, it even crashes the entire notebook serverRelated issues:
enhancement #4107 would use the same information, but NOT raise
Proposed solution
At the beginning of
find_MAP
/sample
and BEFORE creating child processes we should evaluate the model and raise an informative error.Possibly even telling the user which variable was
nan
/inf
?The text was updated successfully, but these errors were encountered: