Evaluating forecasting models
It's evaluation time! The same LSTM network that you have trained in the previous exercise has been trained for you for a few more epochs and is available as net.
Your task is to evaluate it on a test dataset using the Mean Squared Error metric (torchmetrics has already been imported for you). Let's see how well the model is doing!
Latihan ini adalah bagian dari kursus
Intermediate Deep Learning with PyTorch
Petunjuk latihan
- Define the Mean Squared Error metrics and assign it to
mse. - Pass the input sequence to
net, and squeeze the result before you assign it tooutputs. - Compute the final value of the test metric assigning it to
test_mse.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Define MSE metric
mse = ____
net.eval()
with torch.no_grad():
for seqs, labels in dataloader_test:
seqs = seqs.view(32, 96, 1)
# Pass seqs to net and squeeze the result
outputs = ____
mse(outputs, labels)
# Compute final metric value
test_mse = ____
print(f"Test MSE: {test_mse}")