In this we do we are going to understand the steps taken to be a regression tree.
The conceptual understanding that you will love from this lecture will help you until your interview
or Veira questions.
Plus, you'll be able to manipulate the decision tree and interpret its result much better than someone
who just knows the court to make a decision tree.
So as I showed you earlier in a decision tree, we are trying to create regions or segments.
These segments have particular creek districts such as here.
We said that this region is a group of students who studied less than an arts.
The next region is a good group of students who studied more than 10 nuts but scored less than sixty
five marks in the midterms.
And so on.
Secondly, when we have these regions, we make a prediction for the response with evil, which is usually
the mean of the response value of observations in that region.
So for the first region, we have five students and we are predicting that if a student studies less
than 10 us, that student will score the average of this quarter of these five students, which is thirty
nine MOCs.
Similarly, if a student belongs to the second region, that is student studied more than 10 hours.
But Madame Skoda's less than 65 monks, then that student will be scoring 70 monks.
But the main question is, how do we decide these regions?
Which variable should we pick for the first plate?
And at what value?
How and why did we decide that first this our variable will be used and that to be just putting value
of Penas?
And why not for Peanut's?
The answer is we will pick such variable and such splitting value so that we get minimum sum of squared
A.
Dissembles, good at it.
Time is given by this formula, which is the actual rally of response variable in the observation minus
the predicted value of response in that region.
Then we square that down and then we add all touchstones, the meaning of this sigma symbol here means
that we are adding this is summation of all such terms.
So for all the observations, we are going to find the difference from that predicted value.
And we are going to square it and we are going to add all those values for all the regions.
And are variable and splitting value will be chosen.
Such that the value of this term is minimal.
If you know or remember from linear regression, this is very similar to the or Mary Lee squared method.
Let us understand what this means for decision trees.
Let us consider only the first card for now, which is this is us.
So we have two regions.
This is region one, which is for less than 10 hours.
And this is region two, which is far more than Tynan's.
Region one.
We have five values.
That is 50 percent of the population.
These first five.
Where the odds values less than 10 belong to the first region.
And for these very values, we have a predicted value of thirty nine.
Which is the mean score of this population.
What region do we have, the other five values?
These observations belong to Region two, and the predicted value for them is the average value, which
is 75.
So as buddy formula, we find the difference of.
The first value was just to define what this means for 39 discredit.
And this is at first, um.
Then we do this for the second observation.
We find a difference of 38 and 39.
We square it.
And this is our second that Adam.
Then we find a difference of 40 and 39 square, it turned out at home and so on, when we have all these
other times, but all the regions, we add all those other towns to get the value of odysseys.
There it is.
Let's do some of Squeers.
Now, instead of a value of ten for us, if we had a splitting relly 015, we'll have these seven thumbs.
These seven observations in the region one and these three in the region to the average of these seven
will be taken as the mean score.
An average of these three will be taken as a means score for region to really do this exercise again
and find out the Odyssey's value.
And we will choose that datasource value, which is lowered out of these two.
So basically the split is based on the value of.
Retired, all possible variables and all possible splitting values of those variables.
We find out the artists and we choose the RSS with just minimum.
So for this scenario, it turns out that odds the first where he will likely choose.
And we have a splitting rally of an Ares.
Or this combination of variable and splitting relu.
We get the minimum value of odysseys.
Now, ideally, we have to do this at all possible values of our trade, even then, we also have to
consider the second variable.
Which is make them good.
So it turns out that when we have a lot of preening observations and a lot of variables, it becomes
computationally infeasible to consider every possible partition and all such possible regions.
That is why we Tager top down approach known as the coercive binary splitting.
The approach that we take is top down because we start at the top of the tree, that is all the observations
are belonging to a single region in the beginning, and then we start making these split.
Now, each split separates the predictable space into two parts.
This is why it is called binary splitting.
It is greedy because at each step of the rebuilding process, the best split at that particular step
is considered.
We do not look ahead or considered picking a split that will lead to a better three later on.
We contend that only that current split and Jews that split, which is giving us these minimum odysseys.
So I'll summarize the whole rebuilding process.
When our program is trying to build a data entry, this is what is happening in the background.
It considers all the predictors x1 x2 up to XP one by one, then all possible values of points for each
variable is considered to divide the space into two regions.
It calculates the squared error.
This squared error times for all such possibilities and chooses the one with least value of the sum
of squared error.
It continues to make this place like this such that the resulting tree has lowest Odyssey's until the
stop in criteria's made.
So in our example problem we had, we were predicting students scored.
The program continued.
All the variables first.
Initially, we had 10 students data.
The average was coming out to be 57.
It considered the variables are then make them and all possible values of these are midterm values.
So it considered five or six or seven, eight, nine, 10.
All such possible values of ARS.
And all such possible splitting values of McDonald's.
It chose this particular variable, which is odd and dispiriting value, because at this step this was
giving the minimum Odyssey's once displayed was made.
It went to each of detailed posted to the left node, but it did not spread it further because some
stopping criteria was met here.
Then it went to the date, nor the stopping criteria was not met here.
It again tried all the variables.
That is odd and make them.
It again tested all the possible splitting values for Odd and Midem that even.
It got.
The Odyssey's value for all such possibilities and chose the Odyssey's, which was minimum, which in
this case came out to be Metung variable.
Less than 60 feet.
All this happens in the background of this awkward.
You just need to give the data let which is the one variable that you want to predict, which are the
predicted variables.
And what is this topping criteria for that decision tree?
Once you specify all these values, the three can run and you get an output like this.