I have a neural network that gives out a continuous value as output and I need to classify it as class 0 or 1. I am currently using a sigmoid on this continuous output value but after sigmoid the values for both class 0 and 1 are greater than 0.5. So when I put the condition:
if sigmoid_output > 0.5:
assigned_class = 1
else:
assigned_class = 0
then all are assigned the same class but when I change this threshold of 0.5 to 0.5055 after manual review on the threshold, I get a better distribution of output in class 0 and 1. So I was wondering if there is any optimal way to determine this threshold value. I was thinking on the lines of logistic regression, as sigmoid is a special case of logistic regression but could not infer anything on my own.