Let's say we have a set of labels of the same length, and we need to find the distance between them.
In the case of binary labels, one can use the Hamming distance. For example, if $l_1 = 01101$ and $l_2 = 00111$, then $d(l_1, l_2) = 2$.
In my case, labels are formed from the alphabet $A=\{a, b, c, d, e\}$, so the length of the alphabet is $|A|=5$, and the length of each label is $n=4$.
In my case, an ordinal scale is applicable for letters from alphabet $A$:
$$a < b < c < d < e.$$
Examples of labels: deed
, aaaa
, aaad
, aaae
, dada
, cccd
.
Edit. The Hemming distance for three labels aaaa
, aaad
, aaae
gives $$d(aaaa, aaad) = d(aaaa, aaae)$$ but I am looking for a metric which will distinguish $d$ and $e$ and return $$d(aaaa, aaad)<d(aaaa, aaae)$$ because $d<e$.
Edit 2.
For creating a label we use a threshold $T \in \mathbf{R}$ and apply the next function for the $i$-th element of $X=(x_1, x_2, \ldots, x_n)$: \begin{equation} f(x_i) = \begin{cases} a, & x_i \leq -T, \\ b, & -T < x_i \leq 0, \\ c, & x_i = 0, \\ d, & 0 < x_i \leq T, \\ e, & x_i >T. \ \end{cases} \end{equation} Finally, we use the concatination operator $\&$, for example, $a \& a \& a \& a= aaaa$.
Question. What a metric can I use to calculate the distance between labels?