SpinTheMic
Pro

Interview practice question

Thousands of rare city names

Machine Learning · Feature Engineering · Beginner

Your "city" feature has 4,000 unique values, most appearing fewer than 10 times. How do you handle it?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • One-hot would create thousands of sparse columns.
  • Group rare cities into "other".
  • Map to higher levels: state, region, city tier.
  • Frequency or target encoding with smoothing.
  • Native categorical support in boosting libraries.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics