Concatenation of chains

Can we use cat to catenate chains one after another rather than alongside?

So in this given case i would like to have chains one after another as a single continuous chain which will make it 2000 rather than two.

I’m not sure if it makes a lot of sense, but you can in principle construct a new Chains object like this:

using MCMCChains

chain = Chains(randn(2000, 10, 2))  # 2000 iterations, 10 parameters, 2 chains
size(chain)  # (2000, 10, 2)

new_chain = Chains(Array(chain))
size(new_chain)  # (4000, 10, 1)
1 Like

i managed to do what I wanted :slight_smile: here first chain is from 1:1000 and same was for second chain thats why I couldn’t catenate them in continuous manner. so I had change iteration range and then it worked.

And yeah its not same chain as above…but that doesn’t matter

chain_reloaded1 = setrange(chain_reloaded1, 1001:2000)

chainn = cat(chain_reloaded,chain_reloaded1;dims=1)

image