Aan de slagBegin 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?

Deze oefening maakt deel uit van de cursus

Intermediate Deep Learning with PyTorch

Bekijk cursus

Interactieve oefening met praktijkervaring

Zet theorie om in actie met een van onze interactieve oefeningen

Begin oefening