Skip to Main Content
Programming Machine Learning
book

Programming Machine Learning

by Paolo Perrotta
March 2020
Beginner to intermediate content levelBeginner to intermediate
342 pages
8h 38m
English
Pragmatic Bookshelf
Content preview from Programming Machine Learning

Our Own MNIST Library

Let’s recap where we are and where we want to go. In the previous chapters, we built a binary classifier. Now we want to apply that program to MNIST.

As a first step, we need to reshape MNIST’s images and labels into an input for our program. Let’s see how to do that.

Preparing the Input Matrices

Our binary classifier program expects its input formatted as two matrices: a set of examples X, and a set of labels Y. Let’s start with the matrix of examples X.

X is supposed to have one line per example and one column per input variable, plus a bias column full of 1s. (Remember the bias column? We talked about it in Bye Bye, Bias.)

To fit MNIST’s images to this format, we can reshape each image to a single line of pixels, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Machine Learning Algorithms - Second Edition

Mastering Machine Learning Algorithms - Second Edition

Giuseppe Bonaccorso
Practical Machine Learning for Computer Vision

Practical Machine Learning for Computer Vision

Valliappa Lakshmanan, Martin Görner, Ryan Gillard

Publisher Resources

ISBN: 9781680507706Errata Page