How to change Posterior distribution after sampling some draws

I’m trying to use pymc3 re-implementing the experiment of a paper.
In the paper, posteriors are initialized normally with some hyper-parameters. However, in the mcmc period, parameters of these posteriors are changed that make any variables are related to some other variables.


This picture is a screenshot from http://www.personal.psu.edu/wzg13/publications/nips18.pdf
I have struggled with this problem for a week. But I failed to find a solution.

The screenshot explains how to sample from the posterior, so it is not exactly “change posterior distribution after sampling some draws”. The sampler used here is a Gibbs sampler combining with Metropolis-Hasting. I think you should first try writing down the model in pymc3, and call pm.sample(...) directly and see how the default performs.