AWS Certified Machine Learning Engineer - Associate (MLA-C02) free question 3 / 10 · Domain 1: Data Preparation for ML and AI
A Data Wrangler dataset stores each household's electricity usage as an array, and three arrays have 3, 4, and 5 values. Before flattening the arrays into columns, the analyst standardizes them to the length of the sequence at the 50th percentile. What happens to the arrays?
- The 3-value array gets one missing value added and the 5-value array is truncated to 4 values
- The arrays are padded with missing values to 5 values, the length of the longest sequence
- The 3-value array is dropped from the dataset and the 5-value array is truncated to 4 values
- The 3-value array is repeated to reach 4 values and the 5-value array is kept at 5 values
Show the answer and explanation
Answer: A
Why this is correct
The Standardize length transform sets each time series to the length that you specify as a quantile of the time series set. For lengths of 3, 4, and 5, the sequence at the 50th percentile has 4 values. Arrays that are shorter than that length have missing values added, so the 3-value array gains one NaN, and arrays that are longer are truncated, so the 5-value array is cut to 4 values.
Why the other options are wrong
"The 3-value array is dropped from the dataset and the 5-value array is truncated to 4 values" … Arrays that are shorter than the specified length are not dropped. They have missing values added, which can then be handled with the approaches for missing time series data.
"The 3-value array is repeated to reach 4 values and the 5-value array is kept at 5 values" … The page describes neither repetition nor keeping longer arrays. Shorter arrays have missing values added and longer arrays are truncated to the specified length.
"The arrays are padded with missing values to 5 values, the length of the longest sequence" … The length comes from the quantile that you choose, here the 50th percentile, which is 4. Arrays longer than that length are truncated rather than extended.
Key points
Standardizing the length matters because many ML algorithms require flattening the time series, which separates each value into its own column, and the number of columns in a dataset cannot change. Choosing Flatten the output writes the values of the time series into separate columns, and the added missing values can be handled with the imputation methods.