Courseiva
ModelingmediumMultiple ChoiceObjective-mapped

Class Imbalance in Multiclass Classification — Resampling and Class Weights

A team trained a multiclass classification model using SageMaker built-in XGBoost. The model's accuracy is high, but for a specific class, recall is very low. The team wants to improve recall for that class without significant accuracy drop. Which approach is MOST effective?

Quick Answer

The answer is resampling the training data to balance class representation. This is the most effective approach because class imbalance in multiclass classification causes models like XGBoost to optimize for overall accuracy, often at the expense of minority class recall. By oversampling the minority class or undersampling majority classes, you force the model to learn more robust decision boundaries for the underperforming class, directly addressing the root cause of low recall without a significant accuracy drop. On the AWS Certified Machine Learning Specialty MLS-C01 exam, this scenario tests your understanding of data-level techniques versus algorithm-level fixes; a common trap is choosing to adjust class weights in XGBoost’s hyperparameters, but resampling is more reliable for built-in objectives like multi:softmax. Remember: when recall for one class lags, resample the data first—think of it as “rebalancing before reweighting.”

⚠ Common exam trap

Many candidates assume increasing model complexity (max_depth) or switching algorithms will fix class imbalance, when in fact the most effective and direct approach is to rebalance the training data through resampling.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Resample the training data to balance the class representation

Resampling the training data to balance class representation directly addresses the root cause of low recall for a specific class in a multiclass XGBoost model. XGBoost's built-in objective functions (e.g., 'multi:softmax') optimize for overall accuracy, which can bias the model toward majority classes; resampling (e.g., oversampling the minority class or undersampling the majority) forces the model to learn decision boundaries that better capture the minority class, improving recall without drastically reducing overall accuracy.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Add more training data from all classes

    Why it's wrong here

    Adding more data may not balance the class.

  • Resample the training data to balance the class representation

    Why this is correct

    Resampling addresses class imbalance, improving recall for minority class.

  • Increase the max_depth hyperparameter of XGBoost

    Why it's wrong here

    Increasing max_depth may cause overfitting, not specifically improve recall for a class.

  • Switch from XGBoost to a linear learner

    Why it's wrong here

    Linear learner may not handle complex patterns.

About these practice questions

This MLS-C01 question is part of Courseiva's 1,672-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on MLS-C01

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A data scientist is training a multiclass classification model to categorize support tickets into 50 categories. The dataset has 100,000 labeled tickets. The scientist uses a random forest classifier with 100 trees. The model achieves 90% accuracy on the test set, but the F1-score for some rare categories is below 0.1. The scientist wants to improve performance on rare categories without significantly reducing overall accuracy. Which approach should the scientist try?

medium
  • A.Increase the maximum depth of trees
  • B.Reduce the number of trees to 50 to prevent overfitting
  • C.Switch to a one-vs-rest logistic regression model
  • D.Use class_weight='balanced' or compute custom class weights

Why D: (use class_weight='balanced' or compute custom class weights) helps the model focus on rare classes by assigning higher penalties to misclassifications of minority classes. Option B (reduce the number of trees to 50) may reduce model capacity and hurt overall performance. Option C (switch to a one-vs-rest logistic regression model) may not handle rare classes well without class weighting. Option A (increase the maximum depth of trees) could lead to overfitting and may not address class imbalance.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This MLS-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLS-C01 exam.