P = np.array(P) print str(Xtest.shape[0]) + " test sequences" print str(X.shape[0]) + " training sequences" if '1' in sys.argv[8]: L1 = True else: L1 = False if 'y' in sys.argv[4]: model = MLFKTAdaptTransitionDifficultyModel(X, P, intermediate_states, 0, L1) else: model = MLFKTAdaptTransitionDifficultyModel(X, P, intermediate_states, 0.1, L1) mcmc = MCMCSampler(model, 0.15) burn = int(sys.argv[1]) for c in range(20): mcmc.burnin(int(math.ceil((burn+0.0) / 20))) print("finished burn-in #: " + str((c+1)*burn/20)) num_iterations = int(sys.argv[2]) loop = 20 per_loop = int(math.ceil((num_iterations+0.0) / loop)) for c in range(loop): a = time.time() mcmc.MH(per_loop) b = time.time() print("finished iteration: " + str((c+1)*per_loop) + " in " + str(int(b-a)) + " seconds")
P = Pnew Xtest = np.array(Xtest) Ptest = np.array(Ptest) X = np.array(X) P = np.array(P) print str(Xtest.shape[0]) + " test sequences" print str(X.shape[0]) + " training sequences" if 'y' in sys.argv[4]: model = MLFKTConstrainedModel(X, P, intermediate_states, 0) else: model = MLFKTConstrainedModel(X, P, intermediate_states, 0.1) mcmc = MCMCSampler(model, 0.15) burn = int(sys.argv[1]) for c in range(20): mcmc.burnin(int(math.ceil((burn+0.0) / 20))) print("finished burn-in #: " + str((c+1)*burn/20)) num_iterations = int(sys.argv[2]) loop = 20 per_loop = int(math.ceil((num_iterations+0.0) / loop)) for c in range(loop): a = time.time() mcmc.MH(per_loop) b = time.time() print("finished iteration: " + str((c+1)*per_loop) + " in " + str(int(b-a)) + " seconds")