Predicting Real Estate Prices with Machine Learning: A Guide to Using Sequential Models
Real estate is the world‘s largest asset class, valued at over $300 trillion globally as of 2022. For most people, a home is the most expensive purchase they will ever make. And for investors and financial institutions, real estate makes up a significant portion of portfolios and balance sheets.
Given the enormous economic impact of real estate, it‘s no surprise that an incredible amount of time and resources are spent trying to anticipate its future direction. Where are prices headed? Which properties and locations are likely to appreciate the most? What are the key factors driving valuations?
Traditionally, appraisers and analysts made largely subjective estimates based on experience and intuition. But in recent years, a more scientific approach has emerged: machine learning.
By training computer algorithms on large volumes of real estate data, it‘s now possible to build highly accurate predictive models for property prices. And one of the most promising techniques is known as sequential modeling.
How Sequential Models Work
A sequential model is a type of machine learning architecture well-suited for data that has a natural order or sequence, such as time series data or natural language.
In the case of real estate, the sequence is the historical progression of a property‘s characteristics and sales prices over time. By analyzing patterns in this sequence, a sequential model can learn to predict future values.
Here‘s a simplified overview of how it works:
- Start with a dataset of property transactions, including things like:
- Sale price and date
- Location
- Square footage
- Number of bedrooms and bathrooms
- Year built
- Lot size
- Etc.
- Normalize the data and split it into training, validation, and test sets.
- Define a sequential model architecture specifying the type and number of layers. Each layer feeds into the next in sequence.
- Dense layers
- Activation functions like ReLU, sigmoid
- Dropout layers to prevent overfitting
- Output layer predicting price
- Train the model on the historical sequence of data. This involves:
- Forward and backward passes through the layers
- Adjusting weights via optimization algorithms like gradient descent
- Multiple training epochs until performance plateaus
- Evaluate the trained model‘s predictive accuracy on the unseen test set.
- Use the model to forecast prices for new properties by providing their features as input.
While the mathematical details get complex, the key point is that the model is able to automatically learn the most significant patterns and relationships in the data. The sequence of dense and activation layers are very good at representing complex nonlinear functions.
With sufficient data and a well-designed architecture, sequential models can pick up on subtle and unintuitive factors that even expert human appraisers might miss. The result is predictions of remarkable accuracy.
Factors Affecting Prediction Accuracy
Of course, machine learning is not magic and predictions will never be 100% perfect. The quality of the results depends on a number of important factors:
Data Quantity and Quality – The more comprehensive and clean the historical data, the better the model will learn. Data should cover a representative sample of properties across different times, locations, and price ranges. Noisy or missing data will degrade performance.
Feature Selection – Including the right set of input features is crucial. The most predictive attributes aren‘t always obvious. In addition to standard fields like square footage and location, things like crime rates, school districts, and proximity to amenities can have significant explanatory power.
Careful feature engineering – creating new input signals from raw data – is often the secret to squeezing out incremental model improvements. Ratios like price-per-square-foot or days on market can be more informative than the raw values themselves.
Model Architecture – The arrangement of layers and hyperparameters like learning rate determine how well the model can capture patterns while still generalizing to new data. Too simple and it won‘t learn well, too complex and it may overfit. Finding the optimal architecture often involves extensive trial and error.
Economic Conditions – Real estate prices are inextricably linked to the health of the overall economy. Even the most accurate model will struggle to predict a sudden downturn like the 2008 financial crisis or the impact of an unforeseen event like COVID-19. Incorporating macroeconomic indicators into the model can help, but there will always be some irreducible uncertainty.
Prediction in Practice
To illustrate the potential of sequential models for real estate, let‘s look at an example.
Researchers from the University of Texas at Austin and Northwestern Polytechnical University recently developed a long short-term memory (LSTM) neural network for predicting house prices. LSTMs are a type of sequential model known for being able to learn long-term dependencies.
The team trained their model on a dataset of historical house sales in California from 2008-2018, including variables such as sale price, square footage, number of bedrooms/bathrooms, zip code, and date. They used a walk-forward validation strategy, making one-step ahead predictions and retraining after each time step to simulate the way the model would be used in practice.
The results were impressive. Compared to a standard linear regression, the LSTM achieved over 20% lower mean absolute error – equivalent to being $50,000 closer to the actual sale price on average for a median priced home. Even more significantly, the LSTM outperformed experienced human appraisers by a wide margin.
As the authors note, "the model can make a decent price suggestion by just taking the house information, with no need of the homeowner name, credit score, incomes and other sensitive information that are usually used by bank appraisers."
This is just one example of the many ways machine learning is being used to transform real estate. From mortgage underwriting to property management to urban planning, barely an aspect of the industry has been untouched.
Getting Started
If you‘re interested in applying sequential models to your own real estate price predictions, there are a number of great open source resources to get started:
- Zillow‘s Zestimate competition on Kaggle includes a cleaned dataset of property sales and tutorials for building models
- This end-to-end walkthrough shows how to forecast real estate prices using an LSTM in Python
- Fast.ai‘s Practical Deep Learning for Coders course includes a real estate case study
While the barrier to entry has never been lower, it‘s important to remember that machine learning is a complex and rapidly evolving field. Before deploying a model in a high-stakes scenario like actual trading, it‘s essential to have a deep understanding of the underlying math and methodology.
That said, the potential rewards are more than worth the effort. We are still in the early innings of real estate‘s big data revolution. As investors, lenders, brokers, and other market participants adopt these tools, those who stay ahead of the curve stand to reap significant profits.
Over time, machine learning will likely become table stakes. The ability to accurately forecast property cash flows and anticipate market shifts will go from being a nice-to-have to a must-have in order to stay competitive.
So while the multi-million dollar question of where real estate prices are headed next is unlikely to ever be answered with 100% certainty, one prediction seems clear: The future of real estate will belong to those who embrace the power of predictive analytics.