commit 0a5802d200bb784ea23e916247f7d09b9650014c
parent 8d85f3b4e6a8ae109c3462ff78fccf783afcc434
Author: Mike Oliphant <oliphant@nostatic.org>
Date: Sat, 10 Jun 2023 22:05:20 -0700
Show 4 significant digits for checkpoint ESR (#265)
* Show 4 significant digits for checkpoint ESR
* Use 4 significant digits for final ESR display
* Use scientific notation after 10 digits to make sure filenames don't blow up
* Switch to .4g since it is sig figs and not decimals
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/nam/train/core.py b/nam/train/core.py
@@ -715,13 +715,13 @@ def _plot(
esr_comment = "...This probably won't sound great :("
else:
esr_comment = "...Something seems to have gone wrong."
- print(f"Error-signal ratio = {esr:.4f}")
+ print(f"Error-signal ratio = {esr:.4g}")
print(esr_comment)
plt.figure(figsize=(16, 5))
plt.plot(output[window_start:window_end], label="Prediction")
plt.plot(ds.y[window_start:window_end], linestyle="--", label="Target")
- plt.title(f"ESR={esr:.4f}")
+ plt.title(f"ESR={esr:.4g}")
plt.legend()
if filepath is not None:
plt.savefig(filepath + ".png")
@@ -847,7 +847,7 @@ def train(
trainer = pl.Trainer(
callbacks=[
pl.callbacks.model_checkpoint.ModelCheckpoint(
- filename="checkpoint_best_{epoch:04d}_{step}_{ESR:.4f}_{MSE:.3e}",
+ filename="checkpoint_best_{epoch:04d}_{step}_{ESR:.4g}_{MSE:.3e}",
save_top_k=3,
monitor="val_loss",
every_n_epochs=1,