Understanding neural network probability

I'm training a CNN model with two classes to predict. I know it gives me a probability for one class and for the other one, and I also know I can get the predicted label, but I don't the results given. Isn't the sum of the output for each evaluated input supposed to be equal 1.0? For instance:

[[0.2858745  0.85059494]
[0.2858745  0.85059494]
[0.6040499  0.5927084 ]
[0.8403308  0.291448  ]
[0.04195209 0.95504093]
[0.79433376 0.21279709]
[0.79433376 0.21279709]
[0.01326967 0.9891382 ]
[0.0153821  0.9867737 ]
[0.79433376 0.21279709]
[0.01617167 0.98520505]
[0.01351487 0.98596036]
[0.01473185 0.9846144 ]
[0.00896762 0.9899838 ]
[0.00936404 0.9893628 ]]


Is there something I didn't get?

Code:

model_05_01 = Sequential()
input_shape=(x_train.shape[1], 1)))

metrics=['accuracy'])

• What framework are you using? What's the architecture of your network (esp. the last layer)? – Ben Reiniger May 12 '20 at 21:30
• Tensorflow. 3 Conv1D layers, + 2 Dense layers, the last one is model.add(Dense(2, activation='sigmoid')) – Tiago Minuzzi May 12 '20 at 22:21
• Edit the post with the code. – Tiago Minuzzi May 12 '20 at 23:35

What you have declared here is actually a 2-class multi-label classifier. It is trying to learn the probability of being each class independently where they are not mutually exclusive.

While that is a valid classifier problem to solve, I'm guessing what you mean is that you have an exclusive 2-class problem: it's either positive, or negative. In that case, you want the final layer to be Dense(1, activation='sigmoid')