Select Page

### Introduction

Being able to estimate the price for your house is useful. In this blog post, I show how I used real-world data from Property24 to build a small model using machine learning that is able to predict the price for a house in Tokai Cape Town with some level of accuracy.

### Viewing The Data

I began by loading up the data into a Pandas data frame on a Kaggle Notebook. The linear regression machine learning algorithm needs at least one feature (input) and one label (output). I guessed that for this model the number of bedrooms, number of bathrooms, number of cars that can be parked and the square meterage could be the features and the house price the label. This I considered, could produce a model to predict the price for a house in Tokai Cape Town. ### Plotting Two Graphs

For the linear regression algorithm to work there needs to be a linear, exponential, cubic or other relationship between each feature and the label. In order for me to see if this relationship exists in my data, I plotted the graphs shown below. Analysing the relationship between my features and label, I concluded t that linear regression should work to build my desired model.    ### Using The Linear Regression Algorithm

The next step of my operation was to use multi-featured linear regression to fit a line graph through data that could then be used to predict a certain output. I performed this method using Python and a module called Sklearn. The parameters of my hypothesis function (model) are seen below along with some other metrics such as the R-squared value. ### Conclusion

As you can see above, it looks like linear regression worked. The model (shown below) appears to estimate the price of a house in Tokai Cape Town with some level of accuracy. I hope that this blog post inspires you to use machine learning.

It is worth noting that more investigation is needed to ensure the best results.

* Since technology is continually developing, by the time you read this blog the products used may have changed.

House Price:

0.00