A sigmoid calculator evaluates the S-shaped logistic function f(x) = L ÷ (1 + e^(−k(x − x₀))) and its slope, and it also finds x from a given value, which is the logit. With the default settings you get the standard sigmoid σ(x) = 1 ÷ (1 + e⁻ˣ) used in statistics and machine learning. Enter x, and change the maximum L, the steepness k or the midpoint x₀ if you need to. It runs in your browser.
How to use the sigmoid calculator
- Choose Find the sigmoid value at x or Find x from a value.
- Enter x, or the value y.
- Change L, k and x₀ if you need something other than the standard curve.
- Press Calculate.
The logistic function
The Wikipedia article on the logistic function gives the general form f(x) = L ÷ (1 + e^(−k(x − x₀))). Here L is the carrying capacity, the highest value of the function, k is the logistic growth rate, which sets the steepness, and x₀ is the x value of the midpoint.[1] As x goes to minus infinity the function goes to 0, and as x goes to plus infinity it goes to L.[1] The standard form, with L = 1, k = 1 and x₀ = 0, is f(x) = 1 ÷ (1 + e⁻ˣ), which the page says is sometimes simply called the sigmoid function and is also called the expit. When L = 1, the values lie between 0 and 1.[1]
What a sigmoid is
The article on sigmoid functions defines one as any mathematical function whose graph has a characteristic S-shaped curve. More exactly, it is a bounded, differentiable, real function that is defined for all real input values and has a positive derivative at each point.[2] Sigmoids most often return values in the range 0 to 1, and another commonly used range is from −1 to 1.[2] The logistic function is the best-known example, and the hyperbolic tangent is a shifted and scaled version of it.[2]
Useful properties
At x = 0 the standard sigmoid is 1/2. The page notes the symmetry 1 − f(x) = f(−x), the linear growth with a slope of 1/4 near 0, and that the function can be computed over a small range such as [−6, 6], because it is almost flat beyond that.[1] Its slope satisfies f′(x) = f(x)(1 − f(x)), the logistic differential equation, so the slope is largest, 0.25, at the midpoint, and it is tiny in the tails.[1] For the general form, the slope is k f (1 − f ÷ L). The calculator shows the slope along with the value. For x = 2, the standard sigmoid is 0.8808 and the slope is 0.1050.
The logit, the inverse
The page says that the logistic function is the inverse of the natural logit function, logit(p) = ln(p ÷ (1 − p)) for 0 < p < 1.[1] So if you know the value y, you can find x. For the standard curve, x = ln(y ÷ (1 − y)). In general, x = x₀ − ln(L ÷ y − 1) ÷ k. A value of 0.8808 gives x = 2. The value must be above 0 and below L, because the curve never reaches them. In statistics, the logit turns a probability into log-odds, which is the basis of logistic regression.
The tanh connection
The page gives the relation between the logistic function and the hyperbolic tangent: f(x) = 1/2 + (1/2) tanh(x ÷ 2), or equivalently tanh(x) = 2f(2x) − 1.[1] The calculator shows tanh(x) computed this way for the standard sigmoid. For x = 1, tanh(1) = 2σ(2) − 1 = 0.7616. The tanh curve has the same shape as the sigmoid, but it runs from −1 to 1.
Where sigmoids are used
The logistic curve models growth that starts slowly, speeds up and levels off at a limit, such as the spread of an idea or the size of a population in a limited habitat. In machine learning, the sigmoid turns a number into a probability and is used in logistic regression and in neural networks. With L = 100 you can model a percentage. With a larger k the curve is steeper, and with a different x₀ it is shifted along the x-axis. Try a few settings to see their effects.
Worked examples
With the defaults and x = 2, the value is 0.8808, the slope is 0.105, and the share of the maximum is 88 percent. With x = −2, the value is 0.1192, which equals 1 − 0.8808. With L = 100, k = 0.5 and x₀ = 10, the function describes a curve that rises to 100, with its midpoint at x = 10. At x = 10 the value is 50, and the slope is 0.5 × 50 × 0.5 = 12.5, which is the steepest point. At x = 20, the value is 99.3. Enter these numbers to see the effect of each setting.
Choosing the settings
If you want a curve that goes from 0 up to some limit, set L to that limit. If you want it to rise faster, make k bigger. If you know the midpoint, such as the time at which half of the growth has happened, put it in x₀. For a probability model, keep L at 1. A curve with a negative k falls instead of rising, from L down to 0, and it is the mirror image of the rising curve around the midpoint.
Common mistakes
- Using a positive exponent. The standard form has e to the power of minus x.
- Expecting the curve to reach 0 or 1. It gets close, but never gets there.
- Confusing the midpoint with the maximum. The midpoint, where f = L ÷ 2, is where the slope is the steepest.
- Taking the logit of 0 or 1. It is undefined.
What next
Use this often? Add Sigmoid to your Home screen.
Frequently asked questions
What is a sigmoid calculator?
A tool that evaluates the S-shaped logistic function and its slope for any x, and finds x from a value.
What is the sigmoid formula?
σ(x) = 1 ÷ (1 + e⁻ˣ). The general logistic function is L ÷ (1 + e^(−k(x − x₀))).
What is σ(0)?
One half, 0.5. The curve is symmetric, so σ(−x) = 1 − σ(x).
What is the derivative of the sigmoid?
σ′(x) = σ(x)(1 − σ(x)). It is largest at x = 0, where it equals 0.25.
What is the inverse of the sigmoid?
The logit, ln(p ÷ (1 − p)), defined for p between 0 and 1.
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.