-
Notifications
You must be signed in to change notification settings - Fork 37
Description
I want to use Turing for the GP-SSM model, which is based on the PGAS algorithm. The implementation is actually straight forward thanks to Turing. However, I have noticed that the Gibbs sampler runs the whole model for every subsampler. For large models this implies that there is a huge computational overhead. One way to solve this issue would be by implementing some "hacky" macros, like:
@condition_on (:x, ;y) = begin
# Do some code here which is only executed when :x or :y appears in the sampling space
endwhich would be changed to something like :
if :x in spl.alg.space || :y in spl.alg.space
# Run the code above
endThis makes the model rather difficult to design because it might not be obvious what belongs inside the brackets and what not. @torfjelde had the idea to do something like the following instead :
var = @condition_on (:x, ;y) = begin
# Compute var
endwhich would be changed to something like :
if :x in spl.alg.space || :y in spl.alg.space
# Compute var
cache["var"] = var
else
var = cache["var"]
endI am anyway planning to implement this macro for my own use and I was thinking that this might be interesting for Turing in general. What do you think?