Data Preparation for ML and AI A free question from our original MLA-C02 practice exam. Try it, then open the answer to see why each option is right or wrong.
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.
AA. Apply a log transform to square footage, then standardize the transformed feature with statistics computed on the training split only.
BB. Remove every home above the 99th percentile of square footage from both the training and test sets, then standardize the remaining values before fitting.
CC. Replace square footage with one-hot encoded bins of one square foot each, so that every possible size becomes a separate feature.
DD. 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.
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 →