def get_benchmark_samples_pmc():
    # load benchmark samples, make sure its a particular file version
    benchmark_samples_fname = "pmc_sv_benchmark_samples.txt"
    benchmark_samples_sha1 = "d53e505730c41fbe413188530916d9a402e21a87"
    assert_file_has_sha1sum(benchmark_samples_fname, benchmark_samples_sha1)
    
    benchmark_samples = np.loadtxt(benchmark_samples_fname)
    benchmark_samples = benchmark_samples[np.arange(0, len(benchmark_samples), step=50)]
    return benchmark_samples
def get_benchmark_samples_mcmc():
    # load benchmark samples, make sure its a particular file version
    benchmark_samples_fname = "mcmc_sv_benchmark_samples.txt"
    benchmark_samples_sha1 = "dd71899bf8ead3972de45543b09af95dc858a208"
    
    assert_file_has_sha1sum(benchmark_samples_fname, benchmark_samples_sha1)
    
    benchmark_samples = np.loadtxt(benchmark_samples_fname)
    benchmark_samples = benchmark_samples[np.arange(0, len(benchmark_samples), step=100)]
    return benchmark_samples
Example #3
0
def get_benchmark_samples_pmc():
    # load benchmark samples, make sure its a particular file version
    benchmark_samples_fname = "pmc_sv_benchmark_samples.txt"
    benchmark_samples_sha1 = "d53e505730c41fbe413188530916d9a402e21a87"
    assert_file_has_sha1sum(benchmark_samples_fname, benchmark_samples_sha1)

    benchmark_samples = np.loadtxt(benchmark_samples_fname)
    benchmark_samples = benchmark_samples[np.arange(0,
                                                    len(benchmark_samples),
                                                    step=50)]
    return benchmark_samples
Example #4
0
def get_benchmark_samples_mcmc():
    # load benchmark samples, make sure its a particular file version
    benchmark_samples_fname = "mcmc_sv_benchmark_samples.txt"
    benchmark_samples_sha1 = "dd71899bf8ead3972de45543b09af95dc858a208"

    assert_file_has_sha1sum(benchmark_samples_fname, benchmark_samples_sha1)

    benchmark_samples = np.loadtxt(benchmark_samples_fname)
    benchmark_samples = benchmark_samples[np.arange(0,
                                                    len(benchmark_samples),
                                                    step=100)]
    return benchmark_samples
 def get_StaticMetropolis_instance(D, target_log_pdf):
     step_size = 0.002
     acc_star = None
     schedule = None
     instance = StaticMetropolis(D, target_log_pdf, step_size, schedule, acc_star)
     
     # give proposal variance a meaningful shape from previous samples
     benchmark_samples_fname = "pmc_sv_benchmark_samples.txt"
     benchmark_samples_sha1 = "d53e505730c41fbe413188530916d9a402e21a87"
     assert_file_has_sha1sum(benchmark_samples_fname, benchmark_samples_sha1)
     
     benchmark_samples = np.loadtxt(benchmark_samples_fname)
     benchmark_samples = benchmark_samples[np.arange(0, len(benchmark_samples), step=50)]
     instance.L_C = np.linalg.cholesky(np.cov(benchmark_samples.T))
     
     return instance
    def get_StaticMetropolis_instance(D, target_log_pdf):
        step_size = 0.002
        acc_star = None
        schedule = None
        instance = StaticMetropolis(D, target_log_pdf, step_size, schedule,
                                    acc_star)

        # give proposal variance a meaningful shape from previous samples
        benchmark_samples_fname = "pmc_sv_benchmark_samples.txt"
        benchmark_samples_sha1 = "d53e505730c41fbe413188530916d9a402e21a87"
        assert_file_has_sha1sum(benchmark_samples_fname,
                                benchmark_samples_sha1)

        benchmark_samples = np.loadtxt(benchmark_samples_fname)
        benchmark_samples = benchmark_samples[np.arange(0,
                                                        len(benchmark_samples),
                                                        step=50)]
        instance.L_C = np.linalg.cholesky(np.cov(benchmark_samples.T))

        return instance
from matplotlib.lines import Line2D
import os

from kameleon_rks.examples.plotting import visualise_pairwise_marginals
from kameleon_rks.experiments.kernel_gradient_is.pmc_sv import result_fname
from kameleon_rks.experiments.tools import assert_file_has_sha1sum
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

if False:
    # plot benchmark samples, make sure its a particular file version
    benchmark_samples_fname = "pmc_sv_benchmark_samples.txt"
    benchmark_samples_sha1 = "d53e505730c41fbe413188530916d9a402e21a87"
    assert_file_has_sha1sum(benchmark_samples_fname, benchmark_samples_sha1)
    benchmark_samples = np.loadtxt(benchmark_samples_fname)
    benchmark_samples = benchmark_samples[np.arange(0,
                                                    len(benchmark_samples),
                                                    step=50)]

    mean = np.mean(benchmark_samples, axis=0)
    var = np.var(benchmark_samples, axis=0)
    print("%d benchmark samples" % len(benchmark_samples))
    print "mean:", repr(mean)
    print "var:", repr(var)
    print "np.mean(var): %.3f" % np.mean(var)
    print "np.linalg.norm(mean): %.3f" % np.linalg.norm(mean)

    visualise_pairwise_marginals(benchmark_samples)
    plt.show()
Example #8
0
from matplotlib.lines import Line2D
import os

from kameleon_rks.examples.plotting import visualise_pairwise_marginals
from kameleon_rks.experiments.kernel_gradient_is.pmc_sv import result_fname
from kameleon_rks.experiments.tools import assert_file_has_sha1sum
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

if False:
    # plot benchmark samples, make sure its a particular file version
    benchmark_samples_fname = "pmc_sv_benchmark_samples.txt"
    benchmark_samples_sha1 = "d53e505730c41fbe413188530916d9a402e21a87"
    assert_file_has_sha1sum(benchmark_samples_fname, benchmark_samples_sha1)
    benchmark_samples = np.loadtxt(benchmark_samples_fname)
    benchmark_samples = benchmark_samples[np.arange(0, len(benchmark_samples), step=50)]
    
    
    mean = np.mean(benchmark_samples, axis=0)
    var = np.var(benchmark_samples, axis=0)
    print("%d benchmark samples" % len(benchmark_samples))
    print "mean:", repr(mean)
    print "var:", repr(var)
    print "np.mean(var): %.3f" % np.mean(var)
    print "np.linalg.norm(mean): %.3f" % np.linalg.norm(mean)
    
    visualise_pairwise_marginals(benchmark_samples)
    plt.show()

# from kameleon_rks.experiments.latex_plot_init import plt