1
$\begingroup$

I'm working on CNN model and I used one hot vector type of labels. The number of classes is 3: [1,0,0], [0,1,0], [0,0,1].

net(x)

I'm getting such an output: [0.8439, 0.1355, 0.0757], which is obviously 1st class. The question: why a sum of values in this vector exceeds 1? Also, I got earlier even one negative value of those 3. On what it is depending and how to know what these "outputs" could be.

$\endgroup$
0
$\begingroup$

Here it's a mistake to one-hot-encode the class, because it turns the task into multi-label classification instead of regular multi-class classification. In your task an instance can only have a single class, so the class should be encoded as an int (for example with LabelEncoder).

This is why the predicted probabilities don't sum to 1, because in multi-label classification the classes are independent of each other. For example the output [0.9,0.4,0.7] means that class 1 label is predicted true at 90% and false at 10%, class 2 label is predicted true at 40% and false at 60%, class 3 label is predicted true at 70% and false at 30%. It wouldn't make sense to pick the maximum probability of the 3 classes in this scenario.

See also this answer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.