MUFID ALNADI

Machine Learning

From-Scratch Clustering

Hand-built K-means and DBSCAN, tested honestly on whether clustering apartment locations actually improves rent prediction.

Data — ~48k New York City rental listings — price, coordinates, and amenities.

From-scratch DBSCAN matched scikit-learn exactly — 0 of 48,343 labels differed — and nudged rent R² from 0.601 to 0.620

Context

An unsupervised question with a supervised test: if you group apartments by location, does that grouping help a model predict rent — or just look tidy?

Approach

  • Implemented and studied K-means (three initialization schemes) and DBSCAN (made linear-time with spatial-grid binning), validating both against reference implementations until the partitions matched.
  • Fed the cluster label into a downstream rent model as a single engineered feature.
  • Judged the clustering by downstream usefulness, not only by intrinsic tidiness scores.

Result

Grouping by geography added a small but consistent improvement to rent prediction; the same trick on already-present listing features added almost nothing. The lift was modest — and the write-up says so plainly rather than dressing it up.

What it demonstrates

The ability to build non-trivial algorithms correctly and, just as important, the restraint to measure their value honestly and not oversell a marginal gain.

K-means, DBSCAN, and Gaussian-mixture cluster assignments tiling a map of Manhattan.
K-means, DBSCAN, and Gaussian-mixture cluster assignments tiling a map of Manhattan.
← All work