【AI】One-hot Vector实例

 

One-Hot Encoding

Key word: Encoding

  • Label Encoding

| Food Name | Categorical | Calories | | — | — | — | | Apple | 1 | 95 | | Chicken | 2 | 231 | | Broccoli | 3 | 50 |

  • One-hot encoding
Apple Chicken Broccoli Calories
1 0 0 95
0 1 0 231
0 0 1 50

For each unique value in the original categorial column, a new column is created in this method.