‫Hello everyone.
‫In this video we will learn how to split our available data and do best and green site
‫then we will train our more than on training set and we'll find out script on our test site to create
‫that screen is split.
‫First we need to import the function as string split from a scalar.
‫We will write from a scalar dot model selection
‫import
‫Green s split
‫known to use this function.
‫We first need to define our four variables.
‫That is our independent Green variable a word independent best variable.
‫Then number dependent green variable and then dependent test variable.
‫So we'll cleared this for variable we'll write X underscored Green
‫we'll write X and the score.
‫Best
‫wire and best score green
‫and Y underscore test.
‫These are our four data frames and this will get the value of the output of our screen test split functions.
‫We'll write Green underscore best
‫and in record will first mention the word independent variable which is x Maruti
‫then our dependent variable which is why Mighty Few remember we created this very well known last lecture.
‫Then the next parameter is a size as mentioned in order to re lecture.
‫We are splitting our data and it between data issue.
‫So what 80 percent of data will go into training set and no 20 percent of data will go in to test site.
‫That's right here we will mention zero point two this zero point two means 20 percent of data will go
‫into slice and the last parameter is that domestic.
‫Does that I know them.
‫But you can give any integer value we are providing this number just to get the same sample every time.
‫So if I mentioned random I say equal to one every time while running this test string slight every time
‫my training and test site will remain same.
‫So even if you are using the same random estate as we are using you will also get the same training
‫site.
‫So we will just mention random status CEDAW if you want to get the same training set.
‫You should also mention random search as 0
‫not just to check the number of rows and columns in our training and test set will right bring X underscore
‫Crane dot shape dot shape but you give me the number of rows and columns
‫now you can see 80 percent of our data is in training say so.
‫Four hundred and four observations are in our training set and rest of 1 0 2 observations are in asset.
‫Now we will follow the standard process of creating a linear regression model will first create an object.
‫This time we will name it.
‫ELAM underscored a
‫and will equate it to linear regression.
‫Now we will train our model from our training set that is extreme.
‫And by train right
‫Lemond scored a dog fit.
‫Then we will mention our training set which is x and the school train and Y underscore underscoring.
‫This statement will fit our model on our training set.
‫Now let's create the predicted value of y using this model.
‫So we will write y underscored test
‫underscored a equate to a limb a predict
‫here.
‫I'm predicting my test dependent variable so I will give my test independent variable so I will write
‫X and the score test.
‫If I run this
‫I have my predicted value of test set and by underscore best underscore a similarly we will create by
‫underscore Crane underscore to a will get the predicted values of our training set
‫this time.
‫We will use X and the school crane
‫now to check the artist squared value for our training and test data.
‫We will import another function
‫we will write from a skill and not my tricks.
‫Import
‫import are to that score score scored
‫you don't have to learn on this in Texas.
‫You can just save a copy of this notebook or you can search online.
‫The index are readily available online now to get the artist good value.
‫We just need to mention ah to underscore discord.
‫This is a function we imported
‫if we want to get more detail about this function.
‫We can just certitude and help by using question mark operator can just write.
‫Question mark and if we executed we will get all the details.
‫So here.
‫If you see in the same index we need to mention our y underscore crew which is the order is not Y values
‫then we need to mention the Y predicted values really do the same.
‫And just blows this right out to that school to.
‫And then record will first rate y underscore
‫this
‫so y underscore test is our or is another value and Y underscore best underscore a is the predicted
‫value of y variable.
‫So we'll just run this
‫so the is good value is zero point five for now let's call the artist good value for our training set
‫fit on this the artist good value for our training set is zero points and five.
‫You can also see that the artist good value for our test data is less than the artist good value for
‫our training site as we discuss in the world to be lectures that test artist good value is of more importance
‫as compared to training site and we should always look at our test score instead of creating artist
‫good values to evaluate the performance of our model
‫that so you split your data into distant dream and by 10.