def make_results_file(final_result, evaluationfolder, DLCscorer):
"""
Makes result file in csv format and saves under evaluation_results directory.
If the file exists (typically, when the network has already been evaluated),
newer results are appended to it.
"""
col_names = [
"Training iterations:",
"%Training dataset",
"Shuffle number",
" Train error(px)",
" Test error(px)",
"p-cutoff used",
"Train error with p-cutoff",
"Test error with p-cutoff",
]
df = pd.DataFrame(final_result, columns=col_names)
output_path = os.path.join(str(evaluationfolder), DLCscorer + "-results.csv")
if os.path.exists(output_path):
temp = pd.read_csv(output_path, index_col=0)
df = pd.concat((temp, df)).reset_index(drop=True)
df.to_csv(output_path)
## Also storing one "large" table with results:
# note: evaluationfolder.parents[0] to get common folder above all shuffle evaluations.
df = pd.DataFrame(final_result, columns=col_names)
output_path = os.path.join(
str(Path(evaluationfolder).parents[0]), "CombinedEvaluation-results.csv"
)
if os.path.exists(output_path):
temp = pd.read_csv(output_path, index_col=0)
df = pd.concat((temp, df)).reset_index(drop=True)
df.to_csv(output_path)
evaluate3
最新推荐文章于 2024-05-27 17:00:50 发布