Skip to main content
Colin Jaffe/3 min read

Neural Networks: Image Recognition to Handwritten Digits

This lesson is a preview from our Data Science & AI Certificate Online (includes software) and Python Certification Online (includes software & exam). Enroll in a course for detailed lessons, live instructor support, and project-based training.

In section five, we're going to start talking about neural networks. Neural networks are one of the most complex possible models and deal with the most complex of data.

In section five, we're going to start talking about neural networks. Neural networks are one of the most complex possible models and deal with the most complex of data. We're talking about image recognition, speech recognition, translation, chatbot conversations, even recommendation data—very complex interweaving of variables.

So it's not as well suited to things like the Titanic data, but it's really good for what we're going to use it for today, which is a classic example of neural network use: translating handwritten digits to actual numbers. And this is used quite a lot in the real-world to produce systems that scan zip codes—for example, handwritten zip codes at the post office—and be able to have with 99-plus percent accuracy what digit that is. That makes it much easier, rather than having people go through the millions of letters that the U.S. Postal Service receives every day and having somebody look at every single letter’s zip code and manually enter them.

So having something that can handle that complex a piece of data is incredibly powerful. So what is a neural network? Let's talk just for a bit about that. You can compare a neural network to a brain.

And in fact, that's the idea. It's a neural network as in brain network. And it's inspired by the brain, for sure—by how the brain is structured.


It has different layers of what we call neurons, also called nodes, but neuron is more brainy, so we tend to use that word. And all of these layers work together to solve the problem. So you often have an input layer where the data goes into the network, an output layer where it produces a result—like, is this a two? Is this a five?—and in between, what are called the hidden layers, because we don't really see those.

They are the layers in between that are able to do the calculations to produce, based on the input, the output. Now, neural networks are going to adjust weights in those hidden layers. It’s similar to the slope that we got with a linear regression, right? What number goes next to X to produce Y? Y = MX + B. What do we multiply X by? And ultimately, it’s producing those numbers on every single possible bit of input to try to recognize different parts of a handwritten number and figure out which parts of these are more or less important to identifying that number.

And that's how it trains. It tries different numbers, and it finds which ones produce the best result. One of the neat things about the way that TensorFlow—our neural network library—visualizes things is that we’ll actually see it learning as we go, which makes for a very neat visual and a very informative one.


We’ll be diving into neural networks as we go. We’ll also be using our TensorFlow and Keras machine learning libraries. The data we’ll be exploring will be the handwritten digits.

And we’ll be covering all of these: how to visualize data as a grayscale image, how to normalize data—not using StandardScaler, but just manually—and how to build, compile, and train a machine learning model, a neural network machine learning model, and just in general, how neural networks work. We’ll get into some issues with the data and how we can improve it. And we’ll do all this here in section five to bring this course to a close.

I’ll see you there.


RELATED ARTICLES