Exemplo n.º 1
0
	test = isg.ISG3D_UAI(9, 9, 9)
    elif test_name == 'rbm':
	print 'Running RBM_UAI for {0} Iterations.'.format(num_iter)
	test = isg.RBM_UAI()
    elif test_name == 'ferrof':
	print 'Running Ferro2D_Frustrated for {0} Iterations.'.format(num_iter)
	test = isg.Ferro2D_Frustrated(60, 60)
    elif test_name == 'chi':
	print "Running Chimera."
	test = isg.test = isg.Chimera(4,4,4)
    
    temp = Ising_Gibbs(test)
    
    import time
    
    time_1 = time.time()
    temp.gibbs_random(num_iter)
    time_2 = time.time()
    print "Sampling lasted: ", time_2 - time_1
    
    print 'Saving results in ' + './Regular_Gibbs_' + test_name + '_' + str(num_iter) + '.npy'
    
    cur_res_num = ASAW_config.get_and_inc_cur_res_num('path_config.cfg')
    f = open('Regular_Gibbs_' + test_name + '_' + str(num_iter) + '.npy', 'w')
    save(f, temp.energies[1:])
    f.close()
    
    temp.compute_acf(max_lag = min(num_iter-1, 500), subsample = max(num_iter/100000, 1))
    
    temp.plots()
Exemplo n.º 2
0
        num_iter = int(sys.argv[1])
    elif len(sys.argv) > 1:
        num_iter = int(sys.argv[1])

    if batch:
        rbm = isg.RBM_UAI_BLOCK()
        v = zeros(784)

        total_energy = []

        for i in xrange(5):
            v[0:428] = ones(428)
            bbs = Block_RBM_Sampler(rbm, v, None)
            total_energy.append(bbs.iterate(num_iter))

        cur_res_num = ASAW_config.get_and_inc_cur_res_num("path_config.cfg")
        bbs.acf_plot_multi_energies(total_energy, res_num=cur_res_num)
        f = open("Block_RBM_" + str(cur_res_num) + ".npy", "w")
        save(f, total_energy)

        f.close()
    else:
        rbm = isg.RBM_UAI_BLOCK()
        v = zeros(784)
        total_energy = []

        v[0:428] = ones(428)
        bbs = Block_RBM_Sampler(rbm, v, None)
        import time

        time_1 = time.time()