Relation between model and guide

ok, there are a few things going on here, some of which are being encapsulated which might be contributing to your confusion. in general, all your non-observed sample statements in the model should have a corresponding sample statement in the guide. what you’re missing in the snippet above is

global_guide = AutoDelta(poutine.block(model, expose=['weights', 'locs', 'scale']))

this statement is sampling a delta distribution for weights, locs, scale under the hood. this can be equivalently written as

def guide(data):
  auto_weights = pyro.param('auto_weights', ...)
  pyro.sample('weights', dist.Delta(auto_weights))
  ...

and similarly for locs and scale. you can play around with this by removing global_guide(data) and pyro will throw a warning that you have random variables in your model missing in your guide.

1 Like