A sigmoid is an activation function that squashes any input into an S-shaped curve between 0 and 1. Think of it as a dial: changing the input changes the output smoothly, rather than flipping it straight from off to on. That makes the output useful when a neural network predicts a probability. section 9.2
Figure 9.7 The sigmoid function
The curve shows both the smooth middle and the nearly flat ends. section 9.2
From inputs to a collision prediction
In a collision-prediction network, each hidden node first adds its weighted inputs, then applies sigmoid to that sum. The output node repeats the weighted-sum-and-sigmoid process using the hidden nodes’ results. One resulting prediction is 0.00214, interpreted as a 0.214% chance of collision. section 9.4
Sigmoid also helps a network learn nonlinear relationships. Its drawback is at the extremes: the curve becomes almost flat, so its slope approaches zero and learning can slow or stop. This is the vanishing-gradient problem. A step function gives an exact 0 or 1 instead, while other activation functions offer different learning behavior. section 9.10 section 9.2
def sigmoid(x): return 1 / (1 + np.exp(-x)) def sigmoid_derivative(x): return sigmoid(x) * (1 - sigmoid(x)) #A
The short NumPy listing implements sigmoid and the derivative used when backpropagation adjusts weights. section 9.9















