SPEAKER 1: In the previous episodes in this series
we've been taking a journey to cut through the hype
and get down to the nitty gritty,
so that anybody, regardless of background
could understand a bit about how AI works.
In the last episode, we looked at artificial neurons
and how they're actually very simple mathematical functions
that can have their internal parameters fit, so that they
can give the desired output.
And this is a process that was called learning,
which gives rise to the term, "machine learning."
With just a single neuron, we saw
how we could fit numbers together
to figure out the equation of a line.
Now, that's useful, but it is limited.
So in this episode, we'll explore
how to take that to the next level with an exploration
into how neurons can be networked together
to learn more complex patterns.
And thus, unlock scenarios like computer vision
or natural language processing.
Now, the idea of a neural network
comes from understanding how your brain works.
Now, this shows a simulation of the brain.
And it's from a fun interactive site
that I've shared in the description below.
You can drag and drop neurons to form a network
and see how information moves along
in the network of your brain.
On the other hand, an artificial neural network
emulates this in a more primitive way.
Neurons are gathered into what we call layers,
as you can see here.
And each layer accepts inputs only from the previous layer
like this.
And then it only passes to neurons
in the next layer like this.
If each of these so-called neurons
is simply a mathematical function that
can learn parameters, then the network
can figure out the parameters for each layer
to get the desired outputs for a set of desired inputs.
Now, this means we have to think about how
we manage our data to format it into a way
that an artificial neural network can understand.
So for example, say we want to do a computer vision experiment
and see if we can create a neural network that understands
the difference between a cat and a dog,
the neural network will be designed to only understand
two things.
Whether an image is of a cat or whether it's of a dog.
So our output would need to have only two neurons.
So let's make it so that one of them
outputs the value 1 if the picture is
a cat, and the other one outputs the value
1 if the picture is a dog.
Now, remember this diagram?
You gave it the data, you gave it the answers,
and the ML algorithm figures out the rules.
In this case, the answers are the desired values
of the neurons.
So 1 and 0, top to bottom, if it's a cat.
And 0 and 1, top to bottom, if it's a dog.
So we could say that our answers look like this, 1,0 for cat 0,1
for dog.
Now, this is a process that's used a lot when
people build AI systems.
And it's called one-hot encoding.
You have an array representing the output neurons,
and they're all zero, except one of them, and that one is hot,
which gives it the name.
So the idea, now, is exactly the same as before.
You input a picture of a cat and you tell the neural network
that the desired output is 1,0 on the output neurons.
And then you show it lots more pictures of cats and dogs,
and you go through the learning process.
When the data coming in looks like this,
adjust your parameters so that the data going out
looks like this.
And the computer does the same process
of making a guess about the parameters,
calculating the accuracy of that guess over all of the data,
and using the results of that to make a better guess.
Now, you might be asking, wait a minute,
neurons take numbers as input and he's only got four of them.
So how does that figure out the values
in a cat or a dog picture?
And you'd be right.
I'm just showing this as a simple illustration.
The network to learn the contents
of cats and dogs pictures is much larger
and more sophisticated.
It'll have many, many more neurons and layers.
But here's the important part.
The principle is exactly the same.
So let me show you a real computer vision scenario that
was state-of-the-art just a few years ago,
and how this principle is simple yet cutting edge.
Here's some pictures of clothing, things like t-shirts,
dresses, and shoes.
With the principle of machine learning and neural networks
we've been discussing, a computer
can learn how to tell the difference between them.
Let's take a look.
First of all, we'll need a neural network.
It will have inputs and outputs.
So to design it, I always like to look at the outputs first.
There are 10 different types of clothing in our data.
So we need 10 neurons on the output.
And we'll encode the answers, sometimes called labels,
of the data so that each neuron represents a clothing type.
So for example, boots are number 6,
dresses are number 3, and so on.
So we can one-hot encode our answers like we did before.
Now, let's take a look at the pictures that make up our data.
Now, these are pretty simple pictures,
and each one is 28 by 28 dots, where each dot is a gray scale.
So the value 0 is stored in the computer for black, the value
255 for white, and everything between is a shade of gray.
So a 28 by 28 pixels, we only have 784 pieces
of data for each picture.
Experiments have shown that a neural network with only two
layers and 20 neurons on the input, and 10 on the output--
remember, that's because there's 10 types of clothing--
is actually enough to handle this.
So the 784 pieces of data representing each picture
are fed into a layer of 20 neurons.
These 20s output are fed to the 10,
and the network will figure out what makes a shoe a shoe very
quickly using the same process that we've been talking about.
Each of these 20 neurons will guess its weight and its bias,
as will each of these.
All of the images will be fed in and the answers
received by calculating the result from the weights
and the biases will be measured for accuracy.
All of this information will be used to get a new guess
and the data will be measured using that.
And in just a few seconds, a neural network
will learn to determine the differences between the images.
I cover coding this kind of thing
in my ML Foundations course, right here on the Google
Developers channel.
So if you want to learn how to do it.
But you can see here how the computer learns.
Each of these lines represents a pass-through the data,
where it set the parameters, calculated the results from its
guess, and then on the next lines-- also called the epoch--
it repeated the process.
Over time, you can see the loss goes down,
which means the parameters were learned,
that meant that this neural network got better
at determining what's a shoe, a shirt, a dress, or any
of the other items of clothing in the data set.
Now, this had pretty simple data and it was a pretty simple
neural network.
As your data gets more complex, like color images that
are much larger, then so will the network.
So for example, the network that can do diagnosis of retina
scans looks like this.
It's pretty much the same thing.
It's just bigger.
It uses a few different layer types in the simple neurons
I showed you.
But the important thing is that the principle of how it works
stays the same.
Whether you're fitting a line, seeing simple images
like these fashion ones, or building a medical diagnosis
system for diabetic retinopathy images, like these.
So please, like, share, and subscribe
to the Google Developer channel to learn more.
But most of all, please enjoy this series.
[MUSIC PLAYING]