Suppose I have total 10 images, of 2 classes, lets say 6 cats and 4 dogs, now I want my neural network to associate a priority to each of these images, so if it predicts one of the 6 cats with a higher priority correctly, then it will be rewarded, and if it predicts one of the 6 cats with a lower priority correctly, then it does not matter much.
Furthermore, this priority is not something that I hard code and tell my neural network, that give high priority to this image, and low to this image, instead it is a parameter, so neural network will update these priorities by gradient descent, and figure out which image it needs to give higher priority, and which image it needs to give lower priority.
What kind of reward should I give to my neural network, if I set loss to zero, for predicting correctly images, then it does not consider priority, should I write a custom loss function, that takes priority into consideration?
class Net(nn.Module): def __init__(self): super().__init__() self.priority_with_images = nn.Parameter(number of images * size of priority vector) # each image will have a one dimensional priority, # (I could set priority for each image as a number also, but I think 1d vector priority would be better) def forward(self, input_images): # suppose I get a vector representing probability image # is one of the classes, after passing image through neural network # do I compute loss in forward itself, and return it? # do I return something like, loss * priority_with_images, # will this ensure that parameters of priority_with_images gets updated?