Hello, guys.
Welcome back.
So to follow along to this class, I'll need you to download this file.
I'm going to put it into the downloadable resources part of this class.
OK, so we're going to use that file with that comment rate matrix.
So it'll be read Matrix.
Real date that see as we see us v.
That'll load the file load the data up to file OK into into our workspace.
OK, so.
It will look pretty much like this.
OK.
But if I double click on this, OK, you'll see that in fact, it has some headers.
Okay.
It has some headers that correspond to the features that we're analyzing into our linear regression
model.
OK.
So it is very important for us to know where it's the output data and where are the features that we
want to start.
OK.
So for this particular class, the features that we want to study are in the one, two and column of
our matrix, whereas the the final result, the output of our linear regression model will be on the
D on the fourth column.
OK, so once we have the data on the workspace, we should separate the data.
OK, has we need?
That features and outputs in separate value, separate variables such as we can use these common has.
It is right here.
OK.
And then name X.
These first three columns, OK, so it'll be every row and columns from one to three.
And then they do this same for why.
But this time will be the fourth row.
OK.
And then and then I call model equals ft l m of X comma y semicolon.
OK.
And that will I'll put this object over here, which is our module.
OK.
It is our module.
OK.
So if I do not use semicolon, it will output these except screenshot.
OK, so.
Here we can see, OK, we can see the coefficients for every single one of the features that we have.
OK?
And as we already know, the first column of our data represents the age.
OK, how old the house is.
And we already know that it impacts negatively on the two, on the price at which we can sell the house.
This same goes with the closeness to the to the nearby subway station.
The further away it is, the longer distance we have to walk to the to the nearest subway station.
The cheapest we have to just sell the house.
OK, so but the number of total convenience and the total convenience stores nearby the house impacts
possible fleet on the price of the house, as we can see in here.
And of course, we have an independent coefficient, an independent term, OK, which is very often
court.
Has I told you before the biased term, OK, which just does not depend on any of the features that
we are and that we're studying.
So if we want to predict, OK, if we want to predict the price of the house with this module, the
thing that we have to do is pretty much use these command over here, predict model, OK, which is
the the object that we have in here.
OK, our model, OK?
And with this model and with this model, I want to predict the value of a house of, let's say, five
years old.
With a distance to the nearest subway station of 300 and 19 meters, and let's say that it has six convenience
stores nearby it, so it should be quite close to this number.
OK, not necessarily.
And not necessarily greater in that necessarily and cheaper, but it should be quite close to it.
OK, so.
Forty seven point three nine.
OK.
Which is kind of close to this.
OK.
And it is it is within the area that I could pretty much assume, OK, it is within the area that I
could pretty much expect.
OK.
So.
Again.
To summarize, OK.
In order to create a model, in order to create the model, we need to execute this comment over here
and then in order to give some prediction to the user, we need to ride the common and predict has a
viable the model that we have to have in the work space force and the features of the house of the object
that we want to predict with our model.
OK, so this is pretty much the framework that we are going to be using in order to implement linear
regression modeling these E in this module of the course.
OK.
And I encourage you.
I encourage you.
Has a homework to arrive at function?
OK.
To write a function using the knowledge that we acquired in this class in order to do this repetitively.
OK.
I do not have to go into the comment window.
A bear or bear do not have to.
And we shouldn't have to to write these comments directly on the code off our graphical user interface.
OK, we should call upon a function every time we want to do it.
OK.
And the function should receive has any input.
The name of the.
Off the file that we have data on.
OK, we can assume for that purpose that the last column.
The very last column of our data will always be the value of the of the variables that we want to get.
Whereas the first and minus one columns will always be the features.
OK.
So with those assumptions, let's write a function that takes only the name of the file that we want
to analyze and outputs the model.
OK.
And with the module we will, we are going to be able to predict further, more some bouts.
So see you in the next class.