KatInterview

Design a Production ML Pipeline and Prevent Overfitting on Tabular Data

Machine LearningModel answer
MediumModel answerMachine Learningtabular dataregressioncross-validation

Last updated

Architect an end-to-end machine learning pipeline for real estate price prediction, covering EDA, spatial validation, feature scaling, GBDT baselines, and neural network regularization.

You are tasked with designing a production machine learning pipeline to estimate real estate transaction prices for an expansion into newly added geographical markets. The dataset consists of 50,000 transaction records across 20 attributes, which include continuous numerical variables, localized spatial identifiers, and high-cardinality categorical attributes.

Your primary evaluation metric is Mean Absolute Error (MAE), and the pipeline must demonstrate strong generalizability when deployed to completely unobserved regional markets.

Address the following requirements in your pipeline design:

  1. Exploratory Data Analysis & Leakage Prevention:

    • How will you systematically identify data leakage, feature importance, and multi-collinearity during early EDA?
    • What quantitative metrics and visual tools will you use to detect multi-collinear subsets of variables?
  2. Data Preprocessing & Feature Engineering:

    • Propose a leakage-free preprocessing pipeline to handle missing values and high-cardinality categorical variables.
    • Discuss appropriate target variable transformations and how they interact with an MAE loss objective.
  3. Model Selection & Optimization Strategy:

    • Compare feature scaling and transformation requirements for a Lasso (L1-regularized) linear model versus a Multi-Layer Perceptron (MLP).
    • Explain why Gradient Boosted Decision Trees (GBDTs) should be included as a primary benchmark for this task.
    • Formulate loss functions aligned with the primary metric.
  4. Validation Setup & Overfitting Remediation:

    • Define a cross-validation strategy tailored to the out-of-region deployment goal.
    • Given a diagnostic scenario where an MLP achieves a training MAE of $5,000 but a validation MAE of $25,000, outline a structured plan of architectural and training modifications to close this generalization gap.

Hints

Hint 1

Standard random K-fold splits will suffer from spatial data leakage; consider group-based splits by location.

Hint 2

Lasso applies a uniform penalty magnitude across all beta parameters, making feature standardization indispensable.

Hint 3

Log transformations on right-skewed prices preserve medians under exponentiation, aligning well with L1 loss minimization.