Precision vs recall when using transformer models?

Here is an example: How can I use class_weights when training? - #7 by nielsr (Or if you look for “class weight” on the forums you’ll find related examples.) This is the important part:

loss_fct = nn.CrossEntropyLoss(weight=torch.tensor([0.2, 0.3]))

where the tensor contains the class weights. Refer to the PyTorch documentation for more information about the class weights.

For hyperparameters to tune, as you say they are less distinct than more traditional algorithms. Typically you’d do a search for the optimal learning rate at least, potentially also including other arguments of the optimizer.

1 Like