March 2020
Beginner to intermediate
342 pages
8h 38m
English
It’s time to reach for our binary classification code (from Classification in Action), and run it on MNIST. We do have to adapt it a bit, but the changes are minimal. Indeed, we can use the exact same functions that we used in the previous chapter, as long as we update the main code:
| | import mnist as data |
| | w = train(data.X_train, data.Y_train, iterations=100, lr=1e-5) |
| | test(data.X_test, data.Y_test, w) |
One line for training, one for testing. We don’t need to load and prepare the data, because our MNIST library library already takes care of that.
And here’s the output of our first image classifier:
| | Iteration 0 => Loss: 0.69314718055994528623 |
| | Iteration 1 => Loss: 0.80042530259490185518 |
| | Iteration ... |
Read now
Unlock full access