I would like to know if it’s possible to get a predict_proba() (function that returns the probability distribution from a model in sklearn) from a neural net in PyTorch.
I basically need them to make ROC and precision-recall curves. But since I’m using the train_model() function from this tutorial https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html 28 , I’m not sure how to get the probability distribution.
output = net(image)
print(output) #print output from crossentropy score

sm = torch.nn.Softmax()
probabilities = sm(output) 
print(probabilities) #Converted to probabilities

This code above makes sense to get the probabilities?.. I obtain the probabilities when I use this block of code, but I want to know if this makes sense, or if there is a theoretical error. I ask this because the result of the output above is from a crossentropy loss criterion I’ve used, and I’m not sure if makes sense to stack a softmax after it.