Implementation of infinite HMM