A sigmoid is a smooth S-shaped curve that turns an ordinary input into a value between 0 and 1. It is useful when the outcome is binary—yes or no, true or false—but the question is really “how likely?” Rather than draw an awkward straight line through 0s and 1s, the curve rises from near 0, climbs fastest around its middle, and then levels off near 1. section 8.2 section 8.3
A meltdown probability curve
Suppose x is hours since a toddler’s nap and y is the probability of a meltdown. Early on, the probability is low. As time without a nap grows, it rises; around an inflection point, the curve changes from speeding up to leveling off. At a chosen threshold, often 0.5, a probability can become a yes/no prediction—but a prediction is still not guaranteed to be right. section 8.2
The logistic function is one common sigmoid: 1 / (1 + e^−(β₀ + β₁x)). Here, x is the input, e is approximately 2.71828, and β₀ and β₁ are intercept and slope values. Those coefficients control where the curve sits and how it changes. Fitting logistic regression means finding coefficients for a curve likely to produce the observed binary data, rather than using least squares. section 8.3
import numpy as np
import matplotlib.pyplot as plt
def logistic(x, b0, b1): #1
return 1.0 / (1.0 + np.exp(-(b0 + b1*x))) #1
b0 = -7.0587 #2
b1 = 2.2047 #2
x = np.linspace(0,7,num=1000) #3
y = logistic(x, b0, b1) #4
plt.plot(x, y, color='blue') #5
plt.show() #5
This short function makes the curve concrete: change β₀, β₁, or the range of x values, then plot the resulting probabilities. section 8.3
An S-curve can also describe progress, not just probabilities. Adding data, labor, and computing may bring large early gains in a model’s capability, followed by an inflection point and diminishing returns. A tightly defined operating domain can help the curve approach the desired coverage; an overly broad one may level off far below it. section 9.10















