Imagine your have five different classes e.g. ['cat', 'dog', 'fish', 'bird', 'ant']. If you would use one-hot-encoding you would represent the presence of 'dog' in a five-dimensional binary vector like [0,1,0,0,0]. If you would use multi-hot-encoding you would first label-encode your classes, thus having only a single number which represents the presence of a class (e.g. 1 for 'dog') and then convert the numerical labels to binary vectors of size .
Examples:
'cat' = [0,0,0]
'dog' = [0,0,1]
'fish' = [0,1,0]
'bird' = [0,1,1]
'ant' = [1,0,0]
This representation is basically the middle way between label-encoding, where you introduce false class relationships (0 < 1 < 2 < ... < 4, thus 'cat' < 'dog' < ... < 'ant') but only need a single value to represent class presence and one-hot-encoding, where you need a vector of size (which can be huge!) to represent all classes but have no false relationships.
Note: multi-hot-encoding introduces false additive relationships, e.g. [0,0,1] + [0,1,0] = [0,1,1] that is 'dog' + 'fish' = 'bird'. That is the price you pay for the reduced representation.
Imagine your have five different classes e.g. ['cat', 'dog', 'fish', 'bird', 'ant']. If you would use one-hot-encoding you would represent the presence of 'dog' in a five-dimensional binary vector like [0,1,0,0,0]. If you would use multi-hot-encoding you would first label-encode your classes, thus having only a single number which represents the presence of a class (e.g. 1 for 'dog') and then convert the numerical labels to binary vectors of size .
Examples:
'cat' = [0,0,0]
'dog' = [0,0,1]
'fish' = [0,1,0]
'bird' = [0,1,1]
'ant' = [1,0,0]
This representation is basically the middle way between label-encoding, where you introduce false class relationships (0 < 1 < 2 < ... < 4, thus 'cat' < 'dog' < ... < 'ant') but only need a single value to represent class presence and one-hot-encoding, where you need a vector of size (which can be huge!) to represent all classes but have no false relationships.
Note: multi-hot-encoding introduces false additive relationships, e.g. [0,0,1] + [0,1,0] = [0,1,1] that is 'dog' + 'fish' = 'bird'. That is the price you pay for the reduced representation.
The accepted answer seems rather eccentric to me. I think that is rarely done, if ever, and will usually yield bad results.
There's a much more common, sensible use case for this. "Multi-hot encoding" doesn't seem to be a standard term, but I'm not sure there's any standard term. scikit-learn refers to a multi label binarizer.
This is simply used for multi label problems. That is, problems where more than one label can be associated with each example.
For example, say you are trying to detect whether certain types of animal are in a photo. Note that multiple types of animal can be in a single photo. Say the possible types of animal are ['cat', 'dog', 'fish', 'bird', 'ant']. A photo containing cats and dogs would be represented as [1, 1, 0, 0, 0].
If I understand Multi Hot encoding correctly basically we take arrays of different lengths, and turn them into arrays/lists of all the same length with each index of the new array/list being on(0) or off(1) for the various entries in the original array.
so
[1,3] would become [0, 1, 0, 1]
My question is, how do we account for if a number appears twice in the original array/list,
for example [1,3,3]
python - How to do Multi-hot Encoding but with actual values instead of ones - Stack Overflow
Muti-hot encoding vs Label-Encoding - Data Science Stack Exchange
Multi-hot encoding for ambiguous input
python - Determining the validity of a multi-hot encoding - Stack Overflow
You can think of binary encoding as a compromise between label encoding and one-hot encoding. For distinct categories, label encoding introduces a false linear order that brings a lot of noise into the model (category 1 < category 2 < category 3....) . Binary encoding introduces false additive relationships between the categories (e.g. category 4 + category 1 = category 5 or 100 + 001 = 101) but fewer of them.
Therefore, binary will usually work better than label encoding, however only one-hot encoding will usually preserve the full information in the data.
Unless your algorithm (or computing power) is limited in the number of categories it can handle, one-hot encoding will be preferred over other encoding schemes. If you are limited, mean encoding is a powerful alternative because it transform a categorical feature into a numeric one (giving you the minimal number of inputs) while preserving the most important information in the data.
[Mean encoding replaces every category with its target mean. The mean encodings need to be constructed carefully on a separate dataset to avoid data leakage. If you want to reduce your input dimensions as much as possible, this can be helpful. Mean encoding can also be helpful as an additional feature and is very popular on Kaggle to squeeze out some extra performance. This is also known as target encoding or likelihood encoding.]
Do I understand correctly that a traditional binary approach to counting numbers is exactly what the Multi-Hot is? We can imagine a byte as a vector of 8 components, and each entry is either 0 or 1.0
I strongly believe so.
This means I can't use it for 255 distinct categories (or for relatively unrelated categories)
Is the effect as bad in Multi-Hot encoding, in particular in a binary approach?
I found a pretty interesting answer. It seems that binary can actually be used with classification tasks really well!
Have a look at the table on the last page of paper "A Comparative Study of Categorical Variable Encoding Techniques for Neural Network Classifiers" 2017

This would mean we can save the number of input neurons BY AN INCREDIBLE AMOUNT, instead of using traditional one-hot encoding.
Personally, I can get it intuitively: Label-encoding tells us to set a neuron with different values: 1,2,3,4... It's really easy for the network to linearly-interpolate from 1 to 2 and from 2 to 3, by using fractions. Thus, there is a really strong precidence between such input values, and the network will easily pick up on that. So we can't use Label-encoding for categories.
Contrary to that, Binary encoding exhibits a more "integer-like" behavior. In other words, it's not as blatantly evident how to linearly interpolate from 1 to 2 in binary form (from 0001 to 0010), which resembles one-hot approach too :)