-: Hello and welcome to this tutorial.
All right, it's now time to build our very first AI.
Because right now,
we've only made the manual of instructions
with the AI class, but we haven't created any object yet,
and so we haven't a real, actual AI yet.
But we're about to get it right now
because we're about to create one object of this AI class.
And this object will be nothing else than an AI,
which will have a brain and a body.
All right, so let's do this.
It's actually very simple to do it
now that we have defined everything with the classes.
So, basically, what we need to do
is first, create a brain, because, as you can see,
when we create an AI, we need to input a brain,
but we also input a body,
so we need to create a body as well.
And then, once we created a brain object and a body object,
well, we will be able to create the AI.
But no worries,
we will build the brain and the body in a Flashlight.
And actually, let's do it right now.
Let's start with the brain.
We're gonna call the brain CNN
because the brain is a convolutional neural network
and it will be an object of the CNN class,
so it makes sense to call it CNN.
So CNN equals, and then we take our CNN class this time,
and we input, in parenthesis, according to you.
Well, at this point right now
when we create an object of a class,
what we have to input is very simply
the argument of the init function.
And that's number actions.
And thanks to what we previously,
when getting the doom environment,
where we already have this number actions
and therefore, we simply need to input number actions here
into the CNN class.
Perfect.
So now we have the brain.
Now, let's make the body.
We're gonna create an object of the softmax body class
and we're gonna call this object softmax body.
That will be the body of our AI.
And this object is an object of the softmax body class
to which we have to input the only argument
of the init function of the softmax body class,
which is the temperature, T.
And therefore, here we input T, but we have to specify value
because so far, T is just an argument.
So T equals, and we're gonna start with one.
That's a small temperature, but this might work very well.
And actually, I already know this will work very well, so.
But you can try with other temperatures.
You know how it works now.
Your actions will be more sure of themselves.
That is the action with the highest Q-value
will have a higher probability to be selected,
as opposed to the other actions,
which will have lower probabilities to be selected
and therefore, they will be less explored.
But anyway, we can start with one.
This will get us a good body.
All right, so now we have a brain, we have a body,
so I guess it's time to make the final AI, eventually.
So now, you're gonna see
how things are gonna become so simple.
It's when the intuition reaches its peak.
To make an AI, we simply need to create an object
that we call, of course, AI from our AI class.
And since an AI is composed of a brain and a body,
we input the brain,
which is our convolutional neural network, for the object
and a body, which is nothing else
than the softmax body object from the softmax body class.
And see, we built an AI in a Flashlight
by just inputting a brain and a body.
And now, we have an AI ready to be trained.
So now it's time to launch
the whole Deep convolutional Q-Learning process
with experience replay,
that bonus of eligibility trace on 10 steps.
And eventually, once we have all this,
we will train the AI to make it smart.
So can't wait to do this.
The next section is gonna be about
setting up experience replay.
So we're not going to implement it all over again,
like for the self-driving car, because the good news is
that we already have it implemented.
So that will be fast.
We will just create an object of the replay memory class
that is in this experience replay file.
So that will help us a lot.
And therefore, we will move on quickly
to what's new and most important, that is the training.
So let's attack this in the next tutorials.
And until then, enjoy AI.