Courseiva
Exploratory Data AnalysishardMultiple ChoiceObjective-mapped

Exploratory Data Analysis for Imbalanced Datasets

A machine learning team is building a model to predict customer churn. The dataset has 20 features and 50,000 rows. After initial EDA, they notice that the target variable 'churn' is highly imbalanced (5% churn, 95% non-churn). Which EDA step should the team prioritize to address this imbalance before model training?

Quick Answer

The correct EDA step to prioritize is analyzing the distribution of each feature separately for churn and non-churn groups. This approach directly addresses the imbalance by revealing how individual features behave within each class, allowing the team to identify which variables are most predictive of the minority churn class. On the AWS Certified Machine Learning Specialty MLS-C01 exam, this concept tests your understanding that EDA for imbalanced datasets must go beyond global statistics—a common trap is to apply dimensionality reduction like PCA or jump to modeling steps such as cross-validation, which do not diagnose class-specific feature patterns. A reliable memory tip is to think “split before you model”: always separate your data by target class during EDA to uncover hidden drivers of the minority group.

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

Analyze the distribution of each feature separately for churn and non-churn groups.

During EDA for an imbalanced dataset, it is crucial to compare feature distributions between churn and non-churn groups to identify which features separate the classes. Option A is wrong because removing outliers from the majority class is not a standard EDA step and can introduce bias. Option C is wrong because stratified cross-validation is a model evaluation technique applied during training, not an EDA step. Option D is wrong because PCA is a dimensionality reduction technique that does not address class imbalance.

Answer analysis

Option-by-option breakdown

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

  • Remove outliers in the majority class to balance the dataset.

    Why it's wrong here

    Removing data may discard useful information and reduce dataset size.

  • Analyze the distribution of each feature separately for churn and non-churn groups.

    Why this is correct

    This helps identify which features differentiate the classes and informs whether resampling or cost-sensitive methods are needed.

  • Perform stratified cross-validation to ensure balanced folds.

    Why it's wrong here

    Cross-validation is a modeling technique, not an EDA step.

  • Apply Principal Component Analysis (PCA) to reduce noise.

    Why it's wrong here

    PCA does not address class imbalance.

About these practice questions

One of 1,672 original MLS-C01 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

3 more ways 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 exploring a dataset with 100 features. The goal is to build a binary classification model. The dataset is highly imbalanced with 95% negative class and 5% positive class. The data scientist wants to understand the relationship between features and the target. Which technique is most appropriate for initial exploratory analysis?

easy
  • A.Remove the minority class samples and analyze the majority class only.
  • B.Use stratified sampling to create a balanced subset for visualization and correlation analysis.
  • C.Use random sampling to select 10% of the data for EDA.
  • D.Apply SMOTE to the dataset before performing EDA.

Why B: Stratified sampling preserves the class proportions, ensuring that the minority class (5% positive) is adequately represented in the subset for visualization and correlation analysis. Option A is wrong because removing the minority class would prevent any analysis of the target relationship. Option C is wrong because random sampling could miss the rare positive class entirely, leading to biased insights. Option D is wrong because SMOTE is a synthetic data generation technique intended for training, not for initial exploratory analysis.

Variation 2. A company is building a classification model and discovers that the target variable is imbalanced: 95% of samples belong to class A and 5% to class B. The data scientist needs to understand the distribution of numeric features for each class. Which approach is most appropriate?

medium
  • A.Run a t-test for each feature to determine statistical significance between classes.
  • B.Generate box plots for each feature using Amazon QuickSight.
  • C.Use Amazon SageMaker Data Wrangler to create histograms for each feature, grouped by class label.
  • D.Compute the correlation matrix between features and the target.

Why C: The most appropriate approach for understanding the distribution of numeric features for each class is to use histograms grouped by the class label. Amazon SageMaker Data Wrangler (option C) can generate these histograms, providing a clear visual comparison of how each numeric feature is distributed across class A and class B. This is especially useful with imbalanced data (95% vs 5%) because it reveals differences in shape, central tendency, and spread without being influenced by class frequencies. Option A (t-test) tests for statistical significance but does not visualize the distribution. Option B (box plots) can show summary statistics but not the full distribution shape as effectively as histograms. Option D (correlation matrix) measures linear relationships with the target but does not show per-class feature distributions.

Variation 3. A machine learning team is building a fraud detection model. The dataset is highly imbalanced (99.9% legitimate, 0.1% fraudulent). Which EDA technique is most important to apply before modeling?

hard
  • A.Normalize all numerical features to have zero mean and unit variance.
  • B.Remove outliers from the dataset using the IQR method.
  • C.Create a stratified train-test split to preserve the class distribution.
  • D.Perform correlation analysis to remove highly correlated features.

Why C: Stratified sampling is crucial for highly imbalanced datasets to ensure that the rare class is proportionally represented in both training and testing splits, allowing for proper evaluation. Normalization (A) is important but does not address imbalance. Removing outliers (B) could remove fraud cases. Correlation analysis (D) is useful but not the most critical step for 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.