# One hot encoding of target space

I had a face to face interview for a data scientist job a few days ago. One of the questions I was asked was: in the case of classifier predicting the brand of TV from some features (price, size, specs, ...) out of 4 possible brands, how do you encode the brand variable? My answer was one hot encoding, it was accepted but then they asked me to do it explicitly and I sketched something like:

brand A -> [1,0,0,0]
brand B -> [0,1,0,0]
brand C -> [0,0,1,0]
brand D -> [0,0,0,1]


And then, I was corrected under the reason that these columns were not independent. And that the solution should have been three binary columns instead.

Later it hit me that I do not know why independence is required, and also that three binary variables are not independent. Two would be.

Can someone provide some explanation to help with my confusion?

• Either you or your interviewer mixed up the things. If it is one hot encoding, then your answer is perfect but if they told you that three binary columns would have done the job, then they are talking about Binary labels, not one hot encoding. With three binary labels, you can actually represent four categories as 001, 010, 011, 100  – Nain Jan 12 '18 at 19:44
• you only need two features to represent four categorical levels: 00, 01, 10, 11. Three dimensions could encode up to 8 factor levels. But this is not an appropriate way to distinguish four classes in the target of a multiclass classification, and it is not necessarily a great approach for input encoding either. – David Marx Jan 13 '18 at 7:32