Skip to content

Commit

Permalink
add standard deviation to the report for regions props and efd
Browse files Browse the repository at this point in the history
  • Loading branch information
afoix committed Sep 27, 2024
1 parent b9c64d5 commit d51a120
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/shapeembed/gather_run_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ def trial_table(df, tname):

#def simple_table(df, tname, model_re=".*vq.*"):
def simple_table(df, tname, model_re=".*", sort_by_col=None, ascending=False, best_n=40):
cols=['model', 'compression_factor', 'latent_dim', 'batch_size', 'beta', 'test_f1', 'mse/test']
cols=['model', 'compression_factor', 'latent_dim', 'batch_size', 'beta', 'test_f1', 'test_f1_std', 'mse/test']
df = df.loc[df.model.str.contains(model_re), cols].sort_values(by=cols)
if sort_by_col:
df = df.sort_values(by=sort_by_col, ascending=ascending)
df = df.iloc[:best_n]

with open(f'{tname}_tabular.tex', 'w') as fp:
fp.write("\\begin{tabular}{|llll|r|r|} \hline\n")
fp.write("Model & CF (and latent space size) & batch size & BETA & F1 score & Mse \\\\ \hline\n")
fp.write("Model & CF (and latent space size) & batch size & BETA & F1 score & F1 score (std) & Mse \\\\ \hline\n")
for _, r in df.iterrows():
mname = r['model'].replace('_','\_')
beta = '-' if pd.isna(r['beta']) else r['beta']
fp.write(f"{mname} & {r['compression_factor']} ({r['latent_dim']}) & {r['batch_size']} & {beta} & {r['test_f1']:f} & {r['mse/test']:f} \\\\\n")
fp.write(f"{mname} & {r['compression_factor']} ({r['latent_dim']}) & {r['batch_size']} & {beta} & {r['test_f1']:f} & {r['test_f1_std']:f} & {r['mse/test']:f} \\\\\n")
fp.write("\hline\n")
fp.write("\end{tabular}\n")

Expand Down Expand Up @@ -146,12 +146,14 @@ def keep_first_fname(series):
df.set_index(idx_cols, inplace=True)
df.sort_index(inplace=True)
#df = df.groupby(level=['trial', 'dataset', 'model', 'compression_factor', 'latent_dim', 'batch_size']).agg({
df['test_f1_std'] = df['test_f1'].astype(float)
df = df.groupby(level=idx_cols, dropna=False).agg({
'beta': 'mean'
, 'test_accuracy': 'mean'
, 'test_precision': 'mean'
, 'test_recall': 'mean'
, 'test_f1': 'mean'
, 'test_f1_std': 'std'
, 'mse/test': 'mean'
, 'loss/test': 'mean'
, 'mse/val': 'mean'
Expand Down

0 comments on commit d51a120

Please sign in to comment.