1. Learn
  2. /
  3. Courses
  4. /
  5. Deep Learning for Text with PyTorch

Connected

Exercise

Evaluating the model's performance

The PyBooks team has been making strides on the book recommendation engine. The modeling team has provided you two different models ready for your book recommendation engine at PyBooks. One model is based on LSTM (lstm_model) and the other uses a GRU (gru_model). You've been tasked to evaluate and compare these models.

The testing labels y_test and the model's predictions y_pred_lstm for lstm_model and y_pred_gru for gru_model.

Instructions

100 XP
  • Define accuracy, precision, recall and F1 for multi-class classification by specifying num_classes and task.
  • Calculate and print the accuracy, precision, recall, and F1 score for lstm_model.
  • Similarly, calculate the evaluation metrics for gru_model.