Clustering.jl icon indicating copy to clipboard operation
Clustering.jl copied to clipboard

bug fix in randindex

Open trappmartin opened this issue 8 years ago • 3 comments

RandIndex should be 1. of both assignments are equal. The current code returns 0.

trappmartin avatar Nov 17 '17 15:11 trappmartin

Hi @trappmartin, thanks for the contribution. Can you give an example of where the current code is incorrect and your code is correct? I'm having trouble creating one.

If I have, e.g.

c1 = [1]
c2 = [1]

then n == 1, but nc == nan, so t1 != nc, and the test on line 27 fails, and produces a nan result... so it seems that the code is still incorrect?

kmsquire avatar Nov 17 '17 16:11 kmsquire

Also, could you also add tests which cover all branches of your changes (once you've verified that they're correct)?

kmsquire avatar Nov 17 '17 16:11 kmsquire

Interesting, I haven't checked this case. On my machine, the current code produces 0 if

c1 = [1, 2, 3]
c2 = [1, 2, 3]

which should not be the case. I'll check the case you reported and add a fix asap (after the weekend).

trappmartin avatar Nov 17 '17 16:11 trappmartin