Skip to content

Postprocessing

plot_summary(sampler, training=False, **plotkwargs) ยค

Create plots of the most important quantities in the summary.

Parameters:

Name Type Description Default
training bool

If True, plot training quantities. If False, plot production quantities. Defaults to False.

False
Source code in flowMC/utils/postprocessing.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
def plot_summary(sampler: object, training: bool = False, **plotkwargs) -> None:
    """
    Create plots of the most important quantities in the summary.

    Args:
        training (bool, optional): If True, plot training quantities. If False, plot production quantities. Defaults to False.
    """

    # Choose the dataset
    data = sampler.get_sampler_state(training=training)
    # TODO add loss values in plotting
    keys = ["local_accs", "global_accs", "log_prob"]
    if sampler.track_gelman_rubin:
        keys.append("gelman_rubin")

    # Check if outdir is property of sampler
    if hasattr(sampler, "outdir"):
        outdir = sampler.outdir
    else:
        outdir = "./outdir/"

    for key in keys:
        if training:
            which = "training"
        else:
            which = "production"
        _single_plot(data, key, which, outdir=outdir, **plotkwargs)