Beispiel #1
0
def view_true_samples(seed):
    """
    Plots MCMC samples from the true posterior.
    """

    samples = get_true_samples(seed)

    fig = util.plot.plot_hist_marginals(samples, lims=sim.get_disp_lims(), gt=true_ps)
    fig.suptitle('true samples')

    plt.plot()
Beispiel #2
0
def view_samples_nde(seed):
    """
    Plots MCMC samples for all NDE experiments.
    """

    for exp_desc in ed.parse(util.io.load_txt('exps/gauss_nl.txt')):

        samples = get_samples_nde(exp_desc, seed)

        fig = util.plot.plot_hist_marginals(samples, lims=sim.get_disp_lims(), gt=true_ps)
        fig.suptitle('NDE, sims = {0}'.format(exp_desc.inf.n_samples))

    plt.plot()
Beispiel #3
0
def view_samples_sl():
    """
    Plots MCMC samples for all synth likelihood experiments.
    """

    for exp_desc in ed.parse(util.io.load_txt('exps/gauss_sl.txt')):

        exp_dir = os.path.join(root, 'experiments', exp_desc.get_dir(), '0')
        samples, _ = util.io.load(os.path.join(exp_dir, 'results'))

        fig = util.plot.plot_hist_marginals(samples, lims=sim.get_disp_lims(), gt=true_ps)
        fig.suptitle('Synth Lik, sims = {0}'.format(exp_desc.inf.n_sims))

    plt.plot()
Beispiel #4
0
def view_samples_snl(seed):
    """
    Plots MCMC samples for all SNL experiments.
    """

    for exp_desc in ed.parse(util.io.load_txt('exps/gauss_seq.txt')):

        if isinstance(exp_desc.inf, ed.SNL_Descriptor):

            all_samples = get_samples_snl(exp_desc, seed)

            for i, samples in enumerate(all_samples):
                fig = util.plot.plot_hist_marginals(samples, lims=sim.get_disp_lims(), gt=true_ps)
                fig.suptitle('SNL, round = {0}'.format(i + 1))

    plt.plot()