Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't Convert Logits to Probabilities #2

Open
agnonchik opened this issue Sep 28, 2018 · 2 comments
Open

Couldn't Convert Logits to Probabilities #2

agnonchik opened this issue Sep 28, 2018 · 2 comments

Comments

@agnonchik
Copy link

Hi Jiangzy,

Can you help me to convert output of your model to probability? For example, after three epochs, I've got zero loss for a test mini-batch:

Ground truth:
Variable containing:
0 0 1 0 0
1 0 0 0 0
0 0 0 0 1
0 0 1 0 0
[torch.cuda.LongTensor of size 4x5 (GPU 0)]

MultiLabelNN output:
Variable containing:
1.5470 1.2482 -1.0002 -0.9878 -0.9223
1.1135 0.9233 -0.7197 -0.7006 -0.6467
1.9094 1.5543 -1.2340 -1.1795 -1.0985
1.2281 1.0065 -0.8014 -0.7568 -0.7007
[torch.cuda.FloatTensor of size 4x5 (GPU 0)]

Testing Phase: Epoch: [124][ 2/ 3] Iteration Loss: 0.000000e+00

How can I convert "1.5470 1.2482 -1.0002 -0.9878 -0.9223" to probabilities???

If I apply Softmax to the NN output, I will get "0.4000 0.3517 0.0826 0.0829 0.0829" for the first row which is not consistent with the corresponding ground truth "0 0 1 0 0".
Nevertheless, the loss is zero! Why? I cannot understand this.
For the given ground truth "0 0 1 0 0", I expect maximum probability to be at the third (not at the first) position of Softmax output vector. Am I wrong?

So, my question is how to make predictions out of NN output (e.g. "1.5470 1.2482 -1.0002 -0.9878 -0.9223)?

Please help.
Val.

@agnonchik
Copy link
Author

I have solved the problem by converting hot vectors to indices.

@steveyi168
Copy link

I have solved the problem by converting hot vectors to indices.

HI, agnonchik

how to convert? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants