Interview Q&A / Machine Learning
Machine Learning interview questions
Supervised vs unsupervised learning, overfitting, metrics and the classic models, explained simply.
Prefer rapid revision? Practise Machine Learning short interview answers →
- What is the difference between label encoding and one-hot encoding?
Label encoding maps each category to an integer, which falsely implies an order. One-hot encoding creates one 0/1 column per category with no implied order. Use one-hot for unordered categories in linear models; integer codes are fine for ordered ones or tree models.
BeginnerQuick answer1 min read - How would you encode a categorical feature with thousands of values, like a pincode?
One-hot would create thousands of sparse columns. Better options are target (mean) encoding computed out-of-fold, frequency encoding, grouping rare values into 'other', hashing, or learned embeddings.
IntermediateQuick answer1 min read