Summary

Introduction

This is a predictive analysis for housing price analysis, one of the ongoing community prediction competitions on Kaggle. (https://www.kaggle.com/c/home-data-for-ml-course/overview)

I used and practiced Ridge Regression for this competition as it contains a lot of x variables having high correlation to target variable(housing price).

Correlation between major X variables and y variable

Correlation between major X variables and y variable

Datasets

Train Data → 79 X variables related to houses and sales prices (y variable). Total 1,460 rows.

Test Data → 79 X variables related to houses. Total 1,459 rows.

Language and libraries

Python, Pandas, Sklearn, Seaborn

Data Preprocessing

Outliers

I found some ‘bad’ outliers that deviated from overall trend in ‘GrLivArea’ and ‘GarageArea’ columns which are major continuous variable in the datasets. As I am going to use Linear Regression model with Ridge, I considered to delete these outliers because they can provide wrong information about the columns and make receive more penalty when the model is fitting. Test score was improved when these outliers are removed.

                Bad outliers in ‘GrLivArea’ column

            Bad outliers in ‘GrLivArea’ column

              Bad outliers in ‘GarageArea’ column

          Bad outliers in ‘GarageArea’ column

Imputation

Some columns(’Alley’, ‘PoolQC’, ‘Fence‘ and ‘MiscFeature’) having more than 60% of missing values are removed as there are too small number of data which can be used as reference for imputation. I used ‘mean’ value for missing values in numerical columns. Also, missing values in categorical columns are filled with ‘-1’ to mark that missing values are different from current categories.