← Boston Consulting Group Interview Insights

Boston Consulting Group·Data Scientist·Online Assessment (OA)·Intermediate

Intermediate
May 2026

Summary

BCG data scientist online assessment, one of those notebook-style coding tasks where you're basically just writing production-ish ML code under a timer. Not a lot of ambiguity in the prompt, but there's still enough rope to hang yourself if you fumble the pipeline structure.

Questions Asked (1)

Q1

Write full Python code to train a GradientBoostingClassifier using 5-fold cross-validation, report the mean ROC-AUC score, and save the final model to disk as model.pkl.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

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.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

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.

1. Import libraries and load data

Import necessary libraries such as GradientBoostingClassifier, cross_val_score, train_test_split (if needed), and joblib. Load your dataset and separate features and target.

2. Set up cross-validation and evaluate

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.

3. Train final model on full data

Fit the classifier on the entire dataset (X, y) to leverage all available data for the final model.

4. Save the model to disk

Use joblib.dump or pickle.dump to save the trained model as 'model.pkl'.

Key Points to Mention

  • Use of cross_val_score with cv=5 and scoring='roc_auc' for evaluation.
  • Setting random_state for reproducibility.
  • Refitting the model on the full dataset after cross-validation.
  • Using joblib for efficient model serialization.
  • Discussion of trade-offs: cross-validation for reliable performance estimate vs. final model trained on all data.
  • Handling of class imbalance or preprocessing if relevant (e.g., using pipeline).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.