def make_table()

in prediction_generation/aggregate_table_wide.py [0:0]


def make_table(uni_default_f1, uni_default_cover, uni_default_precision, uni_default_recall,
               uni_best_f1, uni_best_cover, uni_best_precision, uni_best_recall, methods):
    """Create part of the aggregate table
    """
    tex = []
    tex.append("%% This table requires booktabs!")

    tex.append("\\begin{tabular}{lrrrr|rrrr}")
    superheader = (
        " & ".join(
            [
                "",
                "\\multicolumn{4}{c}{Default}",
                "\\multicolumn{4}{c}{Best} \\\\",
            ]
        )
        + "\\cmidrule(lr){2-5}\\cmidrule(lr){6-9}"
    )
    tex.append(superheader)
    subheader = (
        " & ".join(
            [
                "",
                "F1",
                "Cover",
                "Precision",
                "Recall",
                "F1",
                "Cover",
                "Precision",
                "Recall" + "\\\\",
            ]
        )
        + "\\cmidrule(r){1-1}"
        + "\\cmidrule(lr){2-5}"
        + "\\cmidrule(l){6-9}"
    )
    tex.append(subheader)

    table = []

    L = max(map(len, methods))
    textsc = lambda m: "\\textsc{%s}%s" % (m, (L - len(m)) * " ")
    table.append(list(map(textsc, methods)))

    all_exps = [uni_default_f1, uni_default_cover, uni_default_precision, uni_default_recall,
                uni_best_f1, uni_best_cover, uni_best_precision, uni_best_recall]

    for exp in all_exps:
        row = []
        maxscore = max((exp[m] for m in methods if m in exp))
        for m in methods:
            if m not in exp:
                row.append(5 * " ")
                continue
            score = exp[m]
            scorestr = tabulate._format(
                score, tabulate._float_type, ".3f", ""
            )
            if score == maxscore:
                row.append("\\textbf{%s}" % scorestr)
            else:
                row.append(scorestr)
        table.append(row)

    transposed = list(zip(*table))
    for row in transposed:
        tex.append(" & ".join(row) + " \\\\")
    tex.append("\\cmidrule(r){1-1}\\cmidrule(lr){2-5}\\cmidrule(l){6-9}")
    tex.append("\\end{tabular}")

    return tex