Logistic regression is a machine learning algorithm for the classification and predicts the categorical variable through a logistic function. The logistic regression model passes the outcome of a linear function of features through a logistic function to calculate the probability of an occurrence. The model then maps the probability to binary outcomes.

The logistic function in linear regression is a type of sigmoid, a class of functions with the same specific properties. Sigmoid is a mathematical function that takes any real number and maps it to a probability between 1 and 0.

The sigmoid function is also called a logistic function.

It acts as an activation function in machine learning which is used to add non-linearity in a machine learning model, in simple words it decides which value to pass as output and what not to pass.

Sigmoid function in logistic regression is an advanced regression technique that can solve various classification problems. Being a classification model, it is termed “regression” because the fundamental techniques are similar to linear regression.

Binary classification problems like a tumour are malignant or not, an email is spam or not and multiclass classification problems like classifying a random fruit like an apple, mango or orange can be solved using logistic regression.

The formula of the sigmoid function is:

The sigmoid function forms an *S-shaped* graph, which means as x approaches infinity, the probability becomes 1, and as x approaches negative infinity, the probability becomes 0. The model sets a threshold that decides what range of probability is mapped to which binary variable.

Suppose we have two possible outcomes, *true* and *false*, and have set the threshold as *0.5*. A probability less than *0.5* would be mapped to the outcome *false*, and a probability greater than or equal to *0.5*would be mapped to the outcome *true*