-
Notifications
You must be signed in to change notification settings - Fork 19
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
Allow multiple callbacks #80
Comments
Hmm since it is already possible to use arbitrary callbacks and one can always combine them manually, I'd say it's not necessary to support tuples or arrays of callbacks. I think it would make AbstractMCMC more complex without any clear benefit. As a side note, also e.g. Flux does not support multiple callbacks explicitly. Do you have a convincing example? |
Not even adding a
I'm using a custom progress-meter through a callback + logging to TensorBoard using another callback, which means that I do use this pattern. I also want to add some more specific callbacks on top of this. We also have Turkie.jl which one might want to use together with some custom callback. IMO finding motivating examples is trivial, but one can argue that it's so easy to write this pattern by hand that it's not worth it, sure. I do want to maybe point out that some people that use Turing aren't the most proficient in Julia, and so being able to do something like |
Yes, in particular not adding a specific struct. I don't think this belongs into AbstractMCMC since it is something that is not specific to MCMC and could be dealt with much more generally than with a specific (args...; kwargs...) -> foreach(f -> f(args...; kwargs...), fs) This seems to be a much more general pattern that arguably better fits into a separate package (I wonder if it already exists somewhere since it does not seem to be a completely uncommon use case). |
I concur. Cool thing, not a great fit for AbstractMCMC -- definitely a good candidate for a downstream bolt-on package, though. |
It would be nice if it was possible to pass in multiple callbacks rather than a single callable. Of course this can always be done manually, but still would be convenient, e.g.
sample(..., callback=(cb1, cb2))
or something.Easiest solutions:
MultiCallback
struct that just takes a bunch of functions and its call is to iterate over them.hasmethod
(not inferrable at compile-time unfortunately).The text was updated successfully, but these errors were encountered: