BaşlayınÜcretsiz Başlayın

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!

Bu egzersiz

Intermediate Deep Learning with PyTorch

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • 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 to outputs.
  • Compute the final value of the test metric assigning it to test_mse.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# 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}")
Kodu Düzenle ve Çalıştır