MCPcopy Index your code
hub / github.com/evalplus/evalplus / texprint

Function texprint

tools/render.py:85–117  ·  view source on GitHub ↗
(before_summary, after_summary, bfgreedy, afgreedy)

Source from the content-addressed store, hash-verified

83
84
85def 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
120def rich_print(before_summary, after_summary, bfgreedy, afgreedy):

Callers 1

render.pyFile · 0.85

Calls 3

make_lineFunction · 0.85
aplusFunction · 0.85
align_ampersandsFunction · 0.85

Tested by

no test coverage detected