This is basically a 'do you actually know ML pipelines or do you just know how to tab-complete sklearn' question.
Start by outlining the pipeline architecture and emphasizing the importance of fitting transformers only on training data to prevent leakage. Then, walk through each step from data splitting to model evaluation, explaining the rationale behind choices like using a fixed seed for reproducibility and handling missing values and categorical variables appropriately. Finally, discuss the interpretation of coefficients in the context of the problem and the trade-offs involved.
Pro tip: Mention that you would use sklearn's Pipeline and ColumnTransformer to encapsulate preprocessing and model training, ensuring that all transformations are applied consistently and that fitting is restricted to training data. This demonstrates production-ready thinking and awareness of common pitfalls.
Split the data into training and validation sets using a fixed random seed to ensure reproducibility. Set up a preprocessing pipeline that includes imputation for missing values, one-hot encoding for categorical variables, and scaling for numeric features, ensuring that all transformers are fit only on the training data.
Train an OLS linear regression model on the preprocessed training data. Evaluate its performance on the validation set using RMSE and R-squared, and discuss how these metrics inform model quality.
Extract the fitted coefficients from the model and interpret them in the context of the features. Explain how each feature impacts the target variable, considering the scaling and encoding applied.
Discuss the assumptions of linear regression (e.g., linearity, independence, homoscedasticity, normality of residuals) and any trade-offs made in preprocessing (e.g., imputation method, encoding choice). Mention potential limitations and how they might affect results.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.