Online Update while matrices size is changing


I am having some difficulties online update the parameters. Hope someone could help me.

I have a hierarchical structure model. The output of the sampling is in the matrix form. Now I want to apply an algorithm that can update the columns of the output matrix.

What this algorithm does is:

  1. Run pm.sample with my model for 10 iterations.
  2. Use the last iteration to determine the number of rows of the parameter matrix.
  3. Using the updated row number to make changes to my parameter matrix and other related vector parameters. (There are multiplications between vector and matrices )
  4. Then we use these updated parameters as a starting sample to run a new MCMC sampling for 10 iterations.
  5. Repeat 2 to 4

I am wondering how to do such sampling while the size of matrices is changing for every 10 iterations. And how to set samples from the previous iteration as the starting point of the new sampling.

I hope I stated clearly. I appreciate it if anyone has an idea of how I can proceed with this.

Do you expect that the shape of the parameter matrix will change between iterations or are you just altering the values?

The shape of the parameter matrix will change each iterations.

The parameter shape is not fixed, and it will converges to the true shape.