scikit-learn interview question
What do fit, transform, fit_transform and predict do in scikit-learn?
Definition Asked in Machine Learning Engineer interviews
Summary
fit learns from data (a scaler learns means, a model learns weights). transform applies what was learned to
data. fit_transform does both on the same data (training data only). predict (and predict_proba) uses a
fitted estimator to produce outputs for new rows.
Keep reading with a membership
The full answer with examples, key points and comparisons is part of the membership, along with every other interview answer, progress tracking and Daily Review. Most-asked answers stay free to read.
More scikit-learn questions
- How do scikit-learn Pipelines and ColumnTransformer work, and why use them?
- How do you tune hyperparameters with GridSearchCV or RandomizedSearchCV?
- How do you handle categorical features in scikit-learn?
- Your scikit-learn model's cross-validation score varies a lot between folds. What does it mean, and what do you do?