We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I was trying to compute the class weight "balanced". I see that there are two arguments:
parser.add_argument('--dense-weight', type=float, default=0.5, help='Token labeling loss multiplier (default: 0.5)') parser.add_argument('--cls-weight', type=float, default=1.0, help='Cls token prediction loss multiplier (default: 1.0)')
How can I multiply the loss to get the balanced class weight?
Thank you in advance
The text was updated successfully, but these errors were encountered:
What I did so far:
from sklearn.utils import class_weight class_weights = class_weight.compute_class_weight('balanced', np.unique(target_values), target_values.numpy()) class_weights = torch.tensor(class_weights, dtype=torch.float) train_loss_fn = nn.CrossEntropyLoss(weight=class_weights).cuda()
See that I am changing the loss function, before I was using TokenLabelGTCrossEntropy :
train_loss_fn = TokenLabelGTCrossEntropy(dense_weight=args.dense_weight,\ cls_weight = args.cls_weight, mixup_active = mixup_active).cuda()
Sorry, something went wrong.
No branches or pull requests
Hello,
I was trying to compute the class weight "balanced". I see that there are two arguments:
How can I multiply the loss to get the balanced class weight?
Thank you in advance
The text was updated successfully, but these errors were encountered: