MLA-C01 Practice Question 63: CSV Training Data Format
AWS Certified Machine Learning Engineer – Associate (MLA-C01) · Test 7 · question 3 of 10
A data scientist exports a pandas DataFrame with df.to_csv("train.csv", index=False) and uses the file to train the SageMaker AI built-in XGBoost algorithm with the text/csv content type. The file has a header row of column names, and the target column churned is the last column. The training job fails while parsing the data.
What should the data scientist change in the file?
Show answer and explanation
Answer:
SageMaker AI's common CSV training format requires that a CSV file has no header record and that the target variable is in the first column. The export breaks both rules: the header row cannot be parsed as numbers, and the algorithm would treat whatever is in the first column as the label. Writing the file with churned first and header=False fixes both (option A).
- B is wrong because the header row is still there, and it is what causes the parsing failure. - C is wrong because removing the header lets the file parse, but the algorithm would then train on the first feature column as the label, and on churned as an input feature. The job could "succeed" and produce a meaningless, leaky model. - D is wrong because the format has no header rows at all, and adding a second one makes parsing worse. The label is found by position, not by name.
Reference: Common Data Formats for Training