Data representation / feature encoding · BEGINNER LESSON
One-hot encoding
One-hot encoding is a way to represent a category or symbol as a binary vector, with one position set to 1 and the others set to 0. It keeps categories separate without implying that one category is larger or smaller than another.
What it is and what is measured
One-hot encoding turns a discrete item into a set of binary indicators, also called 0/1 features. In medical machine learning, each category of a variable becomes its own binary feature. In DNA sequence representation, each nucleotide can be written as a 4-dimensional binary vector, such as A = [1,0,0,0]. The thing being measured is category identity or symbol identity, not size, order, or amount. This is useful when the original labels are not numerical measurements. [0,1]
[1] Enhancing Model Generalizability in Medical Artificial ... - PMC [2] EDEN: multiscale expected density of nucleotide encoding for ... - PMC
How it works
The mechanism is simple: list all possible categories, then make one binary column for each category. For a given item, put 1 in the column that matches the category and 0 in all other columns. This preserves the nonordinal nature of the original variable, meaning it does not pretend that one label comes before or after another. In sequence data, the same idea keeps exact nucleotide positions while encoding each base separately. [0,1]
[1] Enhancing Model Generalizability in Medical Artificial ... - PMC [2] EDEN: multiscale expected density of nucleotide encoding for ... - PMC
Why it is used
One-hot encoding can help models use categorical information without inventing a fake ranking between categories. In one medical study, it was reported to perform well with certain imbalance-handling methods, and it expanded the number of variables from 83 to 113. In DNA work, it is described as a simple standard representation that preserves exact locations. These are task-specific findings, not universal guarantees. [0,1]
[1] Enhancing Model Generalizability in Medical Artificial ... - PMC [2] EDEN: multiscale expected density of nucleotide encoding for ... - PMC
Limitations
A major limitation is dimensionality growth: when a variable has many unique categories, one-hot encoding can greatly increase the number of features. For very long DNA sequences, the binary vectors can also be memory-intensive because they are sparse, meaning many entries are 0. Another limitation is that, by itself, one-hot encoding gives exact position or category identity but does not automatically add broader context such as neighborhood patterns. [0,1]
[1] Enhancing Model Generalizability in Medical Artificial ... - PMC [2] EDEN: multiscale expected density of nucleotide encoding for ... - PMC
Limits of the evidence
The sources support one-hot encoding as a representation method and show examples in medical classification and DNA sequence encoding. They do not show that one-hot encoding is always best; performance depends on the dataset, model, and task. Reported results are specific to the studied problems. [0,1]
[1] Enhancing Model Generalizability in Medical Artificial ... - PMC [2] EDEN: multiscale expected density of nucleotide encoding for ... - PMC
SEE THE IDEA
How one-hot encoding represents a category
Start with all possible labels or symbols.
Make one 0/1 feature for each possible category.
Mark the matching category with 1 and all others with 0.
The result is a numeric form a model can use.
Each step converts identity into a binary pattern without creating an artificial order.
One-hot encoding maps one category to one active position in a binary vector; the rest stay 0.
TRY IT YOURSELF
Test your understanding
Choose an answer, then check the explanation.
PUT IT TOGETHER
Match each concept to its meaning
Drag a label onto its description, or select a label and then select a description. This also works with a keyboard.
4 pairs to match
Sources and further reading
This general lesson was generated from public source material. It explains a concept; it does not interpret a private paper or provide medical advice.