one-hot vector encoding

Table of Contents

To represent discrete-valued feature, one can put one feature per value, and put 1 if the discrete-valued feature take that value, i.e.

name favorite color height net worth
james red 1.7 5000
josh blue 1.8 4000

to

name favorite red favorite blue height net worth
james 1 0 1.7 5000
josh 0 1 1.8 4000

Backlinks

discrete feature encoding

Discrete feature encoding is to encode a discrete valued variable such as color with possible values {red, blue, green}, to a numeric variable.

Author: Linfeng He

Created: 2024-04-03 Wed 20:58