Your generate_chains function is not needed. It is used in the notebook to show that we recover the true (unknown) transition matrix. Since you just want to generate samples from a known transition matrix, you can just do that:
with pm.Model() as model:
x0 = pm.Categorical.dist(trans_mat[0]) # Or whatever you want the chain to start at.
discrete_mc = DiscreteMarkovChain("MarkovChain", P=trans_mat, init_dist=x0, steps=99)
idata = pm.sample_prior_predictive(samples=50, random_seed=rng)
DiscreteMarkovChainis a random variable. It’s the same as any other random variable in PyMC. You can check out the getting started resources in the examples gallery if you want to understand how PyMC works more deeply.- MCMC has nothing to do with your problem as stated
- \psi = [0.14188124, 0.39936942, 0.45874934] is the stationary distribution of a markov chain with the transition matrix you provided. If all you want to do is count states, a chain of length N is expected to have N\psi_i instances of state i.
Again, you should just be using mc = qe.MarkovChain(trans_mat).