-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mhof_dev' into mhof_dev_lr_scheduler
- Loading branch information
Showing
13 changed files
with
74 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
aggregate benchmark csv file to generate latex table | ||
""" | ||
import argparse | ||
import pandas as pd | ||
|
||
|
||
def gen_latex_table(raw_df, fname="table_perf.tex", | ||
group="method", str_perf="acc"): | ||
""" | ||
aggregate benchmark csv file to generate latex table | ||
""" | ||
df_result = raw_df.groupby(group)[str_perf].agg(["mean", "std", "count"]) | ||
latex_table = df_result.to_latex(float_format="%.3f") | ||
str_table = df_result.to_string() | ||
print(str_table) | ||
with open(fname, 'w') as file: | ||
file.write(latex_table) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Read a CSV file") | ||
parser.add_argument("filename", help="Name of the CSV file to read") | ||
args = parser.parse_args() | ||
|
||
df = pd.read_csv(args.filename, index_col=False, skipinitialspace=True) | ||
gen_latex_table(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mkdir $2 | ||
python main_out.py --gen_plots $1 --outp_dir $2 | ||
# mkdir $2 | ||
sh scripts/merge_csvs.sh $1 | ||
python main_out.py --gen_plots merged_data.csv --outp_dir partial_agg_plots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,54 @@ | ||
""" | ||
unit and end-end test for deep all, mldg | ||
""" | ||
import pytest | ||
from tests.utils_test import utils_test_algo | ||
|
||
|
||
def test_dann_fbopt(): | ||
""" | ||
dann | ||
""" | ||
args = "--te_d=caltech --task=mini_vlcs --debug --bs=2 --model=dann --trainer=fbopt --nname=alexnet --epos=3" | ||
args = "--te_d=caltech --task=mini_vlcs --debug --bs=2 --model=dann --trainer=fbopt --nname=alexnet --epos=3 --no_dump" | ||
utils_test_algo(args) | ||
|
||
|
||
def test_jigen_fbopt(): | ||
""" | ||
jigen | ||
""" | ||
args = "--te_d=caltech --task=mini_vlcs --debug --bs=2 --model=jigen --trainer=fbopt --nname=alexnet --epos=3" | ||
args = "--te_d=caltech --task=mini_vlcs --debug --bs=2 --model=jigen --trainer=fbopt --nname=alexnet --epos=3 --no_dump" | ||
utils_test_algo(args) | ||
|
||
|
||
def test_diva_fbopt(): | ||
""" | ||
diva | ||
""" | ||
args = "--te_d=caltech --task=mini_vlcs --debug --bs=2 --model=diva --gamma_y=1.0 --trainer=fbopt --nname=alexnet --epos=3" | ||
args = "--te_d=caltech --task=mini_vlcs --debug --bs=2 --model=diva --gamma_y=1.0 --trainer=fbopt --nname=alexnet --epos=3 --no_dump" | ||
utils_test_algo(args) | ||
|
||
|
||
def test_erm_fbopt(): | ||
""" | ||
erm | ||
""" | ||
args = "--te_d=caltech --task=mini_vlcs --debug --bs=2 --model=erm --trainer=fbopt --nname=alexnet --epos=3" # pylint: disable=line-too-long | ||
args = "--te_d=caltech --task=mini_vlcs --debug --bs=2 --model=erm --trainer=fbopt --nname=alexnet --epos=3 --no_dump" # pylint: disable=line-too-long | ||
with pytest.raises(RuntimeError): | ||
utils_test_algo(args) | ||
|
||
|
||
def test_irm_fbopt(): | ||
""" | ||
irm | ||
""" | ||
args = "--te_d=caltech --task=mini_vlcs --debug --bs=2 --model=erm --trainer=fbopt_irm --nname=alexnet --epos=3 --no_dump" # pylint: disable=line-too-long | ||
utils_test_algo(args) | ||
|
||
|
||
def test_forcesetpoint_fbopt(): | ||
""" | ||
diva | ||
""" | ||
args = "--te_d=0 --tr_d 1 2 --task=mnistcolor10 --bs=16 --model=jigen --trainer=fbopt --nname=conv_bn_pool_2 --epos=10 --es=0 --mu_init=0.00001 --coeff_ma_setpoint=0.5 --coeff_ma_output_state=0.99 --force_setpoint_change_once" | ||
args = "--te_d=0 --tr_d 1 2 --task=mnistcolor10 --bs=16 --model=jigen --trainer=fbopt --nname=conv_bn_pool_2 --epos=10 --es=0 --mu_init=0.00001 --coeff_ma_setpoint=0.5 --coeff_ma_output_state=0.99 --force_setpoint_change_once --no_dump" | ||
utils_test_algo(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
""" | ||
unit and end-end test for lr scheduler | ||
""" | ||
from tests.utils_test import utils_test_algo | ||
|
||
|
||
def test_lr_scheduler(): | ||
""" | ||
train | ||
""" | ||
args = "--te_d=2 --tr_d 0 1 --task=mnistcolor10 --debug --bs=100 --model=erm \ | ||
--nname=conv_bn_pool_2 --no_dump --lr_scheduler=CosineAnnealingLR" | ||
utils_test_algo(args) |