databricks Machine Learning Associate · Practice questions

Section 3: Model Development Practice Questions

Review 10 sample questions with their correct answers and explanations. Sign up free to continue with the full topic quiz.

Sign up free for the full quiz

Question 1

Which classification metric threshold-independent and appropriate for imbalanced data focuses on the positive class?

  1. MAE
  2. PR-AUC — Correct
  3. R-squared
  4. 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?

  1. 12
  2. 36 — Correct
  3. 15
  4. 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?

  1. Take the log of the actual prices and compare directly with dollar thresholds
  2. Exponentiate the predictions back to dollars first — Correct
  3. Nothing; RMSE is scale-invariant
  4. 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?

  1. Fine-tune a pretrained CNN on GPUs — Correct
  2. One-hot encoding each pixel and using k-means
  3. A linear regression on raw pixel values
  4. 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?

  1. Log only the final best trial manually after a week
  2. Rely on Optuna storing results in the notebook output
  3. Disable MLflow while tuning
  4. 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?

  1. Use accuracy as the objective
  2. Shuffle labels
  3. Remove the majority class
  4. 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?

  1. It tries more distinct values for the same budget — Correct
  2. It never repeats configurations
  3. It requires no evaluation metric
  4. 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?

  1. study = optuna.create_study(direction='minimize') study.optimize(objective, n_trials=50) — Correct
  2. study = optuna.grid(objective, 50)
  3. optuna.fmin(objective, max_evals=50)
  4. 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?

  1. Gradient-boosted trees — Correct
  2. k-means
  3. No model, because 50,000 rows is too small for any ML
  4. 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?

  1. Shuffle the labels
  2. Class weights or resampling — Correct
  3. Use accuracy as the only metric
  4. 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.

Ready for the full quiz?

Create a free QuizAnalyst account to practice the complete question set and save your progress.

Sign up free for the full quiz