top of page
  • Writer's pictureBethel Empire

Predicting house price using age, distance from bus station and the number of grocery stores nearby

Updated: Nov 26, 2022

Alexander Olusegun Akiode

Masters Student of Artificial Intelligence

Birmingham City University

DISCLAIMER: This prediction result and procedure is strictly for educational, information and entertainment purposely only. Thanks.

The Aim:

In this blog, we shall be going through the process and the lines of code that was used to achieve:

1. AI digital model to implement house price prediction and also

2. Be able to generate GUI calculator

We shall be using a modified form of the dataset

#Storyline 1: For me to cook and be able to get an edible food served on the dinning table, I will need to have my raw food and food processes. The Dataset will be the raw food to be cooked, while the food processes that will make the food edible will be the existing libraries, modules, functions and variables that has been processed from the digital agricultural farm. Please come along as we use both to achieve our aim and objective.

# Quick summary for the story line:

# Raw food == Dataset

# Food processors == These are the existing libraries

#Storyline 2: Below is the link to the raw food (Dataset)

#Storyline 3: Below are some of the food processors that will help to make our food presentable (data visualisation) and edible(AI model output). We shall be using them one by one to ensure we follow due process so the food can come out well. Other ingredients will be introduced as we go along


#Storyline 4: I have deliberated singled this food processor (panda library) out because it is the first important library through which we will process our raw food (dataset)

# Importing pandas

import pandas as pd

#Storyline 5: Now we first need to put the food processor (pandas) to work.

The work here will be; reading our file using the location path

Note: Pandas is a software library written for the Python programming language for data manipulation and analysis. In particular, it offers data structures and operations for manipulating numerical tables and time series.

To have a glance of the numerous data columns and rows, we print the ‘head’ which is automatically the first five and the last five rows of the table.

You will observe below that we have 8 columns of which the first one is not required. We have 414 rows and 8 columns here, subsequently, we will have to drop the unnecessary column.

#Storyline 6: Now, before we had to cook our raw food, we needed to preserve it somewhere. MongoDB is the storage container we shall be adopting to run this program.

#Storyline 7: Now we are beginning to arrange our raw food (dataset) accordingly for easy usage

NOTE: Please be aware that you will have to put your MongoDB username and password here before it can run your dataset from your collection perfectly.

#Storyline 8: Now we will organise the raw food accordingly on our food preparation tray

#Storyline 9: We took the raw food out of the storage unit and we discovered we wont need all of it so we only selected the quantity or content (features, rows, columns) we need to give a fair prediction result model. After which we only placed (insert) the cleaned raw food( pruned dataset) in the preparation tray accordingly.

#Storyline 10: Now for us to be able to start picking the raw food one by one, we need to use the find function to locate and retrieve the stored raw food (dataset)


#Storyline 11: Removing unwanted food content

#Storyline 12: Re-accessing the content of of the raw food

#Storyline 13: Defining the content of the raw food and the cooked food will help us predict what the cooked food will look like.

#Storyline 14: We will check the accuracy of the content of the raw appropriately so we do not cook dirt with it(checking our dataset content accuracy one by one)




From the model check above, Linear regression is the most preferred with more accurate prediction result.



#Storyline 15: The food is ready. Thanks

However, it will be glad to know how the GUI works. Since I am only using three features “house age, distance to station and number of stores around. These will be our parameters to predict the price of houses within the location. Just input these features and the target will be achieved. See sample input and results below

From above, we had a house aged 12, distance from station at 8meters and number of stores in the area as 5. When we calculated it using the house price prediction, we got the price of the property to be £466,744 worth.

### Model flowchart

### Video presentation

20 views0 comments

Bình luận

bottom of page