When a model calculates a score, it still needs a rule for turning that score into an output. An activation function performs that transformation. In a perceptron, the step function returns 1 when the score is nonnegative and 0 when it is negative: step(x) = 1 if x ≥ 0, otherwise 0. Thus, ŷ = step(ax₁ + bx₂ + c) converts a weighted score into a prediction. section 5.1
Common activation functions shape model outputs in different ways:
- The step function makes a hard binary decision. section 5.1
- The sigmoid function maps any real number to a value between 0 and 1, supporting soft assignments such as a 60% or 95% happiness score. section 6.0
- Sigmoid, hyperbolic tangent, softmax, and ReLU are used in neural networks; activation functions between layers break linearity and enable more complex boundaries. section 10.6
- ReLU sends negative numbers to 0 and leaves nonnegative numbers unchanged, helping reduce the vanishing-gradient problem during training. section 10.6
Classifying an alien's mood
Represent a sentence by counting words such as “aack” and “beep.” A perceptron computes a score from those counts, weights, and a bias. Applying the step function labels the sentence happy when the score is at least zero and sad otherwise. A logistic classifier replaces this abrupt decision with a score between 0 and 1, allowing sentences to be compared by how happy they appear. section 5.1 section 6.0
Figure 5.8 The step function is useful in the study of perceptron models. The output of the step function is 0 when the input is negative and 1 otherwise.
Use the graph to see how the step function jumps from 0 for negative inputs to 1 for nonnegative inputs. section 5.1













