Welcome to the basic tutorial of using pipelines and solving a regression problem. In this particular example, we are going to use the house price data. We will have different features like building cost, zoning classification, lot size, road access, lot configuration and various other features and we have to predict the sale price of that particular house. So let's get started. We are going to run the code on the Kaggle kernel platform. If you want this code, the link to this particular code is provided in the description section below. All you need to do is click on it, log into Kaggle and you will get started with it. First, we will begin by importing libraries. We are going to import numpy and pandas. Also, we are going to do model selection as usual. Then two important things that we are going to import here. One is the make pipeline from pipeline and one is the compose from make column transformer. Now what make column transformer does is it takes various kinds of transformations to different set of variables and then combines it. Although we are going to do a simple version of it, but I am going to still use this just to showcase how this is going to be used. Next, we are going to also import a imputing strategy. We are going to impute it using the KNN imputer. Then we are going to do select k best features just to shorten the length of features that we could use and then we will use k bence discretizer to basically bend the numerical variables. On top of it, we will do a linear regression and check the mean square error of the regression model outcomes. So, let us import the data. I have two different files that I need to import, the train and the test. So I have imported them, the train data is imported within train data frame and the test data is imported within sub-test. This is the data frame that we will be using to predict and participate within the competition. So, let us run this. So, if I run it, the data is imported and I can look at the train data. As you have seen, all the variables are present. Sales price is something that we need to be predicting. So, let us move ahead. We will move ahead and now split the data into train and test. I will take Y as sales price and rest of the variables except sale price and ID will be the X variables. I can split the data into X train and Y train, X test and Y test and the test size we are going to take is 0.2. We are going to take a random state of 200 to ensure that our split always remains constant and we will be able to reproduce our outcomes. So if I did this, my train data is now split into train and test. Now let us get all the numerical variables to get started with. So, we are going to just pick out all the numerical variables and leave out any object variables that are possible. The next video we will try to get the object variables as well and then see how we can improve the model from this particular current state. So I have taken the numerical variables here by using a generator which means if there are any data type that is integer and float within the X variables they will get selected. So if I run this code, I will basically get all the numerical features that are required to build the model. Now let us go ahead and build the pipeline. So to build the pipeline, what we will do is we will take the make column transformer and for this particular example we could also just start with the make pipeline but I wanted to have this step here so that we could include another pipeline in the next video. Remember make column transformer is used when you have two or more variations of transformations on features you want to do. In this particular example, we just have numerical type of features that we want to transform and we will be doing the pipeline in this particular method. So we will begin with make pipeline. We will take the K&N imputer strategy like we have spoken about earlier and then we are going to take all of the variables that have been imputed and then we will create bins out of it. The maximum bin is going to be 6. If there are anything less than 6 it will just give us a warning. Next we will also select the top 15 variables for this particular model rather than taking all of the variables that are getting produced and we will do all this transformation on the numerical features that we have identified earlier. Now moving on to creating the pipeline along with linear regressions. For this particular example, we are just going to take a religion regression base model. So whatever pre-processor pipeline we have created, we are going to append that to a linear regression pipeline and then we will make another pipeline. So remember we are using the same make pipeline and just attaching the linear regression to that pipeline. We have all that is needed to build the model. We have the transformation steps, the pre-processor steps and the model attached in one pipeline called RIG model. Now let's build the model. So to build the model what I am going to do is I am going to say RIG model dot fit and say run. Now it will run. If there are any bins which are less than the one that we have defined it will just show us a warning but this is fine to go ahead and do the execution. So as you can see you will see the linear regression model is built. Now let's check the accuracy using RMSC. We are going to use the RIG model to predict on X train and get the Y train predicted and similarly we are going to get the Y test predicted. We are going to do the RMSC on top of these two and let's look at what we got the score for these two. So the train RMSC is around 40,000. Test RMSC is around 50,000. So there is still scope to improve these particular scores and we will try to improve the scores using the categorical variables within this particular data set in the next video. Also we will try to use random forest and see if we can still further improve the RMSC. So to make the submission what we are going to do is we are going to predict on the submission test data set that we have. We are going to drop the ID and take the rest of the variables and predict on top of it. So we will predict now what we will do is we will create the ID and take the predictions that we just have within one data set and then finally submit this particular model to Kaggle. So if I run this particular code I will basically get a ID and sales price. So in this way we are able to use a simple pipeline to predict house prices in the house prices data set. Now I have submitted this code by saving this particular code and going to the output and hitting submit to prediction and once I submitted that particular output to the competition I was able to get a score 0.23. The closer it is to 0 the more better our model is. So on the leaderboard we have a score of 0.23 which is a decent start but there is still scope of improving the accuracy. Anyway guys thank you for watching this video. If you like this video please hit the thumbs up button and please don't forget to subscribe to my channel.