1
$\begingroup$

I have two lists which are circular, in that given list

['A','B','C','D','E']

'A' and 'E' are the same distance apart as 'A' and 'B' and so on.

Given I have rankings

R1=['A','B','C','D','E']

R2=['E','A','B','C','D']

how can I compute their similarity or distance?

$\endgroup$
2
  • $\begingroup$ What are 'A','B','C','D','E'? Real numbers? Integers? Matrices? $\endgroup$ Commented Mar 30, 2020 at 3:24
  • $\begingroup$ they are categorical variables representing colors for example. $\endgroup$
    – ha554an
    Commented Mar 30, 2020 at 13:42

1 Answer 1

0
$\begingroup$

The variables $A$, $B$, $C$, $D$, and $E$ can be encoded as points on a circle $S^1$ that is by angles between $0$ ans $2\pi$ if you measure the angles in radians. Vectors $R_1$ and $R_2$ are thus points on a five-dimensional torus $$T^5=\underbrace{S^1\times ...\times S^1}_\text{5}$$ The distance $d_{12}$ between $R_1$ and $R_2$ is the distance between these points on the torus $T^5$.

It's more convenient to measure the angles on your circles in $2\pi\cdot\mathrm{radians}$. Then $A$, $B$, $C$, $D$, and $E$ are real numbers $x_1, ..., x_5$ all between $0$ and $1$. Then $R_1=(x_{11},..., x_{15})$, $R_2=(x_{21},..., x_{25})$, and

$$d_{12} = \sum\limits_{i=1}^{5}s_i,$$ where \begin{equation} s_i = \begin{cases} |x_{2i}-x_{1i}|, & \text{if $|x_{2i}-x_{1i}|\leq 0.5$}\\ 1-|x_{2i}-x_{1i}|, & \text{if $|x_{2i}-x_{1i}| > 0.5$} \end{cases} \end{equation}

An explanation of this formula for a two-dimensional torus is given here: link.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.