Course menuMLA-C02

Exams / MLA-C02 / Study guide / Feature engineering

Feature engineering: MLA-C02 study notes and practice questions

What to know about Feature engineering for the MLA-C02 exam, from the Data Preparation for ML and AI domain (28% of the exam guide), then 1 free question to test it. Part of the MLA-C02 study guide.

Last verified against current AWS documentation ·How we write our questions

What to know for the exam

Feature engineering questions give a dataset problem (skew, many categories, missing values) and ask which transformation helps the model.

Numeric features

  • Standardization (z-score) and min-max scaling put features on similar scales; distance-based and gradient-based models need this, tree models don’t.
  • Log transform reduces the pull of very large values in right-skewed features such as income or price.
  • Binning turns a continuous value into ranges, such as age groups.
  • Outliers: cap (winsorize), transform, or investigate; don’t drop the cases the model must handle.

Categorical features

  • One-hot encoding for low-cardinality categories with no order.
  • Ordinal (label) encoding when categories have a natural order (small, medium, large).
  • Target or frequency encoding, or hashing, for high-cardinality columns such as ZIP codes, where one-hot creates thousands of columns.
  • Embeddings for very high-cardinality IDs in deep learning.

Missing values

  • Drop rows only if few are missing and they’re random.
  • Impute with the mean or median (median for skewed data), the mode for categories, or a model-based estimate.
  • Add an indicator column when “missing” itself carries meaning.

Text, dates and combinations

  • Text: tokenization, TF-IDF, n-grams or embeddings.
  • Dates: day of week, month, hour, holiday flags, time since an event; cyclical features with sine and cosine.
  • Feature crosses combine features, such as latitude and longitude buckets.
  • Dimensionality reduction (PCA) for many correlated features.

Avoiding leakage

Fit scalers, encoders and imputers on the training set only, then apply them to validation and test data. Never use features that wouldn’t be known at prediction time.

Tools

Data Wrangler has built-in transforms for all of these; SageMaker Processing and Glue run them in code; Feature Store saves the results for reuse.

Common traps

  • One-hot encoding a column with thousands of values.
  • Scaling with statistics from the whole dataset before splitting.
  • Dropping extreme but valid values the model must predict.

Try the 1 practice question

A solar installer predicts installation cost for residential roofs. The main feature is house square footage, which is heavily skewed: most homes are around 1,800 square feet, but a few large estates exceed 20,000.

The team uses a linear regression model in SageMaker AI and needs the model to stay stable for the largest homes without dropping the outliers. The scaling steps must be fit only on the training data, so that test data does not leak into the transformation.

Which preprocessing approach meets these requirements?

Choose one answer.

  1. A. Apply a log transform to square footage, then standardize the transformed feature with statistics computed on the training split only.
  2. B. Remove every home above the 99th percentile of square footage from both the training and test sets, then standardize the remaining values before fitting.
  3. C. Replace square footage with one-hot encoded bins of one square foot each, so that every possible size becomes a separate feature.
  4. D. Standardize square footage using the mean and standard deviation of the full dataset, including the test split, before splitting.
Show the answer and explanation

Answer: A

  • A. Right: Correct. A log transform compresses the long right tail so large homes do not dominate the regression, and the statistics for scaling come only from the training split. The outliers stay in the data.
  • B. Wrong: Removing the largest homes deletes exactly the cases the business needs the model to price. The stem asks that the outliers be kept.
  • C. Wrong: Bins of one square foot create tens of thousands of sparse features, most with almost no examples. The model would overfit and would not generalize to sizes it has not seen.
  • D. Wrong: Computing scaling statistics over the full dataset leaks test information into training. The transformation is correct only when it is fit on the training split.

Explanation

A log transform reduces the influence of very large values in a skewed feature, and standardization fit on training data keeps the test set separate. Dropping the largest homes removes the cases the model must price, and one-hot binning of every square foot creates sparse, overfitting features.

Study

Want more on Feature engineering? The 5 full-length practice sets have 9 more Feature engineering questions, 325 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets

Study Feature engineering

More Data Preparation for ML and AI topics