A step function turns a score into a simple decision: it returns 1 when the input is at least zero and 0 when the input is negative. In a perceptron, applying it to the score produces the prediction. section 5.8
From score to prediction
If a perceptron gives a sentence a score of 2.4, the step function returns 1; if the score is −0.7, it returns 0. This supports labels such as happy = 1 and sad = 0. section 5.8
def step(x):
if x >= 0:
return 1
else:
return 0
def prediction(weights, bias, features):
return step(score(weights, bias, features)) #A
This small Python implementation checks the threshold and feeds the result into a perceptron prediction. section 5.19
The step function is a specific activation function. It works well for discrete perceptrons, but real neural networks avoid it because its sharp output prevents gradient descent; sigmoid and other activation functions are used instead. section 10.6 section 10.5


