Skip to content

Commit 598a4cc

Browse files
authored
Merge branch 'master' into mhof_dev
2 parents 40327c0 + 39f9a0d commit 598a4cc

File tree

7 files changed

+20
-11
lines changed

7 files changed

+20
-11
lines changed

docs/doc_benchmark.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ In case that the benchmark is not entirely completed, the user can obtain partia
132132
explained below.
133133

134134

135-
### Obtain partial results
136-
If the benchmark is not yet completed (still running or has some failed jobs, e.g. BrokenPipe Error due to multiprocessing in PIL image reading), the `results.csv` file containing the aggregated results will not be created.
135+
### Aggregate obtained partial results
136+
If the benchmark is not yet completed (still running or has some failed jobs, e.g. Out of Memory, BrokenPipe Error due to multiprocessing in PIL image reading), the `results.csv` file containing the aggregated results will not be created.
137+
137138
The user can then obtain the aggregated partial results with plots from the partially completed benchmark by running
138139
the following after cd into the DomainLab directory:
139140
```commandline
@@ -144,9 +145,9 @@ e.g. `./zoutput/benchmarks/demo_benchmark`, where `demo_benchmark` is a name def
144145

145146
Alternatively, one could use
146147
```examples
147-
cat ./zoutput/benchmarks/[name of the benchmark]/rule_results/*.csv > result.csv
148+
sh scripts/sh_benchmark_partial_agg.sh OUTPUT_DIR/rule_results
148149
```
149-
clean up the extra csv head generated and plot the csv using command below
150+
where rule_results is the subfolder that contains partially finished csv result files. This script will partially aggregate the csv files in a faster fashion, output latex table which summarizes the results named "output_table_perf.tex" (which also contains a text format table before the latex table), and at the end generate plots using the following functionality.
150151

151152
### Generate plots from .csv file
152153
If the benchmark is not completed, the `graphics` subdirectory might not be created. The user can then manually

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "domainlab"
3-
version = "0.7.0"
3+
version = "0.7.1"
44
readme = "README.md"
55
repository = "https://github.com/marrlab/DomainLab"
66
homepage = "https://marrlab.github.io/DomainLab/"

scripts/generate_latex_table.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pandas as pd
66

77

8-
def gen_latex_table(raw_df, fname="table_perf.tex",
8+
def gen_latex_table(raw_df, fname="output_table_perf.tex",
99
group="method", str_perf="acc"):
1010
"""
1111
aggregate benchmark csv file to generate latex table
@@ -15,6 +15,8 @@ def gen_latex_table(raw_df, fname="table_perf.tex",
1515
str_table = df_result.to_string()
1616
print(str_table)
1717
with open(fname, 'w') as file:
18+
file.write(str_table)
19+
file.write("\n")
1820
file.write(latex_table)
1921

2022

scripts/merge_csvs.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#!/bin/bash
2+
# $1 should be a folder with only csv files
3+
# $2 is the output file name
24

35
# Define the directory containing the text files
46
directory=$1
57

68
# Define the output CSV file
7-
output_file="merged_data.csv"
9+
output_file="${2:-merged_data.csv}"
810

911
# Initialize the merged CSV file with the header from the first file
1012
find "$directory" -maxdepth 1 -type f -name "*.csv" | sort | head -1 | xargs head -n 1 > "$output_file"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# $1 should be the rule_results folder which contains several csv files
2+
# $2 default to be merged_data.csv
3+
4+
file_na_merged_csv="${2:-merged_data.csv}"
5+
sh scripts/merge_csvs.sh $1 $file_na_merged_csv
6+
python scripts/generate_latex_table.py $file_na_merged_csv
7+
python main_out.py --gen_plots $file_na_merged_csv --outp_dir partial_agg_plots

scripts/sh_genplot.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def copy_dir(dir_path="zdata"):
3838
package_data={
3939
"zdata": [f for f in copy_dir()],
4040
},
41-
version="0.7.0",
41+
version="0.7.1",
4242
description="Library of modular domain generalization for deep learning",
4343
url="https://github.com/marrlab/DomainLab",
4444
author="Xudong Sun, et.al.",

0 commit comments

Comments
 (0)