Sigmoid Function
Maps any real number to the range (0, 1); used in logistic regression.
Live Calculator
MembersVariables
Example
\sigma(0) = 0.5
How it works
The sigmoid function turns any real-valued input into a number between 0 and 1 by comparing e^{-x} against 1 in the denominator. Large positive inputs make e^{-x} very small, so the output gets close to 1; large negative inputs make e^{-x} very large, so the output gets close to 0. This smooth S-shaped curve is useful when you want to interpret a model output as a probability-like value.
When to use it
Use the sigmoid when you need a smooth output bounded between 0 and 1, especially in binary classification models such as logistic regression. It is also common in neural networks for outputs that represent probabilities or gates.
Worked example, step by step
Compute sigma(2) step by step: sigma(2) = 1 / (1 + e^{-2}) First, evaluate the exponent: e^{-2} 0.1353 Substitute: sigma(2) = 1 / (1 + 0.1353) Add the denominator: 1 + 0.1353 = 1.1353 Divide: 1 / 1.1353 0.8808 Final answer: sigma(2) 0.8808
Common mistakes to avoid
- Forgetting the negative sign in the exponent and using e^x instead of e^{-x}
- Thinking the sigmoid can output exactly 0 or 1, when it only approaches those values
- Confusing the input x with a probability instead of a real-valued score or logit
Did You Know?
The sigmoid was the classic neural-network activation before ReLU took over.
Share this formula
More in Data Science & ML
View allMean Squared Error (MSE)
BasicAverage of squared differences between predicted and actual values.
Root Mean Squared Error (RMSE)
BasicSquare root of MSE, in the same units as the target variable.
Mean Absolute Error (MAE)
BasicAverage of absolute differences between predictions and actual values.
Coefficient of Determination (R²)
IntermediateProportion of variance in the target explained by the model.
Classification Accuracy
BasicFraction of predictions that are correct.
Precision
IntermediateOf all positive predictions, the fraction that were correct.