(before_summary, after_summary, bfgreedy, afgreedy)
| 83 | |
| 84 | |
| 85 | def texprint(before_summary, after_summary, bfgreedy, afgreedy): |
| 86 | TEXTTEMPS = [r"\temptwo{}", r"\tempfour{}", r"\tempsix{}", r"\tempeight{}"] |
| 87 | |
| 88 | def aplus(s) -> str: |
| 89 | return r"\aplus{" + s + r"}" |
| 90 | |
| 91 | def make_line(summary, amax, ap=False): |
| 92 | pkvals = [f"{v[amax[i]]:.1f}" for i, v in enumerate(summary.values())] |
| 93 | if ap: |
| 94 | pkvals = [aplus(v) for v in pkvals] |
| 95 | return ( |
| 96 | " & ".join(pkvals) |
| 97 | + " & " |
| 98 | + " & ".join([TEXTTEMPS[i] for i in amax]) |
| 99 | + r" \\" |
| 100 | ) |
| 101 | |
| 102 | print("======== LaTeX Table Ingredent ========") |
| 103 | argmax = [np.argmax(v) for v in before_summary.values()] |
| 104 | text1 = "base & " |
| 105 | if bfgreedy is not None: |
| 106 | text1 += f"{bfgreedy:.1f} & " |
| 107 | argmax = [np.argmax(v) for v in after_summary.values()] |
| 108 | text1 += make_line(before_summary, argmax) |
| 109 | |
| 110 | text2 = "\\aplus{+extra} & " |
| 111 | if afgreedy is not None: |
| 112 | text2 += aplus(f"{afgreedy:.1f}") + " & " |
| 113 | text2 += make_line(after_summary, argmax, ap=True) |
| 114 | |
| 115 | text1, text2 = align_ampersands(text1, text2) |
| 116 | cprint(text1, "green") |
| 117 | cprint(text2, "green") |
| 118 | |
| 119 | |
| 120 | def rich_print(before_summary, after_summary, bfgreedy, afgreedy): |
no test coverage detected