Skip to content

Commit

Permalink
Close plots after plottings
Browse files Browse the repository at this point in the history
  • Loading branch information
1pha committed Mar 11, 2024
1 parent 7075b7c commit a81b206
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sage/trainer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def _reg_inference(preds, target, root_dir, run_name) -> float:
fig.suptitle(run_name)
fig.tight_layout()
fig.savefig(root_dir / f"{run_name}-kde.png")
plt.close()
return mse


Expand Down Expand Up @@ -196,6 +197,7 @@ def _get_norm_cf_reg(preds, target, root_dir, run_name) -> None:
fig.suptitle(run_name, size=titlesize)
fig.tight_layout()
fig.savefig(root_dir / f"{run_name}-cf.png")
plt.close()


def _cls_inference(preds, target, root_dir, run_name) -> float:
Expand All @@ -214,6 +216,7 @@ def _cls_inference(preds, target, root_dir, run_name) -> float:
p = sns.heatmap(cf, annot=True, fmt="d")
p.set_title(run_name)
plt.savefig(root_dir / f"{run_name}-cf.png")
plt.close()
return acc


Expand Down

0 comments on commit a81b206

Please sign in to comment.