# What is the role of logistic function in logistic regression?

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?

• 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). – Emre Jan 5 '18 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. 