-
Notifications
You must be signed in to change notification settings - Fork 49
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
generalTestBF() doesn't seem to always call callbacks #50
Comments
In that case, the integration is done with a native R function (integrate()), so I can't pass a callback to that function. Do you just want me to call it before and after the integrate() call? |
awesome! cheers |
Please test that and let me know if that solves your issue. |
so i guess it depends on what proportion of the total run time of generalTestBF() is spent inside this integrate function. if it is closer to 50%, then this will likely work really well, but if it is closer to 0% or 100%, then it may not make any difference. ballpark, what would you expect? |
It should be model/data dependent, but it should never spend very much time in that function. Do you have a case where it takes a long time? |
you've still got ssgo-fred.csv, yeah?
|
hmm, that's a different problem from the one I was thinking. I'll re-open it. |
Well, it is a slow integrate() call. I'm not sure what to do about it besides speed up the underlying code (planned), but that doesn't solve the main problem of updating progress when integrate() is working; do you have any suggestions? |
what if i can provide you with an equivalent integrate() which takes a callback? |
Sounds like a fine plan. |
right-o, i'll try and have something to you within the fortnight. i can either
In option 2, you'd check if the JASP package is available, and if it is, call i think i'd prefer option 2. what's your preference? |
Given that this is sure to be useful to other people writing JASP plugins, it seems (2) would be best. You might also consider versions of optim() and nlm() with callback support; I use those and they have the same issue (it just so happens that integrate() takes the most time, but those can also be slow). |
yup, been thinking the same thing. |
you're calling these functions from R, yeah? you're not calling the native implementations from C? |
also, what arguments do you pass into the callbacks? you pass progress information, anything else? and was it a value between 0 and 1000 for progress? |
ok, i've created a package called withcallbacks: https://static.jasp-stats.org/misc/withcallbacks_1.0.tar.gz if you can detect if this package is available, and call the integrate function provided by it, then i can start profiling where time is spent inside of it (and add callbacks to appropriate places) |
so it appears that there are two main code paths in integrate(), one for finite limits of integration, and one for non-finite limits of integration. does BayesFactor use one or the other exclusively? |
yes.
Only progress, no, and yes.
No, it uses both. However, in the time-consuming functions (ie, not t tests) the limits are infinite. |
actually, i can take care of this too, and send in a pull-request if you like. |
Sure. |
Did you ever look at this? |
yeah, it's on my todo list. to my knowledge, there's currently only one situation where it's an issue. it might be when you specify a single factor, which has many levels. it depends on a long running integrate, or optim call. i've made the modified functions, i just need to get around to integrating them and testing them. |
At a guess you don't call callbacks if there's only one independent variable?
If I provide an independent variable with lots of levels (~1000), then the analysis runs to finish without calling the callback once.
Is it possible to call it in this scenario?
Trying to accommodate users who might make a mistake.
with thanks
The text was updated successfully, but these errors were encountered: