Mar 15, 2017 · post

Predicting NYC Real Estate Prices with Probabilistic Programming

Probabilistic Real Estate is a prototype we built to explore the New York City real estate market. As explained in a previous post, we used probabilistic programming’s ability to incorporate hierarchical models to make predictions across neighborhoods with sparse amounts of pricing data. In this post, we’ll focus on how we designed the prototype to capitalize on another strength of probabilistic programming: the ability to generate probability distributions.

Prototype Overview: Price Mode

Screenshot of Probabilistic Programming in price mode, showing all five boroughs of NYC.

In price mode, Probabilistic Real Estate shows the median price for each neighborhood.

In price mode, the prototype’s most conventional view, the strength of the orange shading is determined by the median price for each neighborhood. This creates a heat map of relative neighborhood real estate prices. The most expensive neighborhoods are clustered in Manhattan, with nearby Brooklyn and Queens neighborhoods a close second. The map view is complemented by the sidebar, which provides a list of the neighborhoods ordered by price. Use the sidebar to quickly spot things like the most expensive neighborhood (the Upper East Side).

Animated GIF showing the prototype in price mode with the year being cycled through from 2010 to 2018.

Changing years shows the change in median prices over time.

Use the year selector in the bottom right corner to cycle from the past (2010) to the predicted future (2018). You can see the dark orange of high median prices spread out from Manhattan further and further into the surrounding boroughs as the years progress.

Neighborhood detail view of Prospect Heights neighborhood in price mode.

The neighborhood detail view shows the probability distribution for the selected neighborhood.

Clicking on a neighborhood reveals a more detailed view. A map of hexagonal groups (roughly five blocks each) provides more geographically specific price predictions. The graphs on the left reveal the strengths of the probabilistic approach by showing not just the median price, but the entire probability distribution. This distribution is calculated using samples generated by the model. Each sample can be considered a simulation of the way events could play out in a world described by our model. The prices for the 25th and 75th percentiles are highlighted, showing the range of likely prices. How close those percentiles are to the median predicted price is partly an indication of forecast uncertainty. In the “Probability by Year” chart they move farther apart in future years where the uncertainty grows.

Probabilistic Possibilities: Probability Mode

Neighborhood detail view of Prospect Heights neighborhood in probability mode.

In probability mode, the neighborhood detail view shows how the selected price impacts the probability you would be able to afford a property in that neighborhood.

The possibilities of utilizing the entire probability distribution are further explored in probability mode, the prototype’s other, less conventional, mode. Price mode gives you a sense of real estate price dynamics across the city. Probability mode is more focused. It allows you to choose an amount of money and then uses each neighborhood’s probability distribution to show your chances of being able to afford a property within that neighborhood.

Animated GIF of changing the price while in detail view of Prospect Heights in probability mode.

When you change the price, the probability is recalculated using each neighborhood’s probability distribution.

The probability calculation is visualized very clearly in the neighborhood detail graph. The black line is the selected price: based on your criteria, you can afford all samples less than that price (to the left of it). The probability that you could afford a property within that neighborhod, then, is represented by the set of samples less than the selected price divided by the total number of samples. Use the graph to see that how much paying an additional $100,000 improves your chances depends on where the selected price is in the distribution. In Prospect Heights in 2016, going from $1.1M to $1.2M improves your chance of affording a property by 2% (from 2% to 4%), while going from $1.7M to $1.8M increases your chance by 7% (from 35% to 43%).

While we chose to frame the neighborhood probability as how likely it is you would be able to afford a property in that neighborhood, you could also look at it as a prediction of the percent of properties for sale in that neighborhood that you would be able to afford. In this model, they are the same thing.

Comparing the shapes of the probability distributions across different neighborhoods also provides valuable information. A flatter distribution can indicate both a wider variety of prices in that neighborhood and a greater degree of uncertainty.

Overview of all neighborhoods in probability mode.

In probability mode, the probability for each neighborhood is calculated using that neighborhood’s probability distribution.

Returning to the overview of the neighborhoods in probability mode, we see something that looks roughly like the inverse of the price mode overview we started with. This makes sense: as probability mode focuses on where you could afford property, it highlights neighborhoods with lower prices. As we just saw, however, the calucations here are subtler then you might initally suspect. Your chance of affording a property in each neighborhood is calcuated using the entire probability distribution, allowing for different results across neighborhoods with different distribution shapes.

Go Explore!

In this post we showed some of the product possibilities opened up by probabilistic programming’s ability to quantify probabilities. Now that you’ve heard a bit about that from us, we hope you explore the Probabilistic Real Estate prototype to get a feel for it in practice. Here are some questions to get you started:

Beyond Real Estate

The usefulness of probability distributions extends well beyond real estate prototypes. Read our interview with Thomas Wiecki to see how they can be used in predicting stock market behavior, and keep an eye on this blog for an upcoming post on how we used probabilistic programming to model the likelihood of loan repayment.

Read more

Mar 22, 2017 · talk slides
Mar 13, 2017 · talk slides

Latest posts

Nov 15, 2020 · post

Representation Learning 101 for Software Engineers

by Victor Dibia · Figure 1: Overview of representation learning methods. TLDR; Good representations of data (e.g., text, images) are critical for solving many tasks (e.g., search or recommendations). Deep representation learning yields state of the art results when used to create these representations. In this article, we review methods for representation learning and walk through an example using pretrained models. Introduction Deep Neural Networks (DNNs) have become a particularly useful tool in building intelligent systems that simplify cognitive tasks for users. more
Jun 22, 2020 · post

How to Explain HuggingFace BERT for Question Answering NLP Models with TF 2.0

by Victor · Given a question and a passage, the task of Question Answering (QA) focuses on identifying the exact span within the passage that answers the question. Figure 1: In this sample, a BERTbase model gets the answer correct (Achaemenid Persia). Model gradients show that the token “subordinate ..” is impactful in the selection of an answer to the question “Macedonia was under the rule of which country?". This makes sense .. good for BERTbase. more
Jun 16, 2020 · notebook

Evaluating QA: Metrics, Predictions, and the Null Response →

by Melanie · A deep dive into computing QA predictions and when to tell BERT to zip it! In our last post, Building a QA System with BERT on Wikipedia, we used the HuggingFace framework to train BERT on the SQuAD2.0 dataset and built a simple QA system on top of the Wikipedia search engine. This time, we’ll look at how to assess the quality of a BERT-like model for Question Answering.
May 19, 2020 · notebook

Building a QA System with BERT on Wikipedia →

by Melanie · So you’ve decided to build a QA system. You want to start with something simple and general so you plan to make it open domain using Wikipedia as a corpus for answering questions. You want to use the best NLP that your compute resources allow (you’re lucky enough to have access to a GPU) so you’re going to focus on the big, flashy Transformer models that are all the rage these days.
Apr 28, 2020 · notebook

Intro to Automated Question Answering →

by Melanie · Welcome to the first edition of the Cloudera Fast Forward blog on Natural Language Processing for Question Answering! Throughout this series, we’ll build a Question Answering (QA) system with off-the-shelf algorithms and libraries and blog about our process and what we find along the way. We hope to wind up with a beginning-to-end documentary that provides:
Apr 1, 2020 · newsletter

Enterprise Grade ML

by Shioulin · At Cloudera Fast Forward, one of the mechanisms we use to tightly couple machine learning research with application is through application development projects for both internal and external clients. The problems we tackle in these projects are wide ranging and cut across various industries; the end goal is a production system that translates data into business impact. What is Enterprise Grade Machine Learning? Enterprise grade ML, a term mentioned in a paper put forth by Microsoft, refers to ML applications where there is a high level of scrutiny for data handling, model fairness, user privacy, and debuggability. more

Popular posts

Oct 30, 2019 · newsletter
Exciting Applications of Graph Neural Networks
Nov 14, 2018 · post
Federated learning: distributed machine learning with data locality and privacy
Apr 10, 2018 · post
PyTorch for Recommenders 101
Oct 4, 2017 · post
First Look: Using Three.js for 2D Data Visualization
Aug 22, 2016 · whitepaper
Under the Hood of the Variational Autoencoder (in Prose and Code)
Feb 24, 2016 · post
"Hello world" in Keras (or, Scikit-learn versus Keras)


In-depth guides to specific machine learning capabilities


Machine learning prototypes and interactive notebooks


A usable library for question answering on large datasets.

Explain BERT for Question Answering Models

Tensorflow 2.0 notebook to explain and visualize a HuggingFace BERT for Question Answering model.

NLP for Question Answering

Ongoing posts and code documenting the process of building a question answering model.

Interpretability Revisited: SHAP and LIME

Explore how to use LIME and SHAP for interpretability.


Cloudera Fast Forward is an applied machine learning reseach group.
Cloudera   Blog   Twitter