SageMaker ClientError: Detected non integer labels in the dataset

Viewed 14

I have created a SageMaker training job to train on a toy, tabular, multiclass(3) dataset which has failed with the following error:

ClientError: Detected non integer labels in the dataset. For classification tasks, the labels should be integers between 0 to (num_classes-1), exit code: 2

It sounds like they're saying that for the classes (labels) they want to see values between 0 and 2 in this case, as I have 3 classes.

I have set num_classes to 3 and have validated that I only have 3 unique values in the rightmost column of my dataset: 0, 1, and 2

I've set feature_dim to 3. I've removed the headers from my dataset. My raw data looks like 5,000 lines of this: csv snapshot

Can anyone guess as to what might be causing this error?

1 Answers

I wanted to answer this because at the time of this writing, the error message I recieved returns 0 hits on Google.

It turns out that the issue was that SageMaker expects the class labels to appear in the first column, by default. This is different from how datasets are typically structured. So when I got this error message, SageMaker was looking at my first column which had all sorts of float values. I fixed it by moving my labels to the first column.

Related