Question 1
Which classification metric threshold-independent and appropriate for imbalanced data focuses on the positive class?
- MAE
- PR-AUC — Correct
- R-squared
- Accuracy
Correct answer
PR-AUC
Explanation
PR-AUC focuses on positive-class performance and is informative for imbalanced problems.
Question 2
A grid search with CrossValidator uses numFolds=3 and a grid of 2 regParam values × 3 elasticNetParam values × 2 maxIter values. How many models are fitted during the search, excluding the final refit?
- 12
- 36 — Correct
- 15
- 18
Correct answer
36
Explanation
2 × 3 × 2 = 12 combinations, each trained on 3 folds: 36 models.
Question 3
A model is trained on log(price). Predictions are evaluated with RMSE in dollars. What must be done first?
- Take the log of the actual prices and compare directly with dollar thresholds
- Exponentiate the predictions back to dollars first — Correct
- Nothing; RMSE is scale-invariant
- Multiply predictions by 10
Correct answer
Exponentiate the predictions back to dollars first
Explanation
Metrics in original units require back-transforming predictions; RMSE is not scale-invariant.
Question 4
A team wants to build an image classifier with 2 million labeled images. Which approach is most appropriate?
- Fine-tune a pretrained CNN on GPUs — Correct
- One-hot encoding each pixel and using k-means
- A linear regression on raw pixel values
- Gradient-boosted trees on image file names
Correct answer
Fine-tune a pretrained CNN on GPUs
Explanation
Deep learning, especially transfer learning, excels at image tasks with large datasets.
Question 5
A data scientist tunes a model with Optuna and wants each trial recorded in MLflow. What is a straightforward approach?
- Log only the final best trial manually after a week
- Rely on Optuna storing results in the notebook output
- Disable MLflow while tuning
- Log each trial as a nested MLflow run — Correct
Correct answer
Log each trial as a nested MLflow run
Explanation
Logging each trial as a nested run keeps the search reproducible and comparable.
Question 6
Which approach mitigates class imbalance at the algorithm level without resampling data?
- Use accuracy as the objective
- Shuffle labels
- Remove the majority class
- Class weights — Correct
Correct answer
Class weights
Explanation
Class weights change the loss to emphasize minority-class errors.
Question 7
What is an advantage of random search over grid search for hyperparameter tuning?
- It tries more distinct values for the same budget — Correct
- It never repeats configurations
- It requires no evaluation metric
- It always finds the global optimum
Correct answer
It tries more distinct values for the same budget
Explanation
Random search samples the space and is often more efficient when only a few hyperparameters matter.
Question 8
Which code runs an Optuna study that minimizes validation RMSE for 50 trials?
- study = optuna.create_study(direction='minimize')
study.optimize(objective, n_trials=50) — Correct
- study = optuna.grid(objective, 50)
- optuna.fmin(objective, max_evals=50)
- study = optuna.create_study(direction='maximize')
study.optimize(objective, n_trials=50)
Correct answer
study = optuna.create_study(direction='minimize')
study.optimize(objective, n_trials=50)
Explanation
create_study with direction='minimize' and optimize with n_trials runs the search; the objective returns the metric.
Question 9
A team must choose between gradient-boosted trees and a deep neural network for a 50,000-row tabular dataset with 30 features and limited compute. Which is the most reasonable choice?
- Gradient-boosted trees — Correct
- k-means
- No model, because 50,000 rows is too small for any ML
- A very deep neural network with GPUs
Correct answer
Gradient-boosted trees
Explanation
Tree ensembles are strong baselines for tabular data and cheaper to train than deep networks.
Question 10
A fraud dataset has 0.5% positive cases. Which technique helps mitigate class imbalance during training?
- Shuffle the labels
- Class weights or resampling — Correct
- Use accuracy as the only metric
- Remove all positive cases
Correct answer
Class weights or resampling
Explanation
Class weighting and resampling help models learn the minority class; evaluation should use metrics such as precision, recall or PR-AUC.