Skip to content

Couldn't Convert Logits to Probabilities #2

@agnonchik

Description

@agnonchik

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions