Introduction

The goal of this project:

To predict the resale prices of HDB Flats according to their specifications such as the floor area, storey, location etc.

The dataset used for this project can be found here.

1. Motivation and Problem Definition

In September 2022, the prices of Housing Board resale flats in Singapore continued to rise for the 27th consecutive month, with a staggering 45 units sold for at least $1 million in September alone. In the same year, a total of over 27,000 of resale applications were registered . Now that, is a big number for a small nation like Singapore. With inflation and other economic factors, it has become increasingly challenging to determine the fair value of a resale flat in such a volatile market.

With this many people buying and selling flats, a question comes to mind, how much is my flat worth, or for the buyers, how much is a reasonable price to pay for a flat like this? Wouldn’t it be nice if I could input the basic details of a flat and get a rough estimate of the resale price to make sure that the deal is decent?

That is exactly the motivation behind our project. We want to implement a model that helps both buyers and sellers predict the resale price of a specific flat, such that they will be able to make a more informed decision.

Thus, our problem definition is How will the different variables of a resale flat affect its resale price? And the goal of this mini project is to create a model that can accurately predict the sale price of a flat to help buys and sellers make a more informed decision.

2. Models

  1. Linear Regression Linear Regression is one of the simplest model to implement and we tried to use it as a baseline in terms of accuracy. On average for both Train and Test data, it had R² value of 0.68 and Root Mean Squared Error (RMSE) of 94000 which is bad. This was not the result we wanted, thus we decided to explore further on how we can improve these metrics.

  2. Random Forest Regression Random Forest is a type of Ensemble learning that combines the output of multiple decision trees to reach a single result and handles both classification and regression problems. This is the first time we utilise this model and while it did provide us with a tremendous improvement in R² (0.88), we decided to not use this model because we could not visualise the tree properly since the number of branches increased exponentially as the depth increased.

  3. Polynomial Regression Upon further inspection, the relationship between resale price and its features were not really linear. Hence, we decided, why not we try to use a curve to represent this relationship? Similar to the previos model, we have not tried Polynomial Regression before.

We started off with the basic degree 2 and realised a great improvement in R² (0.76) and RMSE (81000). However, we also realised that as the degree increased, the R² increased as well since the model will try to fit its curve to all the data points. But, the RMSE did not necessary increase in all cases. Furthermore, this increases the risk of over-fitting the model.

To resolve the issue of retrieving the optimal degree for polynomial regression, we must first think of the goal for our results, that is too minimise the RMSE as much as possible because we already know that a higher degree yields a higher R² value. We implemented GridSearchCV to do the work for us. The parameters were set up as such, Degree Range of 1 - 10 and Scoring based on Negative RMSE. The reason why it uses negative RMSE is such that the highest "negative RMSE" will be returned and that translates to the lowest RMSE, which is what we want.

After a long 255 minutes and 28 seconds, the optimal degree GridSearchCV returned was 5 and its corresponding RMSE is 72000. That is a whopping 20% decrease in RMSE compared to Linear Regression!

3. Insights and Conclusions

We chose to implement the Polynomial Regression of Degree 5 for the prediction of the resale prices. However, we did find some unexpected issues with the prediction.

  • Negative Resale Price Interestingly, a negative resale price was possible! But how? It turns out we did not limit the user inputs. For instance, a 2 Room HDB Flat should not have a floor area (sqm) of 100. Thus, to reduce the risk of a negative resale price, we implemented additional constraints to ensure the user inputs are valid.

To further minimise this risk, we utilised Polynomial Regression of Degree 4 as a backup model in case the Degree 5 model predicts a negative resale price. Additionally, the Linear Regression model serves as the final solution to the issue of negative resale price.

  • Conclusion
    We hope that such models will be able to help individuals make a more informed decision such that they will be able to buy or sell their flats at a fair price and save the hassle of searching for the best price.

Built With

Share this project:

Updates