Add a bias to a linear score
Preserve the order of coordinates and the signs of values. · 174 words
A linear score is a dot product: multiply each feature by its matching weight, then add. A bias b is an extra constant, so s = w dot x + b. It supplies a baseline. For example, a museum app suggests a members-only tour. Let x = [is_member, visited_before], w = [2, 1], and b = -2. A returning member scores 2(1) + 1(1) - 2 = 1. A new visitor scores 2(0) + 1(0) - 2 = -2. At cutoff 0, the first passes and the second fails.
A bias shifts every score equally. A weight controls one feature's contribution. Consider a library model with x = [is_new, is_long], w = [1, 2], and b = -2. A new, long book scores 1(1) + 2(1) - 2 = 1 and passes cutoff 0. A new, short book scores 1(1) + 2(0) - 2 = -1 and fails. If b becomes 0, their scores become 2 and 1, so both pass. The bias moves the whole decision boundary, while weights set relative feature effects.
Check your recall
For x = [0, 1], w = [2, 1], and b = -2, what is the score, and does it pass a cutoff of 0?
Check your answer
The score is 2(0) + 1(1) - 2 = -1. It does not pass the cutoff of 0.
Sources and credits
Original KeyTouch lesson. Background reading · Zhang et al. · Linear Algebra.