Data Science Asked by user2974655 on April 30, 2021
helo,
i have a very weird problem.
my validation accuracy graph is very jumpy, and i dont know how to fix it
this is the graph:
this is a multi label problem. i calculate accuracy with 0.5 threshold
i think that the problem related to my loss function
(i needed to minimize even one class success in the model prediction, and not only when he success in all of them)
i have a costume loss function:
def loss_function(predictions, labels, batch_size):
eps = 0.000000000000000000000000001
losses = 0
k = len(lebels[0])
ones = torch.ones(1, 1).expand(batch_size, k).cuda()
loss1 = -((ones-labels)*(((ones-predictions)+(eps)).log())).sum(dim=1)
prod = (ones-labels)*k - labels*((predictions+ eps).log())
loss2 = torch.min(prod, dim=1)[0]
losses = (loss1 + loss2).sum()
return losses / batch_size
i hope someone can understand the problem
thank you very much.
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP