Errors in the Training Classifier
Learn to calculate an error in the training classifier and the relationship between our parameter A and the error E.
We'll cover the following
Calculate an error
Let’s look at the first training example: the width is and the length is for a ladybug. If we tested the function with this example, where is , we would get:
The function with the parameter , which is set to the randomly chosen value of , is suggesting that for a bug of width , the length should be . We know that’s too small because the training data example tells us it must be a length of . So, we have a difference, which indicates an error. Like before, with the miles to kilometers predictor, we can use this error to inform how we adjust the parameter .
But before we do that, let’s think about what should be again. If is , then the line goes right through the point where the ladybug sits at . It’s a subtle distinction, but we don’t actually want that. We want the line to go above that point. Why? Because we want all the ladybug points to be below the line, not on it. The line needs to be a divider between ladybugs and caterpillars, not a predictor of a bug’s length given its width.
So, let’s try to aim for when . It’s just incrementally above . We could’ve chosen or even , but we don’t want a larger number like or because that would make it more likely that the line will go above both the ladybugs and caterpillars data points, resulting in a separator that isn’t useful at all. So the desired target is , and the error is:
which is,
Let’s pause and remind ourselves what the error, the desired target, and the calculated value mean visually.
Get hands-on with 1200+ tech skills courses.