Hello and welcome to this art tutorial.
So we have a very exciting tutorial ahead of us because in this tutorial
we are going to build the A and an and fit it to the training set.
So right now it's time for action
and let's build our first artificial neural network.
All right.
So as I told you in the previous tutorial, we are going to use the best package
for that.
That is the most efficient one that offers the most options,
and also one package that can run your models very efficiently.
That's indeed very important because the models that we're going
to build are complex and, you know, they can run over many epochs.
So we need a package that will be efficient
for these highly compute
intensive tasks that are inevitable when we build a deep learning model.
In this section, in this tutorial, we're not going to build a very deep
learning model.
We are going to have indeed two hidden layers, but still.
And if you need to work with a deeper artificial neural
network, well, of course it's better if you have the best package.
So there are several deep learning packages in R, so we have neural net
to build deep learning models that are regressors and not classifiers.
So we cannot use this one.
Then we have a net that allows us to build a deep
learning classifier model, but with only one hidden layer.
And then we have deep net, another very good deep learning package
that can build deep learning models with many hidden layers.
But that's still not the one we're going to use.
And so now I'm going to tell you the one that we're going to use.
It is called the H2O package.
So why is it, in my opinion, the best package to build deep learning models?
Well, it's for three reasons.
The first reason, and that's the most important reason,
is that H2O is an open source software platform
that allows you to connect to an instance of a computer system
that therefore allows you to run your model very efficiently.
So thanks to this connection to this computer system,
we will be able to train
a deep learning model very efficiently, like in a few seconds.
For those of you who follow the Python tutorials, it's like connecting to a GPU,
you know, that allows you to run highly compute intensive parallel computations.
So that's the first reason efficiency.
Now, the second reason is that this package
offers a lot of options to build your deep learning model.
So, you know, it will be very easy for us to choose different numbers of hidden
layers and choose different numbers of neurons in the hidden layers,
as well as other options to develop your model.
And speaking of options, that leads me to the third reason why.
To me, it is the best deep learning package.
Well, the third reason is that one option of this H2O package
is that it contains a parameter tuning argument that allows you
to choose some optimal numbers to build your deep learning model.
So we will see that by building the model.
And so let's start creating it.
So the first thing we have to do is of course to install the H2O package.
So let's do this.
We're going to use the install dot packages command.
Here we go.
And remember in this install the packages function
we need to input the name of the package in quotes.
That is h to o.
So that's all H2O written this simple way.
And so you just need to select this line and execute it.
To install the package I already have
installed on my our studio here, it is.
And it's also already imported.
But of course this will install this package without any issue.
And of course if you have any issue you can ask me some questions in the Q&A.
I'll help you fix that.
So I'm going to put that in comment.
And now let's move on to the next line,
which is to import this package in case we have to automate the scripts.
So to import it as usual we use library and in parentheses not in quotes.
The name of the package H to. Oh.
All right. Great.
And now we need to do something special.
It's not the usual package that we've been using throughout this course.
It's a new kind of package
because it's a package that we're taking from an open source platform,
and therefore that requires a connection to an EC2 instance.
And therefore what we'll do right now before starting to create
the model is to establish this connection.
And don't worry, that's very easy.
We need to take our package H to oh then dot.
And then as you can see here it contains many functions.
And the function we're interested in to make this connection
and in fact initialize an H2O instance.
Well we need to take the init function.
All right.
And as you can see in this function we have several parameters that allows you
to connect to a specific server for example, this first argument
here is IP which you can use to specify the IP address of the server
you want to connect to, in which your H2O instance will be running.
But that's only if you have an idea of which server you want to connect to.
But in our case, we will connect to some sort of a default
available server, and therefore we want to use these parameters here.
However, there is one that we'll use and that is the end thread's parameter here.
And what is this argument.
Well this argument is the number of cores in the system that you're connecting to
that will be used to build the deep learning model.
Because, you know, building a deep learning
model requires a lot of computations.
Highly compute intensive ones.
And therefore we need many cores to run these computations.
And again, that's the reason why we prefer GPUs or CPUs.
Because simply GPUs have many more cores.
So here we'll take this argument and threads.
And now the trick is to input the value minus one.
Because specifying this minus one value will take
all the available cores of the system you're connecting to.
So don't even think about it.
I strongly recommend to use minus one here because this will optimize the number
of course to use and therefore the future computations.
Great.
And that's actually the only argument we need to input here in this
init function.
So we are ready to execute that to connect to the system.
All right. So let's execute.
Starting h2o JVM and connecting.
And here we go.
All the connections are established.
And now we're working on another system
much more powerful because we have an optimized number of cores.
And so we are ready to build any kind of complex deep learning models.
Great. So now we have everything we need.
We have a powerful tool with us.
So we are definitely ready to start building the deep learning model.
All right.
So that's what we're going to do starting from the next tutorial.
Until then, enjoy machine learning.