report updated
This commit is contained in:
parent
e1b2b68f26
commit
2263b1ab7d
|
@ -3,27 +3,10 @@ import statistics as stats
|
|||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
def _in_div(s):
|
||||
return "<div>" + s + "</div>\n"
|
||||
|
||||
def _header_footer(s):
|
||||
return (
|
||||
"""
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
.dataframe {
|
||||
tr:hover {
|
||||
background-color: aquamarine;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
""" +
|
||||
s +
|
||||
"</body></html>"
|
||||
)
|
||||
def _fmt_line(s):
|
||||
return f"> {s} \n"
|
||||
|
||||
|
||||
class EvaluationReport:
|
||||
def __init__(self, prefix=None):
|
||||
|
@ -139,18 +122,17 @@ class EvaluationReport:
|
|||
def target(self, val):
|
||||
self._target = val
|
||||
|
||||
def to_html(self, *metrics):
|
||||
res = _in_div("target: " + self.target)
|
||||
def to_md(self, *metrics):
|
||||
res = _fmt_line("target: " + self.target)
|
||||
for k, v in self.prevs.items():
|
||||
res += _in_div(f"{k}: {str(v)}")
|
||||
res += _fmt_line(f"{k}: {str(v)}")
|
||||
for k, v in self.times.items():
|
||||
res += _in_div(f"{k}: {v:.3f}s")
|
||||
res += _fmt_line(f"{k}: {v:.3f}s")
|
||||
res += "\n"
|
||||
for m in metrics:
|
||||
res += self.get_dataframe(metrics=m).to_html() + "\n\n"
|
||||
|
||||
return _header_footer(res)
|
||||
|
||||
return res
|
||||
|
||||
@staticmethod
|
||||
def combine_reports(*args):
|
||||
|
|
|
@ -25,7 +25,7 @@ def estimate_comparison():
|
|||
er = method.evaluate_comparison(DATASET, target=target)
|
||||
er.target = target
|
||||
with open(OUTPUT_FILE, "a") as f:
|
||||
f.write(er.to_html(["acc"], ["f1"]))
|
||||
f.write(er.to_md(["acc"], ["f1"]))
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
|
||||
|
|
Loading…
Reference in New Issue