What is one hot encoding?

I don’t quite understand how label encoding works. I am referring to Kaggle competition encode_label function. I tried to find some other resources online but could not get anywhere. Can anyone explain?


There’s nothing special going on here. We’re simply taking the labels and converting them into vectors. If a particular class is present in the image, we set the element at that index to 1, and if a class isn’t present, we set it to 0. So, if the labels are '2 4 5' , you end with the vector [0, 0, 1, 0, 1, 1, 0, 0, 0, 0] .

Courtesy- @aakashns

1 Like