KatInterview

Building a Home Sale Price Estimator End to End

Machine LearningModel answer
EasyModel answerMachine Learningregressionfeature-engineeringtime-series-validation

Last updated

Design a regression pipeline that estimates residential sale prices, covering missing data, categorical encoding, feature ideas, time-aware validation, metrics, and interpretability.

Context

A real estate platform wants a model that estimates the sale price of residential homes. You have roughly 100,000 completed sales from the last five years. Each record includes living area (sqft), bedroom and bathroom counts, year built, lot size, basement area, a categorical neighborhood field, and the price the home sold for. Some records also carry an earlier sale of the same property.

The model's users are real estate agents, so predictions must be explainable to non-technical people.

What to cover

Walk through how you would design the full pipeline:

  1. Cleaning and encoding. How do you treat missing values (for example, a blank basement area or lot size) and a high-cardinality categorical field such as neighborhood?
  2. Feature engineering. Propose three concrete derived features and explain the reasoning behind each.
  3. Validation. Housing markets drift over time. How do you split the data so your offline results reflect performance on future sales?
  4. Metrics. Which evaluation metric(s) would you report, and why might you choose them over mean squared error?
  5. Outliers. How do you detect unusual prices and decide what to do with them?

Worked scenario

A new listing arrives: 2,500 sqft, built in 1990, located in an affluent neighborhood that is on the rise, with the lot size field empty. Describe what happens to this record, step by step, before the model scores it. Focus on the missing lot size and the neighborhood encoding.

Constraint

Whatever model you choose, justify how it stays interpretable for agents.

Hints

Hint 1

Ask why a value is missing before choosing a fix: a blank basement area usually means no basement, while a blank lot size is genuinely unknown. Consider a missingness flag alongside any imputation.

Hint 2

Neighborhood has too many levels for one-hot encoding. Think about shrinking each neighborhood's average toward the overall average based on how many sales it has, and make sure the encoding is computed without peeking at the row's own price or at future sales.

Hint 3

Do not shuffle the data randomly. Train on earlier periods and test on later ones, and think about which metric treats a $50k miss on a $200k house differently from the same miss on a $2M house.