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-09-04 20:18:34 发布
该代码段描述了一个名为defmake_results_file的函数,用于将深度学习网络的训练和测试结果整理成CSV格式,并在指定的评价文件夹中保存。如果文件已存在,新结果会被追加。还创建了一个包含所有shuffle评估的大表,存储在共同父文件夹中。
摘要由CSDN通过智能技术生成