It is ok if you encode binary code. But you probably need to add another layer (or filter) depending on your task and model. Since your encoding now implies invalid common functions due to binary representation.
For example, binary encoding for input ( x = [x1, x2] ):
'apple' = [0, 0] 'orange' = [0, 1] 'table' = [1, 0] 'chair' = [1, 1]
This means that orange and chair use the same x2 function. Now with predictions for two classes of y :
'fruit' = 0 'furniture' = 1
And the linear optimization model ( W = [w1, w2] and bias b ) for the tagged data sample:
(argmin W) Loss = y - (w1 * x1 + w2 * x2 + b)
Whenever you update w2 scales for chair as furniture , you get a positive improvement in choosing orange for this class. In this particular case, if you add another layer U = [u1, u2] , you can probably solve it:
(argmin U,W) Loss = y - (u1 * (w1 * x1 + w2 * x2 + b) + u2 * (w1 * x1 + w2 * x2 + b) + b2)
Okay, why not avoid this representation of skips using single-string encoding. :)
Mehdi
source share