Skip to content

Interview Questions — House Price Prediction

These questions target the specific decisions made in this project: why regression, how the ceiling affects everything downstream, why each feature was engineered, and how to communicate model quality to a non-technical audience. Work through them after completing the project, not before.


Q1. Why is house price prediction a regression problem and not classification?

Show answer

Regression predicts a continuous numeric value. Classification predicts a category from a fixed set. House prices are continuous — $312,500 and $312,501 are meaningfully different values, not bins, and the task is to predict the actual value, not assign a label like "cheap" or "expensive."

You could reframe this as a classification problem by discretizing the target into price buckets (e.g., below $200k, $200k–$350k, above $350k). This is sometimes done when the business question is "which tier does this property fall into?" rather than "what is the precise price?" But you lose information by discretizing — you cannot recover the original price from the bucket label — and you introduce an arbitrary boundary choice that affects model behavior. Unless the business explicitly needs categories, regression is the right default for a numeric output.

The evaluation metrics also differ. Regression uses MAE, RMSE, and R². Classification uses accuracy, precision, recall, and F1. Reporting that your model achieves "71% accuracy" on house price buckets tells you nothing about how far off the predictions are in dollar terms.


Q2. The target variable is capped at $500,000. How does that affect your model?

Show answer

The cap creates a problem called censored data or ceiling effect. Every block whose true median value exceeds $500,000 is recorded as exactly $500,000. The model is trained on this corrupted label — it learns that certain combinations of features (high income, coastal location, San Francisco Bay area) map to a target of 5.0, even though the true value was higher and unknown.

Three concrete effects:

  1. Systematic underestimation for high-value properties. The model cannot predict above 5.0 because it never saw values above 5.0 in training. For the most expensive neighborhoods, its predictions will be clumped just below the ceiling.

  2. Biased evaluation metrics for that segment. MAE and RMSE computed across the whole test set understate the model's error for high-value blocks, because the true value is unknown — we only know it is at least 5.0.

  3. The ceiling is not random. It affects a specific geographic segment: coastal California, Bay Area, and LA. Any analysis of spatial error will show elevated errors in exactly those regions.

What you can do: train a separate model on blocks where the true value is clearly below the cap (e.g., MedHouseVal < 4.5) and acknowledge the model is unreliable for blocks near or at the ceiling. For a production system, you would use actual transaction prices from a real estate database instead of census-capped medians.


Q3. Why did you create rooms_per_person instead of using AveRooms and AveOccup separately?

Show answer

rooms_per_person = AveRooms / AveOccup captures the spaciousness of a block — how many rooms are available per occupant. A block with 6 rooms and 2 occupants is a very different housing situation from a block with 6 rooms and 6 occupants, even though both have the same value for AveRooms.

When you give a linear model AveRooms and AveOccup as separate features, it can only learn a weighted sum: a * AveRooms + b * AveOccup. It cannot compute a ratio. The true relationship involves a ratio, not a sum, so the linear model cannot represent it directly. Pre-computing the ratio as a feature expresses the relationship explicitly.

For tree-based models the argument is less critical — a tree can approximate a ratio through a sequence of splits — but pre-computing it still helps. It reduces the depth the tree needs to detect the spaciousness signal, which lowers variance and speeds up learning.

The same logic applies to bedrooms_ratio (fraction of rooms that are bedrooms) and income_per_room (purchasing power per unit of available space). Each one encodes a domain insight that the raw columns cannot represent as a linear combination.


Q4. How do you interpret R² = 0.82? Is that good?

Show answer

R² = 0.82 means the model explains 82% of the variance in median house values across test blocks. The remaining 18% is variance that cannot be predicted from the 15 features in this dataset.

Whether 0.82 is "good" depends entirely on context:

  • Compared to the baseline: The mean-prediction baseline has R² = 0.00 by definition. Linear regression reaches 0.60. Random Forest reaches 0.82. The increase from 0.60 to 0.82 is substantial and justifies the added complexity of a tree-based model.

  • Compared to the problem difficulty: Housing prices depend on factors not in this dataset — school quality, neighborhood crime, proximity to transit, lot size, home condition, recent renovations. A model that lacks these signals will always have unexplained variance. For block-level census data from 1990, 0.82 is a strong result.

  • Compared to the use case: For ranking neighborhoods or monitoring regional trends, R² = 0.82 is more than sufficient. For individual home appraisal, you would want R² above 0.95 and much tighter prediction intervals. This model is not appropriate for that use case regardless of its R².

Always interpret R² relative to a baseline and relative to the problem's inherent difficulty. Never report it in isolation.


Q5. What is the difference between MAE and RMSE, and which would you report to a business stakeholder?

Show answer

Both measure prediction error in the original units of the target (here, $100k increments):

  • MAE (Mean Absolute Error): The average of |actual - predicted| across all predictions. Every error is weighted equally. An error of $100k contributes exactly 10 times more than an error of $10k.

  • RMSE (Root Mean Squared Error): The square root of the average of (actual - predicted)². Squaring errors before averaging gives larger errors disproportionate weight. An error of $100k contributes 100 times more to RMSE than an error of $10k.

The practical difference: if your model makes mostly small errors but occasionally makes very large ones, RMSE will be noticeably higher than MAE. If errors are uniformly distributed, they will be close.

For a business stakeholder, report MAE. It is intuitive — "on average, our predictions are off by $31,600" is a sentence anyone can understand. RMSE is harder to interpret because the squaring operation means the number does not directly correspond to a typical error; it is dominated by worst-case predictions.

For technical audiences and model selection, use RMSE. When you are choosing between two models, RMSE penalizes large errors more, which is appropriate when large errors are especially costly. If the business cares most about not being catastrophically wrong on any single prediction, optimize for RMSE. If all errors are weighted equally, optimize for MAE.


Q6. Geographic features (lat/lon) improved your model. Why can't linear regression use them effectively but Random Forest can?

Show answer

The relationship between geographic coordinates and house prices in California is highly non-linear and spatially local. Coastal areas command a premium, but the coastal premium is not a smooth function of latitude or longitude — it depends on which coast, which neighborhood, and what is nearby. A location at latitude 34.0 could be inland Riverside (low prices) or coastal Santa Monica (high prices), and those two locations have nearly the same latitude but very different prices.

A linear model fits coefficients: price = a * Latitude + b * Longitude + .... This forces it to find a global linear trend — roughly, "prices decrease as you go north" or "prices increase as you go west" — which is partially true but misses all the local spatial structure. The linear model cannot learn that the coastal premium in Santa Barbara is independent of the coastal premium in San Diego.

A decision tree, and by extension Random Forest, splits on thresholds: "if Latitude < 34.2 AND Longitude > -118.5, go left." This can partition the geographic space into any shape, capturing local neighborhoods, coastal strips, and inland valleys as distinct regions without requiring a globally linear relationship. With enough splits, a tree can approximate any spatial pattern.

This is why geographic cluster labels (geo_cluster from KMeans) also helped — they gave the linear model a discrete region indicator that it could use without needing to learn a non-linear spatial function from raw coordinates.


Q7. Your model systematically underestimates the most expensive homes. Why, and what can you do about it?

Show answer

The systematic underestimation at high values comes from the data ceiling at $500k. The training data contains hundreds of blocks with MedHouseVal = 5.0, but this is not their true value — it is the maximum the census would record. The true values for those blocks might be $600k, $700k, or higher. The model learns that certain feature combinations (high income, coastal location) map to a target of 5.0, but since it never sees values above 5.0 in training, it cannot predict above 5.0.

Additionally, even for blocks below the ceiling, the high-value segment ($400k–$500k) has fewer training examples and more noise, which causes the model to regress toward the mean in that region.

Three approaches to address this:

  1. Use better data. Train on actual real estate transaction prices from a source like Zillow, Redfin, or county assessor records, which do not have this cap. The ceiling is a feature of this specific census dataset, not of the underlying problem.

  2. Train a separate model for high-value blocks. Filter blocks with predicted values above a threshold (e.g., 4.0) and train a dedicated model on that subset, treating the ceiling prediction task separately from the general prediction task.

  3. Use quantile regression. Instead of predicting a point estimate, predict the 10th, 50th, and 90th percentile of the distribution. This gives you a range for each prediction and can reveal whether the model is uncertain (wide interval) or confident (narrow interval) for a given block. For ceiling-affected blocks, the upper quantile will flag the uncertainty explicitly.


Q8. A stakeholder wants to know how confident the model is in each prediction. How would you address that?

Show answer

A single point prediction like "$315,000" gives no information about uncertainty. Providing confidence intervals turns a point estimate into a decision-making tool.

Several approaches work with the models trained in this project:

Option 1 — Quantile Regression. Train separate models to predict the lower bound (e.g., 10th percentile) and upper bound (e.g., 90th percentile) of the target distribution. Scikit-learn's GradientBoostingRegressor supports this via loss='quantile':

from sklearn.ensemble import GradientBoostingRegressor

gbr_low  = GradientBoostingRegressor(loss='quantile', alpha=0.10, n_estimators=300)
gbr_high = GradientBoostingRegressor(loss='quantile', alpha=0.90, n_estimators=300)
gbr_mid  = GradientBoostingRegressor(loss='quantile', alpha=0.50, n_estimators=300)

gbr_low.fit(X_train, y_train)
gbr_high.fit(X_train, y_train)
gbr_mid.fit(X_train, y_train)

lower = gbr_low.predict(X_test)
upper = gbr_high.predict(X_test)
median_pred = gbr_mid.predict(X_test)

This gives an 80% prediction interval [lower, upper] for each block — 80% of true values should fall within this range.

Option 2 — Random Forest Variance. A Random Forest produces predictions from 100+ individual trees. The standard deviation across those trees is a measure of model uncertainty:

tree_preds = np.array([tree.predict(X_test) for tree in best_rf.estimators_])
pred_std = tree_preds.std(axis=0)  # uncertainty per prediction

# High std = high model disagreement = low confidence
uncertain_blocks = X_test[pred_std > 0.5]

Option 3 — Conformal Prediction. A more statistically rigorous framework that produces prediction intervals with a guaranteed coverage rate (e.g., the true value falls within the interval 90% of the time, by construction). The MAPIE library implements this for scikit-learn models with minimal additional code.

For a stakeholder presentation, the key message is: "We give you a range, not just a number. For a block predicted at $315,000, the 80% interval is $260,000–$370,000. Decisions that depend on a precise value should treat the full interval as the answer."


← Model Building | Next: Interview Questions →