After training Logistic regression on training data, getting each test sample to algorithm computes weighted sum of sample features. If this is greater than zero, we know the sample is from negative class and otherwise, sample is positive. I want to know why we need to calculate the logistic function that map our weighted sum to range zero and one. One reason can be that we want to interpret the results as probability. are there any other reasons?
$\begingroup$ You also need to be able to compute the error gradient during optimization. If you only used the function's argument, you would not be able to compare it with the ground truth (0 or 1). $\endgroup$– EmreJan 5, 2018 at 18:49
Because it makes the network learn the desired output (usually 1 or 0) much easier. It is possible to omit the logistic function (aka sigmoid function) and achieve desired results, but the network has to learn to specifically map each input to one or zero which is hard when it has the ability to map it to any real number. The logistic function makes it easier because the network just has to learn to map it to a positive or negative number.
Now the network can map an input to -6 if it wanted to and still produce the desired output -1, whereas before it has to output specifically -1.
Also, @Media logistic regression doesn't need a non-linearity for this purpose. It will still only be able to separate the data in a linear fashion.
Logistic and other activation functions are used to add non linearity to the neural network models. In logistic model which uses just one neuron it may have a nice interpretation. To interpret what it does other than probability of belonging to each class, its sign shows whether your input data is on the left of the decision boundary or on the right of that. Also, if it has great value, it shows more confidence of belonging to that class.