Evaluate a sequence model with per-batch MAPE and RMSE.
Metrics are the torchmetrics MeanAbsolutePercentageError and MeanSquaredError(squared=False) between model(x, lengths).squeeze() and the squeezed target batch, as in the schu25a original. Inputs, predictions, and targets are additionally returned as nested Python lists for plotting.
Parameters
Name
Type
Description
Default
model
nn.Module
Model called as model(x, lengths).
required
val_loader
DataLoader
Loader yielding (x, lengths, y) batches. Batches are converted to NumPy, so device should be “cpu” unless metrics_only=True.