def do_baseline()

in bayesmark/experiment_baseline.py [0:0]


def do_baseline(args):  # pragma: io
    """Alternate entry into the program without calling the actual main.
    """
    # Load in the eval data and sanity check
    perf_ds, meta = XRSerializer.load_derived(args[CmdArgs.db_root], db=args[CmdArgs.db], key=cc.EVAL_RESULTS)
    logger.info("Meta data from source file: %s" % str(meta["args"]))

    D = OrderedDict()
    for kk in perf_ds:
        perf_da = perf_ds[kk]
        D[(kk,)] = compute_baseline(perf_da)
    baseline_ds = ds_concat(D, dims=(cc.OBJECTIVE,))

    # Keep in same order for cleanliness
    baseline_ds = baseline_ds.sel({cc.OBJECTIVE: list(perf_ds)})
    assert list(perf_ds) == baseline_ds.coords[cc.OBJECTIVE].values.tolist()

    # Could optionally remove this once we think things have enough tests
    for kk in D:
        assert baseline_ds.sel({cc.OBJECTIVE: kk[0]}, drop=True).identical(D[kk])

    # Now dump the results
    XRSerializer.save_derived(baseline_ds, meta, args[CmdArgs.db_root], db=args[CmdArgs.db], key=cc.BASELINE)