Binary classification for single class

I want to detect a cat image. Rest all images are i am treating as a non-cat. Do i need to treat this as a two class problem(should i use two nodes at the end?)? Can I use only one node at the end and after model trained, use threshold to differentiate two whether image is cat or non-cat?


To classify a cat, one node at the end of your model is enough, because 0 can represent non-cat and 1 for cats. To achieve this, you can add a Sigmoid layer at the end of your model, which will work as you explained about using the threshold for classification.

Hi Nikronik,

If I use single layer, I should depend upon threshold. Threshold tuning will consume lot of time.

The difference between 2-node and 1-node has no “trainable” parameters. So to suggest that you’ll need to spend more time in the 1-node case tuning doesn’t really make sense.

With 2-nodes at the end, you can think of getting 2 sigmoid-ed scores, and what you do with those is up to you. A popular way is softmax of course, but if you have precision/recall constraints it seems to me you’re going to end up doing tuning either choice of architecture.