A US-based housing company named Surprise Housing has decided to enter the Australian market. The company uses data analytics to purchase houses at a price below their actual values and flip them on at a higher price. For the same purpose, the company has collected a data set from the sale of houses in Australia. The data is provided in the CSV file below.
The company is looking at prospective properties to buy to enter the market. You are required to build a regression model using regularisation in order to predict the actual value of the prospective properties and decide whether to invest in them or not.
The company wants to know:
Which variables are significant in predicting the price of a house, and
How well those variables describe the price of a house.
Also, determine the optimal value of lambda for ridge and lasso regression.
A US-based housing company named Surprise Housing has decided to enter the Australian market. The company uses data analytics to purchase houses at a price below their actual values and flip them on at a higher price. For the same purpose, the company has collected a data set from the sale of houses in Australia. The data is provided in the CSV file below.
The company is looking at prospective properties to buy to enter the market. You are required to build a regression model using regularisation in order to predict the actual value of the prospective properties and decide whether to invest in them or not.
The company wants to know: -Which variables are significant in predicting the price of a house, and -How well those variables describe the price of a house. -Also, determine the optimal value of lambda for ridge and lasso regression.
We are required to model the price of houses with the available independent variables. This model will then be used by the management to understand how exactly the prices vary with the variables. They can accordingly manipulate the strategy of the firm and concentrate on areas that will yield high returns. Further, the model will be a good way for management to understand the pricing dynamics of a new market.
Dateset could be found here: https://github.com/rahul2july/housingpriceprediction/blob/main/data_description.txt
In summary, for ridge:
-the best hyperparameter alpha is 6.0
-r-squared train = 0.8863, r-squared test: 0.8734
-There is improvement in r-squared test when compared to linear regression.
-Top 5 features defining "SalePrice" are:
- OverallCond
- BsmtFullBath
- 2ndFlrSF
- BsmtFinSF2
- GrLivArea
In summary, for lasso:
-the best hyperparameter alpha is 0.0001
-r-squared train = 0.8901, r-squared test: 0.8778
-There is improvement in r-squared test when compared to linear regression.
-Top 5 features defining "SalePrice" are:
- BsmtFullBath
- OverallCond
- OverallQual
- BsmtFinSF1
- 1stFlrSF
RSS is very close for both the models viz. ridge regression and lasso regression.
We could see that Lasso seems to be performing a little better out of the three models wrt. mse.
Since Lasso will penalize more on the dataset and can also help in feature elimination hence we are going to consider that as my final model.
-python - version 3.9.13
-numpy - version 1.22.2
-pandas - version 1.4.1
-matplotlib - version 3.5.1
-seaborn - version 0.11.2
-sklearn - version 1.1.1
-statsmodels - version 0.13.2
This project was inspired by Linear Regression Assignment as part of Data Science course.
This project was based on: https://learn.upgrad.com/course/1991/segment/25160/150983/463809/2405074
Created by [@rahul2july] - feel free to contact me!
Contributor -Rahul Gupta