﻿1
00:00:00,066 --> 00:00:03,433
Remember this because, you know,
this is your first machine learning model.

2
00:00:03,433 --> 00:00:06,433
So this is the first time
you're going to use this fit method.

3
00:00:06,566 --> 00:00:09,133
And then you're going to see
you're going to use it all the time.

4
00:00:09,133 --> 00:00:13,333
Whether you're going to do neural networks
or anything in artificial intelligence,

5
00:00:13,600 --> 00:00:16,466
the method that we're going to use
to train our regression

6
00:00:16,466 --> 00:00:18,700
model is the fit method.

7
00:00:18,700 --> 00:00:20,500
And how do we call such method?

8
00:00:20,500 --> 00:00:25,300
Well, first we have to take the object
itself regressor and then add that

9
00:00:25,566 --> 00:00:29,966
and then add the method itself
which is fit and add some parentheses.

10
00:00:30,266 --> 00:00:35,200
So as a reminder, the fit method here is a
method of the linear regression class.

11
00:00:35,366 --> 00:00:39,433
And I remind also that a class indeed
has a couple of not only instructions

12
00:00:39,433 --> 00:00:40,766
but also tools.

13
00:00:40,766 --> 00:00:42,866
And these tools are called the methods.

14
00:00:42,866 --> 00:00:46,366
And these tools complete some actions
like training a model

15
00:00:46,366 --> 00:00:47,900
on a certain training set,

16
00:00:47,900 --> 00:00:51,900
or predicting some future results
you know, on the test set.

17
00:00:52,133 --> 00:00:54,000
So that's the first method
and you'll see that.

18
00:00:54,000 --> 00:00:56,166
Then we'll use another method.

19
00:00:56,166 --> 00:00:56,500
All right.

20
00:00:56,500 --> 00:01:00,366
So basically this fit
method will train this regression model

21
00:01:00,366 --> 00:01:03,366
the simple linear regression
model on the training set.

22
00:01:03,533 --> 00:01:07,133
And now as you might guess the only thing
that's missing here and that we have to

23
00:01:07,133 --> 00:01:10,933
enter in the fit method is of course
the training set itself.

24
00:01:11,200 --> 00:01:15,133
However we have to enter it
in a certain way because the fit method

25
00:01:15,133 --> 00:01:18,166
expects
a certain format of the training set.

26
00:01:18,400 --> 00:01:23,333
And this format is of course, you know,
the couple of X train and Y train.

27
00:01:23,400 --> 00:01:24,066
Right?

28
00:01:24,066 --> 00:01:27,266
I remind that
X train contains the features, you know,

29
00:01:27,266 --> 00:01:31,166
the independent variables
of the training set and Y train contains

30
00:01:31,366 --> 00:01:34,900
the dependent variable vector
of the training set as well.

31
00:01:35,100 --> 00:01:40,333
And the fit method here expects exactly
the training set in this format with first

32
00:01:40,600 --> 00:01:44,466
the matrix of features
x train, and second,

33
00:01:44,466 --> 00:01:48,866
the dependent variable vector
x train and y train.

34
00:01:48,866 --> 00:01:50,266
Just like that.

35
00:01:50,266 --> 00:01:50,800
All right.

36
00:01:50,800 --> 00:01:52,366
So now what I suggest is

37
00:01:52,366 --> 00:01:56,300
that we run all the cells
because we haven't run any cell so far.

38
00:01:56,300 --> 00:01:59,133
So we're going to do it because indeed
when we're going to run the cell

39
00:01:59,133 --> 00:02:00,500
something will happen in the output.

40
00:02:00,500 --> 00:02:01,500
So let's see.

41
00:02:01,500 --> 00:02:05,200
First we have to import the libraries
where we import numpy,

42
00:02:05,200 --> 00:02:06,766
matplotlib and pandas.

43
00:02:06,766 --> 00:02:08,300
Then we import into the data set.

44
00:02:08,300 --> 00:02:11,300
Make sure to have it uploaded in Colab.

45
00:02:11,600 --> 00:02:13,066
Then step three.

46
00:02:13,066 --> 00:02:16,766
We were going to split the data set
into the training set and the test set.

47
00:02:17,033 --> 00:02:17,766
So there we go.

48
00:02:17,766 --> 00:02:20,766
Now we have xtrain
excess weight training white test.

49
00:02:20,966 --> 00:02:25,200
And since we have X train and Y train,
well we can now train the simple linear

50
00:02:25,200 --> 00:02:29,366
regression model on the training set
by calling this fit method

51
00:02:29,566 --> 00:02:33,866
taken from the regressor
object of the linear regression class.

52
00:02:33,866 --> 00:02:34,800
Here we go.

53
00:02:34,800 --> 00:02:35,933
Let's play this cell.

54
00:02:35,933 --> 00:02:38,633
And as I told you,
there is something in the output.

55
00:02:38,633 --> 00:02:40,366
That's just to say that indeed

56
00:02:40,366 --> 00:02:44,433
the linear regression model is created
and that's the default parameters.

57
00:02:44,633 --> 00:02:46,300
You don't have to worry about them.

58
00:02:46,300 --> 00:02:48,200
But there you go. Congratulations.

59
00:02:48,200 --> 00:02:52,200
You actually built and trained
your very first machine learning model.

60
00:02:52,200 --> 00:02:53,400
I'm super excited for you.

61
00:02:53,400 --> 00:02:56,400
I remember how excited
I was the first time I did this.

62
00:02:56,700 --> 00:02:57,500
So there you go.

63
00:02:57,500 --> 00:02:58,200
I know the feeling.

64
00:02:58,200 --> 00:03:01,200
But be aware, my friends,
that this is the first,

65
00:03:01,200 --> 00:03:05,033
but definitely not the last machine
learning model that you're going to build.

66
00:03:05,033 --> 00:03:06,866
We're going to build many others

67
00:03:06,866 --> 00:03:10,766
more complex, of course,
and for any types of applications.

68
00:03:10,766 --> 00:03:14,333
So you know, by the end of this course
you will know how to do anything

69
00:03:14,333 --> 00:03:15,266
in machine learning.

70
00:03:15,266 --> 00:03:19,100
And that's why we really want to provide
code templates for you to be efficient

71
00:03:19,400 --> 00:03:21,666
on how to play with them. Okay.

72
00:03:21,666 --> 00:03:23,300
So congratulations again.

73
00:03:23,300 --> 00:03:27,233
Now we're going to proceed to
the next step predicting the test results.

74
00:03:27,233 --> 00:03:30,233
And for this
we're going to use a new method.

75
00:03:30,466 --> 00:03:33,300
And so now I would like you to take action
I would like you

76
00:03:33,300 --> 00:03:36,866
to try to predict the test results
before we do it together.

77
00:03:37,066 --> 00:03:41,000
And I'm going to give you a little hint,
even if you can look at it online.

78
00:03:41,200 --> 00:03:44,966
Well, the method that you have to use
to predict new observations

79
00:03:45,166 --> 00:03:46,800
is the predict method.

80
00:03:46,800 --> 00:03:47,833
As simple as that.

81
00:03:47,833 --> 00:03:50,366
You know, they chose some simple terms.

82
00:03:50,366 --> 00:03:52,700
So there you go.
Try to implement that before me.

83
00:03:52,700 --> 00:03:54,533
That's your little exercise here.

84
00:03:54,533 --> 00:03:57,966
And we will implement this solution
together in the next tutorial.
