← Boston Consulting Group Interview Insights
The ask itself is pretty clear but I second-guessed whether they wanted me to fit the final model on all the data before saving or just dump whatever came out of cross-validation.
Start by clearly stating the necessary imports and loading the dataset. Then, use cross_val_score with roc_auc scoring to compute the mean ROC-AUC over 5 folds, and finally fit the model on the full dataset and save it using joblib or pickle. Emphasize reproducibility and proper evaluation.
Pro tip: Mention that you set a random_state for reproducibility and that you use joblib for efficient serialization of scikit-learn models. Also, briefly discuss the trade-off between using cross_val_score for evaluation and then refitting on the full data for the final model.
Import necessary libraries such as GradientBoostingClassifier, cross_val_score, train_test_split (if needed), and joblib. Load your dataset and separate features and target.
Instantiate GradientBoostingClassifier with a fixed random_state. Use cross_val_score with cv=5 and scoring='roc_auc' to compute ROC-AUC scores across folds, then calculate and print the mean score.
Fit the classifier on the entire dataset (X, y) to leverage all available data for the final model.
Use joblib.dump or pickle.dump to save the trained model as 'model.pkl'.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.