Getting probability score

I need to have probability score for each testing sample. What changes I should make in following code to get those probability score for each sample

eta = nn.functional.softmax(logits,-1)

this gives you probability of each class given sample x (P(i|x)).

this gives you probability of each class for each sample.
can you give me an example of what you want

it should work.


for imageName,realLabel,actualLabel,logitValue in zip(tested_file_name,real_label,actual_pred,logits):


for imageName,realLabel,actualLabel,logitValue in zip(tested_file_name,real_label,actual_pred,eta):

some where in your for loop print it.

something is off
how many class do you have ?
what is you batch size??

eta should be NxC and eta.sum(-1) = 1

I have 9 classes and the total batch size is 16

can you give me eta shape.
and what you’re printing in for loop

eta.size is 9*9

Output of above print in for is above I have attached in previous commnets

in for loop you should print logitValue not eta itself.
but still something is off,
you should have eta shape as 16x9??
also all of tested_file_name,real_label,actual_pred,logits should have 16 element or have 16 row (if they’re matrices).

okay, i have printed logitvalue

it’s better now.
i think you can report predicted label probability as confidence.
in your example >>>> 0.1517

hey thanks @mMagmer.