How would you handle encoding a categorical variable with thousands of unique values to ensure efficient and effective model performance?