You are welcome to the Machine Learning Course, and this tutorial is in continuation of our previous session.
So, let's see ahead.
Now, we are going to see about the Decision Tree Regressor.
During the time of classification also, we have performed classification with the help of decision tree.
Now, we will try and perform regression, so in continuous output we will perform regression and see.
So, let's begin.
So, our first step is as usual we will import the libraries,
From sklearn dot datasets import load, this time we will choose a new dataset, which is of diabetes, so load diabetes, before that I will connect this as it is not giving me suggestions, because through suggestions it becomes easy as we get short cuts.
After this, the next thing that I want is from sklearn dot model selection import cross val score, so what will this cross val score do? This will basically help me in finding out the score.
Finally, the algorithm that I am going to try.
From sklearn dot tree import decision tree regressor.
So, these are all my libraries.
Now, I want a dataset, which I will take from load diabetes, so we know that, x comma y is equal to l o a d underscore diabetes, and this we have to write return xy and here we have to make it as true, True.
So, we got our x and y also.
So, we have our x and y now.
So, let's move ahead,
So, this is our output, and that x was our input.
Now, we will make one model for this, so D T R E G R regressor DT regressor is equal to decision tree regressor… and if you wish to pass any parameters, then you can do that I am just passing random state,and initialising it as zero, that's it.
So, this is my D T R E G R and with dot fit I will pass this dataset for learning.
X and y, so I am letting it learn.
And after learning I will let it do prediction with D T E G R, dot p r e d predict, and here I will pass only x.
So this is the prediction.
Now, in y we have the actual predictions that are observed.
So, here you can see for 151, it has also given us 151, for 75 it has given 75, for 141 also it is giving 141.
So, it has given the output perfectly.
Now, we will take out its cross val score.
For that I will put a cross val score, and here I put our regressor, which is D T E G R, so I have put the regressor, along with that I will put x and y and cross validation is equal to I will pass 10 as the value.
So, let me run this, so it will run on 10 samples.
So, you can see this is the score, which is not that great at the time of cross validation, because here all the data is an overfitting I would say, you can see here up, that giving the exact same output, this is call as over fitting,
So its score is not that nice, and if we want to improve its score, then ahead we will see in the performance metrics session, seeing that you can improve its score or improve the prediction.
So, this is the way the decision tree regressor works.
So friends let's conclude here for today. We will Stop this session here.
And it's upcoming parts we will cover in the next session.
Till then keep learning and remain motivated.
If you have any queries or comments, click the discussion button below the video and post there. This way, you will be able to connect to fellow learners and discuss the course. Also, Our Team will try to solve your query.
good learning but the content titles are jumbled up, like first title of this module is decision tree dichotomiser which is practical part ahead of theory part. Same with the SVM practical 1 title has
Isakki Alias Devi P
yes, i am happy to learning for machine learning in LearnVern.it i s easily understanding for Beginners.
Superb and amazing 😍🤩 enjoyable experience.
Muhammad Nazam Maqbool
Absolutely good course... will suggest it to everyone. has superb content that is covered in a fantastic way.
super course and easily understanding and Good explaned
Ruturaj Nivas Patil
Very well explained in entire course. Great course for everyone as it takes from scratch to advance level.