Solved – neural network output layer for binary classification

machine learningneural networks

I'm using a neural network for a binary classification problem. Is it better to have one neuron in the output layer or to use two, i.e. one for each class?

Best Answer

Assuming you are using a softmax activation, you can do it either way. With softmax you can treat one as implicit.

Personally, I prefer to explicitly represent one neuron per class. At least for me I find it easier to reason about what the results mean that way, and I don't have to change as much if I want to switch activation functions or problem types.

But in general, the issue is minor (or at the very least, I've never seen it make a big difference).