What exactly this the following line means?
# p=T[:, state] what does this means?
# Here is the complete code
import numpy as np
T = np.array([ [ 0.40, 0.56, 0.03, 0.01],
[0.45, 0.51, 0.04, 0.00],
[0.25, 0.25, 0.25, 0.25 ],
[0.00, 0.00, 0.01, 0.99 ]])
xk = np.arange(len(T))
def gen_sample(state):
return np.random.choice(xk, 1, p=T[:, state])
I understand it takes the transition matrix but what does " : " and "state" mean?