Plots the per-epoch training and (optionally) validation loss from the
history slot of a swrc_fit object. A log(1 + x) y-axis is used so
that both the (larger) composite training loss and the (small) validation
MSE remain clearly visible on the same panel.
Usage
plot_training_history(
fit,
loss_col = "loss",
val_col = "val_mse",
log_scale = TRUE,
base_size = 12
)Examples
# plot_training_history() reads only `fit$history`, so a minimal
# swrc_fit carrying one is enough to draw the curve without TensorFlow.
h <- data.frame(
epoch = 1:20,
loss = 1 / (1:20),
val_mse = 1 / (1:20) + 0.01
)
fake <- structure(list(history = h), class = "swrc_fit")
plot_training_history(fake)
