Interview Q&A · questions with model answers
scikit-learn Interview Questions
Part of the study plan for: Machine Learning Engineer
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
How do you tune hyperparameters with GridSearchCV or RandomizedSearchCV?
Wrap the pipeline in a search object with a parameter grid or distributions, a cross-validation scheme and a scoring metric, fit it on the training data, then inspect best_params_ and cv_results_…
-
How do you handle categorical features in scikit-learn?
Use OneHotEncoder(handle_unknown="ignore") for low-cardinality categories with linear models, OrdinalEncoder for ordered categories or tree models, TargetEncoder (scikit-learn 1.3+, cross-fitted…