March 2020
Beginner to intermediate
342 pages
8h 38m
English
Even though linear regression isn’t a natural fit for binary classification, that doesn’t mean that we have to scrap our linear regression code and start from scratch. Instead, we can adapt our existing algorithm to this new problem, using a technique that statisticians call logistic regression.
Let’s start by looking back at ŷ, the weighted sum of the inputs that we introduced in Adding More Dimensions:
| | ŷ = x1 * w1 + x2 * w2 + x3 * w3 + … |
In linear regression, ŷ could take any value. Binary classification, however, imposes a tight constraint: ŷ must not drop below 0, nor raise above 1. Here’s an idea: maybe we can find a function that wraps around the weighted sum, and constrains it to the range from 0 to 1—like ...