Given an input X, my goal is to predict a list of probabilities for n factors, where the factors could be attributes like feasibility, comfort, ease etc. using a neural network. I have soft targets for each of these classes that I have computed for each of these targets. The factors are not necessarily related to each other (and even if they are, an earlier part of the neural network can take care of that).
What would the best loss for this situation be?
Pytorch examples would be a bonus!
Thanks
- 123
1 Answers
From the comments, it sounds like you have a fairly standard multi-label problem and want the model predictions to be the probabilities of class membership instead of the predicted classes. The good news is that the math already gives you this, and if you’re only getting predicted categories from your code, the path forward should be to change your code. For instance, the predict method in sklearn will give your the category with the highest predicted probability, yet predict_proba gives the raw predicted probabilities. Your software should have such a capability, and if it does not, you might want to use a different software.
Consequently, I would not use any special kind of loss function with the soft labels to predict probabilities. Rather, I would model the original binary decisions as a multi-label problem and predict the probabilities from that model.
One caveat is that neural networks tend to give predicted probabilities that are overconfident. Calibrating these predictions so they better reflect the reality of true event occurrence is possible but not always trivial. The multi-label aspect of this problem where event occurrence can be influenced by other events occurring further muddies the picture. (This may very well be an open problem.)
- 62,186
x1, I had 3 user ratings for 2 features :feasibility:[0,1,0],comfort:[1,1,1]. I would want my NN to predict for x1 :feasibility : 0.333,comfort : 1. – OlorinIstari Aug 15 '23 at 03:28predict_probainstead of justpredictto predict the category with the highest predicted probability. – Dave Aug 15 '23 at 03:32