How can I mathematically represent the one-hot encoding? If we have 5 classes and 3 inputs, let's say [C1, C2, C3, C4, C5] and [X1, X2, X3] then,

*

*If X1 belongs to the C4 class then the hot encoder for this will be [0, 0, 0, 1, 0].


*If X1 belongs to the C2 class then the hot encoder for this will be [0, 1, 0, 0, 0].
How can I mathematically represent it?
I've also seen math-oriented people refer to a one-hot vector using an indicator function, but I am unable to understand this:
$$
1_A(x) :=
  \begin{cases}
    1 & \text{if}\ x \in A, \\
    0 & \text{if}\ x \notin A.
  \end{cases}
$$
Can anyone explain this above scenario to me?

$A$ is a set. If $x$ is an element of $A$, return $1$. Else return $0$. Thus $A$ is the set of cases that you are assigning a $1$ to in your encoding vector. Thus one-hot encoding is a vector form of this indicator function that applies componentwise.
