-
Notifications
You must be signed in to change notification settings - Fork 50
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
Calling mcmc() from within a function #149
Comments
I think this seems to be a bug. I have recreated with the following:
installed package status:
Example obtained from docs (https://mambajl.readthedocs.io/en/latest/examples/seeds.html), works when run outside a function with a minor modification to fully qualify the use of I (identity matrix) i.e. changed I to LinearAlgebra.I:
The error and call stack:
Please can someone take a look? Also see: #105 |
Further to above the problems seems to relate solely to calling the Mamba.mcmc function. I can encapsulate everything else within a function then return the elements in a Dict that can be used to call mcmc outside the function. |
It is a known problem with no current solution. Mamba needs to restructure how it handles and passes around anonymous functions. |
Thanks Benjamin. I will take a look to see what is involved. |
Probably a big task. Other people in other packages have had similar issues: JuliaLang/julia#21356 |
Just a tip for people who have this problem and need a quick fix: As a way to get around the problem, while the bug is not fixed, put the model definition outside the function and reference it. Also in the model definition make sure that all variables with input data are named, so that you can change the input values inside the function. For me this is a much more flexible way to still be able to structure my program, as the model definition itself doesn't change, just the input data. |
Hi,
I'm very interested in using Mamba for a current project. I have enjoyed the tutorial and some examples so far.
However I have noticed some rather unexpected errors I believe when calling
mcmc()
from within another function (also briefly mentioned in this closed issue #105 (comment)). For example, calling theblr()
function below gives the errorERROR: MethodError: no method matching (::getfield(Main, Symbol("##127#128")))(::Model) The applicable method may be too new: running in world age 25145, while current world is 25151.
Example function:
The following code runs however without any issues:
So am I missing some details here or is this a bug?
Thanks in advance,
Arthur
The text was updated successfully, but these errors were encountered: