Bye Bye, Bias
So far, we implemented this prediction formula:
| ŷ = x1 * w1 + x2 * w2 + x3 * w3 |
Now we want to add the bias back to the system, like this:
| ŷ = x1 * w1 + x2 * w2 + x3 * w3 + b |
We could rush to the code and add the bias everywhere, like we had in the previous chapter—but hold on a minute. I can teach you a trick to roll the bias into the code more smoothly.
Give another look at the previous formula. What’s the difference between the bias and the weights? The only difference is this: the weights are multiplied by some input variable x, and the bias is not. Now imagine that there is one more input variable in the system (let’s call it x0) that always has a value of 1. We can rewrite the formula like this:
| ŷ = x1 * w1 + x2 * w2 + ... |
Get Programming Machine Learning now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.