I’m trying to build a regression network that has 16 outputs with one of the 16 outputs weighted 3 times as high (or X times as high in the general case) for loss purposes as the other 15 outputs. I have built a network that works for the 16 outputs when they are all equal weighted, but how would I go about up-weighting one of the outputs above the others? I feel like there should be a simple way of doing this that I’m not thinking of. Thanks for the help and ideas in advance!
So basically I need to create a custom loss function that takes the MSE of (predictions, targets) where the loss with respect to target_1 is X times the other targets.
Is there a way to alter the top level MSE_loss function to do this like this? :
class MSELoss(_Loss):
def __init__(self, size_average=True, reduce=True):
super(MSELoss, self).__init__(size_average, reduce)
def forward(self, input, target):
_assert_no_grad(target)
#Weight the first item in the input list and , target list or accept a variable to choose which item
return F.mse_loss(input, target, size_average=self.size_average, reduce=self.reduce)