One-Hot Vector

Overview

A one-hot vector is a representation technique used for encoding categorical data in machine learning. It is a vector where exactly one element is set to 1, and all other elements are set to 0. This method is particularly useful for indicating which of the possible classes occurred in a specific trial.

In the context of machine learning, one-hot encoding is a common practice for transforming categorical variables into a format that can be provided to algorithms to improve predictions. For instance, if you have a categorical variable with three possible values: "cat", "dog", and "bird", a one-hot encoding would represent these as:

  • "cat" -> [1, 0, 0]
  • "dog" -> [0, 1, 0]
  • "bird" -> [0, 0, 1]

This encoding allows algorithms to process categorical data without assuming any ordinal relationship between the categories, which is crucial for many machine learning models that rely on numerical input.