When using ADVI, we usually sample the approximation and the using those samples we perform PPC.
Consider following example,
w = Normal("w", mu = 0, sd = 10, shape = number_of_features)
mu = w * x
likelihood = Normal("y", mu = mu, std = 10, observed = y)
approx = pm.advi.fit(1000)
trace = approx.sample(50000)
I want to understand what really happens during the sampling of approx. Is this what happens during when called approx.sample(50000) ?
w = Normal("w", approx.mean.eval() = 0, sd = approx.std.eval(), shape = number_of_features)
mu = w * x
likelihood = Normal("y", mu = mu, std = 10)
trace = sample(50000)
Moreover, if we want to use intermediate mean and std values using the tracker and then compute the PPC for those values, how can I achieve that?
Yes, that is conceptually what happen, although the exact sampling happens in the graph.
You can set the parameters by doing .set_value, see this post for more details: Saving ADVI results and reloading
Thanks for the clarification.
It works. Can you please tell me what is the relationship between rho and std?
You can find the transformation here: