예제 #1
0
        # print ('opt iwae',np.mean(iwaes))
        # print()

        # print ('opt vae flex',np.mean(vaes_flex))
        # print ('opt iwae flex',np.mean(iwaes_flex))
        # print()


        # VAE_train = test_vae(model=model, data_x=train_x[:n_data], batch_size=n_data, display=10, k=50)
        # IW_train = test(model=model, data_x=train_x[:n_data], batch_size=n_data, display=10, k=50)
        # print ('amortized VAE',VAE_train)
        # print ('amortized IW',IW_train)


        print()
        AIS_train = test_ais(model=model, data_x=train_x[:n_data], batch_size=n_data, display=2, k=100, n_intermediate_dists=2000)
        print ('AIS_train',AIS_train)



        print()
        print()
        print ('AIS_train',AIS_train)
        # print()
        print ('opt vae flex',np.mean(vaes_flex))
        # print()
        print ('opt vae',np.mean(vaes))
        # print()
        print ('amortized VAE',VAE_train)
        print()
                             data_x=train_x[:n_data],
                             batch_size=n_data,
                             display=10,
                             k=50)
        IW_train = test(model=model,
                        data_x=train_x[:n_data],
                        batch_size=n_data,
                        display=10,
                        k=50)
        print('amortized VAE', VAE_train)
        print('amortized IW', IW_train)

        print()
        AIS_train = test_ais(model=model,
                             data_x=train_x[:n_data],
                             batch_size=n_data,
                             display=2,
                             k=50,
                             n_intermediate_dists=500)
        print('AIS_train', AIS_train)

        print()
        print()
        print('AIS_train', AIS_train)
        # print()
        print('opt vae flex', np.mean(vaes_flex))
        # print()
        print('opt vae', np.mean(vaes))
        # print()
        print('amortized VAE', VAE_train)
        print()
예제 #3
0
        IW_test = test(model=model,
                       data_x=test_x,
                       batch_size=batch_size_IW,
                       display=10,
                       k=k_IW)
        print('IW_test', IW_test)
        with open(experiment_log, "a") as myfile:
            myfile.write('IW_test ' + str(IW_test) + '\n')
            myfile.write('time' + str(time.time() - start_time) + '\n\n')
        iw_test_list.append(IW_test)

        print('\nTesting with AIS, Train set, B' + str(batch_size_AIS) + ' k' +
              str(k_AIS) + ' intermediates' + str(n_intermediate_dists))
        AIS_train = test_ais(model=model,
                             data_x=train_x,
                             batch_size=batch_size_AIS,
                             display=2,
                             k=k_AIS,
                             n_intermediate_dists=n_intermediate_dists)
        print('AIS_train', AIS_train)
        with open(experiment_log, "a") as myfile:
            myfile.write('AIS_train ' + str(AIS_train) + '\n')
            myfile.write('time' + str(time.time() - start_time) + '\n\n')
        ais_train_list.append(AIS_train)

        print('\nTesting with AIS, Test set, B' + str(batch_size_AIS) + ' k' +
              str(k_AIS) + ' intermediates' + str(n_intermediate_dists))
        AIS_test = test_ais(model=model,
                            data_x=test_x,
                            batch_size=batch_size_AIS,
                            display=2,
                            k=k_AIS,
    print ('IW_train', IW_train)
    with open(experiment_log, "a") as myfile:
        myfile.write('IW_train '+ str(IW_train) +'\n')
        myfile.write('time'+str(time.time()-start_time)+'\n\n')

                
    print('\nTesting with IW, Test set, B'+str(batch_size_IW)+' k'+str(k_IW))
    IW_test = test(model=model, data_x=test_x, batch_size=batch_size_IW, display=10, k=k_IW)
    print ('IW_test', IW_test)
    with open(experiment_log, "a") as myfile:
        myfile.write('IW_test '+ str(IW_test) +'\n')
        myfile.write('time'+str(time.time()-start_time)+'\n\n')


    print('\nTesting with AIS, Train set, B'+str(batch_size_AIS)+' k'+str(k_AIS)+' intermediates'+str(n_intermediate_dists))
    AIS_train = test_ais(model=model, data_x=train_x, batch_size=batch_size_AIS, display=2, k=k_AIS, n_intermediate_dists=n_intermediate_dists)
    print ('AIS_train', AIS_train)
    with open(experiment_log, "a") as myfile:
        myfile.write('AIS_train '+ str(AIS_train) +'\n')
        myfile.write('time'+str(time.time()-start_time)+'\n\n')


    print('\nTesting with AIS, Test set, B'+str(batch_size_AIS)+' k'+str(k_AIS)+' intermediates'+str(n_intermediate_dists))
    AIS_test = test_ais(model=model, data_x=test_x, batch_size=batch_size_AIS, display=2, k=k_AIS, n_intermediate_dists=n_intermediate_dists)
    print ('AIS_test', AIS_test)
    with open(experiment_log, "a") as myfile:
        myfile.write('AIS_test '+ str(AIS_test) +'\n\n')
        myfile.write('time'+str(time.time()-start_time)+'\n\n')


    # # log results
예제 #5
0
                   batch_size=batch_size,
                   display=100,
                   k=k_IW)

        print('\nTesting with IW, Test set, B' + str(batch_size) + ' k' +
              str(k_IW))
        model.test(data_x=test_x, batch_size=batch_size, display=100, k=k_IW)

    if eval_AIS:
        k_AIS = 10
        batch_size = 1000
        n_intermediate_dists = 500

        print('\nTesting with AIS, Train set[:10000], B' + str(batch_size) +
              ' k' + str(k_AIS) + ' intermediates' + str(n_intermediate_dists))
        LL_ais_train = test_ais(model,
                                data_x=train_x[:10000],
                                batch_size=batch_size,
                                display=1,
                                k=k_AIS,
                                n_intermediate_dists=n_intermediate_dists)

        print('\nTesting with AIS, Test set, B' + str(batch_size) + ' k' +
              str(k_AIS) + ' intermediates' + str(n_intermediate_dists))
        LL_ais_test = test_ais(model,
                               data_x=test_x,
                               batch_size=batch_size,
                               display=1,
                               k=k_AIS,
                               n_intermediate_dists=n_intermediate_dists)
예제 #6
0
        k_IW = 5000
        batch_size = 20

        print('\nTesting with IW, Train set[:10000], B'+str(batch_size)+' k'+str(k_IW))
        model.test(data_x=train_x[:10000], batch_size=batch_size, display=100, k=k_IW)

        print('\nTesting with IW, Test set, B'+str(batch_size)+' k'+str(k_IW))
        model.test(data_x=test_x, batch_size=batch_size, display=100, k=k_IW)

    if eval_AIS:
        k_AIS = 10
        batch_size = 1000
        n_intermediate_dists = 500
        
        print('\nTesting with AIS, Train set[:10000], B'+str(batch_size)+' k'+str(k_AIS)+' intermediates'+str(n_intermediate_dists))
        LL_ais_train = test_ais(model, data_x=train_x[:10000], batch_size=batch_size, display=1, k=k_AIS, n_intermediate_dists=n_intermediate_dists)

        print('\nTesting with AIS, Test set, B'+str(batch_size)+' k'+str(k_AIS)+' intermediates'+str(n_intermediate_dists))
        LL_ais_test = test_ais(model, data_x=test_x, batch_size=batch_size, display=1, k=k_AIS, n_intermediate_dists=n_intermediate_dists)