Skip main navigation

Housing Price Prediction Using Neural Networks

Our machine learning model must predict the median house price. We will train the model using Boston housing data. The machine learning model we will use this time is an artificial neural network.

Do you know where Boston is? Boston is the northeastern city in the U.S. Boston is considered one of the major cities in the U.S. such as New York, San Francisco, Chicago, and Washington D.C. Probably, you heard housing prices in the world major cities are high! Boston is not an exception. The median price of Boston house is more than $700,000 in 2019.

The median price is above $700,000, but there are more or less expensive districts in Boston. What does determine the price of houses?

Housing Price Prediction Using Neural Networks

We will figure out this using the Boston housing data set from Kaggle. The Boston housing data set we will use is from Harrison and Rubinfeld’s 1979 paper. We will solve the problem using a set of features that describe a house in Boston. Our machine learning model must predict the median house price. We will train the model using Boston housing data. The machine learning model we will use this time is an artificial neural network.

In this dataset, each row describes Boston’s town or suburb. There are 506 rows and 13 attributes with a target column. The target column is the median value of owner-occupied homes.

We are using 13 attributes. Those 13 attributes are ‘per capita crime rate by town,’ the proportion of residential land, proportion of non-retail business, Charles river dummy variable, etc. A dummy variable has a value of 1 or 0. For instance, if the house is near Charles river, a dummy variable will be 1. Otherwise, 0.

Artificial Neural Network

Before we talk about analyzing this data using a neural network, let’s briefly discuss the artificial neural network. You probably guess where this name came from. Yes, it is from our neuron system. When we have some signals to our neuron, a neuron will process that and transfer. The same thing happens in the artificial neural network. When inputs come in, this will be combined and processed and then result in the output.

Simple Neural Network

In our Boston housing problem, inputs can be 13 attributes, and output will be the results that are housing prices. In this picture, the circle which does the same function as a neuron. It calls the hidden units or hidden nodes.

I am showing you the simplest structure of a neural network. We call it a single-neuron network. Can we make a more complicated one? Yes

Multi- Layer Neural Network

This is how the usual neural network looks like. The neural network usually has three different layers. The first layer is the input layer, where you will input the attributes. Then there are hidden layers. In hidden layers, a lot of computation happens to send the output from the calculation to the output later. The circles in each layer are called nodes. We can have as many hidden layers as we want. But more hidden layers mean more complicated networks.

Let’s go back to our Boston housing example. Our 13 attributes will go to the input layer. These inputs will pass to the first hidden layer. You will see many lines that connect the input layer’s nodes to the first hidden layers’ nodes. All or a few selected input nodes are connected to one of the hidden layer nodes. Each connected line has a different strength. Then this repeats from the 1st hidden layer to the 2nd hidden layer. And then to the output layer. Our final output is the weighted combination of some values from the input layer to many layers of the hidden layer.

Let’s go in a little deeper. For instance, from the input layer to the first node in hidden later, the weighted sum of the input nodes value will be transmitted. Then there will be a value added to this number. We call this bias. Then this number will be input to some function. The function we can use can be various. It can be a simple linear function, but it can be a very complicated non-linear function. This is where the neural network can introduce a lot more complications than linear regression!

Neural Network Applications

You have likely heard about face recognition these days. We can find so many applications of artificial neural network in these days not only solving business problems but also providing a lot of technical solutions.

This article is from the free online

Artificial Intelligence and Machine Learning for Business

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education