Machine Learning Specialty · 24% of the exam

Exploratory Data Analysis: free practice questions

5 sample questions from our 60-question bank for this domain — answers and explanations included. These are the same scenario-based style as the real AWS exam.

1. A junior data scientist is performing EDA on a dataset in Amazon SageMaker Studio. They want to identify features most useful for predicting a binary target variable. They compute the Pearson correlation between each numeric feature and the binary target (0/1), rank features by absolute correlation, and drop features with correlation below 0.1. A senior colleague raises a concern about this approach. Which of the following BEST describes the senior colleague's concern?

  • A. Pearson correlation is only valid for measuring linear relationships, so features with strong non-linear relationships to the target would be incorrectly discarded✓ Correct
  • B. Pearson correlation cannot be computed between numeric features and a binary target variable in Python
  • C. Features with low Pearson correlation to the target are never useful in any machine learning model
  • D. The Pearson correlation coefficient ranges from -1 to 1, so a threshold of 0.1 is mathematically invalid
Explanation

The key limitation of Pearson correlation for feature selection is that it only captures linear relationships. A feature could have a strong non-linear, monotonic, or interaction-based relationship with the target while showing near-zero Pearson correlation, meaning it would be incorrectly dropped. Alternatives like Spearman correlation, mutual information, or tree-based feature importance capture non-linear associations. Pearson correlation can technically be computed between a numeric feature and a 0/1 encoded binary target (it becomes a point-biserial correlation), so option B is factually incorrect. Features with low pairwise correlation to the target can still be useful when combined with other features (interaction effects), making option C incorrect. A threshold of 0.1 on a [-1, 1] scale is mathematically valid (it simply means low absolute linear correlation), so option D is incorrect.

2. A data scientist at an e-commerce company is performing EDA on a product recommendation dataset. A categorical feature 'product_category' has 3,200 unique values (high cardinality). The scientist considers three encoding strategies before training a SageMaker built-in Factorization Machines model. Which statement MOST accurately compares these strategies for this specific scenario?

  • A. One-hot encoding should be preferred because it is always lossless and Factorization Machines handle sparse input efficiently✓ Correct
  • B. Ordinal encoding is best because it assigns a unique integer to each category, preserving all category information without increasing dimensionality
  • C. Target encoding is always the safest choice because it reduces dimensionality to a single column without any risk of overfitting
  • D. Hashing (feature hashing) is not suitable for Factorization Machines because it requires dense input vectors
Explanation

One-hot encoding a 3,200-cardinality feature produces a very sparse 3,200-dimensional binary vector per record. The SageMaker Factorization Machines algorithm is specifically designed to work efficiently with sparse input (it accepts data in sparse RecordIO-protobuf format), making one-hot encoding a legitimate and common choice. Ordinal encoding assigns arbitrary integers (e.g., 1–3200) with no ordinal meaning, implying false numeric relationships between unrelated categories — this can mislead distance-based or linear models and is not recommended for nominal high-cardinality features. Target encoding reduces dimensionality to a single numeric column but is prone to target leakage and overfitting when applied naively without proper cross-validation folds, making 'always the safest choice' incorrect. Hashing (feature hashing) maps categories to a fixed-size hash space and produces sparse output compatible with Factorization Machines — the claim that it requires dense input is incorrect.

3. A data scientist is analyzing a high-cardinality categorical feature 'product_id' with 15,000 unique values in a dataset of 200,000 rows. They plan to use this feature in a SageMaker built-in XGBoost model. Which approach BEST handles this high-cardinality feature during EDA and feature engineering?

  • A. Apply one-hot encoding to create 15,000 binary features, as XGBoost can handle sparse input efficiently.
  • B. Drop the 'product_id' feature entirely, as high-cardinality categorical features always cause overfitting.
  • C. Apply target encoding (mean encoding) using the training set only, with cross-validation folds to prevent target leakage, or aggregate 'product_id' into lower-cardinality groups based on business logic.✓ Correct
  • D. Apply ordinal encoding by assigning integers 1–15,000 alphabetically, preserving all cardinality information.
Explanation

Target encoding (replacing each category with its mean target value) is a powerful approach for high-cardinality features as it reduces dimensionality to a single numeric feature while preserving predictive signal. However, it must be computed strictly on training folds to prevent target leakage. Alternatively, domain-driven grouping (e.g., by product category) reduces cardinality meaningfully. Option A is problematic — one-hot encoding 15,000 unique values creates extreme sparsity and dramatically increases memory/compute requirements; while XGBoost can handle sparse data, this is rarely the best approach for 15,000 categories. Option B is overly conservative — dropping the feature removes potentially valuable predictive information without investigation. Option C (ordinal encoding alphabetically) is incorrect because it imposes an arbitrary numerical order with no semantic meaning, leading the model to treat alphabetically adjacent products as numerically similar, which is nonsensical.

4. A data scientist applies the Amazon SageMaker built-in PCA algorithm to a 120-feature dataset. After training, they inspect the explained variance ratio of each component. The first 15 components explain 95% of the total variance. The data scientist now needs to decide how many components to use as input to a downstream SageMaker Linear Learner model. What is the MOST principled approach to making this decision?

  • A. Always use exactly half the original number of features (60 components) to ensure maximum information retention
  • B. Select the number of components that cumulatively explain a sufficient proportion of variance (e.g., 95%), in this case 15 components✓ Correct
  • C. Use all 120 components because discarding any component introduces information loss
  • D. Select components randomly and evaluate downstream model performance to determine the right number
Explanation

The standard principled approach to choosing the number of PCA components is the explained variance threshold method: select the minimum number of components that cumulatively explain a target proportion (commonly 95%) of total variance. With 15 components explaining 95%, this is the appropriate choice as it dramatically reduces dimensionality while preserving nearly all information. Using half the features (60) is an arbitrary rule with no statistical basis. Using all 120 components defeats the purpose of PCA — if all components are retained, there is no dimensionality reduction and the computational benefit is lost. Random selection of components is statistically unsound; PCA components are ordered by decreasing explained variance, so the first components are always the most informative.

5. A data scientist at a financial company is performing EDA on a loan dataset in Amazon SageMaker Studio. They create a box plot of the 'debt_to_income' feature and observe numerous points beyond the upper whisker (Q3 + 1.5×IQR). Before deciding how to handle these, the data scientist wants to determine whether these points represent true outliers or valid extreme values. Which approach is MOST appropriate at this EDA stage?

  • A. Immediately apply Z-score-based removal of all points beyond ±3 standard deviations, as these are statistically guaranteed to be errors.
  • B. Cross-reference the flagged records against domain knowledge and other features (e.g., verify if high debt-to-income ratios correspond to specific loan types or customer segments) and use statistical tests such as Grubbs' test or IQR analysis to inform a business-justified decision.✓ Correct
  • C. Apply SMOTE to oversample the outlier records to balance their representation in the dataset.
  • D. Replace all outlier values with the column median, as the IQR method is the most authoritative outlier detection standard and identified values must be errors.
Explanation

During EDA, the correct approach to outliers is investigative, not immediately prescriptive. Cross-referencing with domain knowledge (e.g., high debt-to-income may be legitimate for commercial loans) and examining contextual features determines whether flagged points are data errors, rare-but-valid observations, or signal-rich edge cases. Statistical tests like Grubbs' test can formally assess outlier likelihood. This informed analysis prevents inadvertently discarding valuable information. Option A is incorrect — Z-score-based removal assumes normality and 'guarantees' nothing; in financial data, extreme values are often real and informative. Option C is completely wrong — SMOTE is for class imbalance in classification, not for handling outliers; applying it to outlier records would generate artificial extreme values. Option D is incorrect — the IQR method is a heuristic visualization tool, not an authoritative gold standard; it flags candidates for investigation, not certain errors. Automatic median replacement without investigation destroys potentially important signal.

55 more questions in this domain

Practice the full bank with instant grading, flashcards, and a timed mock exam.

Start practicing free