Build an End-to-End House Price Regression Pipeline in pandas and scikit-learn

Quick Overview

Build an end-to-end house price regression pipeline with pandas and scikit-learn, from loading data and handling missing values and categorical columns to cross-validated model comparison and test-set predictions. Tests leak-free preprocessing, target transforms, metric choice and practical modeling judgment.

Build an End-to-End House Price Regression Pipeline in pandas and scikit-learn

Company: Roblox

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Technical Screen

You are given a tabular dataset of house sales, similar to the Kaggle house price prediction problem. Each row is one sold house, described by a mix of numeric and categorical columns, and the target is the sale price. Using pandas and scikit-learn, write an end-to-end pipeline that: 1. loads the training and test data; 2. prepares the features, including missing values and categorical columns; 3. trains at least one model and estimates how well it will do on unseen houses; 4. predicts the sale price of every house in the test set and writes the predictions to a file. Write runnable code and explain each choice as you go. ```hint Fit only on training data Any step that learns something from the data, such as filling missing values or encoding categories, should be learned inside each training fold. ``` ```hint Look at the target first Check the shape of the sale price distribution before you choose a loss and a metric. ``` ### Constraints and Clarifications - Assume `train.csv` has an `Id` column, several dozen feature columns and the target column `SalePrice`, and `test.csv` has the same columns without `SalePrice`. - Assume the numeric columns include sizes, counts and years, the categorical columns are stored as strings, and many columns have missing values. - The round asks for pandas and scikit-learn; assume no other modeling library is available. ### Clarifying Questions - Which metric is used for evaluation: error on the price itself, or on the log of the price? - Does the test set come from the same time period and neighborhoods as the training set? - Is there a time budget for training, or a limit on model size? - Should the output be a file of `Id` and predicted `SalePrice`? ### What a Strong Answer Covers - Numeric and categorical preprocessing combined in one scikit-learn pipeline, so the same transforms run on training and test data. - Validation that does not leak information from the validation folds. - A target transform and metric chosen from the shape of the price distribution. - A simple baseline compared against a stronger model. - Handling of categories and missing values that appear only in the test set. ### Follow-up Questions - A category appears in the test set that never appears in training. What does your pipeline do with it? - Cross-validation error is much lower than the error on the real test set. What would you check? - How would you find out which features drive the predictions? - How would you package this pipeline so a service can score one house at a time?

Overview: Build an end-to-end house price regression pipeline with pandas and scikit-learn, from loading data and handling missing values and categorical columns to cross-validated model comparison and test-set predictions. Tests leak-free preprocessing, target transforms, metric choice and practical modeling judgment.

Read the full Roblox Machine Learning Engineer interview experience this question came from

Roblox logo
Roblox
Nov 25, 2026
mediumMachine Learning EngineerTechnical ScreenMachine Learning
0
0

You are given a tabular dataset of house sales, similar to the Kaggle house price prediction problem. Each row is one sold house, described by a mix of numeric and categorical columns, and the target is the sale price. Using pandas and scikit-learn, write an end-to-end pipeline that:

  1. loads the training and test data;
  2. prepares the features, including missing values and categorical columns;
  3. trains at least one model and estimates how well it will do on unseen houses;
  4. predicts the sale price of every house in the test set and writes the predictions to a file.

Write runnable code and explain each choice as you go.

Constraints and Clarifications

  • Assume train.csv has an Id column, several dozen feature columns and the target column SalePrice , and test.csv has the same columns without SalePrice .
  • Assume the numeric columns include sizes, counts and years, the categorical columns are stored as strings, and many columns have missing values.
  • The round asks for pandas and scikit-learn; assume no other modeling library is available.

Clarifying Questions Guidance

  • Which metric is used for evaluation: error on the price itself, or on the log of the price?
  • Does the test set come from the same time period and neighborhoods as the training set?
  • Is there a time budget for training, or a limit on model size?
  • Should the output be a file of Id and predicted SalePrice ?

What a Strong Answer Covers Guidance

  • Numeric and categorical preprocessing combined in one scikit-learn pipeline, so the same transforms run on training and test data.
  • Validation that does not leak information from the validation folds.
  • A target transform and metric chosen from the shape of the price distribution.
  • A simple baseline compared against a stronger model.
  • Handling of categories and missing values that appear only in the test set.

Follow-up Questions Guidance

  • A category appears in the test set that never appears in training. What does your pipeline do with it?
  • Cross-validation error is much lower than the error on the real test set. What would you check?
  • How would you find out which features drive the predictions?
  • How would you package this pipeline so a service can score one house at a time?