WEBVTT

00:00.240 --> 00:02.520
-: Hello and welcome to this tutorial.

00:02.520 --> 00:04.980
So now that we have a brain and a body,

00:04.980 --> 00:06.720
we can make the AI.

00:06.720 --> 00:08.610
Of course, we're going to assemble them

00:08.610 --> 00:10.740
and you're gonna see how now things

00:10.740 --> 00:12.300
are all gonna make sense.

00:12.300 --> 00:14.070
You're gonna understand why we had

00:14.070 --> 00:15.330
to make some classes

00:15.330 --> 00:18.180
or more specifically, the purpose of making these classes,

00:18.180 --> 00:20.490
and mostly you're gonna get intuitive sense

00:20.490 --> 00:22.830
of how you can play with objects

00:22.830 --> 00:25.740
to create new objects, bigger objects.

00:25.740 --> 00:26.880
And as you understood,

00:26.880 --> 00:28.620
we already created two classes:

00:28.620 --> 00:30.240
the brain and the body.

00:30.240 --> 00:33.090
So then by creating some objects of these two classes,

00:33.090 --> 00:35.100
well, we can make a bigger object,

00:35.100 --> 00:36.480
which will be the AI.

00:36.480 --> 00:38.730
And that's exactly what we're gonna do now.

00:38.730 --> 00:42.120
We are gonna make the AI by assembling the two classes

00:42.120 --> 00:45.030
that we created, that is the brain and the body.

00:45.030 --> 00:46.170
So let's do this.

00:46.170 --> 00:48.390
It's gonna become super intuitive now.

00:48.390 --> 00:51.540
I'm going to introduce a new class,

00:51.540 --> 00:54.090
which of course, I'm gonna call AI

00:54.090 --> 00:57.240
because now we're ready to make the final AI.

00:57.240 --> 01:02.240
And right here, I'm going to start with the init function.

01:04.530 --> 01:07.350
And what is this init function going to take?

01:07.350 --> 01:10.320
It is right now that things will make a lot of sense.

01:10.320 --> 01:13.500
Well, first, we get the inevitable self

01:13.500 --> 01:14.580
with the object.

01:14.580 --> 01:17.970
But then, the two arguments are gonna be nothing else

01:17.970 --> 01:21.390
than the brain and the body.

01:21.390 --> 01:25.230
That's the two elements that we need to build an AI.

01:25.230 --> 01:27.390
We need a brain, the neural network

01:27.390 --> 01:30.600
and a body, which will play the action with softmax.

01:30.600 --> 01:33.000
And so now very simply what we have to do

01:33.000 --> 01:35.610
is defining the variables of our AI object

01:35.610 --> 01:38.730
because right now, brain and body are just arguments.

01:38.730 --> 01:39.660
So let's do this.

01:39.660 --> 01:41.490
We have to make two variables obviously.

01:41.490 --> 01:43.950
The first one is self.brain,

01:43.950 --> 01:47.190
which will be equal to the brain argument

01:47.190 --> 01:50.940
but which later will be a brain object created

01:50.940 --> 01:52.710
from the CNN class.

01:52.710 --> 01:56.730
And then the second variable is self.body,

01:56.730 --> 02:00.660
which will be equal to the body argument right here.

02:00.660 --> 02:02.580
But which in the future will be,

02:02.580 --> 02:06.150
of course, an object of the softmax body class.

02:06.150 --> 02:08.100
And so now as simple as that,

02:08.100 --> 02:11.280
thanks to this pretty awesome structure that we made here,

02:11.280 --> 02:12.780
we built an AI.

02:12.780 --> 02:15.000
Not trained yet, not intelligent yet

02:15.000 --> 02:17.550
but still, we have a brain and a body.

02:17.550 --> 02:20.160
So that's perfect, and now the only thing

02:20.160 --> 02:21.480
that we have to do left

02:21.480 --> 02:24.660
is make a big forward function

02:24.660 --> 02:26.910
that will do the whole propagation.

02:26.910 --> 02:29.130
Since now our AI is assembled,

02:29.130 --> 02:30.930
well, we're not gonna use separately

02:30.930 --> 02:32.580
the two forward functions,

02:32.580 --> 02:34.950
the one of the brain and the one of the body.

02:34.950 --> 02:37.140
We're gonna make a big forward function,

02:37.140 --> 02:39.090
which will be our next function,

02:39.090 --> 02:42.630
which will take the images as input,

02:42.630 --> 02:45.360
then we'll propagate the signals in the brain,

02:45.360 --> 02:46.410
and for this, we will, of course,

02:46.410 --> 02:48.780
use the first forward function,

02:48.780 --> 02:51.840
and then once we get the output signals of the brain,

02:51.840 --> 02:54.990
we will forward these output signals into the body

02:54.990 --> 02:56.160
with the forward function here

02:56.160 --> 02:58.320
that will use a softmax technique.

02:58.320 --> 03:01.530
And then eventually, we will return the actions to play.

03:01.530 --> 03:02.520
And that is just now

03:02.520 --> 03:04.110
that we can make this big forward function

03:04.110 --> 03:07.800
because we have assembled the brain and the body.

03:07.800 --> 03:10.650
And so we're not gonna call this next function forward,

03:10.650 --> 03:12.450
we're gonna use the call function,

03:12.450 --> 03:13.920
which is kind of like the init function

03:13.920 --> 03:17.070
but that will call the two forward functions here

03:17.070 --> 03:20.190
from the brain and the body to propagate the signal

03:20.190 --> 03:22.560
from the very beginning with the input images

03:22.560 --> 03:25.170
to the very end with the action to play.

03:25.170 --> 03:28.290
And that's why the next function we will make now

03:28.290 --> 03:30.390
is this call function

03:30.390 --> 03:33.090
that will combine the two forward functions

03:33.090 --> 03:34.830
of the brain and the body.

03:34.830 --> 03:36.360
That's the only thing we have to do

03:36.360 --> 03:39.480
and then we will have our AI ready.

03:39.480 --> 03:42.150
So let's make this final step in the next tutorial.

03:42.150 --> 03:43.953
And until then, enjoy AI.
