Classification in Action
Interact with sample code to explore gradient descent in action.
We'll cover the following...
We'll cover the following...
Final binary classifier
Here’s our final binary classification code:
- Load the pizza data file
- Learn from it
- Come up with a bunch of classifications
As we move from linear regression to classification, most functions in our program have to change. We have a brand-new sigmoid() function. The old predict() split into two separate functions: forward(), which is used during training, and classify(), which is used for classification.
We also change the formula that we use to calculate the loss and its gradient: instead of the mean squared error, we use the log loss. As a result, we have brand-new implementations for loss() and gradient().
We also write a new test() function that prints the percentage of correct classifications. The instruction ...