IniziaInizia gratis

Loss weighting

Three versions of the two-output model for alphabet and character prediction that you built before have been trained: model_a, model_b, and model_c. For all three, the loss was defined as follows:

loss_alpha = criterion(outputs_alpha, labels_alpha)
loss_char = criterion(outputs_char, labels_char)
loss = ((1 - char_weight) * loss_alpha) + (char_weight * loss_char)

However, each of the three models was trained with a different char_weight: 0.1, 0.5, or 0.9.

Use the function you have defined in the previous exercise, evaluate_model(), to check the accuracy of each model. Which char_weight was used to train which model?

Questo esercizio fa parte del corso

Intermediate Deep Learning with PyTorch

Visualizza il corso

Esercizio pratico interattivo

Passa dalla teoria alla pratica con uno dei nostri esercizi interattivi

Inizia esercizio