How would you reduce the dimensionality of a dataset that mixes numerical and categorical features?

Quick Overview

Asks how to reduce the dimensionality of tabular data that mixes numeric and categorical columns. Tests why plain PCA misleads on such data, how FAMD balances the two types, how to scale one-hot dummies, and when Gower distance embeddings or learned embeddings fit better.

How would you reduce the dimensionality of a dataset that mixes numerical and categorical features?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How would you reduce the dimensionality of a dataset that mixes numerical and categorical features? Explain why the obvious approach can mislead and which alternatives you would consider. ```hint Why plain PCA struggles PCA ranks directions by variance. For a numeric column and for a categorical's dummy columns, work out how much variance each brings in total and on a single direction, under a few different scalings of the dummies. Then see how the number of levels and their balance change those numbers. ``` ```hint More than one route Consider methods built for mixed types, encoding followed by a linear method, and methods that start from a distance between rows. The right one depends on whether you need interpretable factors, a production feature pipeline or a picture for exploration. ``` ### What a Strong Answer Covers - Why PCA on raw or naively encoded mixed data gives misleading components. - A method designed for mixed types, how it balances numeric and categorical variables, and what it does not fix. - An encode-then-decompose route with sensible scaling of the dummy columns and a decomposition that suits sparse matrices. - A distance-based route for exploration or clustering, and its scaling limits. - Learned or supervised options for high-cardinality data, and how to choose among the routes by goal. ### Follow-up Questions - How would you decide how many components to keep for mixed data? - A categorical feature has 20,000 levels. Which of these approaches still work, and what would you change? - How would you handle missing values in each approach? - How would you check that a low-dimensional embedding preserves the structure you care about?

Overview: Asks how to reduce the dimensionality of tabular data that mixes numeric and categorical columns. Tests why plain PCA misleads on such data, how FAMD balances the two types, how to scale one-hot dummies, and when Gower distance embeddings or learned embeddings fit better.

PracHub logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

How would you reduce the dimensionality of a dataset that mixes numerical and categorical features? Explain why the obvious approach can mislead and which alternatives you would consider.

What a Strong Answer Covers Guidance

  • Why PCA on raw or naively encoded mixed data gives misleading components.
  • A method designed for mixed types, how it balances numeric and categorical variables, and what it does not fix.
  • An encode-then-decompose route with sensible scaling of the dummy columns and a decomposition that suits sparse matrices.
  • A distance-based route for exploration or clustering, and its scaling limits.
  • Learned or supervised options for high-cardinality data, and how to choose among the routes by goal.

Follow-up Questions Guidance

  • How would you decide how many components to keep for mixed data?
  • A categorical feature has 20,000 levels. Which of these approaches still work, and what would you change?
  • How would you handle missing values in each approach?
  • How would you check that a low-dimensional embedding preserves the structure you care about?