Added train_step function for markov chain.