﻿1
00:00:00,200 --> 00:00:02,533
Hello and welcome to this art tutorial.

2
00:00:02,533 --> 00:00:06,500
So we have a very exciting tutorial
ahead of us because in this tutorial

3
00:00:06,500 --> 00:00:10,133
we are going to build the A
and an and fit it to the training set.

4
00:00:10,500 --> 00:00:12,033
So right now it's time for action

5
00:00:12,033 --> 00:00:15,300
and let's build
our first artificial neural network.

6
00:00:15,600 --> 00:00:15,966
All right.

7
00:00:15,966 --> 00:00:19,433
So as I told you in the previous tutorial,
we are going to use the best package

8
00:00:19,433 --> 00:00:20,066
for that.

9
00:00:20,066 --> 00:00:23,433
That is the most efficient one
that offers the most options,

10
00:00:23,700 --> 00:00:26,700
and also one package
that can run your models very efficiently.

11
00:00:27,166 --> 00:00:30,000
That's indeed very important
because the models that we're going

12
00:00:30,000 --> 00:00:33,666
to build are complex and,
you know, they can run over many epochs.

13
00:00:33,900 --> 00:00:36,066
So we need a package
that will be efficient

14
00:00:36,066 --> 00:00:37,166
for these highly compute

15
00:00:37,166 --> 00:00:41,133
intensive tasks that are inevitable
when we build a deep learning model.

16
00:00:41,466 --> 00:00:44,900
In this section, in this tutorial,
we're not going to build a very deep

17
00:00:44,900 --> 00:00:45,800
learning model.

18
00:00:45,800 --> 00:00:48,600
We are going to have indeed
two hidden layers, but still.

19
00:00:48,600 --> 00:00:51,833
And if you need to work with a deeper
artificial neural

20
00:00:51,833 --> 00:00:54,833
network, well, of course
it's better if you have the best package.

21
00:00:54,933 --> 00:00:59,766
So there are several deep learning
packages in R, so we have neural net

22
00:01:00,000 --> 00:01:04,933
to build deep learning models
that are regressors and not classifiers.

23
00:01:04,933 --> 00:01:07,000
So we cannot use this one.

24
00:01:07,000 --> 00:01:09,900
Then we have a net
that allows us to build a deep

25
00:01:09,900 --> 00:01:12,900
learning classifier model,
but with only one hidden layer.

26
00:01:13,200 --> 00:01:16,633
And then we have deep net, another
very good deep learning package

27
00:01:16,633 --> 00:01:20,533
that can build deep learning models
with many hidden layers.

28
00:01:20,866 --> 00:01:23,066
But that's still not
the one we're going to use.

29
00:01:23,066 --> 00:01:25,933
And so now I'm going to tell you
the one that we're going to use.

30
00:01:25,933 --> 00:01:28,500
It is called the H2O package.

31
00:01:28,500 --> 00:01:32,733
So why is it, in my opinion, the best
package to build deep learning models?

32
00:01:33,000 --> 00:01:34,633
Well, it's for three reasons.

33
00:01:34,633 --> 00:01:37,600
The first reason,
and that's the most important reason,

34
00:01:37,600 --> 00:01:41,466
is that H2O is an open source
software platform

35
00:01:41,733 --> 00:01:46,033
that allows you to connect
to an instance of a computer system

36
00:01:46,300 --> 00:01:49,566
that therefore allows you
to run your model very efficiently.

37
00:01:49,800 --> 00:01:53,566
So thanks to this connection
to this computer system,

38
00:01:53,633 --> 00:01:55,533
we will be able to train

39
00:01:55,533 --> 00:01:58,800
a deep learning model very efficiently,
like in a few seconds.

40
00:01:59,100 --> 00:02:03,100
For those of you who follow the Python
tutorials, it's like connecting to a GPU,

41
00:02:03,466 --> 00:02:07,033
you know, that allows you to run highly
compute intensive parallel computations.

42
00:02:07,366 --> 00:02:10,033
So that's the first reason efficiency.

43
00:02:10,033 --> 00:02:12,733
Now, the second reason
is that this package

44
00:02:12,733 --> 00:02:15,733
offers a lot of options
to build your deep learning model.

45
00:02:15,800 --> 00:02:19,366
So, you know, it will be very easy for us
to choose different numbers of hidden

46
00:02:19,366 --> 00:02:22,766
layers and choose different numbers
of neurons in the hidden layers,

47
00:02:23,066 --> 00:02:25,733
as well as other options
to develop your model.

48
00:02:25,733 --> 00:02:28,633
And speaking of options,
that leads me to the third reason why.

49
00:02:28,633 --> 00:02:30,733
To me,
it is the best deep learning package.

50
00:02:30,733 --> 00:02:34,166
Well, the third reason is that one
option of this H2O package

51
00:02:34,400 --> 00:02:37,933
is that it contains a parameter
tuning argument that allows you

52
00:02:37,933 --> 00:02:41,166
to choose some optimal numbers
to build your deep learning model.

53
00:02:41,433 --> 00:02:43,700
So we will see that by building the model.

54
00:02:43,700 --> 00:02:46,000
And so let's start creating it.

55
00:02:46,000 --> 00:02:50,400
So the first thing we have to do
is of course to install the H2O package.

56
00:02:50,800 --> 00:02:52,000
So let's do this.

57
00:02:52,000 --> 00:02:55,933
We're going to use
the install dot packages command.

58
00:02:55,966 --> 00:02:56,966
Here we go.

59
00:02:56,966 --> 00:02:59,833
And remember in this install the packages
function

60
00:02:59,833 --> 00:03:02,366
we need to input the name of the package
in quotes.

61
00:03:02,366 --> 00:03:04,633
That is h to o.

62
00:03:04,633 --> 00:03:07,900
So that's all H2O written
this simple way.

63
00:03:08,300 --> 00:03:11,300
And so you just need to select this line
and execute it.

64
00:03:11,433 --> 00:03:14,333
To install the package I already have

65
00:03:14,333 --> 00:03:17,333
installed on my our studio here, it is.

66
00:03:17,500 --> 00:03:19,433
And it's also already imported.

67
00:03:19,433 --> 00:03:22,433
But of course this will
install this package without any issue.

68
00:03:22,633 --> 00:03:25,766
And of course if you have any issue
you can ask me some questions in the Q&A.

69
00:03:26,066 --> 00:03:27,766
I'll help you fix that.

70
00:03:27,766 --> 00:03:29,800
So I'm going to put that in comment.

71
00:03:29,800 --> 00:03:32,200
And now let's move on to the next line,

72
00:03:32,200 --> 00:03:36,633
which is to import this package
in case we have to automate the scripts.

73
00:03:36,900 --> 00:03:42,533
So to import it as usual we use library
and in parentheses not in quotes.

74
00:03:42,533 --> 00:03:45,533
The name of the package H to. Oh.

75
00:03:45,766 --> 00:03:47,033
All right. Great.

76
00:03:47,033 --> 00:03:49,733
And now we need to do something special.

77
00:03:49,733 --> 00:03:53,533
It's not the usual package that
we've been using throughout this course.

78
00:03:54,033 --> 00:03:55,566
It's a new kind of package

79
00:03:55,566 --> 00:03:58,733
because it's a package that we're taking
from an open source platform,

80
00:03:58,966 --> 00:04:03,033
and therefore that requires a connection
to an EC2 instance.

81
00:04:03,300 --> 00:04:06,366
And therefore what we'll do right now
before starting to create

82
00:04:06,366 --> 00:04:09,366
the model is to establish this connection.

83
00:04:09,366 --> 00:04:11,366
And don't worry, that's very easy.

84
00:04:11,366 --> 00:04:15,333
We need to take our package H to
oh then dot.

85
00:04:15,900 --> 00:04:18,633
And then as you can see here
it contains many functions.

86
00:04:18,633 --> 00:04:21,700
And the function we're interested in
to make this connection

87
00:04:21,700 --> 00:04:24,933
and in fact initialize an H2O instance.

88
00:04:25,233 --> 00:04:28,233
Well we need to take the init function.

89
00:04:28,233 --> 00:04:28,600
All right.

90
00:04:28,600 --> 00:04:32,666
And as you can see in this function
we have several parameters that allows you

91
00:04:32,666 --> 00:04:36,466
to connect to a specific server
for example, this first argument

92
00:04:36,466 --> 00:04:40,833
here is IP which you can use
to specify the IP address of the server

93
00:04:40,833 --> 00:04:44,400
you want to connect to, in
which your H2O instance will be running.

94
00:04:45,200 --> 00:04:49,066
But that's only if you have an idea
of which server you want to connect to.

95
00:04:49,300 --> 00:04:52,200
But in our case,
we will connect to some sort of a default

96
00:04:52,200 --> 00:04:55,700
available server, and therefore
we want to use these parameters here.

97
00:04:55,933 --> 00:05:00,600
However, there is one that we'll use and
that is the end thread's parameter here.

98
00:05:00,900 --> 00:05:02,266
And what is this argument.

99
00:05:02,266 --> 00:05:06,466
Well this argument is the number of cores
in the system that you're connecting to

100
00:05:06,833 --> 00:05:09,766
that will be used to build the deep
learning model.

101
00:05:09,766 --> 00:05:11,300
Because, you know,
building a deep learning

102
00:05:11,300 --> 00:05:13,533
model requires a lot of computations.

103
00:05:13,533 --> 00:05:15,400
Highly compute intensive ones.

104
00:05:15,400 --> 00:05:18,633
And therefore we need many cores
to run these computations.

105
00:05:19,033 --> 00:05:23,533
And again, that's the reason why we prefer
GPUs or CPUs.

106
00:05:23,800 --> 00:05:26,600
Because simply GPUs have many more cores.

107
00:05:26,600 --> 00:05:29,133
So here
we'll take this argument and threads.

108
00:05:29,133 --> 00:05:32,466
And now the trick is to input the value
minus one.

109
00:05:32,700 --> 00:05:35,433
Because specifying this
minus one value will take

110
00:05:35,433 --> 00:05:38,500
all the available cores of the system
you're connecting to.

111
00:05:38,900 --> 00:05:40,666
So don't even think about it.

112
00:05:40,666 --> 00:05:44,633
I strongly recommend to use minus one here
because this will optimize the number

113
00:05:44,633 --> 00:05:47,633
of course to use
and therefore the future computations.

114
00:05:48,033 --> 00:05:48,600
Great.

115
00:05:48,600 --> 00:05:51,866
And that's actually the only argument
we need to input here in this

116
00:05:51,866 --> 00:05:52,800
init function.

117
00:05:52,800 --> 00:05:57,000
So we are ready to execute
that to connect to the system.

118
00:05:57,566 --> 00:05:58,733
All right. So let's execute.

119
00:06:00,066 --> 00:06:03,066
Starting h2o JVM and connecting.

120
00:06:03,533 --> 00:06:04,566
And here we go.

121
00:06:04,566 --> 00:06:06,300
All the connections are established.

122
00:06:06,300 --> 00:06:09,066
And now we're working on another system

123
00:06:09,066 --> 00:06:12,366
much more powerful because we have
an optimized number of cores.

124
00:06:12,700 --> 00:06:17,100
And so we are ready to build
any kind of complex deep learning models.

125
00:06:17,666 --> 00:06:19,733
Great. So now we have everything we need.

126
00:06:19,733 --> 00:06:21,566
We have a powerful tool with us.

127
00:06:21,566 --> 00:06:24,900
So we are definitely ready
to start building the deep learning model.

128
00:06:25,366 --> 00:06:25,700
All right.

129
00:06:25,700 --> 00:06:28,700
So that's what we're going to do
starting from the next tutorial.

130
00:06:28,700 --> 00:06:31,700
Until then, enjoy machine learning.
