← ProjectsGeospatial2026Deployed

Real Estate Comparables Finder

Finding underpriced homes in a South Florida MLS export: the cheapest quarter of active listings is compared against closed sales within 1 km, the ten most similar sales are picked by cosine similarity, and listings priced at least $120k below them are flagged as buying opportunities.

Pythonpandasscikit-learnFoliumopenpyxlLeafletReact
435
Active listings screened
37
Opportunities ≥ $120k below comparables
−34%
Median gap to comparable sales
01

Introduction

SummaryTwo minutes

Which of the homes on the market right now are priced well below what similar homes nearby actually sold for? This project answers that for a South Florida MLS snapshot: 435 active listings checked against 4,958 closed sales.

It automates the comparable-sales method an appraiser uses. Take the cheapest quarter of the listings, look at every sale within a kilometre, keep the ten that are most alike in age, size and construction, and compare prices. Listings at least $120k under their comparables are the shortlist. The whole pipeline runs again in your browser below: move the sliders and it re-prices every listing.

02

Context

ProblemBefore

An investor scanning hundreds of active listings cannot price each one by hand. A low list price alone says nothing: it may be a bargain, or simply a smaller, older home in a cheaper street.

ApproachAfter

Do what an appraiser does, automatically: for every cheap listing, find the homes sold nearby, keep the ten most similar in age, size and construction, and compare the asking price with what those homes actually sold for.

Who it was built forDomain expert

The tool was built for Felipe Zurbaran, a friend working in real estate who wanted a repeatable way to shortlist investment candidates from MLS exports instead of reading them listing by listing. Felipe set the rules a deal had to meet. The code turns those rules into parameters:

Cheap
List price in the bottom 25% of the active listings
Nearby
Comparables are closed sales within 1 km
Alike
Same kind of sewer, construction and water service, similar year and living area
Worth it
At least $120,000 below the mean sale price of the ten best comparables
03

Data

The datasetMLS snapshot, 14 Apr 2026

Three CSV exports from the MLS: one of active listings and two of closed sales, with no MLS numbers shared between the two closed-sale files. They cover Miami-Dade and Broward. Each row has the price, coordinates and the features used for matching.

Active
439 listings, 435 after the sanity checks; list prices from $160,000 to $450,000
Closed
5,136 sales, 4,973 with every feature present, 4,958 after the sanity checks
Features
Year built, living area, and three multi-valued tags: sewer, construction and water
Location
Latitude and longitude; distances are great-circle (haversine) kilometres
Cleaning and privacyBefore publishing

Prices arrive as "$1,234" strings and living areas with thousands separators, so both are parsed first. Closed sales missing any feature or the sale price are dropped. The original notebook stopped there. Its top "opportunities" were data-entry errors, so this version adds the checks the prototype already had:

  • Prices below $10,000 removed: a $75 and a $329 listing were rents or per-square-foot figures typed into the price field.
  • The $123,456 placeholder price removed from both files.
  • Coordinates outside Florida removed: one listing was geocoded in Colombia.

The raw exports also hold street addresses, MLS numbers, listing remarks and agents' phone numbers and emails. None of it is published: the page receives only the eleven fields the pipeline reads, with the categories stored as codes.

04

Methodology

Pipeline
MLS export (active + closed)Clean prices, size, yearTargets: list price ≤ Q1Closed sales within 1 kmTop 10 by cosine similarityPrice gap vs. comparablesFolium map + Excel report

Each step narrows the problem before the next, more expensive one. The quantile cut keeps about a quarter of the listings, the 1 km radius keeps a few dozen sales per listing, and cosine similarity only ever compares those few dozen. The original deliverable was a Folium map and a styled Excel workbook. This page replaces both with the explorer below.

From prototype to pipelineTwo notebooks

The first notebook looked for statistical outliers: active listings in the lowest 20% of prices, compared with the mean price of everything within a few kilometres. It plotted the price distribution with a fitted normal curve and mapped the results with Plotly.

That mean mixed condos with houses, and asking prices with sale prices. The final notebook compares only against closed sales, and only against the ones most like the listing. It also gathers the parameters into one configuration cell and adds the price-gap filter.

Choosing the comparablesCosine similarity

Every home becomes a vector. Each sewer, construction and water tag is a 0/1 column, so a home can carry several. Year built and living area are min-max scaled to the range of the closed sales. The encoders are fitted on the closed sales only, so a tag that appears only in active listings is ignored.

Cosine similarity between the listing and each sale inside the radius ranks the candidates, and the mean sale price of the top ten is the estimate. When two sales score the same, which happens often with identical units in one building, the closer one wins. This tie-break is the one change from the notebook, which left tie order to the sort.

One listing, start to finish. The defaults are r = 1 km and N = 10.
v(h) = [ sewer tags | construction tags | water tags | year′ | sqft′ ]
         one-hot (MultiLabelBinarizer)               min-max scaled

C(t)  = { s ∈ sold : haversine(t, s) ≤ r }            candidates in the radius
K(t)  = top-N of C(t) by  cos(v(t), v(s)) = v(t)·v(s) / ‖v(t)‖‖v(s)‖

gap(t) = list(t) − mean{ sale(s) : s ∈ K(t) }          opportunity if gap ≤ −$120k
05

Interactive

Listings and comparables4,958 closed sales · 110 targets
Leaflet © OpenStreetMap contributors
OpportunityTarget, gap too smallComparable sale
Parameters
List-price threshold$384,000
Targets · with comparables110 · 110
Opportunities37
Median gap−$162,200
Median gap, %-33.7%
Python reference37 · matches
Active list prices435 listings, $10k bins
$160,000–$170,000: 2 listings$170,000–$180,000: 0 listings$180,000–$190,000: 0 listings$190,000–$200,000: 0 listings$200,000–$210,000: 0 listings$210,000–$220,000: 0 listings$220,000–$230,000: 0 listings$230,000–$240,000: 1 listings$240,000–$250,000: 2 listings$250,000–$260,000: 1 listings$260,000–$270,000: 2 listings$270,000–$280,000: 3 listings$280,000–$290,000: 1 listings$290,000–$300,000: 1 listings$300,000–$310,000: 1 listings$310,000–$320,000: 3 listings$320,000–$330,000: 8 listings$330,000–$340,000: 9 listings$340,000–$350,000: 10 listings$350,000–$360,000: 15 listings$360,000–$370,000: 8 listings$370,000–$380,000: 31 listings$380,000–$390,000: 29 listings$390,000–$400,000: 46 listings$400,000–$410,000: 31 listings$410,000–$420,000: 42 listings$420,000–$430,000: 56 listings$430,000–$440,000: 43 listings$440,000–$450,000: 49 listings$450,000–$460,000: 41 listings$200k$250k$300k$350k$400k$450kQ25 = $384k
Opportunities37 listings
Selected listing10 of 20 sales in radius
List price$160,000
Mean comparable sale$568,900
Gap−$409k (-71.9%)

Listing: 1972 · 1,784 sqft · Other Construction

#SoldSimilarityDistanceYear · size · construction
1$505,0000.9990.61 km1974 · 2,340 sqft · Other Construction
2$650,0000.8750.13 km1972 · 2,023 sqft · CBS Construction, Other Construction
3$640,0000.6980.31 km1979 · 2,040 sqft · CBS Construction
4$700,0000.6950.68 km1974 · 2,566 sqft · Concrete Block Construction
5$550,0000.6950.51 km1973 · 2,118 sqft · CBS Construction
6$400,0000.6950.54 km1975 · 1,445 sqft · CBS Construction
7$605,0000.6950.88 km1973 · 1,656 sqft · CBS Construction
8$539,0000.6950.22 km1971 · 2,177 sqft · Concrete Block Construction
9$545,0000.6940.73 km1972 · 1,374 sqft · Concrete Block With Brick
10$555,0000.6080.32 km1972 · 1,789 sqft · CBS Construction, Concrete Block Construction
06

Results

ResultsDefault parameters
0
Active listings screened
0
Opportunities ≥ $120k below comparables
−34%
Median gap to comparable sales
  • The first-quartile threshold is $384,000: 110 of the 435 active listings fall at or below it, and every one of them has between 4 and 35 closed sales within 1 km (median 18).
  • 37 of the 110 are listed at least $120,000 below the mean sale price of their ten most similar comparables; the median gap among them is −$162,200 (−33.7%), the largest −$408,900.
  • Sanity checks removed 19 records the original notebook let through — a $75 and a $329 list price, a $123,456 placeholder and a listing geocoded in Colombia — which had been topping the list of opportunities.
  • The browser port reproduces the Python run at the default settings, and the whole pipeline re-runs in milliseconds as the parameters change.
07

Technical explanation

The original deliverablePython

The notebook ended in two files for the client. Both were built for someone who works in spreadsheets and maps, not in Python.

Map
Folium HTML with a home icon per opportunity, its dashed 1 km circle, and the comparables as markers with similarity and distance in the popup
Report
openpyxl workbook with a Summary sheet ranked by price gap, plus one sheet per target listing its comparables; colour-coded rows, auto-fitted columns
Config
One cell with RADIUS_KM, QUARTILE, TOP_N and MIN_PRICE_GAP; re-run to regenerate both files
Why it runs in the browserTypeScript port

The data is small: the bundled snapshot is about 260 KB of JSON, around 60 KB compressed. At that size the browser can rerun the analysis in milliseconds, so the parameters can be sliders rather than a fixed set of precomputed cases. The port reproduces pandas' linear quantile, the haversine formula, sklearn's multi-label and min-max encoders and its cosine similarity.

A build script reruns the Python pipeline at the defaults and saves the summary. The controls panel compares the browser's result against it, so any drift between the two versions shows on the page.

08

Conclusion

RetrospectiveWhat I'd change
  • The data needed more care than the model. The final notebook's best "deals" were typos, and a $10k floor that the prototype already had would have caught them.
  • The comparables ignore bedrooms, bathrooms, lot size and condition. Closed sales also go up to $900,000 while the export capped listings at $450,000. Both push the comparable mean up, so a gap is a reason to look closer, not a valuation.
  • The original radius search is a Python loop over every sale for every target. A latitude band plus a vectorised haversine, as in the browser port, or a spatial index would scale it to a full MLS feed.
  • Next steps: weight comparables by similarity and recency instead of a flat top-ten mean, add days on market, and refresh the export on a schedule.
© 2026 Héctor LiceaDesign concept · placeholder contentBuild 2026.08Rendered client-side · no tracking