Skip to main content

Are you on the right long-term path? Get a full financial assessment

Get a full financial assessment
← Back to S Definitions

Sigmoid function

The sigmoid function is a mathematical function characterized by its distinctive "S"-shaped curve. In the realm of [Quantitative Finance], it plays a crucial role in various modeling and analytical tasks, particularly where a smooth transition between two states or probabilities is required. The sigmoid function transforms any real-valued number into a value between 0 and 1, making it highly useful for expressing probabilities or activation levels in financial and machine learning models.66 This function's unique shape allows it to represent non-linear relationships, which are prevalent in complex financial systems.

History and Origin

The concept behind the sigmoid function, specifically the logistic function, was initially introduced in the 19th century by the Belgian mathematician Pierre François Verhulst. Between 1838 and 1847, Verhulst developed this function to model self-limiting population growth, adjusting the traditional exponential growth model to account for environmental constraints. 64, 65His work sought to better reflect real-world population dynamics where growth eventually stabilizes rather than expanding indefinitely.
63
While its origins lie in demography, the sigmoid function found a pivotal application much later with the advent of artificial neural networks in the 1970s and 1980s. 60, 61, 62Researchers like Hugh Wilson and Jack Cowan, attempting to computationally model biological neurons, utilized the logistic sigmoid function to represent neuron activation. 58, 59This marked a significant moment, as its smooth, differentiable nature allowed for the effective training of these early [neural networks] using backpropagation algorithms, cementing its importance in the emerging field of [machine learning].
55, 56, 57

Key Takeaways

  • The sigmoid function, also known as the logistic function, produces an S-shaped curve and maps any real number to a value between 0 and 1.
    54* It is commonly used in quantitative finance and machine learning, especially for problems involving [probability] or binary outcomes.
    52, 53* Its differentiable nature is crucial for optimization algorithms like gradient descent used in training machine learning models.
    51* Despite its advantages, the sigmoid function is prone to the "vanishing gradient problem" in deep neural networks, which can slow down or halt the learning process.
    48, 49, 50* It is a foundational [activation function] in early neural network architectures and remains relevant in specific applications like the output layer of [logistic regression] models.
    46, 47

Formula and Calculation

The standard sigmoid function, often denoted as (\sigma(x)), is mathematically defined by the formula:

S(x)=11+exS(x) = \frac{1}{1 + e^{-x}}

Where:

  • ( S(x) ) represents the output of the sigmoid function, a value between 0 and 1.
  • ( e ) is Euler's number, the base of the natural logarithm, approximately 2.71828.
  • ( x ) is the input to the function, which can be any real number. In financial or machine learning contexts, ( x ) often represents a linear combination of input features and their corresponding [weights].

This formula transforms (x) into a probability-like output. As (x) approaches positive infinity, ( S(x) ) approaches 1. As (x) approaches negative infinity, ( S(x) ) approaches 0. When (x = 0), ( S(x) = 0.5 ).

Interpreting the Sigmoid Function

The sigmoid function's output is particularly useful because it can be directly interpreted as a [probability]. For instance, in a model predicting a binary outcome, such as whether a loan applicant will default, the sigmoid's output can represent the likelihood of default, ranging from 0% to 100%.
44, 45
Its S-shaped curve implies a non-linear relationship where small changes in input around the midpoint of the curve lead to significant changes in output, while changes at the extremes (very high or very low inputs) result in much smaller changes in output. This characteristic makes it suitable for modeling phenomena that exhibit saturation or limits, such as the adoption rate of a new financial product or the probability of a rare event. The ability to smoothly transition between values makes it a valuable tool for [data analysis] and [predictive analytics] in finance.

Hypothetical Example

Consider a simplified [credit scoring] model designed to predict the probability of a loan applicant defaulting. Let's say the model takes a composite score (based on factors like credit history, income, and existing debt) as its input, (x).

If an applicant has a composite score (x = 0), the sigmoid function would output:
S(0)=11+e0=11+1=12=0.5S(0) = \frac{1}{1 + e^{-0}} = \frac{1}{1 + 1} = \frac{1}{2} = 0.5
This indicates a 50% probability of default.

If an applicant has a very strong profile, resulting in a high positive score, for example, (x = 5):
S(5)=11+e511+0.00670.9933S(5) = \frac{1}{1 + e^{-5}} \approx \frac{1}{1 + 0.0067} \approx 0.9933
This suggests a very high probability (99.33%) of not defaulting (or 0.67% probability of default, if the score is inverted or interpreted as likelihood of success).

Conversely, if an applicant has a very weak profile, leading to a large negative score, for example, (x = -5):
S(5)=11+e(5)=11+e511+148.410.0067S(-5) = \frac{1}{1 + e^{-(-5)}} = \frac{1}{1 + e^{5}} \approx \frac{1}{1 + 148.41} \approx 0.0067
This indicates a very low probability (0.67%) of not defaulting (or 99.33% probability of default).

This example illustrates how the sigmoid function transforms a raw score into an interpretable [probability] that can inform [decision making] regarding loan approvals.

Practical Applications

The sigmoid function finds diverse applications in [Quantitative Finance] and related fields:

  • [Logistic regression]: It is the core of logistic regression models, where it transforms the linear combination of input features into a [probability] score for binary classification tasks, such as predicting loan default, stock price movement (up/down), or whether a transaction is fraudulent.
    41, 42, 43* [Neural networks]: Historically, sigmoid functions were widely used as [activation function]s in artificial neural networks, especially in the output layer for binary classification, to squish outputs into a probability range.
    38, 39, 40* [Risk assessment]: In financial [risk assessment], sigmoid functions can model the probability of various adverse events, from corporate bankruptcies to market downturns, converting risk scores into likelihoods.
  • [Financial forecasting]: While not for direct numerical prediction, sigmoid-based models can forecast the probability of certain economic conditions or market states occurring.
  • Credit Scoring: The sigmoid function can be applied to transform credit scores, which are often unbounded, into a bounded probability of default, which is easier to interpret and use for [credit scoring] and [decision making]. Financial institutions use [machine learning] models for various purposes, but caution is advised in their deployment.
    37

Limitations and Criticisms

Despite its utility, the sigmoid function has notable limitations, particularly in the context of deep [neural networks]:

  • Vanishing Gradient Problem: This is the most significant drawback. For very large positive or very large negative inputs, the sigmoid function's gradient (or derivative) becomes extremely small, approaching zero. 33, 34, 35, 36During the backpropagation phase of training deep neural networks, these small gradients are multiplied across many layers, causing the gradients in earlier layers to "vanish" to near zero. 31, 32This effectively prevents the [weights] in those early layers from updating, hindering the [machine learning] model's ability to learn complex patterns and slowing down or even halting the training process.
    29, 30* Non-Zero-Centered Output: The output of the sigmoid function is always positive, ranging from 0 to 1. This means that the outputs of neurons are not centered around zero. 26, 27, 28This can lead to less efficient gradient updates during training, potentially causing a "zig-zagging" effect in the optimization path, which slows down convergence.
    25* Computational Expense: The exponential operation within the sigmoid formula can be computationally more intensive compared to simpler activation functions. 23, 24This can be a concern for very large-scale [deep learning] models.

Due to these limitations, especially the vanishing gradient problem, modern [deep learning] architectures often prefer alternative [activation function]s like the [Rectified Linear Unit] (ReLU) and its variants, which do not suffer from saturation in the positive region.
20, 21, 22

Sigmoid function vs. Rectified Linear Unit (ReLU)

The sigmoid function and the [Rectified Linear Unit] (ReLU) are both types of [activation function]s used in [neural networks], but they have distinct characteristics and applications.

FeatureSigmoid Function (( S(x) = \frac{1}{1 + e^{-x}} ))Rectified Linear Unit (ReLU) (( f(x) = \max(0, x) ))
Output Range(0, 1)[0, (\infty))
ShapeSmooth S-shaped curvePiecewise linear with a hard "bend" at 0
DifferentiabilityContinuously differentiable across its domainNot differentiable at (x=0) (though practically handled)
Vanishing GradientProne to vanishing gradients for very large positive or negative inputs due to saturation. 18, 19Solves vanishing gradient for positive inputs (gradient is 1), but can suffer from "dying ReLU" (zero gradient for negative inputs). 16, 17
Zero-CenteredNo (outputs are always positive) 14, 15No (outputs are always non-negative) 13
Computational CostRelatively more expensive due to exponential operation 11, 12Very computationally efficient (simple max operation) 10
Primary UseOutput layer for binary classification (probabilities), historical hidden layer use. 9Hidden layers of deep neural networks, widely preferred over sigmoid for most tasks. 8

While the sigmoid function excels at mapping values to a probability range and was foundational for early neural networks and [logistic regression], its saturation issues make ReLU a more common choice for hidden layers in deep learning today. The choice between them often depends on the specific architecture and problem.

FAQs

What is the main purpose of a sigmoid function?

The main purpose of a sigmoid function is to transform any real-valued input into a value between 0 and 1. This makes it ideal for representing [probability] or for use as an [activation function] in models like [logistic regression] and [neural networks], enabling them to learn non-linear patterns and make classification decisions.
6, 7

Is the sigmoid function always used in machine learning?

No, the sigmoid function is not always used in machine learning. While it was historically a popular choice, especially in the output layer for binary classification or in earlier [neural networks], modern deep learning often favors other [activation function]s like the [Rectified Linear Unit] (ReLU) due to the sigmoid's susceptibility to the vanishing gradient problem, which can hinder the training of deep models.
4, 5

How does a sigmoid function relate to probability?

A sigmoid function relates to [probability] by "squashing" any input value (which can be a linear combination of features) into an output range of (0, 1). This output can then be directly interpreted as the probability of a certain event occurring, especially in binary classification tasks where there are only two possible outcomes.
2, 3

Can the sigmoid function output exactly 0 or 1?

No, the sigmoid function cannot output exactly 0 or 1. Its output values asymptotically approach 0 as the input approaches negative infinity and asymptotically approach 1 as the input approaches positive infinity, but they never actually reach these extreme values. The output is always strictly between 0 and 1.1

AI Financial Advisor

Get personalized investment advice

  • AI-powered portfolio analysis
  • Smart rebalancing recommendations
  • Risk assessment & management
  • Tax-efficient strategies

Used by 30,000+ investors