params['S'].set(0.10018501374500711)
    params['L'].set(np.array([0.92012063497620489, 0.079879365023795085]))
    params['T'].set(0)"""

    #run viterbi
    state_estimates, masteries = model.viterbi()
    #first val needs to be pulled off (I think)
    state_estimates = [x[1:] for x in state_estimates]
    time_estimates = get_mastery_time(state_estimates)

    trans_errs = []
    for c in range(len(times)):
        trans_errs.append(time_estimates[c] - times[c])

    model.load_test_split(X,P,False)
    trans_pred = model.get_predictions()
    trans_rmse = np.sqrt(np.mean( (trans_pred - X) ** 2))
    #print trans_errs



    # Setup KT-IDEAL model
    pdictl = json.load(open("dump/PARAMS_simulated_trans_"+str(students)+"_second_ktideal_2states_1000iter.json","r"))
    model = KTIDEAL(X,P,0,0.15,False,False)
    params = model.get_parameters()
    #Set the learned model parameters for transition model
    for k, v in params.iteritems():
        if k in pdictl[-1]:
            v.set(pdictl[-1][k])
        else:
            print
        a = time.time()
        mcmc.MH(per_loop)
        b = time.time()
        print ("finished iteration: " + str((c + 1) * per_loop) + " in " + str(int(b - a)) + " seconds")

    end = time.time()

    print ("Finished burnin and " + str(num_iterations) + " iterations in " + str(int(end - start)) + " seconds.")

    folder = "plots_" + fname
    # plotting samples will also load the MAP estimates
    # mcmc.plot_samples(folder + "/", str(num_iterations) + '_iterations')

    # load up test data and run predictions
    model.load_test_split(Xtest, Ptest)
    pred = model.get_predictions()
    num = model.get_num_predictions()
    mast = model.get_mastery()

    err = pred - Xtest
    rmse = np.sqrt(np.sum(err ** 2) / num)

    errl = np.zeros(num)
    predl = np.zeros(num)
    mastl = np.zeros(num)
    xtestl = np.zeros(num)
    i = 0
    for n in range(pred.shape[0]):
        for t in range(pred.shape[1]):
            if pred[n][t] == -1:
                break