How do you use the outputs of an unsupervised model as features in a downstream supervised model?
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: medium
Interview Round: Other
How do you use the outputs of an unsupervised model as features in a downstream supervised model?
For example, a team wants to add clustering or PCA outputs to a classifier's input features.
```hint What can it output
List what a clustering model, a density model or an encoder can produce for a single row, beyond one label.
```
```hint Which rows does it see
Think about which rows the unsupervised model is allowed to be fit on, and what that means during cross-validation.
```
### What a Strong Answer Covers
- Fitting the unsupervised model on training data only, then applying the fitted transform to validation, test and production rows.
- The kinds of features an unsupervised model can produce and what each one captures.
- How to keep the transform from leaking information during cross-validation.
- Production issues: versioning, retraining both models together, and cluster IDs or embeddings that change on refit.
- Checking that the new features help, with an ablation against a raw-feature baseline.
### Follow-up Questions
- When are unsupervised features likely to help a gradient-boosted tree model, and when are they likely to add nothing?
- You have a million unlabeled rows and five thousand labeled ones. How would you use the unlabeled rows?
- How would you choose the number of clusters or the embedding size when the end goal is the supervised metric?
- After the clusterer is retrained, how do you keep the downstream model from breaking?
Overview: Explain how to turn the outputs of clustering, PCA, density models or encoders into input features for a supervised model. Tests knowledge of the feature types these models produce, leakage during cross-validation, pipeline design, and the production cost of keeping two models in step.