There is a related question here how to convert logits to probability in binary classification in tensorflow?
However, this question is asking something different. We often see people use tf.nn.sigmoid(logit) > 0.5
to predict positive class (i.e., 1). Is the sigmoid
calculation wasting computation if we only need to predict (for training, of course, we need sigmoid
in loss function)?
When logit > 0
, then we always have tf.nn.sigmoid(logit) > 0.5
. Thus, only by checking the sign of logit, we know whether it is positive or negative class.
The decision threshold is always 0.5 for testing dataset, right?