Logit Function

Home Glossary Item Logit Function
« Back to Glossary Index

The logit function is a mathematical transformation that maps a probability value from the interval (0, 1) to the entire real number line, effectively converting probabilities into log-odds. It serves as the inverse of the sigmoid function and is a fundamental component in statistical modeling and machine learning, particularly within logistic regression and neural networks, where it bridges linear predictors and probabilistic outcomes.

How it works

The logit function operates by taking a probability value, typically denoted as p, and calculating the logarithm of its odds. The odds are defined as the ratio of the probability of an event occurring to the probability of it not occurring, expressed as p / (1 - p). The logit function then applies the natural logarithm to this ratio. Mathematically, this is expressed as logit(p) = ln(p / (1 - p)). This transformation allows probabilities, which are bounded between 0 and 1, to be represented as unbounded real numbers, facilitating their use in linear equations.

In the context of logistic regression, the logit function is used to model the relationship between a set of predictor variables and a binary outcome. The linear combination of the input features and their corresponding weights is passed through the logit function (or rather, the logit function is applied to the resulting probability, meaning the linear combination represents the log-odds). This allows the model to express the log-odds of the outcome as a linear function of the inputs. The inverse process, applying the sigmoid function to the linear combination, yields a probability value that can be interpreted as the likelihood of the positive class.

The S-shaped curve of the sigmoid function, which is the inverse of the logit, allows the model to accommodate non-linear relationships between the predictors and the predicted event. While the underlying relationship between features and log-odds is linear, the relationship between features and the probability is non-linear. The logit function provides the mathematical foundation for this mapping, ensuring that the output remains a valid probability while allowing the model to capture complex patterns in the data. This transformation is crucial for interpreting the coefficients in logistic regression, as they represent the change in log-odds for a one-unit change in the predictor variable.

Where it is used

The logit function is primarily used in binary classification tasks where the goal is to predict the probability of an instance belonging to one of two classes. It is the core link function in logistic regression, a widely used statistical method for modeling binary outcomes. In these models, the logit function transforms the linear combination of input features into a probability, which can then be thresholded to make a classification decision. This approach is common in fields such as healthcare, where models predict the likelihood of a patient having a specific disease based on symptoms, and in finance, where models assess the probability of credit default.

Beyond logistic regression, the logit function is integral to the activation mechanisms in neural networks, particularly in the output layers of models designed for binary classification. It ensures that the network’s output is constrained to a valid probability range, enabling the use of loss functions like binary cross-entropy, which measures the difference between the predicted probabilities and the actual binary labels. The function is also used in other statistical models that involve probability estimation, such as probit models (though these use a different link function) and various generalized linear models where the response variable is binary or proportion-based.

The technique is applicable in any setting where a continuous score or linear combination of features needs to be converted into a probabilistic interpretation. This includes ranking systems, where the logit function might be used to convert a relevance score into a probability of relevance, and in decision-making processes where uncertainty quantification is required. The ability to map unbounded real values to bounded probabilities makes the logit function versatile in scenarios where the underlying data generating process is not purely linear but needs to be modeled within a probabilistic framework.

Limitations and trade-offs

One limitation of the logit function is its sensitivity to outliers, particularly in the context of logistic regression. Since the function maps probabilities to the entire real number line, extreme values in the input features can lead to very large log-odds, potentially causing the predicted probabilities to approach 0 or 1 too quickly. This can result in overconfident predictions if the model is not properly regularized. Additionally, the assumption of linearity between the predictors and the log-odds may not always hold, requiring feature engineering or the use of polynomial terms to capture non-linear relationships effectively.

Another trade-off is the interpretability of the model coefficients. While the logit function provides a clear mathematical link between linear predictors and probabilities, the coefficients represent changes in log-odds rather than direct changes in probability. This can make it slightly more difficult to interpret the practical impact of a feature on the outcome compared to linear regression, where coefficients represent direct changes in the response variable. Furthermore, the logit function assumes that the odds are non-zero and finite, which means that probabilities of exactly 0 or 1 are not directly supported without modification, as the logit of 0 or 1 is undefined (approaching negative or positive infinity, respectively).

Related terms

  • Activation Function – The logit function is a specific type of activation function, often used in the output layer of neural networks for binary classification.
  • Logistic Regression – The logit function serves as the link function in logistic regression, connecting the linear predictor to the probability of the binary outcome.
  • Loss Function – The logit function is closely associated with loss functions like binary cross-entropy, which measure the error between predicted probabilities and actual labels.
  • Neural Network – Neural networks often use the logit function (or its inverse, the sigmoid) to produce probabilistic outputs for classification tasks.
  • Statistical Distribution – The logit function is used to model probabilities derived from distributions, such as the Bernoulli distribution, in generalized linear models.
« Back to Glossary Index
Eugene Serbin

Systems Analyst and AI Engineer, Semalt

Eugene Serbin is a systems analyst and AI engineer at Semalt. He graduated with honours from Kharkiv National University of Radio Electronics in 2005, specialising in intelligent decision-making systems, and holds a second degree from the same university in economic cybernetics. He writes and edits the AI research summaries, applied machine learning explainers and the glossary on ai-magazine.com.